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

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

Introduction

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

Prototype

public static boolean equals(String str1, String str2) 

Source Link

Document

Compares two Strings, returning true if they are equal.

Usage

From source file:de.hybris.platform.acceleratorstorefrontcommons.forms.validation.GuestRegisterValidator.java

@Override
public void validate(final Object object, final Errors errors) {
    final GuestRegisterForm guestRegisterForm = (GuestRegisterForm) object;
    final String newPasswd = guestRegisterForm.getPwd();
    final String checkPasswd = guestRegisterForm.getCheckPwd();

    if (StringUtils.isNotEmpty(newPasswd) && StringUtils.isNotEmpty(checkPasswd)
            && !StringUtils.equals(newPasswd, checkPasswd)) {
        errors.rejectValue(CHECK_PWD, "validation.checkPwd.equals");
    } else {//from w  ww.j  a v a  2 s  .  c om
        if (StringUtils.isEmpty(newPasswd)) {
            errors.rejectValue("pwd", "register.pwd.invalid");
        } else if (StringUtils.length(newPasswd) < 6 || StringUtils.length(newPasswd) > 255) {
            errors.rejectValue("pwd", "register.pwd.invalid");
        }

        if (StringUtils.isEmpty(checkPasswd)) {
            errors.rejectValue(CHECK_PWD, "register.checkPwd.invalid");
        } else if (StringUtils.length(checkPasswd) < 6 || StringUtils.length(checkPasswd) > 255) {
            errors.rejectValue(CHECK_PWD, "register.checkPwd.invalid");
        }
    }
}

From source file:com.cloudera.nav.sdk.model.custom.MetaClassPackage.java

public boolean isDefaultPackage() {
    return StringUtils.equals(DEFAULT_PACKAGE_NAME, getName());
}

From source file:com.edgenius.wiki.search.interceptor.RoleIndexInterceptor.java

public void afterReturning(Object retValue, Method method, Object[] args, Object target) throws Throwable {
    Role role = null;/*w  ww.  j ava2  s . c  o m*/
    if (StringUtils.equals(method.getName(), RoleService.createRole)) {
        role = (Role) retValue;
    }
    if (role == null)
        return;

    log.info("JMS message send for Role index creating/updating. Role: " + role.getName());
    IndexMQObject mqObj = new IndexMQObject(IndexMQObject.TYPE_INSERT_ROLE, role.getUid());
    jmsTemplate.convertAndSend(queue, mqObj);
}

From source file:it.govpay.model.comparator.EstrattoContoComparator.java

@Override
public int compare(EstrattoConto o1, EstrattoConto o2) {
    //  cod_flusso_rendicontazione, iuv, data_pagamento
    String codFlussoRendicontazione1 = o1.getCodFlussoRendicontazione() != null
            ? o1.getCodFlussoRendicontazione()
            : "";
    String codFlussoRendicontazione2 = o2.getCodFlussoRendicontazione() != null
            ? o2.getCodFlussoRendicontazione()
            : "";

    if (StringUtils.equals(codFlussoRendicontazione1, codFlussoRendicontazione2)) {
        String iuv1 = o1.getIuv() != null ? o1.getIuv() : "";
        String iuv2 = o2.getIuv() != null ? o2.getIuv() : "";

        if (StringUtils.equals(iuv1, iuv2)) {
            Date dataPagamento1 = o1.getDataPagamento();

            if (dataPagamento1 == null)
                return -1;

            Date dataPagamento2 = o2.getDataPagamento();

            if (dataPagamento2 == null)
                return -1;

            dataPagamento1.compareTo(dataPagamento2);
        }//from   w ww  .  j  a  v  a  2s.c o  m

        return iuv1.compareTo(iuv2);
    }

    return codFlussoRendicontazione1.compareTo(codFlussoRendicontazione2);
}

From source file:com.prowidesoftware.swift.model.SwiftBlock3Test.java

@Test
public void testGenerateMUR() throws InterruptedException {
    SwiftBlock3 b = new SwiftBlock3();
    assertNull(b.getTagByName("108"));
    b.generateMUR(true);//w  ww .ja  va  2s . c  o m
    assertNotNull(b.getTagByName("108"));
    final String current = b.getTagByName("108").getValue();
    b.generateMUR(false);
    assertEquals(current, b.getTagByName("108").getValue());
    Thread.sleep(500);
    b.generateMUR(true);
    assertFalse("expected a different MUR after generateMUR(true)",
            StringUtils.equals(current, b.getTagByName("108").getValue()));
}

From source file:com.intel.cosbench.controller.tasklet.Bootor.java

@Override
protected void handleResponse(PingResponse response) {
    DriverInfo driver = getDriver();/*from  w w  w . j  a  va2  s .  c om*/
    if (StringUtils.equals(response.getName(), driver.getName()))
        return;
    String msg = "expetect driver name {} dose not match the real name {}";
    LOGGER.debug(msg, driver.getName(), response.getName());
}

From source file:com.thoughtworks.go.domain.ModificationKey.java

public boolean equals(Object o) {
    if (this == o) {
        return true;
    }//w w  w. ja va 2s .c o m
    if (o == null || getClass() != o.getClass()) {
        return false;
    }
    ModificationKey other = (ModificationKey) o;
    return (StringUtils.equals(comment, other.getComment())) && StringUtils.equals(user, other.getUser());
}

From source file:io.kamax.mxisd.backend.sql.SynapseSqlDirectoryProvider.java

@Autowired
public SynapseSqlDirectoryProvider(SynapseSqlProviderConfig cfg, MatrixConfig mxCfg) {
    super(cfg, mxCfg);

    if (StringUtils.equals("sqlite", cfg.getType())) {
        String userId = "'@' || p.user_id || ':" + mxCfg.getDomain() + "'";
        GenericSqlProviderConfig.Type queries = cfg.getDirectory().getQuery();
        queries.getName()// w ww.j a v a2s .c o m
                .setValue("select " + userId + ", displayname from profiles p where displayname like ?");
        queries.getThreepid()
                .setValue("select t.user_id, p.displayname "
                        + "from user_threepids t JOIN profiles p on t.user_id = " + userId + " "
                        + "where t.address like ?");
    } else if (StringUtils.equals("postgresql", cfg.getType())) {
        String userId = "concat('@',p.user_id,':" + mxCfg.getDomain() + "')";
        GenericSqlProviderConfig.Type queries = cfg.getDirectory().getQuery();
        queries.getName()
                .setValue("select " + userId + ", displayname from profiles p where displayname ilike ?");
        queries.getThreepid()
                .setValue("select t.user_id, p.displayname "
                        + "from user_threepids t JOIN profiles p on t.user_id = " + userId + " "
                        + "where t.address ilike ?");
    } else {
        throw new ConfigurationException("Invalid SQL type");
    }
}

From source file:com.alibaba.cobar.client.router.rules.ibatis.IBatisSqlActionShardingRule.java

public boolean isDefinedAt(IBatisRoutingFact routingFact) {
    Validate.notNull(routingFact);//from w ww  . ja  va2 s.  co m
    boolean matches = StringUtils.equals(getTypePattern(), routingFact.getAction());
    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:gov.nih.nci.cabig.caaers.web.search.SearchUserCommand.java

public boolean isUserAttributesShown() {
    if (!popupRequest)
        return true;
    return StringUtils.equals(popupRequestType, "user");
}