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.web.user.ChangePasswordController.java
@Override protected void onBindAndValidate(HttpServletRequest request, Object command, BindException errors) throws Exception { ChangePasswordCommand cmd = (ChangePasswordCommand) command; if (!StringUtils.equals(cmd.getPasswordNew(), cmd.getPasswordConfirm())) { errors.rejectValue("passwordConfirm", "USR_011", "The passwords provided do not match"); }//from www .j a v a2s . co m super.onBindAndValidate(request, command, errors); }
From source file:com.adobe.acs.commons.images.transformers.impl.ScaleImageTransformerImpl.java
@Override public final Layer transform(Layer layer, final ValueMap properties) { if (properties == null || properties.isEmpty()) { log.warn("Transform [ {} ] requires parameters.", TYPE); return layer; }// w w w .j ava 2s .c o m log.debug("Transforming with [ {} ]", TYPE); Double scale = properties.get(KEY_SCALE, 1D); String round = StringUtils.trim(properties.get(KEY_ROUND, String.class)); if (scale == null) { log.warn("Could not derive a Double value for key [ {} ] from value [ {} ]", KEY_SCALE, properties.get(KEY_SCALE, String.class)); scale = 1D; } if (scale != 1D) { int currentWidth = layer.getWidth(); int currentHeight = layer.getHeight(); double newWidth = scale * currentWidth; double newHeight = scale * currentHeight; if (StringUtils.equals(ROUND_UP, round)) { newWidth = (int) Math.ceil(newWidth); newHeight = (int) Math.ceil(newHeight); } else if (StringUtils.equals(ROUND_DOWN, round)) { newWidth = (int) Math.floor(newWidth); newHeight = (int) Math.floor(newHeight); } else { // "round" newWidth = (int) Math.round(newWidth); newHeight = (int) Math.round(newHeight); } // Invoke the ResizeImageTransformer with the new values final ValueMap params = new ValueMapDecorator(new HashMap<String, Object>()); params.put(ResizeImageTransformerImpl.KEY_WIDTH, (int) newWidth); params.put(ResizeImageTransformerImpl.KEY_HEIGHT, (int) newHeight); layer = resizeImageTransformer.transform(layer, params); } return layer; }
From source file:com.cognifide.cq.cqsm.foundation.actions.check.property.CheckProperty.java
private boolean checkPropertyExists(final Authorizable authorizable) throws RepositoryException { Value[] values = authorizable.getProperty(propertyName); for (Value val : values) { if ((val.getType() == PropertyType.STRING) && StringUtils.equals(val.getString(), propertyValue)) { return true; }// w w w . j a va2 s . c om } return false; }
From source file:com.mirth.connect.model.ncpdp.NCPDPReference.java
public String getCodeByName(String description, String version) { if (StringUtils.equals(version, VERSION_D0)) { for (String key : NCPDPD0map.keySet()) { if (NCPDPD0map.get(key).equals(description)) { return key; }/* w w w . j a v a 2s.c om*/ } } else { for (String key : NCPDP51map.keySet()) { if (NCPDP51map.get(key).equals(description)) { return key; } } } return description; }
From source file:ca.uhn.hunit.test.TestImpl.java
public void setName(String theName) throws PropertyVetoException { if (StringUtils.equals(myName, theName)) { return;/*w w w . j ava 2 s . c om*/ } if (StringUtils.isEmpty(theName)) { throw new PropertyVetoException(Strings.getInstance().getString("test.name.empty"), null); } if (myBattery.getTestNames().contains(theName)) { throw new PropertyVetoException(Strings.getInstance().getString("test.name.duplicate"), null); } String oldValue = myName; fireVetoableChange(NAME_PROPERTY, oldValue, theName); myName = theName; firePropertyChange(NAME_PROPERTY, oldValue, theName); }
From source file:com.github.restdriver.serverdriver.http.Header.java
@Generated("Eclipse") @Override/* www. j a va2s .c om*/ public boolean equals(Object object) { if (this == object) { return true; } if (!(object instanceof Header)) { return false; } Header other = (Header) object; return StringUtils.equalsIgnoreCase(name, other.name) && StringUtils.equals(value, other.value); }
From source file:com.htmlhifive.tools.jslint.engine.option.CheckOptionXmlWrapper.java
@Override public CheckOption getOption(String key, String engine) { for (XmlOption optiontype : checkOptions.getOption()) { try {/*from w w w .jav a 2 s. c om*/ if (StringUtils.equals(optiontype.getKey(), key) && StringUtils.equals(optiontype.getEngine(), engine)) { CheckOption option = new CheckOption(key, optiontype.getEngine(), Class.forName(optiontype.getType()), optiontype.getDescription(), optiontype.getDetail()); option.setEnable(Boolean.valueOf(optiontype.isState())); option.setValue(optiontype.getValue()); return option; } } catch (ClassNotFoundException e) { logger.put(Messages.EM0007, e, optiontype.getType()); } } return null; }
From source file:com.adobe.acs.commons.users.impl.AbstractAuthorizable.java
public boolean hasAceAt(String path) { return getAces().stream().anyMatch(ace -> StringUtils.equals(path, ace.getContentPath())); }
From source file:gov.nih.nci.cabig.caaers.domain.AgentSpecificCtcTerm.java
@Override public boolean isOfSameTerm(String termName, String termCategory, String terminologyVersion, String otherToxicity, String otherMeddra) { //is term matching ? boolean termMatching = StringUtils.equals(getTerm().getTerm(), termName) || StringUtils.equals(getTerm().getCtepTerm(), termName); if (StringUtils.isNotEmpty(termName) && !termMatching) return false; //is category matching ? if (StringUtils.isNotEmpty(termCategory) && !StringUtils.equals(getTerm().getCategory().getName(), termCategory)) return false; //is terminology version matching ? if (StringUtils.isNotEmpty(terminologyVersion) && !StringUtils.equals(getTerm().getCategory().getCtc().getName().toString(), terminologyVersion)) return false; //is otherToxicity matching ? if (StringUtils.isNotEmpty(otherToxicity) && !StringUtils.equals(getOtherToxicity(), otherToxicity)) return false; //is other Meddra matching ? if (StringUtils.isNotEmpty(otherMeddra) && !StringUtils.equals(getOtherMeddraTerm().getTerm(), otherMeddra)) return false; return true;//from w ww. j a va2s.c o m }
From source file:io.wcm.tooling.netbeans.sightly.completion.classLookup.MemberLookupResolver.java
/** * The actual lookup//www.j av a2s. c o m * * @return set of all elements which match the lookup */ public Set<MemberLookupResult> performMemberLookup(String variable) { // if there is more than one "." we need to do some magic and resolve the definition fragmented if (variable.contains(".")) { return performNestedLookup(variable); } Set<MemberLookupResult> ret = new LinkedHashSet<>(); // check, if the current variable resolves to a data-sly-use command ParsedStatement statement = getParsedStatement(variable); if (statement == null) { return ret; } if (StringUtils.equals(statement.getCommand(), DataSlyCommands.DATA_SLY_USE.getCommand())) { // this ends the search and we can perform the actual lookup ret.addAll(getResultsForClass(statement.getValue(), variable)); } else { Set<MemberLookupResult> subResults = performMemberLookup( StringUtils.substringBefore(statement.getValue(), ".")); for (MemberLookupResult result : subResults) { if (result.matches(StringUtils.substringAfter(statement.getValue(), "."))) { ret.addAll(getResultsForClass(result.getReturnType(), variable)); } } } return ret; }