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:controllers.Setup.java

@Catch(ServiceErrorException.class)
public static void jerseyException(Throwable e) {
    flashException(e);/*from   w  ww.  j  a  v a  2  s .c  o m*/
    protectPasswords();
    params.flash();

    if (StringUtils.equals(request.actionMethod, "upload")) {
        license();
    } else {
        index();
    }
}

From source file:net.grinder.plugin.http.tcpproxyfilter.options.GenerationOption.java

/**
 * Get options which belonging to the given group.
 * //from   ww  w .  j  av  a2s  .  c  om
 * @param group
 *            group
 * @return option list
 */
public static List<GenerationOption> getOptions(String group) {
    List<GenerationOption> result = newArrayList();
    for (GenerationOption each : values()) {
        if (StringUtils.equals(group, each.getGroup())) {
            result.add(each);
        }
    }
    return result;
}

From source file:io.muic.ooc.webapp.servlet.DeleteServlet.java

@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {

    String username = request.getParameter("username");
    boolean confirm = StringUtils.equals(request.getParameter("confirm"), "true");

    User user = userService.getUser(username);

    String currentUser = (String) request.getSession().getAttribute("username");

    if (user != null && !StringUtils.equals(currentUser, username)) {
        if (confirm) {
            userService.removeUser(user);

            response.sendRedirect("/");
        } else {/*from  www  .  ja  v  a  2s. co  m*/
            request.setAttribute("user", username);

            RequestDispatcher rd = request.getRequestDispatcher("WEB-INF/remove.jsp");
            rd.include(request, response);
        }
    } else {
        response.sendRedirect("/");
    }
}

From source file:eionet.meta.exports.VocabularyOutputHelper.java

/**
 * finds list of data element values by name.
 *
 * @param elemName//from   w  w w.j  a  v a  2  s.c o m
 *            element name to be looked for
 * @param elems
 *            list containing element definitions with values
 * @return list of dataelement objects containing values
 */
public static List<DataElement> getDataElementValuesByName(String elemName, List<List<DataElement>> elems) {
    if (elems != null) {
        for (List<DataElement> elem : elems) {
            if (elem != null && elem.size() > 0) {
                DataElement elemMeta = elem.get(0);
                if (elemMeta != null && StringUtils.equals(elemMeta.getIdentifier(), elemName)) {
                    return elem;
                }
            }
        }
    }
    return null;
}

From source file:com.ning.arecibo.util.service.ServiceSelector.java

public boolean match(ServiceDescriptor sd) {
    return StringUtils.equals(sd.getName(), serviceName);
}

From source file:com.htmlhifive.tools.jslint.engine.JSCheckerFactory.java

/**
 * Checker??.//from  www . j  a  va  2s.  co  m
 * 
 * @param checker ?.
 * @param options 
 * @return ?
 * @throws CoreException ?.
 */
public static JSChecker createJSChecker(IResource checker, CheckOption[] options) throws CoreException {

    IFile chekerFile = (IFile) checker;
    String charset = chekerFile.getCharset(true);

    try {
        if (StringUtils.equals(checker.getName(), JSLintPluginConstant.JS_LINT_NAME)) {
            return new JSLint(new InputStreamReader(((IFile) checker).getContents(), charset), options);
        } else if (StringUtils.equals(checker.getName(), JSLintPluginConstant.JS_HINT_NAME)) {
            return new JSHint(new InputStreamReader(((IFile) checker).getContents(), charset), options);
        } else {
            logger.put(Messages.EM0004);
            throw new IllegalArgumentException(Messages.EM0004.getText());
        }
    } catch (UnsupportedEncodingException e) {
        throw new RuntimeException(e);
    }
}

From source file:com.thoughtworks.go.domain.command.monitor.BuildFailedErrorDetector.java

public void consumeLine(String line) {
    if (StringUtils.equals(line.trim(), "BUILD FAILED")) {
        reporter.failing("Command reported [BUILD FAILED].");
    }/* w w w. jav  a  2  s. c  om*/
}

From source file:de.erdesignerng.model.CustomTypeList.java

public CustomType findByNameAndSchema(String aTypeName, String aSchemaName) {
    for (CustomType theType : this) {
        if (StringUtils.equals(aTypeName, theType.getName())
                && StringUtils.equals(aSchemaName, theType.getSchema())) {
            return theType;
        }/*www. j a v  a 2  s . c  o  m*/
    }
    return null;
}

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

public boolean isBuildingInAnyPipeline(String name) {
    for (Stage stage : stages) {
        if (StringUtils.equals(stage.getName(), name)) {
            return true;
        }/*  w  ww.jav a  2 s.  c  om*/
    }
    return false;
}

From source file:com.example.RecursionCheck.java

private boolean isGreen(Resource resource) {
    return StringUtils.equals("green", resource.getValueMap().get("colour", String.class));
}