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.thistech.spotlink.job.AdmRegistrationJob.java

private String getEndpoint(ListADMServicesResponseType response, String method) {
    if (response != null) {
        for (CalloutType callout : response.getCallout()) {
            if (StringUtils.isBlank(callout.getMessage())
                    || StringUtils.equalsIgnoreCase(callout.getMessage(), method)) {
                if (callout.getAddress().size() > 0) {
                    for (AddressType addressType : callout.getAddress()) {
                        if (addressType.getType().matches("(?i)SOAP.*")) {
                            return addressType.getValue();
                        }//from  www.  j av  a 2 s  .co m
                    }
                }
            }
        }
    }
    throw new SpotLinkException(
            String.format("Could not find endpoint for %s from ListADMServicesResponseType", method));
}

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

@Override
protected final boolean doHandleGet(final String formName, final SlingHttpServletRequest request) {
    //noinspection SimplifiableIfStatement
    if (StringUtils.equalsIgnoreCase("GET", request.getMethod())) {
        return (CookieUtil.getCookie(request, this.getGetLookupKey(formName)) != null);
    } else {// w w w  .  j a  v  a 2 s  .co m
        return false;
    }
}

From source file:com.sammyun.controller.console.AdCategoryController.java

/**
 * name?/*ww  w . j a  v  a 2  s .c  o  m*/
 */
@RequestMapping(value = "/check_name", method = RequestMethod.GET)
public @ResponseBody boolean checkName(String name, String preName) {
    if (StringUtils.equalsIgnoreCase(name, preName)) {
        return true;
    }
    if (adCategoryService.findList(name).size() > 0) {
        return false;
    } else {
        return true;
    }
}

From source file:com.sfs.whichdoctor.export.prepare.ExportHandlerBase.java

/**
 * Prepare custom export.// w ww .  j ava 2 s.  c om
 *
 * @param request the request
 *
 * @return the builder bean
 */
protected final BuilderBean prepareCustomExport(final HttpServletRequest request) {

    final BuilderBean display = new BuilderBean();

    for (String fieldName : this.getFieldNames()) {

        final String inputName = "custom_" + StringUtils.replace(fieldName, " ", "_");
        final String inputValue = request.getParameter(inputName);

        if (StringUtils.equalsIgnoreCase(inputValue, "true")) {
            display.setParameter(fieldName, true);
        }
    }

    for (String section : this.getSections().keySet()) {

        final String[] sectionEntries = this.getSections().get(section);

        final BuilderBean details = new BuilderBean();
        boolean detailsSet = false;

        for (String entry : sectionEntries) {
            final String inputName = StringUtils.replace(section + "_" + entry, " ", "_");
            final String inputValue = request.getParameter(inputName);

            if (StringUtils.equalsIgnoreCase(inputValue, "true")) {
                details.setParameter(entry, true);
                detailsSet = true;
            }
        }
        if (detailsSet) {
            display.addSection(section, details);
        }
    }
    return display;
}

From source file:hydrograph.ui.graph.controller.PortEditPart.java

private Point getPortLocation(int totalPortsOfThisType, String type, int sequence, int height, int width,
        int margin, PortAlignmentEnum portAlignment) {

    if (portAlignment == null) {
        if (StringUtils.equalsIgnoreCase(type, Constants.INPUT_SOCKET_TYPE))
            portAlignment = PortAlignmentEnum.LEFT;
        else if (StringUtils.equalsIgnoreCase(type, Constants.OUTPUT_SOCKET_TYPE))
            portAlignment = PortAlignmentEnum.RIGHT;
        else if (StringUtils.equalsIgnoreCase(type, Constants.UNUSED_SOCKET_TYPE))
            portAlignment = PortAlignmentEnum.BOTTOM;
    }//from   ww  w . j  a v a  2 s . c om

    Point p = null;
    int portOffsetFactor = totalPortsOfThisType + 1;
    int portHeightOffset = height / portOffsetFactor;
    int portWidthOffset = width / portOffsetFactor;
    int xLocation = 0, yLocation = 0;

    if (PortAlignmentEnum.LEFT.equals(portAlignment)) {
        xLocation = 0;
        yLocation = portHeightOffset * (sequence + 1) - 4 + margin;
    } else if (PortAlignmentEnum.RIGHT.equals(portAlignment)) {
        xLocation = width - 27;
        yLocation = portHeightOffset * (sequence + 1) - 4 + margin;
    } else if (PortAlignmentEnum.BOTTOM.equals(portAlignment)) {
        if (totalPortsOfThisType == 1) {
            xLocation = 43;

        } else if (totalPortsOfThisType > 1) {
            xLocation = portWidthOffset * (sequence + 1) - 6;
        }
        yLocation = height + margin - 8 - 8;

    }
    p = new Point(xLocation, yLocation);
    return p;
}

