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.kalypso.ui.rrm.internal.timeseries.view.filter.TimeseriesBrowserParameterTypeFilter.java

private boolean isEmptyNode(final TreeNode node) {
    final ITreeNodeUiHandler handler = node.getUiHandler();
    return StringUtils.containsIgnoreCase(handler.getClass().getName(), "EmptyNodeUiHandler"); //$NON-NLS-1$
}

From source file:org.kalypso.zml.core.base.ZmlSourceElements.java

private static String getType(final String identifier) {
    /** special handling for boolean polders */
    if (StringUtils.containsIgnoreCase(identifier, ITimeseriesConstants.TYPE_POLDER_CONTROL)) //$NON-NLS-1$
        return ITimeseriesConstants.TYPE_POLDER_CONTROL; //$NON-NLS-1$

    /** convention: type is encode in identifier of the time series link - like W, W_MODELL or Q, Q_MODELL */
    final RETokenizer tokenizer = new RETokenizer(new Pattern("_.*"), identifier); //$NON-NLS-1$
    return tokenizer.nextToken();
}

From source file:org.kalypso.zml.ui.chart.layer.themes.ZmlConstantLineLayer.java

/**
 * differ between generic global .kod alarmstufen definition and special alarmstufen.kod
 */// w  ww.  ja  va2  s. c o m
private IMetadataLayerBoundary[] buildBoundaries(final IObservation observation) {

    final MetadataList metadata = observation.getMetadataList();

    /**
     * *urks* special handling for alarmstufen layer!
     */
    if (StringUtils.containsIgnoreCase(getIdentifier(), "alarmstufe")) //$NON-NLS-1$
    {
        try {
            final URL url = ConfigUtils.findCentralConfigLocation("layers/grenzwerte/alarmstufen.kod"); //$NON-NLS-1$

            final KodBoundaryLayerProvider provider = new KodBoundaryLayerProvider(metadata, url,
                    getDataHandler().getTargetAxisId());
            final IMetadataLayerBoundary[] boundaries = provider.getBoundaries();
            if (!Arrays.isEmpty(boundaries))
                return boundaries;
        } catch (final Exception ex) {
            ex.printStackTrace();
        }
    }

    final IParameterContainer parameters = getProvider().getParameterContainer();
    if (Objects.isNotNull(parameters)) {
        final MetadataLayerBoundaryBuilder builder = new MetadataLayerBoundaryBuilder(metadata, parameters,
                getStyleSet());
        builder.execute(new NullProgressMonitor());

        return builder.getBoundaries(m_handler.getTargetAxisId());
    }

    return new IMetadataLayerBoundary[] {};

}

From source file:org.kuali.coeus.common.budget.impl.struts.BudgetActionsAction.java

protected boolean isFinancialIntegrationOn(AwardBudgetDocument awardBudgetDocument) {
    String parameterValue = getParameterService().getParameterValueAsString(Constants.MODULE_NAMESPACE_AWARD,
            Constants.PARAMETER_COMPONENT_DOCUMENT, Constants.FIN_SYSTEM_INTEGRATION_ON_OFF_PARAMETER);
    if (StringUtils.containsIgnoreCase(parameterValue, Constants.FIN_SYSTEM_INTEGRATION_ON)) {
        return true;
    }//from  ww w  . java  2  s  .co m
    return false;
}

From source file:org.kuali.coeus.common.questionnaire.impl.answer.QuestionnaireAnswerServiceImpl.java

