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

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

Introduction

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

Prototype

public static boolean containsIgnoreCase(final CharSequence str, final CharSequence searchStr) 

Source Link

Document

Checks if CharSequence contains a search CharSequence irrespective of case, handling null .

Usage

From source file:org.egov.ptis.actions.modify.ModifyPropertyAction.java

/**
 * Modifies and Forwards the assessment to next user when form is submitted in editable mode
 *
 * @return/*from w w  w. ja  v a  2 s  .c  om*/
 */
@SkipValidation
@Action(value = "/modifyProperty-forward")
public String forwardModify() {
    setOldPropertyTypeCode(basicProp.getProperty().getPropertyDetail().getPropertyTypeMaster().getCode());
    validate();
    if (hasErrors() && eligibleToShowTaxCalc()) {
        showTaxCalcBtn = Boolean.TRUE;
        allowEditDocument = Boolean.TRUE;
    }
    checkToDisplayAckButton();
    isMeesevaUser = propService.isMeesevaUser(securityUtils.getCurrentUser());

    if (isMeesevaUser && getMeesevaApplicationNumber() != null) {
        propertyModel.setApplicationNo(propertyModel.getMeesevaApplicationNumber());
        propertyModel.setSource(PropertyTaxConstants.SOURCE_MEESEVA);
    }
    if (getModelId() != null && !getModelId().trim().isEmpty()) {
        propWF = (PropertyImpl) getPersistenceService().findByNamedQuery(QUERY_WORKFLOW_PROPERTYIMPL_BYID,
                Long.valueOf(getModelId()));
        basicProp = propWF.getBasicProperty();
        setBasicProp(basicProp);
    } else
        populateBasicProp();
    oldProperty = (PropertyImpl) basicProp.getProperty();
    if (areaOfPlot != null && !areaOfPlot.isEmpty()) {
        final Area area = new Area();
        area.setArea(new Float(areaOfPlot));
        propertyModel.getPropertyDetail().setSitalArea(area);
    }
    if (houseNo != null && !houseNo.isEmpty())
        basicProp.getAddress().setHouseNoBldgApt(houseNo);
    setBoundaries(basicProp);
    if (propTypeId != null && !propTypeId.trim().isEmpty() && !"-1".equals(propTypeId))
        propTypeMstr = (PropertyTypeMaster) getPersistenceService().find(FROM_PROPERTY_TYPE_MASTER_WHERE_ID,
                Long.valueOf(propTypeId));
    propertyModel.getPropertyDetail().setPropertyTypeMaster(propTypeMstr);
    propertyModel.getPropertyDetail().setStructure(oldProperty.getPropertyDetail().isStructure());
    String errorKey = null;
    if (!hasErrors())
        errorKey = propService.validationForBifurcation(propertyModel, basicProp, modifyRsn);
    if (!isBlank(errorKey))
        addActionError(getText(errorKey));

    final PropertyTypeMaster oldPropTypeMstr = oldProperty.getPropertyDetail().getPropertyTypeMaster();
    if (null != propTypeMstr && !propTypeMstr.getType().equals(oldPropTypeMstr.getType()))
        if (propTypeMstr.getType().equals(OWNERSHIP_TYPE_VAC_LAND_STR))
            addActionError(getText("error.nonVacantToVacant"));
    if (hasErrors())
        if (citizenPortalUser || !propertyByEmployee
                || ANONYMOUS_USER.equalsIgnoreCase(securityUtils.getCurrentUser().getName())
                || isAssistantOrRIApprovalPending())
            return NEW;
        else if (isCommissionerRoOrBillCollector())
            return VIEW;
    try {
        modifyBasicProp();
    } catch (final TaxCalculatorExeption e) {
        addActionError(getText("unitrate.error"));
        logger.error("forwardModify : There are no Unit rates defined for chosen combinations", e);
        return NEW;
    }
    if (multipleSubmitCondition(propertyModel, approverPositionId))
        return multipleSubmitRedirect();
    transitionWorkFlow(propertyModel);
    basicProp.setUnderWorkflow(Boolean.TRUE);
    basicPropertyService.applyAuditing(propertyModel.getState());
    propService.updateIndexes(propertyModel, getApplicationType());
    if (SOURCE_SURVEY.equalsIgnoreCase(propertyModel.getSource())) {
        SurveyBean surveyBean = new SurveyBean();
        surveyBean.setProperty(propertyModel);
        BigDecimal totalTax = BigDecimal.ZERO;
        if (StringUtils.containsIgnoreCase(userDesignationList, REVENUE_INSPECTOR_DESGN)
                || StringUtils.containsIgnoreCase(userDesignationList, JUNIOR_ASSISTANT)
                || StringUtils.containsIgnoreCase(userDesignationList, SENIOR_ASSISTANT))
            totalTax = propService.getSurveyTax(propertyModel, new Date());
        surveyBean.setApplicationTax(totalTax);
        propertySurveyService.updateSurveyIndex(APPLICATION_TYPE_ALTER_ASSESSENT, surveyBean);
    }

    // added to set createdDate for DemandCalculation object
    if (basicProp.getWFProperty() != null && basicProp.getWFProperty().getPtDemandSet() != null
            && !basicProp.getWFProperty().getPtDemandSet().isEmpty())
        for (final Ptdemand ptDemand : basicProp.getWFProperty().getPtDemandSet())
            basicPropertyService.applyAuditing(ptDemand.getDmdCalculations());
    if (!isMeesevaUser)
        basicPropertyService.update(basicProp);
    else {
        final HashMap<String, String> meesevaParams = new HashMap<>();
        meesevaParams.put("ADMISSIONFEE", "0");
        meesevaParams.put("APPLICATIONNUMBER", propertyModel.getMeesevaApplicationNumber());
        basicProp.setSource(PropertyTaxConstants.SOURCEOFDATA_MEESEWA);
        basicProp.getWFProperty().setApplicationNo(propertyModel.getMeesevaApplicationNumber());
        basicPropertyService.updateBasicProperty(basicProp, meesevaParams);
    }
    setModifyRsn(propertyModel.getPropertyDetail().getPropertyMutationMaster().getCode());
    if (citizenPortalUser)
        propService.pushPortalMessage(propertyModel, getApplicationType());
    else if (Source.CITIZENPORTAL.toString().equalsIgnoreCase(propertyModel.getSource())) {
        final PortalInbox portalInbox = propService.getPortalInbox(propertyModel.getApplicationNo());
        if (portalInbox != null)
            propService.updatePortal(propertyModel, getApplicationType());
    }
    prepareAckMsg();
    buildEmailandSms(propertyModel, getApplicationType());
    addActionMessage(
            getText(PROPERTY_FORWARD_SUCCESS, new String[] { propertyModel.getBasicProperty().getUpicNo() }));
    return isMeesevaUser ? MEESEVA_RESULT_ACK : RESULT_ACK;
}

