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

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

Introduction

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

Prototype

public static boolean equalsIgnoreCase(String str1, String str2) 

Source Link

Document

Compares two Strings, returning true if they are equal ignoring the case.

Usage

From source file:com.sfs.whichdoctor.search.sql.IsbMessageSqlHandler.java

/**
 * Construct the SQL string, description and parameters.
 *
 * @param objCriteria Object containing search criteria values
 * @param objConstraints Object containing search constraint values
 *
 * @return Map containing a String[] { sql, description } =>
 *         Collection< Object > parameters
 *
 * @throws IllegalArgumentException the illegal argument exception
 *//*w ww .j a v a  2 s  . com*/
public final Map<String[], Collection<Object>> construct(final Object objCriteria, final Object objConstraints)
        throws IllegalArgumentException {

    IsbMessageBean searchCriteria = null;

    if (objCriteria instanceof IsbMessageBean) {
        searchCriteria = (IsbMessageBean) objCriteria;
    }

    if (searchCriteria == null) {
        throw new IllegalArgumentException("The search criteria must be a " + "valid IsbMessageBean");
    }

    StringBuffer sqlWHERE = new StringBuffer();
    StringBuffer description = new StringBuffer();
    Collection<Object> parameters = new ArrayList<Object>();

    if (StringUtils.isNotBlank(searchCriteria.getTarget())) {
        String field = searchCriteria.getTarget();
        sqlWHERE.append(" AND isbmessages.IsbTarget =  ?");
        description.append(" and an ISB target of '" + searchCriteria.getTarget() + "'");
        parameters.add(field);
    }

    if (StringUtils.isNotBlank(searchCriteria.getAction())) {
        if (!StringUtils.equalsIgnoreCase(searchCriteria.getAction(), "Null")) {
            String field = searchCriteria.getAction();
            sqlWHERE.append(" AND isbmessages.Action =  ?");
            description.append(" and an ISB action of '" + searchCriteria.getAction() + "'");
            parameters.add(field);
        }
    }

    if (StringUtils.isNotBlank(searchCriteria.getIdentifier())) {
        String field = searchCriteria.getIdentifier();
        sqlWHERE.append(" AND isbmessages.Identifier =  ?");
        description.append(" and an ISB identifier of '" + searchCriteria.getIdentifier() + "'");
        parameters.add(field);
    }

    // Only select inbound messages
    if (StringUtils.equalsIgnoreCase(searchCriteria.getDescription(), "Inbound")) {
        sqlWHERE.append(" AND isbmessages.IsInbound = true");
        description.append(" and is an inbound ISB message");
    }

    // Only select inbound messages
    if (StringUtils.equalsIgnoreCase(searchCriteria.getDescription(), "Outbound")) {
        sqlWHERE.append(" AND isbmessages.IsInbound = false");
        description.append(" and is an outbound ISB message");
    }

    String[] index = new String[] { sqlWHERE.toString(), DataFilter.getHtml(description.toString()) };

    Map<String[], Collection<Object>> results = new HashMap<String[], Collection<Object>>();

    results.put(index, parameters);

    return results;
}

From source file:jp.co.tis.gsp.tools.db.beans.Column.java

@XmlAttribute(name = "DEF")
public String getDefaultValue() {
    if (StringUtils.equalsIgnoreCase(defaultValue, "AUTO_INCREMENT")) {
        return null;
    } else {//from  w  ww.j a v a 2 s .c o  m
        return defaultValue;
    }
}

From source file:com.adobe.acs.commons.quickly.results.impl.ResultBuilderImpl.java

protected final boolean acceptsQuicklyMode(Result result, List<String> modes) {
    if (result.getModes().contains(Result.Mode.ANY) || CollectionUtils.isEmpty(result.getModes())) {
        return true;
    }/*w w w .  j  a v  a 2 s .  com*/

    for (Result.Mode mode : result.getModes()) {
        for (String resultMode : modes) {
            if (StringUtils.equalsIgnoreCase(mode.toString(), resultMode)) {
                return true;
            }
        }
    }

    return false;
}

From source file:com.edgenius.wiki.render.handler.TOCHandler.java

/**
 * @param renderContext //from   ww  w  . j av a2 s  . co  m
 * @param headTree
 * @param deep
 * @param align
 * @param wajax  
 * @return
 */