protected boolean isAnswerMatched(String condition, String parentAnswer, String conditionValue) {
    boolean valid = false;
    if (ConditionType.CONTAINS_TEXT.getCondition().equals(condition)) {
        valid = StringUtils.containsIgnoreCase(parentAnswer, conditionValue);
    } else if (ConditionType.BEGINS_WITH_TEXT.getCondition().equals(condition)) {
        valid = (StringUtils.startsWithIgnoreCase(parentAnswer, conditionValue));
    } else if (ConditionType.ENDS_WITH_TEXT.getCondition().equals(condition)) {
        valid = (StringUtils.endsWithIgnoreCase(parentAnswer, conditionValue));
    } else if (ConditionType.MATCH_TEXT.getCondition().equals(condition)) {
        valid = parentAnswer.equalsIgnoreCase(conditionValue);
    } else if (Integer.parseInt(condition) >= 5 && Integer.parseInt(condition) <= 10) {
        valid = (ConditionType.LESS_THAN_NUMBER.getCondition().equals(condition)
                && (Integer.parseInt(parentAnswer) < Integer.parseInt(conditionValue)))
                || (ConditionType.LESS_THAN_OR_EQUALS_NUMBER.getCondition().equals(condition)
                        && (Integer.parseInt(parentAnswer) <= Integer.parseInt(conditionValue)))
                || (ConditionType.EQUALS_NUMBER.getCondition().equals(condition)
                        && (Integer.parseInt(parentAnswer) == Integer.parseInt(conditionValue)))
                || (ConditionType.NOT_EQUAL_TO_NUMBER.getCondition().equals(condition)
                        && (Integer.parseInt(parentAnswer) != Integer.parseInt(conditionValue)))
                || (ConditionType.GREATER_THAN_OR_EQUALS_NUMBER.getCondition().equals(condition)
                        && (Integer.parseInt(parentAnswer) >= Integer.parseInt(conditionValue)))
                || (ConditionType.GREATER_THAN_NUMBER.getCondition().equals(condition)
                        && (Integer.parseInt(parentAnswer) > Integer.parseInt(conditionValue)));
    } else if (Integer.parseInt(condition) == 11 || Integer.parseInt(condition) == 12) {
        final DateFormat dateFormat = new SimpleDateFormat(Constants.DEFAULT_DATE_FORMAT_PATTERN);
        try {/*  www .  ja  va 2  s.  co  m*/
            Date date1 = new Date(dateFormat.parse(parentAnswer).getTime());
            Date date2 = new Date(dateFormat.parse(conditionValue).getTime());
            valid = (ConditionType.BEFORE_DATE.getCondition().equals(condition) && (date1.before(date2)))
                    || (ConditionType.AFTER_DATE.getCondition().equals(condition) && (date1.after(date2)));
        } catch (Exception e) {

        }

    }
    return valid;
}

From source file:org.kuali.coeus.propdev.impl.krms.PropDevJavaFunctionKrmsTermServiceImpl.java

@Override
public String attachmentFileNameRule(DevelopmentProposal developmentProposal) {
    for (Narrative narr : developmentProposal.getNarratives()) {
        for (String character : restrictedElements) {
            if (StringUtils.containsIgnoreCase(narr.getName(), character)) {
                return FALSE;
            }/*  ww w  . jav a  2 s.  c o  m*/
        }
    }
    return TRUE;
}

From source file:org.kuali.coeus.sys.framework.model.KcTransactionalDocumentFormBase.java

/**
 * This is a duplication of KualiTransactionalDocumentFormBase.populateFalseCheckboxes with the cavet that this function
 * puts a NULL in for fields that contain "answer", which are the field names of radio Y/N buttons for the questionnaire framework.
 * @see org.kuali.rice.kns.web.struts.form.KualiTransactionalDocumentFormBase#populateFalseCheckboxes(javax.servlet.http.HttpServletRequest)
 *//*from   ww w.j  av a 2s  .  c o  m*/
