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:io.wcm.handler.link.testcontext.DummyLinkHandlerConfig.java

@Override
public boolean isValidLinkTarget(Page page) {

    // check for non-linkable templates
    String templatePath = page.getProperties().get(NameConstants.PN_TEMPLATE, String.class);
    if (StringUtils.equals(templatePath, DummyAppTemplate.STRUCTURE_ELEMENT.getTemplatePath())) {
        return false;
    }/*from w  ww .java 2 s .  com*/

    return super.isValidLinkTarget(page);
}

From source file:com.widowcrawler.terminator.model.Rule.java

@Override
public boolean equals(Object obj) {
    if (!(obj instanceof Rule)) {
        return false;
    }//from w ww .j  a  v a 2 s .com

    Rule other = (Rule) obj;

    return this.ruleType == other.getRuleType()
            && StringUtils.equals(this.getPathMatch(), other.getPathMatch());
}

From source file:com.xpn.xwiki.internal.merge.MergeUtils.java

/**
 * Merge String at lines level.// w  w w . j  av  a 2 s  . c o m
 * 
 * @param previousStr previous version of the string
 * @param newStr new version of the string
 * @param currentStr current version of the string
 * @param mergeResult the merge report
 * @return the merged string or the provided current string if the merge fail
 */
public static String mergeLines(String previousStr, String newStr, String currentStr, MergeResult mergeResult) {
    org.xwiki.diff.MergeResult<String> result;
    try {
        result = diffManager.merge(toLines(previousStr), toLines(newStr), toLines(currentStr), null);

        mergeResult.getLog().addAll(result.getLog());

        String resultStr = fromLines(result.getMerged());

        if (!StringUtils.equals(resultStr, currentStr)) {
            mergeResult.setModified(true);
        }

        return resultStr;
    } catch (MergeException e) {
        mergeResult.getLog().error("Failed to execute merge lines", e);
    }

    return currentStr;
}

From source file:de.micromata.genome.gwiki.page.search.expr.SearchExpressionComandWikiSpace.java

public Collection<SearchResult> filter(GWikiContext ctx, SearchQuery query) {
    String text = ((SearchExpressionText) nested).getText();
    List<SearchResult> ret = new ArrayList<SearchResult>();
    for (SearchResult s : query.getResults()) {
        if (StringUtils.equals(s.getElementInfo().getWikiSpace(ctx), text) == true) {
            ret.add(s);//  w w w  . j  a  v a 2s  .  c o  m
        }
    }
    return ret;
}

From source file:de.micromata.genome.gwiki.page.search.expr.SearchExpressionCommandParentPageId.java

public Collection<SearchResult> filter(GWikiContext ctx, SearchQuery query) {
    String text = ((SearchExpressionText) nested).getText();
    List<SearchResult> ret = new ArrayList<SearchResult>();
    for (SearchResult s : query.getResults()) {
        if (StringUtils.equals(s.getElementInfo().getParentId(), text) == true)
            ret.add(s);//from  www .ja  v  a 2s . c o m
    }
    return ret;
}

From source file:br.com.asisprojetos.mapper.TBContratoMapper.java

@Override
public TBContrato mapRow(ResultSet rs, int rowNum) throws SQLException {

    TBContrato tbContrato = new TBContrato();
    tbContrato.setCodContrato(rs.getInt("COD_CONTRATO"));
    tbContrato.setCodCliente(rs.getInt("COD_CLIENTE"));
    tbContrato.setCodVendedor(rs.getInt("COD_VENDEDOR"));
    tbContrato.setNumContrato(rs.getString("NUM_CONTRATO"));
    tbContrato.setDataVigenciaIni(rs.getDate("DAT_VIGENCIA_INI"));
    tbContrato.setDataVigenciaFim(rs.getDate("DAT_VIGENCIA_FIM"));
    tbContrato.setComissao(rs.getFloat("COMISSAO"));
    tbContrato.setQtdProcessMes(rs.getInt("QTD_PROCESS_MES"));
    tbContrato.setQtdProcessAtu(rs.getInt("QTD_PROCESS_ATU"));
    tbContrato.setDataUltimaAtu(rs.getDate("DAT_ULTIMA_ATU"));
    tbContrato.setDataCriacao(rs.getDate("DAT_CRIACAO"));
    tbContrato.setQtdCnpj(rs.getInt("QTD_CNPJ"));
    tbContrato.setQtdNF(rs.getInt("QTD_NF"));
    tbContrato.setQtdParcelas(rs.getInt("QTD_PARCELAS"));
    tbContrato.setValor(rs.getFloat("VALOR"));
    tbContrato.setInAtivo(StringUtils.equals(rs.getString("IN_ATIVO"), "A"));
    tbContrato.setFerramenta(rs.getInt("FERRAMENTA"));
    tbContrato.setPrioridade(rs.getInt("PRIORIDADE"));

    return tbContrato;
}

From source file:fr.scc.elo.dao.impl.TeamDaoImpl.java

@Override
public Team createOrUpdateTeam(String tag, String name) {

    Team found = teamRepository.findByTag(tag);
    if (found == null) {
        return teamRepository.insert(new Team(name, tag));
    }//from   ww w  .jav a  2  s. c om
    if (!StringUtils.equals(name, found.getName())) {
        found.setName(name);
        return teamRepository.save(found);
    }
    return found;
}

From source file:net.eledge.android.europeana.search.RecordController.java

public void readRecord(Activity activity, String id) {
    if (StringUtils.isNotBlank(id)) {
        if ((record != null) && StringUtils.equals(id, record.about)) {
            // don't load the same record twice but do notify listeners!;
            activity.runOnUiThread(new ListenerNotifier<>(listeners.values(), record));
            return;
        }/*from   w  ww .jav  a  2  s.com*/
        record = null;
        currentRecordId = id;
        currentRecordSelected = false;
        if (mRecordTask != null) {
            mRecordTask.cancel(true);
        }
        mRecordTask = new RecordTask(activity);
        mRecordTask.execute(id);
    }
}

From source file:com.glaf.core.security.IdentityFactory.java

/**
 * ?????/*from  www .  j  av a 2 s  .c  o  m*/
 * 
 * @param actorId
 * @param password
 * @return
 */
public static boolean checkPassword(String actorId, String password) {
    boolean isAuthenticated = false;
    User user = (User) getEntityService().getById("getUserById", actorId);
    if (user != null) {
        String pwd = DigestUtil.digestString(password, "MD5");
        if (StringUtils.equals(pwd, user.getPassword())) {
            return true;
        }
        if (StringUtils.equals(password, user.getPassword())) {
            return true;
        }
    }
    return isAuthenticated;
}

From source file:ch.cyberduck.core.local.TildeExpander.java

public String expand(final String name) {
    if (name.startsWith(Local.HOME)) {
        final String expanded = preferences.getProperty("local.user.home") + StringUtils.substring(name, 1);
        if (log.isDebugEnabled()) {
            if (!StringUtils.equals(expanded, name)) {
                log.debug(String.format("Expanded %s to %s", name, expanded));
            }/* w w w.j  a  v a2 s .  c o  m*/
        }
        return expanded;
    }
    return name;
}