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:com.thoughtworks.go.config.Agents.java

public AgentConfig getAgentByUuid(String uuid) {
    for (AgentConfig agentConfig : this) {
        if (StringUtils.equals(agentConfig.getUuid(), uuid)) {
            return agentConfig;
        }/*from  w ww .  ja  v a 2  s  .c  o  m*/
    }
    return NullAgent.createNullAgent(uuid);
}

From source file:net.lmxm.ute.executers.tasks.subversion.SubversionUtils.java

/**
 * Checks if is head revision.//from   w w w.  j av  a 2 s.co m
 * 
 * @param revision the revision
 * @return true, if is head revision
 */
public static boolean isHeadRevision(final String revision) {
    return StringUtils.equals(revision, HEAD_REVISION);
}

From source file:jease.cms.domain.Access.java

public void setPassword(String password) {
    if (!StringUtils.equals(this.password, password)) {
        this.password = encrypt(password);
    }//from   w  w  w  . jav a  2 s.  c o m
}

From source file:com.xxd.web.interceptors.CompanyAuthInterceptor.java

@Override
public boolean preHandle(HttpServletRequest req, HttpServletResponse res, Object o) throws Exception {
    String token = CookieUtil.getCookieValue(req, Constant.TOKEN);
    String ua = HttpHelper.getUserAgent(req);
    // ?URI ??/*from www . j  a  va  2  s .c om*/
    String accountUri = "/usercenter/company/account.html";
    String authUri = "/usercenter/company/authentication.html";
    String loginUri = "/usercenter/company/login.html";
    String registerUri = "/usercenter/company/register.html";
    String licenseUri = "/usercenter/company/license.html";

    // ??
    boolean isLoginPage = StringUtils.equals(req.getRequestURI(), loginUri)
            || StringUtils.equals(req.getRequestURI(), registerUri);
    if (StringUtils.isEmpty(token) || !userService.isLogin(token, ua)) {
        if (isLoginPage) {
            // ?
            return true;
        }
        // 
        res.sendRedirect(loginUri);
        return false;
    }
    JSONObject userInfoJson = userService.getUserInfo(token, ua);
    AccountUserInfoVo accountUserInfoVo = JsonUtil.toObject(userInfoJson, AccountUserInfoVo.class);
    if (accountUserInfoVo == null) {
        // token ?userInfo
        // res.sendRedirect(loginUri);
        return false;
    }
    String userType = accountUserInfoVo.getUsertype();
    if (StringUtils.equals(UserTypeEnum.NEW_ENTERPRISE.getType(), userType)) {
        // ?
        EnterpriseProgressVo eap = new EnterpriseAuthProgressCommand(token, ua).execute();
        // ??
        boolean isAuthPage = StringUtils.equals(req.getRequestURI(), authUri);
        if (eap.getStatus() && isLoginPage) {
            // ?  
            res.sendRedirect(accountUri);
            return false;
        }
        if (!eap.getStatus() && !isAuthPage && !StringUtils.equals(req.getRequestURI(), licenseUri)) {
            // ??? ?license ?
            res.sendRedirect(authUri);
            return false;
        }
        // 
        return true;
    }
    res.sendRedirect("/usercenter/accountInfo.html");
    return false;
}

From source file:de.blizzy.documentr.DocumentrMatchers.java

public static Page argPage(final String parentPagePath, final String title, final String text,
        final String viewRestrictionRole) {

    Matcher<Page> matcher = new ArgumentMatcher<Page>() {
        @Override//  w  ww .ja  va 2 s.  c  o m
        public boolean matches(Object argument) {
            Page page = (Page) argument;
            String pageText = null;
            if (page.getData() instanceof PageTextData) {
                pageText = ((PageTextData) page.getData()).getText();
            }
            return (StringUtils.equals(parentPagePath, ANY)
                    || StringUtils.equals(page.getParentPagePath(), parentPagePath))
                    && StringUtils.equals(page.getTitle(), title) && StringUtils.equals(pageText, text)
                    && (StringUtils.equals(viewRestrictionRole, ANY)
                            || StringUtils.equals(page.getViewRestrictionRole(), viewRestrictionRole));
        }
    };
    return argThat(matcher);
}

From source file:com.hubspot.jinjava.tree.ExpressionNode.java

@Override
public OutputNode render(JinjavaInterpreter interpreter) {
    Object var = interpreter.resolveELExpression(master.getExpr(), getLineNumber());

    String result = Objects.toString(var, "");

    if (!StringUtils.equals(result, master.getImage()) && StringUtils.contains(result, "{{")) {
        try {//from  ww  w.j a v a  2 s . c om
            result = interpreter.renderFlat(result);
        } catch (Exception e) {
            Logging.ENGINE_LOG.warn("Error rendering variable node result", e);
        }
    }

    if (interpreter.getContext().isAutoEscape()) {
        result = EscapeFilter.escapeHtmlEntities(result);
    }

    return new RenderedOutputNode(result);
}

From source file:com.navercorp.pinpoint.common.server.bo.codec.strategy.impl.StringRepeatCountEncodingStrategy.java

@Override
public void encodeValues(Buffer buffer, List<String> values) {
    StringReference previousValueReference = null;
    int count = 0;
    for (String value : values) {
        if (previousValueReference == null || !StringUtils.equals(value, previousValueReference.get())) {
            if (previousValueReference != null) {
                buffer.putVInt(count);//from  w  ww. ja va 2 s .co  m
                this.bufferHandler.put(buffer, previousValueReference.get());
            }
            previousValueReference = new StringReference(value);
            count = 1;
        } else {
            count++;
        }
    }
    if (count > 0 && previousValueReference != null) {
        buffer.putVInt(count);
        this.bufferHandler.put(buffer, previousValueReference.get());
    }
}

From source file:cn.mypandora.service.TestDeptService.java

@Test
public void getDeptParent() {
    BaseDept dept = service.getDeptParent(3L);
    assertTrue(StringUtils.equals(dept.getName(), ""));
    if (null != dept) {
        System.out.println(dept.getId() + "__" + dept.getName());
    }/*from   www.j av  a2s. c  om*/
}

From source file:io.aino.agents.core.NameValuePair.java

@Override
public boolean equals(Object obj) {
    if (null == obj) {
        return false;
    }//from   ww  w.j a v a  2s . c  om

    if (!(obj instanceof NameValuePair)) {
        return false;
    }

    NameValuePair other = (NameValuePair) obj;

    if (!StringUtils.equals(this.name, other.name)) {
        return false;
    }

    if (!StringUtils.equals(this.value, other.value)) {
        return false;
    }

    return true;
}

From source file:app.abhijit.iter.data.source.TelemetryDataSource.java

public void fetch(String registrationNumber) {
    if (StringUtils.equals(registrationNumber, mLastRegistrationNumber)) {
        processTelemetry(mLastResponse);
    } else {/*from  w  w w. j  a  v a  2s.c  om*/
        new FetchTelemetryAsyncTask().execute(registrationNumber);
    }
}