@Override
protected void populateFalseCheckboxes(HttpServletRequest request) {
    Map<String, String[]> parameterMap = request.getParameterMap();
    final String checkBoxToResetFieldParam = "checkboxToReset";
    if (parameterMap.get(checkBoxToResetFieldParam) != null) {
        final String[] checkboxesToResetFields = request.getParameterValues("checkboxToReset");
        if (checkboxesToResetFields != null && checkboxesToResetFields.length > 0) {
            for (int i = 0; i < checkboxesToResetFields.length; i++) {
                String propertyName = (String) checkboxesToResetFields[i];
                if (!StringUtils.isBlank(propertyName) && parameterMap.get(propertyName) == null) {
                    if (this instanceof QuestionableFormInterface
                            && (StringUtils.startsWithIgnoreCase(propertyName,
                                    ((QuestionableFormInterface) this).getQuestionnaireFieldStarter())
                                    && StringUtils.containsIgnoreCase(propertyName,
                                            ((QuestionableFormInterface) this).getQuestionnaireFieldMiddle())
                                    && StringUtils.endsWithIgnoreCase(propertyName,
                                            ((QuestionableFormInterface) this).getQuestionnaireFieldEnd())
                                    || propertyName.matches(
                                            ((QuestionableFormInterface) this).getQuestionnaireExpression()))) {
                        populateForProperty(propertyName, null, parameterMap);
                    } else if (this instanceof MultiQuestionableFormInterface) {
                        processMultiQuestionCheckBox(propertyName, parameterMap,
                                (MultiQuestionableFormInterface) this);

                    } else {
                        populateForProperty(propertyName,
                                KimConstants.KIM_ATTRIBUTE_BOOLEAN_FALSE_STR_VALUE_DISPLAY, parameterMap);
                    }
                } else if (!StringUtils.isBlank(propertyName) && parameterMap.get(propertyName) != null
                        && parameterMap.get(propertyName).length >= 1
                        && parameterMap.get(propertyName)[0].equalsIgnoreCase("on")) {
                    populateForProperty(propertyName, KimConstants.KIM_ATTRIBUTE_BOOLEAN_TRUE_STR_VALUE_DISPLAY,
                            parameterMap);
                }
            }
        }
    }
}

From source file:org.kuali.coeus.sys.framework.model.KcTransactionalDocumentFormBase.java

protected void processMultiQuestionCheckBox(String propertyName, Map<String, String[]> parameterMap,
        MultiQuestionableFormInterface form) {
    boolean checkBoxFound = false;
    int j = 0;/* w ww  .j a  v  a2  s . co  m*/
    for (String starter : form.getQuestionnaireFieldStarters()) {
        if (!checkBoxFound && StringUtils.startsWithIgnoreCase(propertyName, starter)
                && StringUtils.containsIgnoreCase(propertyName, form.getQuestionnaireFieldEnds()[j])
                && StringUtils.endsWithIgnoreCase(propertyName, form.getQuestionnaireFieldEnds()[j])) {
            populateForProperty(propertyName, null, parameterMap);
            ;
            checkBoxFound = true;
            break;
        }
        j++;
    }
    if (!checkBoxFound) {
        populateForProperty(propertyName, KimConstants.KIM_ATTRIBUTE_BOOLEAN_FALSE_STR_VALUE_DISPLAY,
                parameterMap);
    }
}

From source file:org.kuali.kra.coi.disclosure.CoiDisclosureAction.java