From source file:com.sfs.whichdoctor.importer.Importer.java

/**
 * Sets the column map./*  w  w w  . j a va2s  . com*/
 *
 * @param type the type
 * @param data the data
 * @param includeRowsVal the include rows
 */
public final void setColumnMap(final String type, final TreeMap<Integer, TreeMap<Integer, String>> data,
        final TreeMap<Integer, String> includeRowsVal) {

    TreeMap<Integer, String> columnMapVal = new TreeMap<Integer, String>();

    List<String> fields = new ArrayList<String>();

    if (StringUtils.equalsIgnoreCase(type, "exam")) {
        ExamImporter examImporter = new ExamImporter();
        fields = examImporter.getFields();
    }

    // Inspect the first row of data supplied
    Integer rowIndex = data.keySet().iterator().next();

    TreeMap<Integer, String> firstRow = data.get(rowIndex);

    int fieldMatches = 0;

    for (Integer columnNumber : firstRow.keySet()) {
        String dataField = firstRow.get(columnNumber);
        String fieldName = "";

        // Iterate through each field to see if there is a match
        // If there is more than two matches then the first row
        // is indicating column field names
        for (int i = 0; i < fields.size(); i++) {
            String field = (String) fields.get(i);
            if (StringUtils.equalsIgnoreCase(dataField, field)) {
                // Matching field
                fieldName = dataField;
                fieldMatches++;
            }
        }
        columnMapVal.put(columnNumber, fieldName);
    }
    if (fieldMatches > 2) {
        // There were more than two field matches
        // Deselect the first column from the list of imports
        if (includeRowsVal.containsKey(rowIndex)) {
            includeRowsVal.remove(rowIndex);
        }
    }

    setIncludeRows(includeRowsVal);
    setColumnMap(columnMapVal);

}

From source file:com.alibaba.jstorm.utils.NetWorkUtils.java

public static boolean equals(String host1, String host2) {

    if (StringUtils.equalsIgnoreCase(host1, host2) == true) {
        return true;
    }//from   w  w  w.j a  va 2s  .co m

    if (host1 == null || host2 == null) {
        return false;
    }

    String ip1 = host2Ip(host1);
    String ip2 = host2Ip(host2);

    return StringUtils.equalsIgnoreCase(ip1, ip2);

}

From source file:hydrograph.ui.graph.schema.propagation.SequenceFieldPropagation.java

private void removePreviousSequenceFieldFromSchema(List<GridRow> gridRows, String previousValue) {
    if (!gridRows.isEmpty()) {
        GridRow gridRow = gridRows.get(gridRows.size() - 1);
        if (StringUtils.equalsIgnoreCase(gridRow.getFieldName(), previousValue)
                && StringUtils.equalsIgnoreCase(Long.class.getCanonicalName(), gridRow.getDataTypeValue())) {
            gridRows.remove(gridRow);/*from  www. j a  v a  2s. co  m*/
        }
    }
}

From source file:com.hangum.tadpole.engine.query.sql.TadpoleSystem_SchemaHistory.java

/**
 * save schema_history /*from w  w  w.  j a va  2  s .c  o  m*/
 * 
 * @param user_seq
 * @param userDB
 * @param strSQL
 */