From source file:org.egov.ptis.actions.modify.ModifyPropertyAction.java

private boolean isCommissionerRoOrBillCollector() {
    return StringUtils.containsIgnoreCase(userDesignationList, BILL_COLLECTOR_DESGN)
            || StringUtils.containsIgnoreCase(userDesignationList, TAX_COLLECTOR_DESGN)
            || StringUtils.containsIgnoreCase(userDesignationList, COMMISSIONER_DESGN)
            || StringUtils.containsIgnoreCase(userDesignationList, REVENUE_OFFICER_DESGN);
}

From source file:org.egov.ptis.actions.modify.ModifyPropertyAction.java

private boolean isAssistantOrRIApprovalPending() {
    return StringUtils.containsIgnoreCase(userDesignationList, JUNIOR_ASSISTANT)
            || StringUtils.containsIgnoreCase(userDesignationList, SENIOR_ASSISTANT)
            || getModel().getState().getNextAction() != null && getModel().getState().getNextAction()
                    .equalsIgnoreCase(WF_STATE_UD_REVENUE_INSPECTOR_APPROVAL_PENDING);
}

From source file:org.egov.ptis.actions.modify.ModifyPropertyAction.java

/**
 * @return//from w  w  w . j a v  a 2  s  .c  om
 */
private boolean eligibleToShowTaxCalc() {
    return (StringUtils.containsIgnoreCase(userDesignationList, REVENUE_INSPECTOR_DESGN)
            || StringUtils.containsIgnoreCase(userDesignationList, JUNIOR_ASSISTANT)
            || StringUtils.containsIgnoreCase(userDesignationList, SENIOR_ASSISTANT))
            && PROPERTY_MODIFY_REASON_ADD_OR_ALTER.equals(modifyRsn);
}

From source file:org.esigate.server.EsigateServerTest.java

/**
 * Test control handler (auto mode).//from   w w  w .  j ava 2 s .c om
 * 
 * @throws Exception
 *             on error.
 */
