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:gov.nih.nci.cabig.caaers.validation.ValidationErrors.java

public boolean containsErrorWithCode(String code) {
    for (ValidationError error : errors) {
        if (StringUtils.equals(error.getCode(), code))
            return true;
    }// ww w . j av a 2 s  .  c om
    return false;
}

From source file:com.mmj.app.common.checkcode.CheckCodeManager.java

/**
 * ?//  www  .j  a  v  a  2  s . co m
 */
public void setup() {
    try {
        CheckCodeTools.init();
        String checkCodeSwitch = "on";
        if (StringUtils.equals(checkCodeSwitch, "off")) {
            this.needCheck = false;
        } else {
            this.needCheck = true;
        }
        initException = null;
    } catch (Exception e) {
        initException = e;
        logger.error("CheckCodeManager Set Failed!", e);
    }
}

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

public void afterReturning(Object retValue, Method method, Object[] args, Object target) throws Throwable {
    User user = null;//from ww w.  j a v  a 2  s.  c  om
    String removedUsername = null;
    if (StringUtils.equals(method.getName(), UserService.saveUser)) {
        user = (User) retValue;
    } else if (StringUtils.equals(method.getName(), UserService.updateUserWithIndex)) {
        user = (User) retValue;
        if (!user.isEnabled()) {
            //if user is disabled. remove it from index
            removedUsername = user.getUsername();
        }
    } else if (StringUtils.equals(method.getName(), UserService.removeUser)) {
        user = (User) retValue;
        removedUsername = user.getUsername();
        //clean user
        user = null;
    }

    if (user != null && user.isEnabled()) {
        log.info("JMS message send for User index creating/updating. User: " + user.getFullname());
        IndexMQObject mqObj = new IndexMQObject(IndexMQObject.TYPE_INSERT_USER, user);
        jmsTemplate.convertAndSend(queue, mqObj);
    } else if (removedUsername != null) {
        log.info("JMS message send for User index deleting. User: " + user.getFullname());
        IndexMQObject mqObj = new IndexMQObject(IndexMQObject.TYPE_REMOVE_USER, removedUsername);
        jmsTemplate.convertAndSend(queue, mqObj);
    }

}

From source file:biz.netcentric.cq.tools.actool.comparators.AcePermissionComparator.java

@Override
public int compare(final AceBean ace1, final AceBean ace2) {

    final int REORDER_TO_TOP = -1;

    // if default return value was 0 no new entry would get added in case of
    // TreeSet, the result would be a Set containing exactly 2 elements
    // (one deny and one allow), therefore default value here is 1. this
    // ensures a grouping of ACEs in one block containing
    // all denies followed by a block containing all allows
    // (except if doNotReorder is set)
    final int LEAVE_UNCHANGED = 1;

    if (StringUtils.equals(ace1.getPermission(), "deny") && StringUtils.equals(ace2.getPermission(), "allow")
            && !ace1.isKeepOrder()) {
        return REORDER_TO_TOP;
    }/*from  w w  w. j a  va2 s  .  com*/
    return LEAVE_UNCHANGED;
}

From source file:cn.cuizuoli.appranking.http.client.TrustClientHttpRequestFactory.java

@Override
protected HttpURLConnection openConnection(URL url, Proxy proxy) throws IOException {
    if (StringUtils.equals(url.getProtocol(), "https")) {
        HttpsURLConnection.setDefaultSSLSocketFactory(sslSocketFactory);
        HttpsURLConnection urlConnection = (HttpsURLConnection) (proxy != null ? url.openConnection(proxy)
                : url.openConnection());
        urlConnection.setHostnameVerifier(DO_NOT_VERIFY);
        return urlConnection;
    } else {/*from ww w  .  ja  v  a2  s  .c o  m*/
        HttpURLConnection urlConnection = (HttpURLConnection) (proxy != null ? url.openConnection(proxy)
                : url.openConnection());
        return urlConnection;
    }
}

From source file:com.dp2345.controller.mall.member.PasswordController.java

/**
 * ???//from w w w.  j  a va 2 s  . co  m
 */
@RequestMapping(value = "/check_current_password", method = RequestMethod.GET)
public @ResponseBody boolean checkCurrentPassword(String currentPassword) {
    if (StringUtils.isEmpty(currentPassword)) {
        return false;
    }
    Member member = memberService.getCurrent();
    if (StringUtils.equals(DigestUtils.md5Hex(currentPassword), member.getPassword())) {
        return true;
    } else {
        return false;
    }
}

From source file:com.jgui.ttscrape.ConfigurableSportsPostProcessor.java

/**
 * Write the show to the show writer if it matches.
 *//*from   ww w .j a v a2 s . co  m*/
@Override
public void postProcess(Show s) {
    // make sure the category matches.
    if (StringUtils.equals(category, s.getCategory())) {
        String subtitle = s.getSubtitle();

        // for each entry in the contains list,
        // see if the subtitle contains the string
        // (or doesn't if first char is bang char)
        boolean writeIt = false;
        for (String str : contains) {
            if (str.charAt(0) == '!') {
                String s1 = str.substring(1);
                if (StringUtils.contains(subtitle, s1)) {
                    writeIt = false;
                    break;
                }
            } else {
                if (StringUtils.contains(subtitle, str)) {
                    writeIt = true;
                }
            }
        }
        if (writeIt) {
            writer.writeShow(WRITER_NAME, s);
        }
    }
}

From source file:com.shigengyu.hyperion.server.ControllerMethod.java

public String getUrl() {

    String url = StringUtils.EMPTY;
    if (!StringUtils.equals(controller, "/")) {
        url += controller;/*www  .  j  av  a2  s  .  c  o  m*/
    }
    if (!StringUtils.equals(method, "/")) {
        url += method;
    }
    return url + "/";
}

From source file:com.voa.weixin.model.WeixinMenu.java

public Menu getMenuByName(String name) {
    Menu result = null;//from   w w  w  . ja  v  a  2s  .  c om
    for (Menu menu : menus) {
        String menuName = menu.getName();
        if (StringUtils.equals(menuName, name)) {
            result = menu;
        }
    }

    return result;
}

From source file:com.activecq.samples.loginmodule.SamplePrincipalProvider.java

/**
 * @param credentials/*from   w w  w.ja  v a2 s .c om*/
 * @return
 */
private boolean canProvidePrincipal(Credentials credentials) {
    if (!(credentials instanceof SimpleCredentials)) {
        return false;
    }

    SimpleCredentials sc = (SimpleCredentials) credentials;

    return StringUtils.equals("davidg", sc.getUserID());
}