public static SchemaHistoryDAO save(int user_seq, UserDBDAO userDB, String strSQL) {
    SchemaHistoryDAO schemaDao = new SchemaHistoryDAO();

    try {
        //
        //
        //
        String strWorkSQL = strSQL.replaceAll("(\r\n|\n|\r)", ""); // ? .
        strWorkSQL = strWorkSQL.replaceAll("\\p{Space}", " "); // ?  .
        if (logger.isDebugEnabled())
            logger.debug("[start sql]\t" + strWorkSQL);

        String[] arrSQL = StringUtils.split(strWorkSQL);
        if (arrSQL.length != 5)
            return null;
        String strWorkType = arrSQL[0];

        // object type
        String strObjecType = arrSQL[1];

        // objectId
        String strObjectId = StringUtils.remove(arrSQL[2], "(");

        if (StringUtils.equalsIgnoreCase("or", strObjecType)) {
            strObjecType = arrSQL[3];
            strObjectId = StringUtils.remove(arrSQL[4], "(");
        }

        schemaDao = new SchemaHistoryDAO();
        schemaDao.setDb_seq(userDB.getSeq());
        schemaDao.setUser_seq(user_seq);

        schemaDao.setWork_type(strWorkType);
        schemaDao.setObject_type(strObjecType);
        schemaDao.setObject_id(strObjectId);

        schemaDao.setCreate_date(new Timestamp(System.currentTimeMillis()));

        schemaDao.setIpaddress(RWT.getRequest().getRemoteAddr());

        SqlMapClient sqlClient = TadpoleSQLManager.getInstance(TadpoleSystemInitializer.getUserDB());
        SchemaHistoryDAO schemaHistoryDao = (SchemaHistoryDAO) sqlClient.insert("sqlHistoryInsert", schemaDao); //$NON-NLS-1$

        insertResourceData(schemaHistoryDao, strSQL);
    } catch (Exception e) {
        logger.error("Schema histor save error", e);
    }

    return schemaDao;
}

From source file:com.sfs.whichdoctor.export.writer.AgedDebtorsAnalysisWriter.java

/**
 * Process the export./*w  ww .  j  a v  a 2  s. c  o  m*/
 *
 * @param resultsVal the results
 * @param title the title
 * @param displayRef the display
 * @param preferencesRef the preferences
 *
 * @return the string
 */