@Test
@SuppressWarnings("static-method")
public void testControlConnectionAuto() throws Exception {

    WebConversation webConversation;

    webConversation = new WebConversation();
    webConversation.setExceptionsThrownOnErrorStatus(false);
    WebRequest req = new GetMethodWebRequest("http://localhost:8081/server-status");
    req.setParameter("auto", "");
    WebResponse resp = webConversation.getResponse(req);

    assertEquals(STATUS_OK, resp.getResponseCode());
    assertFalse(resp.getText().contains("Esigate Server Status"));

    assertTrue(StatusReader.getLong(resp.getText(), "Uptime") > 0);
    Double cpuLoad = StatusReader.getDouble(resp.getText(), "CPULoad");
    if (cpuLoad != null) {
        assertTrue(cpuLoad > 0);
    }

    // On Windows, Cpuload is unsupported. Do not assert on this system.
    if (!StringUtils.containsIgnoreCase(System.getProperty("os.name"), "win")) {
        assertNotNull(cpuLoad);
    }

    assertEquals(0, StatusReader.getLong(resp.getText(), "Total Accesses").longValue());
    assertEquals(0d, StatusReader.getDouble(resp.getText(), "ReqPerSec"));

}

From source file:org.graylog.plugins.pipelineprocessor.functions.strings.Contains.java

@Override
public Boolean evaluate(FunctionArgs args, EvaluationContext context) {
    final String value = valueParam.required(args, context);
    final String search = searchParam.required(args, context);
    final boolean ignoreCase = ignoreCaseParam.optional(args, context).orElse(false);
    if (ignoreCase) {
        return StringUtils.containsIgnoreCase(value, search);
    } else {//  w  w w  .j  a  v a2  s.c om
        return StringUtils.contains(value, search);
    }
}

From source file:org.jboss.windup.rules.apps.java.scan.operation.IdentifiedArchiveFileFilter.java

@Override
public boolean accept(File file) {
    if (file.isFile()) {
        // only accept MANIFEST, POM.xml, and License files...
        if (StringUtils.equals(file.getName(), "MANIFEST.MF") || StringUtils.equals(file.getName(), "pom.xml")
                || StringUtils.equals(file.getName(), "pom.properties")
                || StringUtils.containsIgnoreCase(file.getName(), "license")
                || StringUtils.containsIgnoreCase(file.getName(), "notice")
                || StringUtils.containsIgnoreCase(file.getName(), "lgpl")
                || StringUtils.containsIgnoreCase(file.getName(), "gpl")) {
            LOG.info(archiveName + " - Accepting File on Identified Archive: " + file.getName() + ".");
            return true;
        }//from w ww . j  av a2  s .com

        if (LOG.getLevel() == java.util.logging.Level.FINE) {
            LOG.fine(archiveName + " - Rejecting File on Identified Archive: " + file.getName() + ".");
        }
        return false;
    }

    return true;
}

From source file:org.jboss.windup.rules.apps.java.scan.provider.DiscoverArchiveLicenseFilesRuleProvider.java

