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.apexxs.neonblack.NeonBlack.java

public List<String> detectFromText(String text) {
    List<String> resultStrings = new ArrayList<>();
    if (StringUtils.isEmpty(text)) {
        return resultStrings;
    }/*from w w w . j  av a  2  s .  c o  m*/

    List<DetectedLocation> detections = this.detector.extractLocationNames(text);
    if (detections.size() > 0) {
        detections = this.searcher.search(detections);
        this.scorer.score(detections);

        for (DetectedLocation detection : detections) {
            FinalLocation fl = new FinalLocation(detection);
            if (StringUtils.equalsIgnoreCase(this.config.getResultFormat(), "json")) {
                resultStrings.add(fl.toJson());
            } else {
                resultStrings.add(fl.prettyPrint());
            }
        }
    }

    return resultStrings;
}

From source file:com.mmj.app.common.checkcode.CheckCodeManager.java

/**
 * CheckCode/*from  ww  w . j a v  a 2  s . c om*/
 * 
 * <pre>
 * 1.????Chekcode
 * 2.Cookie?Checkcode
 * </pre>
 * 
 * @param cookieManager
 * @param checkcode
 * @return
 */
public boolean check(CookieManager cookieManager, String checkcode, CookieNameEnum cookieNameEnum) {
    if (!needCheck) {
        return true;
    }
    if (initException != null) {// ??
        setup();
    }
    boolean stillInitFailed = initException != null;
    if (stillInitFailed) {
        return true;// 
    }

    // ??(??Cookie)
    if (StringUtils.isBlank(checkcode)) {
        return false;
    }
    String checkCodeInCookie = cookieManager.get(cookieNameEnum);
    boolean isValid = StringUtils.equalsIgnoreCase(checkCodeInCookie, checkcode);
    if (!isValid) {// ???Cookie?
        cookieManager.set(cookieNameEnum, null);
    }
    return isValid;
}

From source file:com.exxonmobile.ace.hybris.core.search.solrfacetsearch.provider.impl.VariantCategorySource.java

@Override
public Collection<CategoryModel> getCategoriesForConfigAndProperty(final IndexConfig indexConfig,
        final IndexedProperty indexedProperty, final Object baseProduct) {
    final Set<CategoryModel> variantValueCategoriesForVariantCategory = createEmptyVariantValueCategoriesSet();

    final Set<ProductModel> variantProductsForBaseProduct = getProducts(baseProduct);

    for (final ProductModel product : variantProductsForBaseProduct) {
        if (product instanceof GenericVariantProductModel) {
            final GenericVariantProductModel genericVariantProduct = (GenericVariantProductModel) product;
            final Collection<CategoryModel> variantValueCategories = genericVariantProduct.getSupercategories();

            for (final CategoryModel variantValueCategory : variantValueCategories) {
                // VariantValueCategories have only one VariantCategory
                final CategoryModel parentVariantCategory = variantValueCategory.getSupercategories().get(0);
                final boolean isSameCategoryName = StringUtils.equalsIgnoreCase(parentVariantCategory.getName(),
                        indexedProperty.getName());
                if (isSameCategoryName) {
                    variantValueCategoriesForVariantCategory.add(variantValueCategory);
                }//from   www .jav a2 s .  com
            }
        }
    }
    return variantValueCategoriesForVariantCategory;
}

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

public List<RenderPiece> handle(RenderContext renderContext, Map<String, String> values) {
    int attribute = 0;
    //sort out value from PageAttribute class NO_ prefix fields
    Set<Entry<String, Integer>> entries = attributeNames.entrySet();
    for (Entry<String, Integer> entry : entries) {
        String val = values.get(entry.getKey());
        if (StringUtils.equalsIgnoreCase(val, "false") || StringUtils.equalsIgnoreCase(val, "no")) {
            attribute |= entry.getValue();
            log.info("page attribute '" + entry.getKey() + "' set to false.");
        }//  ww  w. j ava  2  s  .  c  o m
    }
    page.setAttribute(attribute);

    return null;

}

From source file:hydrograph.ui.validators.impl.FTPOperationParamValidator.java