private List<RenderPiece> buildTOCHTML(RenderContext renderContext, Collection<HeadingModel> headTree, int deep,
        String align, boolean unorderList, String wajax) {

    Map<String, String> attributes = new HashMap<String, String>();
    attributes.put(NameConstants.WAJAX, wajax);
    attributes.put("class", "macroToc " + WikiConstants.mceNonEditable);
    attributes.put(NameConstants.AID, TOCMacro.class.getName());

    List<RenderPiece> list = new ArrayList<RenderPiece>();

    //align of TOC
    if (!StringUtils.isBlank(align)) {
        if (StringUtils.equalsIgnoreCase(SharedConstants.ALIGN_VALUES.center.getName(), align)
                || StringUtils.equalsIgnoreCase(SharedConstants.ALIGN_VALUES.centre.getName(), align)) {
            attributes.put("style", "margin-left: auto; margin-right: auto;");
            //special handle for center image
            attributes.put("align", "center");
        } else {
            //left or right, use float style
            attributes.put("style", "float: " + align);
        }
    }
    StringBuffer sb = new StringBuffer(HTMLUtil.buildTagString("div", null, attributes));

    sb.append("<div class=\'title\'>").append(messageService.getMessage("toc")).append("</div>");

    if (headTree == null || headTree.size() == 0) {
        //nothing found in h1. - h7. 
        sb.append("<p>").append(messageService.getMessage("no.header.for.toc")).append("</p>");
        sb.append("</div>");
        list.add(new TextModel(sb.toString()));
        return list;
    }
    //TOC content
    //7 is enough
    int[] headNum = new int[10];

    //find out start of heading level, for example, page may only contain heading 2. the start number should be 2 then
    int startLevel = 8;
    for (HeadingModel head : headTree) {
        startLevel = startLevel > head.getLevel() ? head.getLevel() : startLevel;
    }
    int level = startLevel - 1;

    for (HeadingModel head : headTree) {
        if (head.getLevel() > deep)
            continue;
        if (unorderList) {
            for (int idx = head.getLevel(); idx < level; idx++)
                sb.append("</ul>");
            for (int idx = level; idx < head.getLevel(); idx++)
                sb.append("<ul>");
        }

        level = head.getLevel();
        if (unorderList) {
            sb.append("<li>");
        } else {
            sb.append("<p style=\"text-indent:").append((level - 1) * 30).append("px\"><b>");
            //reset sub levels
            Arrays.fill(headNum, level, headNum.length, 0);
            ++headNum[level - 1];

            //construct 2.2.3 etc head number
            for (int idx = startLevel - 1; idx < level; idx++) {
                //For example if heading start from h2. Then first
                sb.append(headNum[idx]);
                if (idx < level - 1)
                    sb.append(".");
                else
                    sb.append(" ");
            }
            sb.append("</b>");
        }
        list.add(new TextModel(sb.toString()));
        sb = new StringBuffer();

        LinkModel link = new LinkModel();
        link.setView(head.getTitle());
        //Don't put back pageTitle, as link will be same page anchor; link.setLink(pageTitle);
        link.setAnchor(head.getAnchor());
        link.setSpaceUname(spaceUname);
        link.setType(LinkModel.LINK_TO_VIEW_FLAG);
        link.setLinkTagStr(renderContext.buildURL(link));
        list.add(link);

        if (unorderList) {
            sb.append("</li>");
        } else {
            sb.append("</p>");
        }

        sb.append("\n");
    }
    if (unorderList) {
        for (int idx = 0; idx < level; idx++)
            sb.append("</ul>");
    }

    sb.append("</div>");
    list.add(new TextModel(sb.toString()));
    return list;
}

From source file:com.kylinolap.metadata.validation.rule.FunctionRule.java

private void validateReturnType(ValidateContext context, CubeDesc cube, FunctionDesc funcDesc) {

    String func = funcDesc.getExpression();
    DataType rtype = funcDesc.getReturnDataType();

    if (funcDesc.isCount()) {
        if (rtype.isIntegerFamily() == false) {
            context.addResult(ResultLevel.ERROR,
                    "Return type for function " + func + " must be one of " + DataType.INTEGER_FAMILY);
        }/* w ww  . ja v  a2  s.  c o  m*/
    } else if (funcDesc.isCountDistinct()) {
        if (rtype.isHLLC() == false && funcDesc.isHolisticCountDistinct() == false) {
            context.addResult(ResultLevel.ERROR,
                    "Return type for function " + func + " must be hllc(10), hllc(12) etc.");
        }
    } else if (funcDesc.isMax() || funcDesc.isMin() || funcDesc.isSum()) {
        if (rtype.isNumberFamily() == false) {
            context.addResult(ResultLevel.ERROR,
                    "Return type for function " + func + " must be one of " + DataType.NUMBER_FAMILY);
        }
    } else {
        if (StringUtils.equalsIgnoreCase(
                KylinConfig.getInstanceFromEnv().getProperty(KEY_IGNORE_UNKNOWN_FUNC, "false"), "false")) {
            context.addResult(ResultLevel.ERROR, "Unrecognized function: [" + func + "]");
        }
    }

}