@Override
public void perform(GraphRewrite event, EvaluationContext context, ArchiveModel payload) {
    Rule rule = (Rule) context.get(Rule.class);
    Set<FileModel> licenseFiles = findLicense(payload);
    if (licenseFiles.isEmpty()) {
        // no licenses found, skip this one
        return;// w w  w  .j  av  a2 s . c  o  m
    }

    TechnologyTagService technologyTagService = new TechnologyTagService(event.getGraphContext());
    GraphService<LicenseModel> licenseService = new GraphService<>(event.getGraphContext(), LicenseModel.class);

    for (FileModel license : licenseFiles) {
        LOG.info("Classifying: " + license.getFileName() + " as License within archive: "
                + payload.getArchiveName());

        // http://opensource.org/licenses/
        try (InputStream stream = license.asInputStream()) {
            String content = IOUtils.toString(stream);

            if (StringUtils.containsIgnoreCase(content, "Apache License, Version 2.0")) {
                tagLicenseByTechnologyTag(rule, licenseService, technologyTagService, license,
                        "Apache License 2.0", "Apache License 2.0 File",
                        "http://www.apache.org/licenses/LICENSE-2.0");
            } else if (StringUtils.containsIgnoreCase(content, "Apache Software License, Version 1.1")) {
                tagLicenseByTechnologyTag(rule, licenseService, technologyTagService, license,
                        "Apache License 1.1", "Apache License 1.1 File",
                        "http://www.apache.org/licenses/LICENSE-1.1");
            } else if (StringUtils.containsIgnoreCase(content,
                    "Copyright (c) 1995-1999 The Apache Group.  All rights reserved.")) {
                tagLicenseByTechnologyTag(rule, licenseService, technologyTagService, license,
                        "Apache License 1.0", "Apache License 1.0 File",
                        "http://www.apache.org/licenses/LICENSE-1.0");
            } else if (StringUtils.containsIgnoreCase(content, "GNU General Public License")) {
                tagLicenseByTechnologyTag(rule, licenseService, technologyTagService, license, "GNU GPL",
                        "GNU General Public License File", "http://opensource.org/licenses/gpl-license");
            } else if (StringUtils.containsIgnoreCase(content, "The MIT License (MIT)")) {
                tagLicenseByTechnologyTag(rule, licenseService, technologyTagService, license, "MIT License",
                        "MIT License File", "http://opensource.org/licenses/MIT");
            } else if (StringUtils.containsIgnoreCase(content, "Mozilla Public License, version 2.0")) {
                tagLicenseByTechnologyTag(rule, licenseService, technologyTagService, license,
                        "Mozilla Public License 2.0", "Mozilla Public License 2.0 File",
                        "http://opensource.org/licenses/MPL-2.0");
            } else if (StringUtils.containsIgnoreCase(content, "GNU Lesser General Public License")) {
                tagLicenseByTechnologyTag(rule, licenseService, technologyTagService, license, "GNU LGPL",
                        "GNU LGPL File", "http://opensource.org/licenses/lgpl-license");
            } else if (StringUtils.contains(content, "COMMON DEVELOPMENT AND DISTRIBUTION LICENSE")) {
                tagLicenseByTechnologyTag(rule, licenseService, technologyTagService, license, "CDDL",
                        "CDDL License File", "http://opensource.org/licenses/CDDL-1.0");
            } else if (StringUtils.containsIgnoreCase(content, "Eclipse Public License")) {
                tagLicenseByTechnologyTag(rule, licenseService, technologyTagService, license,
                        "Eclipse Public License 1.0", "Eclipse Public License 1.0 File",
                        "http://opensource.org/licenses/EPL-1.0");
            } else if (StringUtils.containsIgnoreCase(content,
                    "Redistribution and use in source and binary forms")) {
                tagLicenseByTechnologyTag(rule, licenseService, technologyTagService, license, "BSD License",
                        "BSD License File", "http://opensource.org/licenses/");
            } else if (StringUtils.containsIgnoreCase(content,
                    "the work of authorship identified is in the public domain of the country")) {
                tagLicenseByTechnologyTag(rule, licenseService, technologyTagService, license,
                        "Public Domain License", "Creative Commons Public Domain License File",
                        "http://creativecommons.org/licenses/publicdomain/");
            }

            else {
                LOG.warning("Must be unknown license type: " + license.getFileName());

                tagLicenseByTechnologyTag(rule, licenseService, technologyTagService, license,
                        "Unknown License", "Unknown License File", "Unknown License File");
            }
        } catch (IOException e) {
            LOG.fine("Error while opening License file: " + license.getFileName() + " with error: "
                    + e.getLocalizedMessage());
        }
    }

}

From source file:org.kalypso.core.KalypsoCorePlugin.java

/**
 * Gets the kalypso timezone (to be used to display any dates in the UI).<br>
 * The timezone is set in the user-preferences. If the preference is not set, the value of the system property
 * 'kalypso.timezone' will be used, or, if not set, the system timezone (see {@link TimeZone#getDefault()}). <br>
 * The user preferences can explicitly be set to:
 * <ul>/*w  w w  .j a va2 s . c  o  m*/
 * <li>OS_TIMEZONE: {@link TimeZone#getDefault() is always used}</li>
 * <li>CONFIG_TIMEZONE: timezone definition from config.ini (kalypso.timezone) is used (defaults to system timezone if not set)</li>
 * </ul>
 */
public TimeZone getTimeZone() {
    final TimeZone timezone = getInternalTimeZone();

    /** we want to get rid of daylight saving times and only support GMT based time zones! */
    final String identifier = timezone.getID();
    if (!StringUtils.containsIgnoreCase(identifier, "gmt")) //$NON-NLS-1$
    {
        final Calendar calendar = Calendar.getInstance();
        calendar.set(Calendar.MONTH, 0); // get offset from winter daylight saving time!
        final int offset = timezone.getOffset(calendar.getTimeInMillis());

        return TimeZone.getTimeZone(String.format("GMT%+d", offset)); //$NON-NLS-1$
    }

    return timezone;

}

From source file:org.kalypso.ui.rrm.internal.results.view.tree.filter.ResultTextSearchFilter.java

private boolean hasChildWithName(final TreeNode node, final String searchString) {
    if (StringUtils.containsIgnoreCase(node.getLabel(), searchString))
        return true;

    final TreeNode[] children = node.getChildren();
    for (final TreeNode child : children) {
        if (hasChildWithName(child, searchString))
            return true;
    }//ww w .j  a v  a2s. c o m

    return false;
}