@Override
public boolean validate(Object object, String propertyName, Map<String, List<FixedWidthGridRow>> inputSchemaMap,
        boolean isJobFileImported) {
    Map<String, FTPAuthOperationDetails> additionalParam = null;
    if (object != null && Map.class.isAssignableFrom(object.getClass())) {
        additionalParam = (Map<String, FTPAuthOperationDetails>) object;
        if (!additionalParam.isEmpty()) {
            for (Map.Entry<String, FTPAuthOperationDetails> map : additionalParam.entrySet()) {
                FTPAuthOperationDetails details = map.getValue();
                if (map.getKey().contains("S3")) {
                    if (details.getField1() == null || details.getField1().isEmpty()) {
                        errorMessage = propertyName + " can not be blank";
                        return false;
                    }/*from  w ww .  java  2  s  .  co  m*/
                    if (details.getField2() == null || details.getField2().isEmpty()) {
                        errorMessage = propertyName + " can not be blank";
                        return false;
                    }
                    if (!StringUtils.equalsIgnoreCase(map.getKey(), Constants.PUT_FILE_S3)) {
                        if (details.getField3() == null || details.getField3().isEmpty()) {
                            errorMessage = propertyName + " can not be blank";
                            return false;
                        }
                    }
                    if (details.getField4() == null || details.getField4().isEmpty()) {
                        errorMessage = propertyName + " can not be blank";
                        return false;
                    }
                } else {
                    if (details.getField1() == null || details.getField1().isEmpty()) {
                        errorMessage = propertyName + " can not be blank";
                        return false;
                    }
                    if (details.getField2() == null || details.getField2().isEmpty()) {
                        errorMessage = propertyName + " can not be blank";
                        return false;
                    }
                }
            }
        }
    }
    return true;
}

From source file:com.microsoft.alm.plugin.authentication.VsoAuthenticationProvider.java

@Override
public void authenticateAsync(final String serverUri, final AuthenticationListener listener) {
    //clear in memory cache, otherwise user is not prompted, TOOD: handle in auth library since it can be an issue for TFS also
    getAuthenticationInfoProvider().clearAuthenticationInfo(VSO_AUTH_URL);

    AuthenticationListener.Helper.authenticating(listener);

    getAuthenticationInfoProvider().getAuthenticationInfoAsync(serverUri, new AuthenticationInfoCallback() {
        @Override/*from   ww w  .ja  v  a 2  s .com*/
        public void onSuccess(final AuthenticationInfo authenticationInfo) {
            try {
                //save for VSO_Deployment
                ServerContextManager.getInstance().validateServerConnection(
                        new ServerContextBuilder().type(ServerContext.Type.VSO_DEPLOYMENT).uri(VSO_AUTH_URL)
                                .authentication(authenticationInfo).build());

                if (!StringUtils.equalsIgnoreCase(serverUri, VSO_AUTH_URL)) {
                    //save for the specific server url
                    ServerContextManager.getInstance()
                            .validateServerConnection(new ServerContextBuilder().type(ServerContext.Type.VSO)
                                    .uri(serverUri).authentication(authenticationInfo).build());
                }

                //success
                AuthenticationListener.Helper.authenticated(listener, authenticationInfo, null);
            } catch (Throwable t) {
                //validate server connection can fail if we are unable to parse the Url
                AuthenticationListener.Helper.authenticated(listener, AuthenticationInfo.NONE, t);
            }
        }

        @Override
        public void onFailure(Throwable t) {
            clearAuthenticationDetails();
            AuthenticationListener.Helper.authenticated(listener, AuthenticationInfo.NONE, t);
        }
    });
}

From source file:gov.nih.nci.cabig.caaers.tools.spring.tabbedflow.SimpleFormAjaxableController.java

protected boolean isAjaxRequest(HttpServletRequest request) {
    return StringUtils.equalsIgnoreCase("true", request.getParameter(getAjaxRequestParamName()));
    /*//from ww  w.j ava2  s .c om
     if (StringUtils.getBlankIfNull(request.getParameter(getAjaxRequestParamName()))
                .equalsIgnoreCase("true")) return true;
     return false;*/
}

From source file:AIR.Common.DB.SQL_TYPE_To_JAVA_TYPE.java

public static SQL_TYPE_To_JAVA_TYPE getType(String sqlType) {
    for (SQL_TYPE_To_JAVA_TYPE type : SQL_TYPE_To_JAVA_TYPE.values()) {
        // if (StringUtils.equals (type._sqlType, sqlType))
        if (StringUtils.equalsIgnoreCase(type._sqlType, sqlType))
            return type;
    }/*from ww w .  ja  v  a 2 s .  com*/
    throw new InvalidDataBaseTypeSpecification(String.format("The sql type %1$s is not recognized", sqlType));
}

