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.anrisoftware.sscontrol.httpd.fudforum.core.LocaleRenderer.java

private String toString(Locale locale, String formatString) {
    if (StringUtils.equals(formatString, LANGUAGE_KEY)) {
        return locale.getLanguage();
    }/* ww w.j  a v a2 s  .  c  om*/
    return locale.toString();
}

From source file:com.hybris.mobile.lib.commerce.data.product.Product.java

public String getImageThumbnailUrl() {

    String thumbnail = getFirstVariantImage();

    if (getImages() != null && !getImages().isEmpty()) {

        boolean imageFound = false;
        Iterator<Image> iterImages = getImages().iterator();

        while (iterImages.hasNext() && !imageFound) {
            Image image = iterImages.next();

            if (StringUtils.equals(image.getFormat(), "thumbnail")
                    && image.getImageType() == ImageDataType.PRIMARY) {
                thumbnail = image.getUrl();
                imageFound = true;// ww w. j  a v  a2s. c o  m
            }
        }

    }

    return thumbnail;

}

From source file:de.micromata.genome.gwiki.web.tags.GWikiHtmlRadioboxTag.java

@Override
public void prepare() {
    if (value == null) {
        value = "on";
    }//from w  w w  .  ja  va2  s  .c om
    String sval = "";
    Object val = GWikiTagRenderUtils.readFormValue(pageContext, property);
    if (val == null) {
        val = "";
    } else {
        sval = val.toString();
    }
    if (StringUtils.equals(value, sval) == true) {
        checked = "checked";
    }
}

From source file:de.micromata.genome.gwiki.plugin.rogmp3_1_0.Composer.java

public String getListDescription() {
    StringBuilder sb = new StringBuilder();
    sb.append(getName());/*from  w  w w  . jav a2  s.c om*/
    String born = get(BORN);
    if (StringUtils.equals(born, "0") == false) {
        sb.append(" (").append(born).append("-").append(get(DIED)).append(", ").append(get(COUNTRY))
                .append(")");
    }
    return sb.toString();
}

From source file:de.micromata.genome.gwiki.sampleplugin_1_0.SampleSkinRenderFilter.java

public Void filter(GWikiFilterChain<Void, GWikiSkinRenderFilterEvent, GWikiSkinRenderFilter> chain,
        GWikiSkinRenderFilterEvent event) {
    if (StringUtils.equals(event.getWikiContext().getRequestParameter("showSampleSkinRenderFilter"),
            "true") == false) {
        return chain.nextFilter(event);
    }//from  www. j  av a  2 s .  co m
    if (GuiElementType.BeginBody.name().equals(event.getGuiElementType()) == true) {
        event.getWikiContext().append("Here starts Body");
    } else if (GuiElementType.HeadMenu.name().equals(event.getGuiElementType()) == true) {
        event.getWikiContext().append("Menu item");
    } else {
        event.getWikiContext().append("Gui Element Type: " + event.getGuiElementType());
    }
    return chain.nextFilter(event);
}

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

public boolean hasPassword(String password) {
    return StringUtils.equals(this.password, encrypt(password));
}

From source file:com.anrisoftware.prefdialog.miscswing.tables.StringEquals.java

/**
 * Compare the new string value with the old string value.
 *//*from   w ww .j  av  a 2s.co  m*/
public boolean isStringEquals(Object newValue, String old) {
    if (newValue == null && old == null) {
        return true;
    }
    String a = null;
    if (newValue != null) {
        a = newValue.toString();
    }
    if (isEmpty(a) && isEmpty(old)) {
        return true;
    }
    return StringUtils.equals(a, old);
}

From source file:com.glaf.jbpm.factory.JbpmActionHandlerFactory.java

public static void execute(String key, ExecutionContext executionContext) {
    String actionHandlerExecution = "spring";
    if (StringUtils.isNotEmpty(SystemProperties.getString(JBPM_ACTION_HANDLER_FACTORY_TYPE))) {
        actionHandlerExecution = SystemProperties.getString(JBPM_ACTION_HANDLER_FACTORY_TYPE);
    }//from  w  w w . j av a2s .co  m
    if (StringUtils.isNotEmpty(CustomProperties.getString(JBPM_ACTION_HANDLER_FACTORY_TYPE))) {
        actionHandlerExecution = CustomProperties.getString(JBPM_ACTION_HANDLER_FACTORY_TYPE);
    }

    key = key.trim();

    ActionHandler actionHandler = null;
    if (StringUtils.equals(actionHandlerExecution, "spring")) {
        actionHandler = (ActionHandler) JbpmActionHandlerBeanFactory.getBean(key);
        if (actionHandler != null) {
            try {
                actionHandler.execute(executionContext);
            } catch (Exception ex) {
                throw new JbpmException(ex);
            }
        }
    } else {
        try {
            actionHandler = (ActionHandler) pool.borrowObject(key);
            if (actionHandler != null) {
                actionHandler.execute(executionContext);
            }
        } catch (Exception ex) {
            throw new JbpmException(ex);
        } finally {
            if (actionHandler != null) {
                try {
                    pool.returnObject(key, actionHandler);
                } catch (Exception ex) {
                    if (LogUtils.isDebug()) {
                        ex.printStackTrace();
                    }
                }
            }
        }
    }
}

From source file:gov.nih.nci.caintegrator.web.action.query.form.SelectListParameter.java

/**
 * @param value the value to set//w  w w . j a va 2s.c  om
 */
public void setValue(String value) {
    if (!StringUtils.equals(getValue(), value)) {
        this.selectedKey = value;
        valueSelectedHandler.valueSelected(optionList.getActualValue(value));
    }
}

From source file:de.dominikschadow.javasecurity.csrf.CSRFTokenHandler.java

public static boolean isValid(HttpServletRequest request)
        throws ServletException, NoSuchAlgorithmException, NoSuchProviderException {
    if (request.getSession(false) == null) {
        throw new ServletException(MISSING_SESSION);
    }//from w  w w . j a v a 2s .c  o m

    return StringUtils.equals(getToken(request.getSession(false)), request.getParameter(CSRF_TOKEN));
}