Example usage for org.apache.commons.lang3 StringUtils equals

List of usage examples for org.apache.commons.lang3 StringUtils equals

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils equals.

Prototype

public static boolean equals(final CharSequence cs1, final CharSequence cs2) 

Source Link

Document

Compares two CharSequences, returning true if they represent equal sequences of characters.

null s are handled without exceptions.

Usage

From source file:net.malisis.advert.advert.ClientAdvert.java

@Override
public void setHash(String hash) {
    if (StringUtils.equals(this.hash, hash) && texture != null) {
        texture.delete();/*  www .  j ava 2  s.  c  om*/
        texture = null;
    }

    super.setHash(hash);

}

From source file:br.com.autonomiccs.apacheCloudStack.client.ApacheCloudStackApiCommandParameter.java

/**
 * We only check the {@link #name} property because, we can only have on parameter with a given name.
 */// www.  j a va 2 s.com
@Override
public boolean equals(Object obj) {
    final boolean isIstanceOfThisClass = obj instanceof ApacheCloudStackApiCommandParameter;
    if (!isIstanceOfThisClass) {
        return false;
    }
    ApacheCloudStackApiCommandParameter that = (ApacheCloudStackApiCommandParameter) obj;
    return StringUtils.equals(this.name, that.name);
}

From source file:com.glaf.base.modules.sys.service.mybatis.AuthorizeServiceImpl.java

/**
 * ?/*from w ww .ja  va 2 s.  c om*/
 * 
 * @param account
 * @param pwd
 * @return
 */
public SysUser authorize(String account, String pwd) {
    SysUser bean = sysUserService.findByAccount(account);
    if (bean != null) {
        if (bean.isDepartmentAdmin()) {
            logger.debug(account + " is department admin");
        }
        if (bean.isSystemAdmin()) {
            logger.debug(account + " is system admin");
        }
        String password = sysUserService.getSysUserPasswordByAccount(account);
        if (!StringUtils.equals(password, pwd) || // ???
                bean.getLocked() == 1) {// ???
            bean = null;
        }
    }
    return bean;
}

From source file:com.webbfontaine.valuewebb.action.pricedb.pdss.PdssCriteriaContainer.java

@Override
public UserCriterion getDefinedCriterion(String criteriaKey) {
    UserCriterion uc = new UserCriterion();

    uc.setFullKey(criteriaKey);//from w  w  w. j a v  a  2s  .com

    RefSelect refSelect = (RefSelect) Component.getInstance(RefSelect.class, true);

    if (StringUtils.equals(criteriaKey, "hsCode")) {
        uc.setType(UserCriterionType.STRING);
    }

    if (StringUtils.equals(criteriaKey, "productDsc")) {
        uc.setType(UserCriterionType.STRING);
    }

    if (StringUtils.equals(criteriaKey, "ageOfPrice")) {
        uc.setType(UserCriterionType.LONG);
    }

    if (StringUtils.equals(criteriaKey, "used")) {
        uc.setType(UserCriterionType.BOOLEAN);
    }

    if (StringUtils.equals(criteriaKey, "unit")) {
        uc.setType(UserCriterionType.REF);
        uc.setPossibleValues(refSelect.selectRimmUnit());
    }

    if (StringUtils.equals(criteriaKey, "coo")) {
        uc.setType(UserCriterionType.REF);
        uc.setPossibleValues(refSelect.selectCountry());
    }

    if (uc.getName() == null) {
        String humanName = HumanNames.getName(criteriaKey);
        uc.setName(humanName == null ? Utils.toWords(criteriaKey) : humanName);
    }

    return uc;
}

From source file:io.wcm.handler.link.testcontext.DummyUrlHandlerConfig.java

@Override
public boolean isIntegrator(Page page) {
    String templatePath = page.getProperties().get(NameConstants.PN_TEMPLATE, String.class);
    return StringUtils.equals(templatePath, DummyAppTemplate.INTEGRATOR.getTemplatePath());
}

From source file:ch.cyberduck.core.sftp.SFTPExceptionMappingService.java

