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.hangum.tadpole.engine.sql.util.resultset.ResultSetUtils.java

/**
 * column of type/*from   ww  w.ja va  2s.  c o  m*/
 * 
 * @param isShowRowNum    ?  ?? .
 * @param rsm
 * @return
 * @throws SQLException
 */
public static Map<Integer, Integer> getColumnType(boolean isShowRowNum, ResultSetMetaData rsm)
        throws SQLException {
    Map<Integer, Integer> mapColumnType = new HashMap<Integer, Integer>();
    int intStartIndex = 0;

    if (isShowRowNum) {
        intStartIndex++;
        mapColumnType.put(0, java.sql.Types.INTEGER);
    }

    for (int i = 0; i < rsm.getColumnCount(); i++) {
        //         logger.debug("\t ==[column start]================================ ColumnName  :  "    + rsm.getColumnName(i+1));
        //         logger.debug("\tColumnLabel        :  "    + rsm.getColumnLabel(i+1));

        //         logger.debug("\t AutoIncrement     :  "    + rsm.isAutoIncrement(i+1));
        //         logger.debug("\t Nullable           :  "    + rsm.isNullable(i+1));
        //         logger.debug("\t CaseSensitive     :  "    + rsm.isCaseSensitive(i+1));
        //         logger.debug("\t Currency           :  "    + rsm.isCurrency(i+1));
        //         
        //         logger.debug("\t DefinitelyWritable :  "    + rsm.isDefinitelyWritable(i+1));
        //         logger.debug("\t ReadOnly           :  "    + rsm.isReadOnly(i+1));
        //         logger.debug("\t Searchable           :  "    + rsm.isSearchable(i+1));
        //         logger.debug("\t Signed              :  "    + rsm.isSigned(i+1));
        ////         logger.debug("\t Currency           :  "    + rsm.isWrapperFor(i+1));
        //         logger.debug("\t Writable           :  "    + rsm.isWritable(i+1));
        //         
        //         logger.debug("\t ColumnClassName     :  "    + rsm.getColumnClassName(i+1));
        //         logger.debug("\t CatalogName        :  "    + rsm.getCatalogName(i+1));
        //         logger.debug("\t ColumnDisplaySize  :  "    + rsm.getColumnDisplaySize(i+1));
        //         logger.debug("\t ColumnType        :  "    + rsm.getColumnType(i+1));
        //         logger.debug("\t ColumnTypeName    :  "    + rsm.getColumnTypeName(i+1));
        //
        // mysql json ? ?  1  ? , ?? pgsql? json ? ? 1111 .
        //                     - 2015.10.21 mysql 5.7
        if (StringUtils.equalsIgnoreCase("json", rsm.getColumnTypeName(i + 1))) {
            mapColumnType.put(i + intStartIndex, 1111);
        } else {
            mapColumnType.put(i + intStartIndex, rsm.getColumnType(i + 1));
        }
        //         logger.debug("\t Column Label " + rsm.getColumnLabel(i+1) );

        //         logger.debug("\t Precision          :  "    + rsm.getPrecision(i+1));
        //         logger.debug("\t Scale             :  "    + rsm.getScale(i+1));
        //         logger.debug("\t SchemaName          :  "    + rsm.getSchemaName(i+1));
        //         logger.debug("\t TableName          :  "    + rsm.getTableName(i+1));
        //         logger.debug("\t ==[column end]================================ ColumnName  :  "    + rsm.getColumnName(i+1));
    }

    return mapColumnType;
}

From source file:net.di2e.ecdr.search.transform.atom.AtomTransformerWithPayload.java

/**
 * Method called by the OSGi container, managed by blueprint whenever a new
 * MetacardTransformer service is exposed to the OSGi Registry
 * /*  www  .j  a v a 2  s .  co m*/
 * @param transformer
 *            the MetacardTransformer that was added
 * @param map
 *            the service properties for the corresponding
 *            MetacardTransformer
 */
public void metacardTransformerAdded(MetacardTransformer transformer, Map<String, Object> map) {
    String id = (String) map.get(Constants.SERVICE_ID);
    // We need to filter out this transformer from being included in the
    // Metacard Transformers used to produce metadata records
    if (!StringUtils.equalsIgnoreCase(id, TRANSFORMER_ID)) {
        metacardTransformerMap.put(id, transformer);
        LOGGER.debug("Adding MetacardTransformer with id [{}] to transformer map.", id);
    }
}

From source file:com.microsoft.alm.plugin.operations.BuildStatusLookupOperation.java