From source file:com.bluexml.xforms.generator.forms.renderable.classes.RenderableAttribute.java

@Override
protected Element getCustomElement(Rendered rendered, ModelElementBindSimple meb, String slabel,
        Stack<Renderable> parents, Stack<Rendered> renderedParents) {

    Element element = null;/*from   ww w.j a  va  2s  .co m*/
    boolean isMultiple;

    if (attribute.getValueList() != null) {
        isMultiple = StringUtils.equalsIgnoreCase(getMetaInfoValue("multiple"), "true");
        element = getSelectElement(rendered, new SelectBean(meb, slabel, attribute.getValueList(), isMultiple));
    } else if (isTextArea()) {
        boolean richTextEditor = (getMetaInfoValue("rte-rows") != null);
        element = getTextAreaElement(meb, slabel, richTextEditor);
    } else if (isImageFileField()) {
        element = getFileElement(meb, slabel, MsgId.INT_FILEFIELD_PREVIEW_IMAGE);
    } else if (isFileField()) {
        element = getFileElement(meb, slabel, MsgId.INT_FILEFIELD_PREVIEW_NONE);
    } else if (isDateTimeField()) {
        element = getDateTimeElement(meb, slabel);
    } else {
        element = getStandardElement(meb, slabel);
    }

    return element;
}

From source file:de.torstenwalter.maven.plugins.AbstractDBMojo.java

/**
 * @see http://docs.oracle.com/cd/B19306_01/server.102/b14357/toc.htm
 *      (SQL*Plus User's Guide and Reference)
 * //ww w .  j  a v a  2s. co m
 * @param credentials
 * @return
 */
protected String getConnectionIdentifier(Credentials credentials) {
    StringBuilder connectionIdentifier = new StringBuilder();
    // fist add the username
    connectionIdentifier.append(credentials.getUsername());
    // then add the password if given
    if (!StringUtils.isEmpty(credentials.getPassword())) {
        connectionIdentifier.append("/").append(credentials.getPassword());
    }

    // now add the connect_identifier:
    if (!useEasyConnect) {
        // To make it more robust and to not to rely on TNSNAMES we specify the
        // full connect identifier like:
        // (DESCRIPTION=
        // (ADDRESS=(PROTOCOL=tcp)(HOST=host)(PORT=port) )
        // (CONNECT_DATA=
        // (SERVICE_NAME=service_name) ) )
        connectionIdentifier.append("@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=tcp)(HOST=")
                .append(hostname).append(")(PORT=").append(port).append(")))(CONNECT_DATA=(SERVICE_NAME=")
                .append(serviceName).append(")");
        if (!StringUtils.isEmpty(instanceName)) {
            connectionIdentifier.append("(INSTANCE_NAME=").append(instanceName).append(")");
        }
        connectionIdentifier.append("))");
    } else {
        // "[//]Host[:Port]/<service_name>"
        connectionIdentifier.append("@//").append(hostname).append(":").append(port).append("/")
                .append(serviceName);
    }
    // add as clause if necessary
    if (StringUtils.equalsIgnoreCase(asClause, "SYSDBA") || StringUtils.equalsIgnoreCase(asClause, "SYSOPER")) {
        connectionIdentifier.append(" AS ").append(StringUtils.upperCase(asClause));
    }

    return connectionIdentifier.toString();
}

From source file:hydrograph.ui.propertywindow.ftp.OperationConfigWidget.java

public void newWindowLauncher() {
    String[] optionList = null;//  w  w w  . j a  v  a2  s  .c  o m
    initialMap = new LinkedHashMap<>(initialMap);
    String protocoltext = null;
    for (AbstractWidget widget : widgets) {
        if (widget.getPropertyName().equals(Constants.PROTOCOL_SELECTION)) {
            FTPProtocolDetails protocolDetails = (FTPProtocolDetails) widget.getProperties()
                    .get(Constants.PROTOCOL_SELECTION);
            if (protocolDetails != null) {
                if (StringUtils.equalsIgnoreCase(protocolDetails.getProtocol(), Constants.AWS_S3)) {
                    protocoltext = protocolDetails.getProtocol();
                    optionList = new String[] { Constants.GET_FILE_S3, Constants.PUT_FILE_S3 };
                } else {
                    protocoltext = protocolDetails.getProtocol();
                    optionList = new String[] { Constants.GET_FILE, Constants.PUT_FILE };
                }
            }
        }
    }

    String selectedText = protocoltext;
    boolean bol = initialMap.entrySet().stream()
            .anyMatch(val -> val.getValue().getProtocolSelection().equals(selectedText));
    if (!bol) {
        initialMap = new LinkedHashMap<>();
    }

    FTPOperationConfigDialog authenticationEditorDialog = new FTPOperationConfigDialog(shell, "",
            propertyDialogButtonBar, initialMap, cursor, optionList, protocoltext);
    authenticationEditorDialog.open();

    Map<String, FTPAuthOperationDetails> newValues = authenticationEditorDialog.getOperationParamDetails();

    if (isAnyUpdate(initialMap, newValues)) {
        propertyDialogButtonBar.enableApplyButton(true);
    }

    initialMap = newValues;
    showHideErrorSymbol(widgets);
}