@Override
public BackgroundException map(final IOException e) {
    if (ExceptionUtils.getRootCause(e) instanceof SSHException) {
        return this.map((SSHException) ExceptionUtils.getRootCause(e));
    }/*from w  w  w .j a v a  2  s  . c  om*/
    final StringBuilder buffer = new StringBuilder();
    this.append(buffer, e.getMessage());
    if (ExceptionUtils.getRootCause(e) != null) {
        if (!StringUtils.equals(e.getMessage(), ExceptionUtils.getRootCause(e).getMessage())) {
            this.append(buffer, ExceptionUtils.getRootCause(e).getMessage());
        }
    }
    if (e instanceof SFTPException) {
        final SFTPException failure = (SFTPException) e;
        final Response.StatusCode code = failure.getStatusCode();
        switch (code) {
        case UNKNOWN:
        case BAD_MESSAGE:
        case FAILURE:
        case OP_UNSUPPORTED:
            return new InteroperabilityException(buffer.toString(), e);
        case NO_SUCH_FILE:
            return new NotfoundException(buffer.toString(), e);
        case PERMISSION_DENIED:
            return new AccessDeniedException(buffer.toString(), e);
        case NO_CONNECTION:
        case CONNECITON_LOST:
            return new ConnectionRefusedException(buffer.toString(), e);
        }
    }
    if (e instanceof UserAuthException) {
        return new LoginFailureException(buffer.toString(), e);
    }
    if (e instanceof ConnectionException) {
        return new ConnectionRefusedException(buffer.toString(), e);
    }
    if (e instanceof Buffer.BufferException) {
        return new InteroperabilityException(buffer.toString(), e);
    }
    if (e instanceof SSHException) {
        final SSHException failure = (SSHException) e;
        final DisconnectReason reason = failure.getDisconnectReason();
        return this.map(e, buffer, reason);
    }
    return this.wrap(e, buffer);
}

From source file:de.micromata.genome.gwiki.page.impl.wiki.blueprint.GWikiBlueprintEditorActionBean.java

protected void buildTemplateList() {
    List<GWikiElementInfo> elems = wikiContext.getElementFinder()
            .getPageInfos(new MatcherBase<GWikiElementInfo>() {

                private static final long serialVersionUID = 6581136045310016723L;

                @Override//from  w ww . j a  v  a 2s  .c  o m
                public boolean match(GWikiElementInfo ei) {
                    if (ei.getId().startsWith("admin/blueprints/") == false) {
                        return false;
                    }
                    if (StringUtils.equals(ei.getProps().getStringValue(GWikiPropKeys.WIKIMETATEMPLATE),
                            "admin/templates/StandardWikiPageMetaTemplate") == false) {
                        return false;
                    }
                    return true;
                }
            });
    Collections.sort(elems, new GWikiElementByPropComparator(GWikiPropKeys.TITLE));
    for (GWikiElementInfo ei : elems) {
        templates.add(Pair.make(ei.getTitle(), ei.getId()));
    }
}

From source file:com.glaf.mail.web.springmvc.MailAccountController.java

@RequestMapping("/edit")
public ModelAndView edit(HttpServletRequest request, ModelMap modelMap) {
    RequestUtils.setRequestParameterToAttribute(request);

    Map<String, Object> params = RequestUtils.getParameterMap(request);
    String rowId = ParamUtils.getString(params, "accountId");
    MailAccount mailAccount = null;//  w  w w.  j av  a 2 s . c  o m
    if (StringUtils.isNotEmpty(rowId)) {
        mailAccount = mailAccountService.getMailAccount(rowId);
        if (StringUtils.equals(RequestUtils.getActorId(request), mailAccount.getCreateBy())) {
            request.setAttribute("mailAccount", mailAccount);
        }
    }

    String view = request.getParameter("view");
    if (StringUtils.isNotEmpty(view)) {
        return new ModelAndView(view, modelMap);
    }

    String x_view = CustomProperties.getString("mailAccount.edit");
    if (StringUtils.isNotEmpty(x_view)) {
        return new ModelAndView(x_view, modelMap);
    }

    return new ModelAndView("/modules/mail/mailAccount/edit", modelMap);
}

From source file:com.quinsoft.zeidon.android.ZeidonImageView.java

@Override
public void setFromOi() {
    viewDelegate.setEntityInstance();/*from w w w.  jav a  2s  .co  m*/
    String url = viewDelegate.getStringFromAttribute();
    if (StringUtils.isBlank(url))
        viewDelegate.findTaskQualification().log().warn("URL for %s is blank", viewDelegate.getAttributeName());
    else if (previousUrl == null || StringUtils.equals(url, previousUrl)) {
        Picasso.with(getContext()).load(url).into(this);
        previousUrl = url;
    }
}

From source file:com.adeptj.runtime.server.CredentialMatcher.java

private static boolean fromServerConfig(String id, char[] password) {
    return Configs.of().undertow().getObject(KEY_USER_CREDENTIAL_MAPPING).unwrapped().entrySet().stream()
            .anyMatch(entry -> StringUtils.equals(entry.getKey(), id)
                    && Arrays.equals(makeHash(password), ((String) entry.getValue()).toCharArray()));
}