Example usage for org.apache.commons.lang3 StringUtils equalsIgnoreCase

List of usage examples for org.apache.commons.lang3 StringUtils equalsIgnoreCase

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils equalsIgnoreCase.

Prototype

public static boolean equalsIgnoreCase(final CharSequence str1, final CharSequence str2) 

Source Link

Document

Compares two CharSequences, returning true if they represent equal sequences of characters, ignoring case.

null s are handled without exceptions.

Usage

From source file:com.ottogroup.bi.spqr.pipeline.queue.chronicle.DefaultStreamingMessageQueue.java

/**
 * Return an instance of the referenced {@link StreamingMessageQueueWaitStrategy}
 * @param waitStrategyName name of strategy to instantiate (eg. {@link StreamingMessageQueueBlockingWaitStrategy#STRATEGY_NAME} (default))
 * @return/* w  w  w  . j  ava  2  s . c o m*/
 */
protected StreamingMessageQueueWaitStrategy getWaitStrategy(final String waitStrategyName) {
    if (StringUtils.equalsIgnoreCase(waitStrategyName, StreamingMessageQueueDirectPassStrategy.STRATEGY_NAME))
        return new StreamingMessageQueueDirectPassStrategy();
    else if (StringUtils.equalsIgnoreCase(waitStrategyName,
            StreamingMessageQueueSleepingWaitStrategy.STRATEGY_NAME))
        return new StreamingMessageQueueSleepingWaitStrategy();
    return new StreamingMessageQueueBlockingWaitStrategy();
}

From source file:com.adobe.acs.commons.adobeio.service.impl.EndpointServiceImpl.java

/**
 * Process the Adobe I/O action//  w w  w.j a va 2 s.  c o  m
 * 
 * @param actionUrl
 *            The url to be executed
 * @param queryParameters
 *            The query parameters to pass
 * @param method
 *            The method to be executed
 * @param payload
 *            The payload of the call
 * @return JsonObject containing the result of the action
 * @throws Exception
 *             Thrown when process-action throws an exception
 */
private JsonObject process(@NotNull final String actionUrl, @NotNull final Map<String, String> queryParameters,
        @NotNull final String method, final String[] headers, @NotNull final JsonObject payload) {
    if (isBlank(actionUrl) || isBlank(method)) {
        LOGGER.error("Method or url is null");
        return new JsonObject();
    }

    URI uri = null;

    try {
        URIBuilder builder = new URIBuilder(actionUrl);
        queryParameters.forEach((k, v) -> builder.addParameter(k, v));
        uri = builder.build();

    } catch (URISyntaxException uriexception) {
        LOGGER.error(uriexception.getMessage());
        return new JsonObject();
    }

    LOGGER.debug("Performing method = {}. queryParameters = {}. actionUrl = {}. payload = {}", method,
            queryParameters, uri, payload);

    try {
        if (StringUtils.equalsIgnoreCase(method, METHOD_POST)) {
            return processPost(uri, payload, headers);
        } else if (StringUtils.equalsIgnoreCase(method, METHOD_GET)) {
            return processGet(uri, headers);
        } else if (StringUtils.equalsIgnoreCase(method, "PATCH")) {
            return processPatch(uri, payload, headers);
        } else {
            return new JsonObject();
        }
    } catch (IOException ioexception) {
        LOGGER.error(ioexception.getMessage());
        return new JsonObject();

    }

}

From source file:edu.umn.se.trap.rule.wellformedrule.RequiredFieldsRule.java

/**
 * @param user/*  w  ww  . j  a  v a2 s  . c o  m*/
 * @throws TrapException
 * 
 *             Checks to make sure the user name and the citizenship/visa
 *             status is not empty.
 * 
 */