From source file:hydrograph.ui.propertywindow.widgets.utility.SubjobUtility.java

/**
* This method set continuousSchema propagation flag to true until it encounters transform or union All component.
* @param component through which continuous propagation starts. 
*///from w w  w .  j  a v a2 s  . c o  m
public void setFlagForContinuousSchemaPropogation(Component component) {

    for (Link link : component.getSourceConnections()) {
        Schema previousComponentSchema = SubjobUtility.INSTANCE.getSchemaFromPreviousComponentSchema(component,
                link);
        Component nextComponent = link.getTarget();
        if (nextComponent != null) {
            Schema schema = (Schema) nextComponent.getProperties().get(Constants.SCHEMA_PROPERTY_NAME);
            while (StringUtils.equalsIgnoreCase(nextComponent.getCategory(), Constants.STRAIGHTPULL)
                    || StringUtils.equalsIgnoreCase(nextComponent.getComponentName(), Constants.FILTER)
                    || StringUtils.equalsIgnoreCase(nextComponent.getComponentName(), Constants.UNIQUE_SEQUENCE)
                    || StringUtils.equalsIgnoreCase(nextComponent.getComponentName(),
                            Constants.PARTITION_BY_EXPRESSION)
                    || nextComponent instanceof SubjobComponent
                    || nextComponent instanceof OutputSubjobComponent) {
                if (StringUtils.equalsIgnoreCase(Constants.UNION_ALL, nextComponent.getComponentName())) {
                    if (!isUnionAllInputSchemaInSync(nextComponent)) {
                        nextComponent.getProperties().put(Constants.IS_UNION_ALL_COMPONENT_SYNC,
                                Constants.FALSE);
                        ((AbstractGraphicalEditPart) nextComponent.getComponentEditPart()).getFigure()
                                .repaint();
                        break;
                    } else {
                        nextComponent.getProperties().put(Constants.IS_UNION_ALL_COMPONENT_SYNC,
                                Constants.TRUE);
                        ((AbstractGraphicalEditPart) nextComponent.getComponentEditPart()).getFigure()
                                .repaint();
                    }
                }

                if (schema == null)
                    schema = new Schema();
                ComponentsOutputSchema outputSchema = SchemaPropagation.INSTANCE
                        .getComponentsOutputSchema(link);
                if (schema.getGridRow() == null) {
                    List<GridRow> gridRows = new ArrayList<>();
                    schema.setGridRow(gridRows);
                }
                schema.getGridRow().clear();
                if (previousComponentSchema != null && !previousComponentSchema.getGridRow().isEmpty()) {
                    schema.getGridRow().addAll(SchemaSyncUtility.INSTANCE
                            .convertGridRowsSchemaToBasicSchemaGridRows(previousComponentSchema.getGridRow()));
                }
                if (!StringUtils.equalsIgnoreCase(Constants.SUBJOB_COMPONENT_CATEGORY,
                        nextComponent.getCategory())) {
                    nextComponent.getProperties().put(Constants.SCHEMA_PROPERTY_NAME, schema);
                    nextComponent.validateComponentProperties(false);
                    Validator validator = (Validator) ((AbstractGraphicalEditPart) nextComponent
                            .getComponentEditPart()).getFigure();
                    validator.setPropertyStatus(
                            (String) nextComponent.getProperties().get(Constants.VALIDITY_STATUS));
                    ((AbstractGraphicalEditPart) nextComponent.getComponentEditPart()).getFigure().repaint();
                }

                nextComponent.setContinuousSchemaPropogationAllow(true);

                if (nextComponent instanceof SubjobComponent) {
                    Container container = (Container) nextComponent.getSubJobContainer()
                            .get(Constants.SUBJOB_CONTAINER);
                    for (Component subjobComponent : container.getUIComponentList()) {
                        if (subjobComponent instanceof InputSubjobComponent) {
                            initializeSchemaMapForInputSubJobComponent(subjobComponent, nextComponent);
                            setFlagForContinuousSchemaPropogation(subjobComponent);
                            break;
                        }
                    }
                    showOrHideErrorSymbolOnComponent(container, nextComponent);
                    Validator validator = (Validator) ((AbstractGraphicalEditPart) nextComponent
                            .getComponentEditPart()).getFigure();
                    validator.setPropertyStatus(
                            (String) nextComponent.getProperties().get(Constants.VALIDITY_STATUS));
                    ((AbstractGraphicalEditPart) nextComponent.getComponentEditPart()).getFigure().repaint();
                } else if (nextComponent instanceof OutputSubjobComponent) {
                    Component subJobComponent = (Component) nextComponent.getSubJobContainer()
                            .get(Constants.SUBJOB_COMPONENT);
                    if (subJobComponent != null)
                        SubjobUtility.INSTANCE.initializeSchemaMapForInputSubJobComponent(subJobComponent,
                                nextComponent);
                    setFlagForContinuousSchemaPropogation(subJobComponent);
                }
                if (!nextComponent.getSourceConnections().isEmpty()) {
                    if (nextComponent.getSourceConnections().size() == 1) {
                        if (nextComponent instanceof SubjobComponent) {
                            if (!checkIfSubJobHasTransformOrUnionAllComponent(nextComponent)) {
                                nextComponent = nextComponent.getSourceConnections().get(0).getTarget();
                            } else {
                                ((AbstractGraphicalEditPart) nextComponent.getComponentEditPart()).getFigure()
                                        .repaint();
                                break;
                            }
                        } else {
                            nextComponent = nextComponent.getSourceConnections().get(0).getTarget();
                        }
                    } else {
                        setFlagForContinuousSchemaPropogation(nextComponent);
                        break;
                    }
                } else
                    break;
            }
        }
        if (StringUtils.equalsIgnoreCase(nextComponent.getComponentName(), Constants.JOIN)
                || StringUtils.equalsIgnoreCase(nextComponent.getComponentName(), Constants.LOOKUP)) {
            nextComponent.setContinuousSchemaPropogationAllow(true);
            ((AbstractGraphicalEditPart) nextComponent.getComponentEditPart()).getFigure().repaint();
        } else if (StringUtils.equalsIgnoreCase(nextComponent.getComponentName(), Constants.AGGREGATE)
                || StringUtils.equalsIgnoreCase(nextComponent.getComponentName(), Constants.CUMULATE)
                || StringUtils.equalsIgnoreCase(nextComponent.getComponentName(), Constants.GROUP_COMBINE)
                || StringUtils.equalsIgnoreCase(nextComponent.getComponentName(), Constants.NORMALIZE)
                || StringUtils.equalsIgnoreCase(nextComponent.getComponentName(), Constants.TRANSFORM)) {
            TransformMapping transformMapping;
            if (nextComponent.getProperties().get(Constants.OPERATION) == null) {
                transformMapping = new TransformMapping();
                nextComponent.getProperties().put(Constants.OPERATION, transformMapping);
            } else {
                transformMapping = (TransformMapping) nextComponent.getProperties().get(Constants.OPERATION);
            }
            OutputRecordCountUtility.INSTANCE.getPropagatedSchema(transformMapping, nextComponent);
            if (transformMapping.isAllInputFieldsArePassthrough()) {
                Schema schema = (Schema) nextComponent.getProperties().get(Constants.SCHEMA_PROPERTY_NAME);
                if (schema == null) {
                    schema = initSchemaObject();
                }
                OutputRecordCountUtility.INSTANCE.addPassThroughFieldsToSchema(transformMapping, nextComponent,
                        schema);
                setFlagForContinuousSchemaPropogation(nextComponent);
                nextComponent.getProperties().put(Constants.SCHEMA_PROPERTY_NAME, schema);
                nextComponent.validateComponentProperties(false);
                Validator validator = (Validator) ((AbstractGraphicalEditPart) nextComponent
                        .getComponentEditPart()).getFigure();
                validator.setPropertyStatus(
                        (String) nextComponent.getProperties().get(Constants.VALIDITY_STATUS));
                ((AbstractGraphicalEditPart) nextComponent.getComponentEditPart()).getFigure().repaint();

            } else {
                nextComponent.setContinuousSchemaPropogationAllow(true);
                ((AbstractGraphicalEditPart) nextComponent.getComponentEditPart()).getFigure().repaint();
            }

        }
        nextComponent.getProperties().put(Constants.PREVIOUS_COMPONENT_OLD_SCHEMA,
                component.getProperties().get(Constants.PREVIOUS_COMPONENT_OLD_SCHEMA));

    }
}

From source file:com.mmj.app.common.cookie.parser.CookieUtils.java

/**
 * "null", <code>null</code>
 * //from   w w  w  . j  a  va 2  s  .  c  o m
 * @return <code>null</code>
 */
public static String filterNullValue(String value) {
    if (StringUtils.equalsIgnoreCase("null", value)) {
        return null;
    }
    return value;
}