@Override
public void doWork(final Inputs inputs) {
    logger.info("BuildStatusLookupOperation.doWork()");
    onLookupStarted();/*from  ww w.j a v a  2 s  .c  om*/

    // Create a default result to return if something goes wrong
    final List<BuildStatusRecord> buildStatusRecords = new ArrayList<BuildStatusRecord>(2);
    final BuildStatusResults results;
    Build latestBuildForRepository = null;
    Build matchingBuild = null;

    // Check to see if we should remove the context from the manager
    if (ServerContextManager.getInstance().get(gitRemoteUrl) != null && forcePrompt) {
        // The context already exists, but the user has requested to "Sign In", so we need to update the auth info
        ServerContextManager.getInstance().updateAuthenticationInfo(gitRemoteUrl);
    }

    // Lookup the context that goes with this remoteUrl
    // If no match exists simply return the default results
    final ServerContext context = ServerContextManager.getInstance().createContextFromRemoteUrl(gitRemoteUrl,
            forcePrompt);
    if (context != null && context.getGitRepository() != null) {
        // Using the build REST client we will get the last 100 builds for this team project.
        // We will go through those builds and try to find one that matches our repo and branch.
        // If we can't find a perfect match, we will keep the first one that matches our repo.
        // TODO: The latest REST API allows you to filter the builds based on repo and branch, but the Java SDK
        // TODO: is not up to date with that version yet. We should change this code to use that method as soon
        // TODO: as we can.
        final BuildHttpClient buildClient = context.getBuildHttpClient();
        final List<Build> builds = buildClient.getBuilds(context.getTeamProjectReference().getId(), null, null,
                null, null, null, null, null, BuildStatus.COMPLETED, null, null, null, null, 100, null, null,
                null, BuildQueryOrder.FINISH_TIME_DESCENDING);
        if (builds.size() > 0) {
            for (final Build b : builds) {
                // Get the repo and branch for the build and compare them to ours
                final BuildRepository repo = b.getRepository();
                if (repo != null && StringUtils.equalsIgnoreCase(context.getGitRepository().getId().toString(),
                        repo.getId())) {
                    // TODO: Get the constant refs/heads/master from someplace common or query for the default branch from the server
                    // Branch names are case sensitive
                    if (StringUtils.equals(b.getSourceBranch(), "refs/heads/master")) {
                        if (latestBuildForRepository == null) {
                            // Found the master branch for the repo, so save that off
                            logger.info("Latest build found for repo for the master branch.");
                            latestBuildForRepository = b;
                        }
                    } else if (StringUtils.equals(b.getSourceBranch(), branch)) {
                        if (matchingBuild == null) {
                            // The repo and branch match the build exactly, so save that off
                            logger.info("Matching build found for repo and branch.");
                            matchingBuild = b;
                        }
                    }

                    if (latestBuildForRepository != null && matchingBuild != null) {
                        // We found both builds
                        break;
                    }
                }
            }

            // Create the results
            if (latestBuildForRepository != null) {
                // Add the repository build to the status records list first
                buildStatusRecords.add(new BuildStatusRecord(latestBuildForRepository.getSourceBranch(),
                        latestBuildForRepository.getResult() == BuildResult.SUCCEEDED,
                        latestBuildForRepository.getId(), latestBuildForRepository.getBuildNumber(),
                        latestBuildForRepository.getFinishTime()));
            }
            if (matchingBuild != null) {
                // Add the matching build to the status records list last
                buildStatusRecords.add(new BuildStatusRecord(matchingBuild.getSourceBranch(),
                        matchingBuild.getResult() == BuildResult.SUCCEEDED, matchingBuild.getId(),
                        matchingBuild.getBuildNumber(), matchingBuild.getFinishTime()));
            }
            results = new BuildStatusResults(context, buildStatusRecords);
        } else {
            // No builds were found for this project
            results = new BuildStatusResults(context, null);
        }
    } else {
        results = new BuildStatusResults(null, null);
    }

    logger.info("Returning results.");
    onLookupResults(results);
    onLookupCompleted();
}

From source file:hydrograph.ui.propertywindow.widgets.listeners.grid.MouseHoverOnSchemaGridListener.java

private String setToolTipForBigDecimal(GridRow gridRow, String componentType) {
    int precision = 0, scale = 0;

    if (StringUtils.isNotBlank(gridRow.getPrecision()) && StringUtils.isNotBlank(gridRow.getScale())) {
        try {//w  ww  .  j ava  2s .co m
            precision = Integer.parseInt(gridRow.getPrecision());
        } catch (NumberFormatException exception) {
            logger.debug("Failed to parse the precision ", exception);
            return Messages.PRECISION_MUST_CONTAINS_NUMBER_ONLY_0_9;
        }

        try {
            scale = Integer.parseInt(gridRow.getScale());
        } catch (NumberFormatException exception) {
            logger.debug("Failed to parse the scale ", exception);
            return Messages.SCALE_MUST_CONTAINS_NUMBER_ONLY_0_9;
        }
    }

    if (StringUtils.isBlank(gridRow.getPrecision()) && (StringUtils.containsIgnoreCase(componentType, "hive")
            || StringUtils.containsIgnoreCase(componentType, "parquet"))) {
        return Messages.PRECISION_MUST_NOT_BE_BLANK;
    } else if (!(gridRow.getPrecision().matches("\\d+")) && StringUtils.isNotBlank(gridRow.getPrecision())) {
        return Messages.PRECISION_MUST_CONTAINS_NUMBER_ONLY_0_9;
    } else if ((StringUtils.isBlank(gridRow.getScale()))) {
        return Messages.SCALE_MUST_NOT_BE_BLANK;
    } else if (!(gridRow.getScale().matches("\\d+")) || scale < 0) {
        return Messages.SCALE_SHOULD_BE_POSITIVE_INTEGER;
    } else if (StringUtils.equalsIgnoreCase(gridRow.getScaleTypeValue(), "none")) {
        return Messages.SCALETYPE_MUST_NOT_BE_NONE;
    } else if (precision <= scale) {
        return Messages.SCALE_MUST_BE_LESS_THAN_PRECISION;
    }
    return "";
}