public final String process(final Collection<Object> resultsVal, final Collection<String> title,
        final BuilderBean displayRef, final PreferencesBean preferencesRef) {

    StringBuffer export = new StringBuffer();

    Collection<Object> results = new ArrayList<Object>();
    BuilderBean display = new BuilderBean();
    PreferencesBean preferences = new PreferencesBean();

    if (resultsVal != null) {
        results = resultsVal;
    }
    if (displayRef != null) {
        display = displayRef;
    }
    if (preferencesRef != null) {
        preferences = preferencesRef;
    }

    String groupBy = preferences.getOption("export", "type");
    if (StringUtils.isBlank(groupBy)) {
        groupBy = "Summary";
    }

    AgedDebtorsAnalysisBean agedDebtors = new AgedDebtorsAnalysisBean();
    /* Cast collection object to aged debtors */
    for (Object objAgedDebtors : results) {
        agedDebtors = (AgedDebtorsAnalysisBean) objAgedDebtors;
    }

    export.append(this.getKeys().getString("EXPORT_PREFIX"));

    for (String titleLine : title) {
        export.append(this.getKeys().getString("HEADER_PREFIX"));
        export.append(" ");
        export.append(titleLine);
        export.append(this.getKeys().getString("HEADER_SUFFIX"));
    }

    if (!StringUtils.equalsIgnoreCase(groupBy, "Summary")) {
        export.append(this.getKeys().getString("HEADER_PREFIX"));
        export.append(" ");
        export.append("Aged Debtors breakdown by " + groupBy);
        export.append(this.getKeys().getString("HEADER_SUFFIX"));
    }

    export.append(this.getKeys().getString("LIST_BEGINNING"));
    export.append(this.getKeys().getString("ROW_BEGINNING"));

    StringBuffer header = new StringBuffer();
    for (String headerLine : display.getOrder()) {
        if (header.length() > 0) {
            header.append(this.getKeys().getString("ITEM_DIVIDER"));
        }
        header.append(this.getKeys().getString("HEADERITEM_PREFIX"));

        if (StringUtils.equalsIgnoreCase(headerLine, "Period Breakdown")) {
            header.append(this.getFormattedPeriodBreakdownHeader(agedDebtors));
        } else {
            header.append(headerLine);
        }
        header.append(this.getKeys().getString("HEADERITEM_SUFFIX"));
    }
    export.append(header.toString());

    export.append(this.getKeys().getString("ROW_END"));

    for (String groupingOrder : agedDebtors.getGroupings().keySet()) {
        AgedDebtorsGrouping group = agedDebtors.getGroupings().get(groupingOrder);

        export.append(this.getKeys().getString("ROW_BEGINNING"));

        StringBuffer fieldValue = new StringBuffer();
        for (String fieldName : display.getOrder()) {
            String field = AgedDebtorsAnalysisFormatter.getField(group, fieldName, this.getType());

            if (StringUtils.equalsIgnoreCase(fieldName, "Period Breakdown")) {
                field = this.getFormattedPeriodBreakdownField(agedDebtors.getPeriods(), group, this.getType());
            }

            if (fieldValue.length() > 0) {
                fieldValue.append(this.getKeys().getString("ITEM_DIVIDER"));
            }
            fieldValue.append(this.getKeys().getString("ITEM_PREFIX"));
            fieldValue.append(field);
            fieldValue.append(this.getKeys().getString("ITEM_SUFFIX"));
        }
        export.append(fieldValue.toString());

        export.append(this.getKeys().getString("ROW_END"));
    }
    export.append(this.getKeys().getString("LIST_END"));

    for (String groupOrder : agedDebtors.getGroupings().keySet()) {

        AgedDebtorsGrouping grouping = agedDebtors.getGroupings().get(groupOrder);

        HashMap<String, BuilderBean> sections = display.getSections();

        if (sections != null) {
            for (String sectionName : display.getSectionOrder()) {
                BuilderBean section = sections.get(sectionName);

                if (!StringUtils.equalsIgnoreCase(groupBy, "Summary")) {
                    String groupName = grouping.getName();
                    if (StringUtils.isBlank(groupName)) {
                        groupName = "Uncategorised";
                    }
                    export.append(this.getKeys().getString("SECTION_PREFIX"));
                    export.append(" ");
                    export.append("Breakdown of " + groupName + " records");
                    export.append(this.getKeys().getString("SECTION_SUFFIX"));
                }

                export.append(this.getKeys().getString("LIST_BEGINNING"));
                export.append(this.getKeys().getString("ROW_BEGINNING"));

                StringBuffer sectionHeader = new StringBuffer();
                for (String headerLine : section.getOrder()) {
                    if (sectionHeader.length() > 0) {
                        sectionHeader.append(this.getKeys().getString("ITEM_DIVIDER"));
                    }

                    sectionHeader.append(this.getKeys().getString("HEADERITEM_PREFIX"));

                    if (StringUtils.equalsIgnoreCase(headerLine, "Period Breakdown")) {
                        sectionHeader.append(this.getFormattedPeriodBreakdownHeader(agedDebtors));
                    } else {
                        sectionHeader.append(headerLine);
                    }

                    sectionHeader.append(this.getKeys().getString("HEADERITEM_SUFFIX"));
                }
                export.append(sectionHeader.toString());

                export.append(this.getKeys().getString("ROW_END"));

                Collection<Object> records = AgedDebtorsAnalysisFormatter.getCollection(grouping, sectionName);

                export.append(getRecordExportList(records, agedDebtors, section, sectionName));

                export.append(this.getKeys().getString("LIST_END"));
            }
        }
    }
    export.append(this.getKeys().getString("EXPORT_SUFFIX"));

    return export.toString();
}