@Override
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    String command = request.getParameter("command");
    //KCCOI-278 added the load line above to fix master disclosure issues but this should really be done 
    // in all cases.
    if (StringUtils.isNotBlank(command)
            && !StringUtils.containsIgnoreCase(command, KewApiConstants.INITIATE_COMMAND)) {
        // 'view' in master disclosure's 'Disclosures' list
        super.loadDocument((KualiDocumentFormBase) form);
    }//from  w  w  w. j ava  2s.co  m
    CoiDisclosureForm coiDisclosureForm = (CoiDisclosureForm) form;
    ActionForward actionForward = super.execute(mapping, form, request, response);

    // we will populate questionnaire data after the execution of any dispatched ("methodTocall") methods. This point, right
    // after the
    // above super.execute() call works well for that because any such dispatched method has finished executing at the end of
    // the call.
    // we will populate questionnaire data after the execution of any dispatched "methodTocall" methods. This point, right
    // after the above super.execute() call works well for that.
    CoiDisclosureDocument coiDisclosureDocument = (CoiDisclosureDocument) coiDisclosureForm.getDocument();
    CoiDisclosure coiDisclosure = coiDisclosureDocument.getCoiDisclosure();

    // specify conditions to narrow down the range of the execution paths in which questionnaire data is populated
    if ((coiDisclosureDocument.getDocumentHeader().hasWorkflowDocument()) && !(coiDisclosure.isManualEvent()
            && CollectionUtils.isEmpty(coiDisclosure.getCoiDisclProjects()))) {
        boolean forceQnnrReload = false;
        // TODO : this is pretty hacky to refresh qn
        if ((StringUtils.equals("reload", coiDisclosureForm.getMethodToCall())
                && !coiDisclosure.isApprovedDisclosure() && !coiDisclosure.isAnnualUpdate()
                && !coiDisclosure.isUpdateEvent())
                || (StringUtils.equals("addManualProject", coiDisclosureForm.getMethodToCall()))) {
            forceQnnrReload = true;
        }
        coiDisclosureForm.getDisclosureQuestionnaireHelper().prepareView(forceQnnrReload);
        coiDisclosureForm.getScreeningQuestionnaireHelper().prepareView(forceQnnrReload);
    }

    // now the rest of subclass-specific custom logic for execute()
    coiDisclosureDocument.getCoiDisclosure().initSelectedUnit();
    if ((StringUtils.equals("reload", coiDisclosureForm.getMethodToCall())
            || StringUtils.equals("updateAttachmentFilter", coiDisclosureForm.getMethodToCall())
            || StringUtils.equals("headerTab", coiDisclosureForm.getMethodToCall())
            || StringUtils.equals("docHandler", coiDisclosureForm.getMethodToCall()))
            && coiDisclosureDocument.getCoiDisclosure().isApprovedDisclosure()) {
        coiDisclosureForm.getDisclosureHelper().setMasterDisclosureBean(
                getCoiDisclosureService().getMasterDisclosureDetail(coiDisclosureDocument.getCoiDisclosure()));
        setQuestionnaireStatuses(coiDisclosureForm);
        actionForward = mapping.findForward(MASTER_DISCLOSURE);
    } else {
        if (StringUtils.isNotBlank(command) && MASTER_DISCLOSURE.equals(command)) {
            coiDisclosureDocument = (CoiDisclosureDocument) coiDisclosureForm.getDocument();
            coiDisclosureDocument.getCoiDisclosure().initSelectedUnit();
            coiDisclosureForm.getDisclosureHelper().setMasterDisclosureBean(getCoiDisclosureService()
                    .getMasterDisclosureDetail(coiDisclosureDocument.getCoiDisclosure()));
            setQuestionnaireStatuses(coiDisclosureForm);
            actionForward = mapping.findForward(MASTER_DISCLOSURE);
        }

    }
    if (coiDisclosure.isManualEvent() && !CollectionUtils.isEmpty(coiDisclosure.getCoiDisclProjects())) {
        coiDisclosure.getCoiDisclProjects().get(0).initHeaderItems();
    }

    // initialize the permissions for notes and attachments helper
    //coiDisclosure was becoming null here, so loading the document above.
    //KCCOI-278 added the line above to fix master disclosure issues but this should really be done 
    // in all cases.
    coiDisclosureForm.getCoiNotesAndAttachmentsHelper().prepareView();

    return actionForward;

}

From source file:org.kuali.kra.institutionalproposal.proposallog.ProposalLogLookupableHelperServiceImpl.java

@SuppressWarnings("unchecked")
@Override/*from   ww  w  .  ja v a 2  s .  com*/
public Collection performLookup(LookupForm lookupForm, Collection resultTable, boolean bounded) {
    String userName = (String) lookupForm.getFieldsForLookup().get(USERNAME_FIELD);
    lookupForm.getFieldsForLookup().remove(FOR_INSTITUTIONAL_PROPOSAL);

    if (!StringUtils.isBlank(userName)) {
        KcPerson person = getKcPersonService().getKcPersonByUserName(userName);
        if (person != null) {
            lookupForm.getFieldsForLookup().put(PI_ID, person.getPersonId());
        }
        lookupForm.getFieldsForLookup().remove(USERNAME_FIELD);
    }
    List<ProposalLog> results = (List<ProposalLog>) super.performLookup(lookupForm, resultTable, bounded);
    if (StringUtils.containsIgnoreCase(lookupForm.getBackLocation(), NEGOTIATION_NEGOTIATION)) {
        return cleanSearchResultsForNegotiationLookup(results);
    } else {
        return results;
    }
}