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:de.erdesignerng.model.View.java
/** * Test if the view was modified(compare it with another view). * * @param aView the view to test against with * @return true if it was modified, else false */// w w w. j a v a 2 s. c o m public boolean isModified(View aView) { return !StringUtils.equals(sql, aView.getSql()); }
From source file:com.hxl.birdhouse.web.manage.module.action.LoginAction.java
public void doLogin(@Param(name = "username") String username, @Param(name = "password") String password, Navigator nav, Context context, TurbineRunData rundata) { // search/*w w w . j a v a 2 s. c o m*/ if (StringUtils.equals(username, Constants.LOGIN_USER_NAME) && StringUtils.equals(password, Constants.LOGIN_PASSWORD)) { CookieUtil.setUserLoginCookie(request, response, username); // nav.redirectTo(WebConstants.INDEX_LINK); } else { context.put("errorMsg", ""); } return; }
From source file:com.yahoo.flowetl.core.util.EnumUtils.java
/** * Attempts to convert a string that represents an enumeration of a given * class into the actual enum object./* w w w .j a v a2s . c om*/ * * @param <T> * the generic type of the enum class to use * * @param enumKlass * the enum class that has the enumerations to select from * * @param enumStr * the enum string we will attempt to match * * @param caseSensitive * whether to compare case sensitive or not * * @return the enum object or null if not found/invalid... */ @SuppressWarnings("unchecked") public static <T extends Enum> T fromString(Class<T> enumKlass, String enumStr, boolean caseSensitive) { if (StringUtils.isEmpty(enumStr) || enumKlass == null) { // not valid return null; } Object[] types = enumKlass.getEnumConstants(); if (types == null) { // not an enum return null; } Object enumInstance = null; for (int i = 0; i < types.length; i++) { enumInstance = types[i]; if (caseSensitive == false) { if (StringUtils.equalsIgnoreCase(ObjectUtils.toString(enumInstance), enumStr)) { return (T) (enumInstance); } } else { if (StringUtils.equals(ObjectUtils.toString(enumInstance), enumStr)) { return (T) (enumInstance); } } } // not found throw new IllegalArgumentException( "Unknown enumeration [" + enumStr + "] for enum class [" + enumKlass + "]"); }
From source file:com.acc.expressupdate.util.ProductExpressUpdateElementPredicate.java
protected boolean areElementsEqual(final ProductExpressUpdateElementData element1, final ProductExpressUpdateElementData element2) { if (element1 == element2) { return true; }/* w w w . j a va 2s.com*/ if (element1 == null || element2 == null) { return false; } if (!StringUtils.equals(element1.getCode(), element2.getCode())) { return false; } if (!StringUtils.equals(element1.getCatalogVersion(), element2.getCatalogVersion())) { return false; } if (!StringUtils.equals(element1.getCatalogId(), element2.getCatalogId())) { return false; } return true; }
From source file:com.alibaba.cobar.client.router.rules.ibatis.IBatisNamespaceShardingRule.java
public boolean isDefinedAt(IBatisRoutingFact routingFact) { Validate.notNull(routingFact);/*from ww w . j a va2 s . c o m*/ String namespace = StringUtils.substringBeforeLast(routingFact.getAction(), "."); boolean matches = StringUtils.equals(namespace, getTypePattern()); if (matches) { try { Map<String, Object> vrs = new HashMap<String, Object>(); vrs.putAll(getFunctionMap()); vrs.put("$ROOT", routingFact.getArgument()); // add top object reference for expression VariableResolverFactory vrfactory = new MapVariableResolverFactory(vrs); if (MVEL.evalToBoolean(getAttributePattern(), routingFact.getArgument(), vrfactory)) { return true; } } catch (Throwable t) { logger.info("failed to evaluate attribute expression:'{}' with context object:'{}'\n{}", new Object[] { getAttributePattern(), routingFact.getArgument(), t }); } } return false; }
From source file:com.htmlhifive.tools.rhino.FunctionBodyVisitor.java
@Override public boolean visit(AstNode node) { if (node instanceof FunctionNode) { this.functionBody = (Block) ((FunctionNode) node).getBody(); this.functionNode = (FunctionNode) node; functionBody.visit(new NodeVisitor() { @Override//from w w w .j ava2 s . co m public boolean visit(AstNode node) { if (node instanceof Word && StringUtils.equals("{", StringUtils.strip(((Word) node).getValue()))) { if (startWord == null) { startWord = (Word) node; } return false; } return true; } }); return false; } return true; }
From source file:gov.nih.nci.cabig.caaers.security.authorization.SiteAuthorizationCheck.java
/** * True, if the user can access the object with the specified role. * @param authentication - An Authentication object * @param role - A user role//from w ww . ja v a2 s . c om * @param o - The object (an instance of Organization) * @return */ public boolean checkAuthorization(Authentication authentication, String role, Object o) { if (o instanceof Organization) { Collection<String> roles = caaersSecurityFacade.getRoles(SecurityUtils.getUserLoginName(authentication), (Organization) o); for (String aRole : roles) { if (StringUtils.equals(role, aRole)) return true; } } return false; }
From source file:com.alibaba.cobar.manager.dao.delegate.CobarAdapterKey.java
@Override public boolean equals(Object obj) { if (obj == this) return true; if (!(obj instanceof CobarAdapterKey)) return false; CobarAdapterKey that = (CobarAdapterKey) obj; return StringUtils.equals(this.ip, that.ip) && this.port == that.port && StringUtils.equals(this.user, that.user) && StringUtils.equals(this.password, that.password); }
From source file:gov.nih.nci.cabig.caaers.domain.dto.AdverseEventDTO.java
public boolean isSame(AdverseEventDTO other) { if (StringUtils.isNotEmpty(externalID)) { if (StringUtils.equals(externalID, other.externalID)) return true; }/* w w w. ja v a 2 s . com*/ return term.isSame(other.term) && StringUtils.equals(grade, other.grade) && StringUtils.equals(startDate, other.startDate) && StringUtils.equals(endDate, other.endDate) && StringUtils.equals(verbatim, other.verbatim) && StringUtils.equals(whySerious, other.whySerious) && StringUtils.equals(attribution, other.attribution); }
From source file:elaborate.util.PasswordUtil.java
/** * * @param plainPassword//from ww w. j av a2 s. c om * a plain text password * @param encodedPassword * Base64 encoded MD5 hash * @return */ public static synchronized boolean matches(String plainPassword, String encodedPassword) { byte[] base64DecodedMd5Password = Base64.decodeBase64(encodedPassword.getBytes()); String base64DecodedPasswordAsString = new String(base64DecodedMd5Password, Charsets.UTF_8); byte[] md5Password = encode(plainPassword); String md5PasswordString = new String(md5Password); /* * // return MessageDigest.isEqual(md5Password, base64DecodedMd5Password); * Fix authentication by doing a string comparison instead of a byte comparison. * We can't change eLaborate Classic for now. */ return (StringUtils.equals(md5PasswordString, base64DecodedPasswordAsString)); }