private void checkUser(FormUser user) throws TrapException {

    if ((user.getUserName() == null)) {
        throw new TrapException(TrapErrors.NO_X500);
    }

    if (user.getCitizenship() == null) {
        throw new TrapException(TrapErrors.NO_CITIZENSHIP);
    }

    if (!StringUtils.equalsIgnoreCase(user.getCitizenship(), "United States")
            && !StringUtils.equalsIgnoreCase(user.getCitizenship(), "USA") && user.getVisaStatus() == null) {
        throw new TrapException(TrapErrors.NO_VISA_STATUS);
    }
}

From source file:com.mirth.connect.plugins.datatypes.delimited.DelimitedBatchProperties.java

@Override
public void migrate3_1_0(DonkeyElement element) {
    String splitType = "Record";

    DonkeyElement splitByRecordElement = element.removeChild("batchSplitByRecord");
    if (splitByRecordElement != null
            && StringUtils.equalsIgnoreCase(splitByRecordElement.getTextContent(), "false")) {
        if (StringUtils.isNotEmpty(element.getChildElement("batchMessageDelimiter").getTextContent())) {
            splitType = "Delimiter";
        } else if (StringUtils.isNotEmpty(element.getChildElement("batchGroupingColumn").getTextContent())) {
            splitType = "Grouping_Column";
        } else if (StringUtils.isNotEmpty(element.getChildElement("batchScript").getTextContent())) {
            splitType = "JavaScript";
        }/* ww  w.  j a v  a 2s  .  c o m*/
    }

    element.addChildElementIfNotExists("splitType", splitType);
}

From source file:com.chenyang.proxy.http.HttpUserAgentForwardHandler.java

private HttpRequest constructRequestForProxy(HttpRequest httpRequest, HttpRemote apnProxyRemote) {

    String uri = httpRequest.getUri();
    uri = this.getPartialUrl(uri);
    HttpRequest _httpRequest = new DefaultHttpRequest(httpRequest.getProtocolVersion(), httpRequest.getMethod(),
            uri);/*from  w  ww . j  a v a 2  s  . co m*/
    Set<String> headerNames = httpRequest.headers().names();
    for (String headerName : headerNames) {
        if (StringUtils.equalsIgnoreCase(headerName, "Proxy-Connection")) {
            _httpRequest.headers().set(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.KEEP_ALIVE);
        } else {
            _httpRequest.headers().add(headerName, httpRequest.headers().getAll(headerName));
        }
    }
    Iterator<Entry<String, String>> iterator = _httpRequest.headers().iterator();
    while (iterator.hasNext()) {
        Entry<String, String> entry = iterator.next();
        logger.info(" heard : {} {}", entry.getKey(), entry.getValue());
    }
    return _httpRequest;
}

From source file:com.dgtlrepublic.anitomyj.ParserNumber.java

/**
 * Checks whether the the number precedes the word "of".
 *
 * @param token           the token/*from w w  w .j  av a2s .  com*/
 * @param currentTokenIdx the index of the token.
 * @return true if the token precedes the word "of"
 */
public boolean numberComesBeforeTotalNumber(Token token, int currentTokenIdx) {
    Result nextToken = Token.findNextToken(parser.getTokens(), currentTokenIdx, kFlagNotDelimiter);
    if (nextToken.token != null) {
        if (StringUtils.equalsIgnoreCase(nextToken.token.getContent(), "of")) {
            Result otherToken = Token.findNextToken(parser.getTokens(), nextToken, kFlagNotDelimiter);

            if (otherToken.token != null) {
                if (StringHelper.isNumericString(otherToken.token.getContent())) {
                    setEpisodeNumber(token.getContent(), token, false);
                    nextToken.token.setCategory(kIdentifier);
                    otherToken.token.setCategory(kIdentifier);
                    return true;
                }
            }
        }
    }

    return false;
}

From source file:com.google.testing.pogen.parser.template.RegexVariableExtractor.java