From source file:com.sfs.whichdoctor.formatter.TrainingStatusFormatter.java

/**
 * Gets the exams by type.//w  ww .  j  ava 2s.c om
 *
 * @param status the status
 * @param type the type
 * @param format the format
 * @return the exams by type
 */
private static String getExamsByType(final TrainingStatusBean status, final String type, final String format) {

    StringBuilder sb = new StringBuilder();

    if (status.getExamsStatus() != null) {
        for (String key : status.getExamsStatus().keySet()) {
            ExamStatus es = status.getExamsStatus().get(key);

            if (StringUtils.equalsIgnoreCase(es.getExamType(), type)) {

                if (sb.length() > 0) {
                    if (StringUtils.equalsIgnoreCase(format, "html")) {
                        sb.append("<br />");
                    } else {
                        sb.append(", ");
                    }
                }
                sb.append(es.getPassCount());
                sb.append(" / ");
                sb.append(es.getAttemptCount());
            }
        }
    }
    return sb.toString();
}

From source file:gov.nih.nci.coppa.services.interceptor.RemoteAuthorizationInterceptor.java

/**
 * Ensures that the current authenticated user is associated with the current session so that security filtering is
 * correct.//from  w  ww .j a  v a  2s  .  c o  m
 *
 * @param invContext the method context
 * @return the method result
 * @throws Exception if invoking the method throws an exception.
 */
@Override
@AroundInvoke
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public Object prepareReturnValue(InvocationContext invContext) throws Exception {
    final String currentUser = UsernameHolder.getUser();
    if (StringUtils.equalsIgnoreCase(UsernameHolder.ANONYMOUS_USERNAME, currentUser)) {
        String username;
        try {
            username = sessionContext.getCallerPrincipal().getName();
        } catch (IllegalStateException e) {
            username = getUnknownUsername();
        }
        UsernameHolder.setUserCaseSensitive(username);
    }
    try {
        return invContext.proceed();
    } finally {
        // See PO-6019. Username needs to be cleaned up after the thread is done.
        UsernameHolder.setUserCaseSensitive(currentUser);
    }
}

From source file:hydrograph.ui.graph.editor.ComponentsEditorContextMenuProvider.java

@Override
protected void doItemFill(IContributionItem ci, int index) {

    StructuredSelection s = (StructuredSelection) SubJobUtility.getCurrentEditor().getViewer().getSelection();

    if (s.getFirstElement() instanceof ComponentEditPart && (StringUtils.equalsIgnoreCase(ci.getId(), team)
            || StringUtils.equalsIgnoreCase(ci.getId(), replaceWith)
            || StringUtils.equalsIgnoreCase(ci.getId(), separator))) {
        return;/*www  . j av  a  2  s. c om*/
    }

    if ((StringUtils.equalsIgnoreCase(ci.getId(), runAs) || StringUtils.equalsIgnoreCase(ci.getId(), debugAs)
            || StringUtils.equalsIgnoreCase(ci.getId(), compareWith)
            || StringUtils.equalsIgnoreCase(ci.getId(), validate))) {
        return;
    }
    super.doItemFill(ci, index);
}

From source file:com.alibaba.otter.node.etl.extract.extractor.GroupExtractor.java

/**
 * ?/*w w  w  . j  a v a2s.c  om*/
 */
private boolean containsInGroupColumn(Set<String> columns, List<ColumnPair> columnPairs) {
    for (ColumnPair columnPair : columnPairs) {
        for (String columnName : columns) {
            if (StringUtils.equalsIgnoreCase(columnPair.getSourceColumn().getName(), columnName)) {
                return true;
            }
        }
    }

    return false;
}

From source file:com.sfs.whichdoctor.beans.BulkContactBean.java

/**
 * Gets the action title.//from  w  w  w  . j  ava  2 s . com
 *
 * @return the action title
 */
public final String getActionTitle() {
    String title = "Return to " + getType().toLowerCase();

    if (StringUtils.equalsIgnoreCase(getType(), "ledger")
            || StringUtils.equalsIgnoreCase(getType(), "ageddebtors")) {
        title = "Return to finance report";
    }

    return title;
}

From source file:com.microsoft.alm.common.utils.UrlHelper.java

public static boolean haveSameAuthority(final URI remoteUrl1, final URI remoteUrl2) {
    if (remoteUrl1 != null && remoteUrl2 != null) {
        return StringUtils.equalsIgnoreCase(remoteUrl1.getAuthority(), remoteUrl2.getAuthority());
    }/*from   w  ww. ja  v a  2s .  c  o m*/

    return false;
}