From source file:com.edgenius.wiki.webapp.admin.action.AdvanceAdminAction.java

public String redeployShell() {
    User anonymous = userReadingService.getUserByName(null);

    //in shell side, page request also verify if space exists or not, if not, it will do space request
    //so here won't do space request
    final LinkedBlockingDeque<String[]> pageQ = new LinkedBlockingDeque<String[]>();

    //This will make GW request Shell.key again - so if Shell site cleans the data, re-deploy still can work out.
    //If shell data is still there, it will return same key as GW instanceID and address won't changed.
    Shell.key = null;//from   w w  w  . j  a v  a2  s. co m

    new Thread(new Runnable() {
        public void run() {
            int pageCount = 0;
            do {
                try {
                    String[] str = pageQ.take();

                    if (StringUtils.equalsIgnoreCase(SharedConstants.SYSTEM_SPACEUNAME, str[0]))
                        break;

                    Shell.notifyPageCreate(str[0], str[1], true);
                    pageCount++;

                    //don't explode the too many concurrent request to Shell!
                    Thread.sleep(1000);
                    if ((pageCount % QUOTA_RESET_COUNT) == 0) {
                        log.warn("Maximumn page shell request count arrived {}, sleep another 24 hours ",
                                QUOTA_RESET_COUNT);
                        //google app engine has quota limitation. Here will sleep 24 hours to wait next quota reset.
                        Thread.sleep(24 * 3600 * 1000);
                        log.warn("Maximumn page shell request sleep is end, restart page request process");
                    }
                } catch (InterruptedException e) {
                    log.error("Thread interrupted for shell request", e);
                }
            } while (true);

            ActivityLog activity = new ActivityLog();
            activity.setType(ActivityType.Type.SYSTEM_EVENT.getCode());
            activity.setSubType(ActivityType.SubType.REDEPLOY_SHELL.getCode());
            activity.setTgtResourceName("SHELL-DEPLOYED");//hardcode
            activity.setCreatedDate(new Date());
            activityLog.save(activity);

            log.info("Shell page request is done for {} pages", pageCount);
        }
    }).start();

    int pageCount = 0;

    long start = System.currentTimeMillis();
    log.info("Shell redeploy request starting...");

    List<Space> spaces = spaceDAO.getObjects();
    if (spaces != null) {
        for (Space space : spaces) {
            if (space.isPrivate() || space.containExtLinkType(Space.EXT_LINK_SHELL_DISABLED)
                    || StringUtils.equalsIgnoreCase(SharedConstants.SYSTEM_SPACEUNAME, space.getUnixName()))
                continue;

            String spaceUname = space.getUnixName();

            List<String> pages = pageDAO.getPagesUuidInSpace(spaceUname);
            if (pages != null) {
                for (String puuid : pages) {
                    if (!securityService.isAllowPageReading(spaceUname, puuid, anonymous))
                        continue;
                    try {
                        pageQ.put(new String[] { spaceUname, puuid });
                        pageCount++;
                    } catch (InterruptedException e) {
                        log.error("Thread interrupted for shell Page Queue", e);
                    }

                }
            }
        }

        log.info("All shell request put into queue. Pages{}; Takes {}s",
                new Object[] { pageCount, (System.currentTimeMillis() - start) / 1000 });
    }

    try {
        pageQ.put(new String[] { SharedConstants.SYSTEM_SPACEUNAME, "" });
    } catch (InterruptedException e) {
        log.error("Thread interrupted for shell Page Queue - end sign", e);
    }

    getRequest().setAttribute("message", messageService.getMessage("redeploy.shell.invoked"));
    return MESSAGE;
}

From source file:com.adobe.acs.commons.forms.helpers.impl.AbstractFormHelperImpl.java

/**
 * Determines of this FormHelper should handle the POST request.
 *
 * @param formName//from w  w  w.  j av a  2 s  . c  o m
 * @param request
 * @return
 */
protected final boolean doHandlePost(final String formName, final SlingHttpServletRequest request) {
    if (StringUtils.equalsIgnoreCase("POST", request.getMethod())) {
        // Form should have a hidden input with the name this.getLookupKey(..) and value formName
        return StringUtils.equals(formName, request.getParameter(this.getPostLookupKey(formName)));
    } else {
        return false;
    }
}