@Override
public void endElement(QName element, Augmentations augs) throws XNIException {
    String text = processCharacters();

    // Ignore elements with prefix (:) to deal with not html elements such as "c:set" in JSP.
    // TODO(kazuu): Should we ignore elements with prefix (:)? Really?
    if (element.prefix == null) {
        HtmlTagInfo tagInfo = tagInfoStack.pop();
        if (!excludedRanges.contains(tagInfo.getStartIndex())) {
            for (String tag : manipulableTags) {
                if (StringUtils.equalsIgnoreCase(element.rawname, tag)) {
                    String name = decideName(element, text, tagInfo);
                    tagInfo.addManipulableTag(name, tagInfo.getStartIndex());
                    break;
                }/*  w w w . j  a v  a 2  s  .  co m*/
            }
        }

        if (!tagInfo.hasVariables()) {
            sortedHtmlTagInfos.add(tagInfo);
        }
    }

    super.endElement(element, augs);
}

From source file:com.liveneo.plat.web.action.JobmsgAction.java

public String listJobmsg() {
    //      Map<String,String> map=(Map)this.getSession().getServletContext().getAttribute(GlobalConstants.SYSTEM_LICENSE_INFO);
    int pageNum = IntegerUtil.converStrToInteger(this.getPageNum()) > 0
            ? IntegerUtil.converStrToInteger(this.getPageNum()) - 1
            : 0;/*  w w  w. j  ava2  s.c o  m*/
    int numPerPage = IntegerUtil.converStrToInteger(getNumPerPage());
    int startIndex = pageNum * IntegerUtil.converStrToInteger(getNumPerPage());

    String search = this.getRequest().getParameter("search");
    if (StringUtils.equalsIgnoreCase(search, "true")) {
        startIndex = 0 * IntegerUtil.converStrToInteger(getNumPerPage());
    }
    String check_changeUrl = this.getRequest().getParameter("changeUrl");
    if (StringUtils.isNotEmpty(check_changeUrl)) {
        this.setQueryjobname("");
        this.setQueryjobstate("");
    }
    List<BdJobmsg> l = this.jobmsgService.findJobmsgBySql(getHql(startIndex, numPerPage));
    this.getSession().setAttribute("userinfoList", l);
    int i = 0;
    i = this.jobmsgService.queryCountJobmsg(this.getDetachedCriteria());
    this.setTotalCount(i);
    this.getSession().setAttribute("totalCount", i);
    return AbstractActionSupport.LIST;
}

From source file:com.glaf.core.service.impl.MxDataModelServiceImpl.java

public DataModel getDataModelByProcessInstanceId(String tableName, String processInstanceId) {
    List<ColumnDefinition> cols = tableDefinitionService.getColumnDefinitionsByTableName(tableName);
    if (cols != null && !cols.isEmpty()) {
        for (ColumnDefinition col : cols) {
            if (StringUtils.equalsIgnoreCase(col.getColumnName(), "PROCESSINSTANCEID_")) {
                TableModel tableModel = new TableModel();
                tableModel.setTableName(tableName);
                ColumnModel cm = new ColumnModel();
                cm.setColumnName("PROCESSINSTANCEID_");
                cm.setJavaType(col.getJavaType());
                cm.setStringValue(processInstanceId);
                cm.setValue(processInstanceId);
                tableModel.setIdColumn(cm);
                Map<String, Object> dataMap = tableDataMapper.getTableDataByPrimaryKey(tableModel);
                if (dataMap != null && !dataMap.isEmpty()) {
                    DataModelEntity model = this.populate(dataMap);
                    return model;
                }/*from ww  w.  j  av  a2 s .com*/
            }
        }
    }

    return null;
}

From source file:com.neophob.sematrix.core.output.OutputHelper.java

/**
 * serial port names are CASE SENSITIVE. this sounds logically on unix platform
 * however com1 will not work on windows, there all names need to be in uppercase (COM1)
 * //from w  w  w  .ja va2 s  .  co m
 * see https://github.com/neophob/PixelController/issues/30 for more details
 * @param configuredName
 * @return
 */
public static String getSerialPortName(String configuredName) {
    for (String portName : Serial.list()) {
        if (StringUtils.equalsIgnoreCase(portName, configuredName)) {
            return portName;
        }
    }

    //we didn't found the port, hope that the provided name will work...
    return configuredName;
}