List of usage examples for org.apache.commons.lang StringUtils equals
public static boolean equals(String str1, String str2)
Compares two Strings, returning true
if they are equal.
From source file:gov.nih.nci.cabig.caaers.service.synchronizer.report.ConcomitantMedicationSynchronizer.java
public void migrate(ExpeditedAdverseEventReport src, ExpeditedAdverseEventReport dest, DomainObjectImportOutcome<ExpeditedAdverseEventReport> outcome) { List<ConcomitantMedication> newConmeds = new ArrayList<ConcomitantMedication>(); List<ConcomitantMedication> existingConmeds = new ArrayList<ConcomitantMedication>(); if (dest.getConcomitantMedications() != null) existingConmeds.addAll(dest.getConcomitantMedications()); if (src.getConcomitantMedications() != null) { for (ConcomitantMedication conMed : src.getConcomitantMedications()) { final ConcomitantMedication xmlConmed = conMed; ConcomitantMedication found = CollectionUtils.find(existingConmeds, new Predicate<ConcomitantMedication>() { public boolean evaluate(ConcomitantMedication concomitantMedication) { return StringUtils.equals(concomitantMedication.getAgentName(), xmlConmed.getAgentName()); }/* w ww. j a va 2 s. c o m*/ }); if (found != null) { found.setEndDate(xmlConmed.getEndDate()); found.setStartDate(xmlConmed.getStartDate()); found.setStillTakingMedications(xmlConmed.getStillTakingMedications()); //remove the pre-existing condition found existingConmeds.remove(found); } else { newConmeds.add(xmlConmed); } } } //remove unwanted for (ConcomitantMedication unwanted : existingConmeds) { dest.getConcomitantMedications().remove(unwanted); } //add newly added for (ConcomitantMedication newPc : newConmeds) { dest.addConcomitantMedication(newPc); } }
From source file:com.sfs.whichdoctor.beans.EmailBean.java
/** * Compare the existing email address with the updated version. If the two * are different return true.// www.j av a 2s . c om * * @param updated the updated * * @return boolean different */ public final boolean compare(final EmailBean updated) { boolean different = false; if (updated == null) { different = true; } else { if (!StringUtils.equals(this.getEmail(), updated.getEmail())) { different = true; } if (this.getPrimary() != updated.getPrimary()) { different = true; } if (!StringUtils.equals(this.getContactType(), updated.getContactType())) { different = true; } } return different; }
From source file:edu.northwestern.bioinformatics.studycalendar.xml.writers.ReorderXmlSerializer.java
@Override public StringBuffer validateElement(Change change, Element eChange) { if (change == null && eChange == null) { return new StringBuffer(""); } else if ((change == null && eChange != null) || (change != null && eChange == null)) { return new StringBuffer("either change or element is null"); }//from w ww. j av a 2 s. c o m StringBuffer errorMessageStringBuffer = super.validateElement(change, eChange); String expectedOldIndex = StringTools.valueOf(((Reorder) change).getOldIndex()); String expectedNewIndex = StringTools.valueOf(((Reorder) change).getNewIndex()); if (!StringUtils.equals(expectedOldIndex, eChange.attributeValue(OLD_INDEX))) { errorMessageStringBuffer.append( String.format("old index is different. expected:%s , found (in imported document) :%s \n", expectedOldIndex, eChange.attributeValue(OLD_INDEX))); } else if (!StringUtils.equals(expectedNewIndex, eChange.attributeValue(NEW_INDEX))) { errorMessageStringBuffer.append( String.format("new index is different. expected:%s , found (in imported document) :%s \n", expectedNewIndex, eChange.attributeValue(NEW_INDEX))); } return errorMessageStringBuffer; }
From source file:morphy.utils.MorphyStringUtils.java
public static boolean equals(String[] array1, String[] array2) { boolean result = true; if (array1 == null && array2 != null) { result = false;//from w w w. ja va2s. c o m } else if (array2 == null && array1 != null) { result = false; } else if (array1 == null && array2 == null) { result = true; } else if (array1.length != array2.length) { result = false; } else { for (int i = 0; i < array1.length; i++) { if (!StringUtils.equals(array1[i], array2[i])) { result = false; break; } } } return result; }
From source file:gov.nih.nci.cabig.caaers.service.security.PasswordManagerServiceImpl.java
private boolean validateToken(User user, String token) throws CaaersSystemException { if (user.getTokenTime().after( new Timestamp(new Date().getTime() - passwordPolicyService.getPasswordPolicy().getTokenTimeout())) && StringUtils.equals(user.getToken(), token)) return true; throw new CaaersSystemException("Invalid token."); }
From source file:gov.nih.nci.cabig.caaers.web.admin.INDCommand.java
public InvestigationalNewDrug createInvestigationalNewDrug() { InvestigationalNewDrug ind = new InvestigationalNewDrug(); ind.setIndNumber(Integer.parseInt(strINDNumber)); int sponsorId = Integer.parseInt(strSponsorId); if (StringUtils.equals("org", holderType)) { Organization org = organizationDao.getById(sponsorId); OrganizationHeldIND holder = new OrganizationHeldIND(); holder.setOrganization(org);/*from w ww . j a v a 2s .com*/ holder.setInvestigationalNewDrug(ind); ind.setINDHolder(holder); } else if (StringUtils.equals("inv", holderType)) { Investigator inv = investigatorDao.getById(sponsorId); InvestigatorHeldIND holder = new InvestigatorHeldIND(); holder.setInvestigator(inv); holder.setInvestigationalNewDrug(ind); ind.setINDHolder(holder); } return ind; }
From source file:fr.paris.lutece.plugins.genericattributes.util.GenericAttributesUtils.java
/** * Return the field which title is specified in parameter * @param strTitle the title// w ww . j a va 2 s .c om * @param listFields the list of fields * @return the field which title is specified in parameter */ public static Field findFieldByTitleInTheList(String strTitle, List<Field> listFields) { if ((listFields == null) || listFields.isEmpty()) { return null; } for (Field field : listFields) { if (StringUtils.isNotBlank(strTitle)) { if (StringUtils.equals(StringUtils.trim(strTitle), StringUtils.trim(field.getTitle()))) { return field; } } else if (StringUtils.isBlank(field.getTitle())) { return field; } } return null; }
From source file:com.naver.jr.study.action.sesame.ListAction.java
/** * ? ?// ww w . jav a 2 s .com * @param themeList */ private void setContentList(List<SesameStep> themeList) { if (StringUtils.equals(StepEnum.IMAGE.getName(), stepName)) { SesameStep sesameStep = themeList.get(0); int totalCount = sesameBO.getContentCount(sesameStep); setContentPaging(totalCount); imageList = sesameBO.getContentList(sesameStep, offset, PAGE_SIZE); } else { List<SesameContents> contentList = new ArrayList<SesameContents>(); for (SesameStep step : themeList) { contentList = sesameBO.getContentList(step); vodList.add(contentList); } } }
From source file:info.archinnov.achilles.helper.EntityIntrospector.java
protected String[] deriveGetterName(Field field) { log.debug("Derive getter name for field {} from class {}", field.getName(), field.getDeclaringClass().getCanonicalName()); String camelCase = field.getName().substring(0, 1).toUpperCase() + field.getName().substring(1); String[] getters;/*from w w w . j av a 2 s. co m*/ if (StringUtils.equals(field.getType().toString(), "boolean")) { getters = new String[] { "is" + camelCase, "get" + camelCase }; } else { getters = new String[] { "get" + camelCase }; } if (log.isTraceEnabled()) { log.trace("Derived getters : {}", StringUtils.join(getters, ",")); } return getters; }
From source file:com.haulmont.cuba.gui.app.core.showinfo.EntityParamsDatasource.java
protected void compileInfo() { if (instance instanceof BaseUuidEntity && !PersistenceHelper.isNew(instance)) { instance = reloadInstance(instance); }/*from ww w.j ava 2s .c o m*/ MetaClass effectiveMetaClass = instance.getMetaClass(); Class<?> javaClass = effectiveMetaClass.getJavaClass(); includeParam("table.showInfoAction.entityName", instanceMetaClass.getName()); if (!StringUtils.equals(effectiveMetaClass.getName(), instanceMetaClass.getName())) { includeParam("table.showInfoAction.entityEffectiveName", effectiveMetaClass.getName()); } includeParam("table.showInfoAction.entityClass", javaClass.getName()); MetadataTools metaTools = AppBeans.get(MetadataTools.NAME); if ((metaTools.isEmbeddable(effectiveMetaClass) || metaTools.isPersistent(effectiveMetaClass)) && PersistenceHelper.isNew(instance)) { includeParam("table.showInfoAction.state", messages.getMessage(getClass(), "table.showInfoAction.isNew")); } if (metaTools.isEmbeddable(effectiveMetaClass)) { includeParam("table.showInfoAction.specificInstance", messages.getMessage(getClass(), "table.showInfoAction.embeddableInstance")); } else if (!metaTools.isPersistent(effectiveMetaClass)) { includeParam("table.showInfoAction.specificInstance", messages.getMessage(getClass(), "table.showInfoAction.nonPersistentInstance")); } String dbTable = metaTools.getDatabaseTable(effectiveMetaClass); if (dbTable != null) { includeParam("table.showInfoAction.entityTable", dbTable); } if (instance != null) { SimpleDateFormat df = new SimpleDateFormat(TIMESTAMP_DATE_FORMAT); includeParam("table.showInfoAction.id", instance.getId().toString()); if (instance instanceof Versioned && ((Versioned) instance).getVersion() != null) { Integer version = ((Versioned) instance).getVersion(); includeParam("table.showInfoAction.version", version.toString()); } if (instance instanceof Creatable) { Creatable creatableEntity = (Creatable) instance; if (creatableEntity.getCreateTs() != null) { includeParam("table.showInfoAction.createTs", df.format(((Creatable) instance).getCreateTs())); } if (creatableEntity.getCreatedBy() != null) { includeParam("table.showInfoAction.createdBy", creatableEntity.getCreatedBy()); } } if (instance instanceof Updatable) { Updatable updatableEntity = (Updatable) instance; if (updatableEntity.getUpdateTs() != null) { includeParam("table.showInfoAction.updateTs", df.format(updatableEntity.getUpdateTs())); } if (updatableEntity.getUpdatedBy() != null) { includeParam("table.showInfoAction.updatedBy", updatableEntity.getUpdatedBy()); } } if (instance instanceof SoftDelete) { SoftDelete softDeleteEntity = (SoftDelete) instance; if (softDeleteEntity.getDeleteTs() != null) { includeParam("table.showInfoAction.deleteTs", df.format(softDeleteEntity.getDeleteTs())); } if (softDeleteEntity.getDeletedBy() != null) { includeParam("table.showInfoAction.deletedBy", softDeleteEntity.getDeletedBy()); } } } }