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:au.edu.anu.portal.portlets.sakaiconnector.PortletDispatcher.java

/**
 * Process any portlet actions. /*from w w w .  ja v  a2s.  co  m*/
 */

public void processAction(ActionRequest request, ActionResponse response) {
    log.debug("processAction()");

    //check mode and delegate
    if (StringUtils.equalsIgnoreCase(request.getPortletMode().toString(), "CONFIG")) {
        processConfigAction(request, response);
    } else if (StringUtils.equalsIgnoreCase(request.getPortletMode().toString(), "EDIT")) {
        processEditAction(request, response);
    } else {
        log.error("No handler for PortletMode: " + request.getPortletMode().toString());
    }
}

From source file:au.edu.anu.portal.portlets.basiclti.BasicLTIPortlet.java

/**
 * Delegate to appropriate PortletMode.//from   ww  w  .  j a v a  2s .c o  m
 */
protected void doDispatch(RenderRequest request, RenderResponse response) throws PortletException, IOException {
    log.info("Basic LTI doDispatch()");

    if (StringUtils.equalsIgnoreCase(request.getPortletMode().toString(), "CONFIG")) {
        doConfig(request, response);
    } else {
        super.doDispatch(request, response);
    }
}

From source file:com.adobe.acs.commons.workflow.process.impl.BrandPortalSyncProcess.java

protected final ReplicationActionType getReplicationActionType(MetaDataMap metaDataMap) {
    final String processArgs = StringUtils
            .trim(metaDataMap.get("PROCESS_ARGS", ReplicationActionType.ACTIVATE.getName()));

    if (StringUtils.equalsIgnoreCase(processArgs, ReplicationActionType.ACTIVATE.getName())) {
        return ReplicationActionType.ACTIVATE;
    } else if (StringUtils.equalsIgnoreCase(processArgs, ReplicationActionType.DEACTIVATE.getName())) {
        return ReplicationActionType.DEACTIVATE;
    }/* www  .  ja  v  a 2 s.com*/

    return null;
}

From source file:info.magnolia.cms.security.auth.PrincipalCollectionImpl.java

/**
 * Gets principal associated to the specified name from the collection.
 * @param name//from w  w  w  . j a va  2 s. co m
 * @return principal object associated to the specified name.
 */
@Override
public Principal get(String name) {
    //TODO: change internal collection to a map and store names as keys to avoid loops !!!!
    Iterator<Principal> principalIterator = this.collection.iterator();
    while (principalIterator.hasNext()) {
        Principal principal = principalIterator.next();
        if (StringUtils.equalsIgnoreCase(name, principal.getName())) {
            return principal;
        }
    }
    return null;
}

From source file:de.softwareforge.pgpsigner.commands.AbstractCommand.java

/**
 * Returns true if this command object considers itself responsible for the given interactive command. This implementation
 * does a case insensitive match on the name returned by getName() and returns true if they match.
 *
 * @param command The current command entered by the user.
 * @return True if the command object wants to process this command.
 *///from   w  w w .  j ava 2s  .co  m
public boolean matchInteractiveCommand(final String command) {
    return StringUtils.equalsIgnoreCase(command, getName());
}

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

/**
 * ??/*from w ww.ja  v  a 2  s .c o  m*/
 */
@RequestMapping(value = "/check_mobile", method = RequestMethod.GET)
public @ResponseBody boolean checkMobile(String previousMobile, String mobile) {
    if (StringUtils.equalsIgnoreCase(previousMobile, mobile)) {
        return true;
    }
    if (memberService.mobileUnique(previousMobile, mobile)) {
        return false;
    } else {
        return true;
    }
}

From source file:com.adobe.acs.tools.csv_asset_importer.impl.Parameters.java

public Parameters(SlingHttpServletRequest request) throws IOException {

    final RequestParameter charsetParam = request.getRequestParameter("charset");
    final RequestParameter delimiterParam = request.getRequestParameter("delimiter");
    final RequestParameter fileParam = request.getRequestParameter("file");
    final RequestParameter multiDelimiterParam = request.getRequestParameter("multiDelimiter");
    final RequestParameter separatorParam = request.getRequestParameter("separator");
    final RequestParameter fileLocationParam = request.getRequestParameter("fileLocation");
    final RequestParameter importStrategyParam = request.getRequestParameter("importStrategy");
    final RequestParameter updateBinaryParam = request.getRequestParameter("updateBinary");
    final RequestParameter mimeTypePropertyParam = request.getRequestParameter("mimeTypeProperty");
    final RequestParameter skipPropertyParam = request.getRequestParameter("skipProperty");
    final RequestParameter absTargetPathPropertyParam = request.getRequestParameter("absTargetPathProperty");
    final RequestParameter relSrcPathPropertyParam = request.getRequestParameter("relSrcPathProperty");
    final RequestParameter uniquePropertyParam = request.getRequestParameter("uniqueProperty");
    final RequestParameter ignorePropertiesParam = request.getRequestParameter("ignoreProperties");
    final RequestParameter throttleParam = request.getRequestParameter("throttle");
    final RequestParameter batchSizeParam = request.getRequestParameter("batchSize");

    this.charset = DEFAULT_CHARSET;
    if (charsetParam != null) {
        this.charset = StringUtils.defaultIfEmpty(charsetParam.toString(), DEFAULT_CHARSET);
    }//from  www. ja  va  2s  . c om

    this.delimiter = null;
    if (delimiterParam != null && StringUtils.isNotBlank(delimiterParam.toString())) {
        this.delimiter = delimiterParam.toString().charAt(0);
    }

    this.separator = null;
    if (separatorParam != null && StringUtils.isNotBlank(separatorParam.toString())) {
        this.separator = separatorParam.toString().charAt(0);
    }

    this.multiDelimiter = "|";
    if (multiDelimiterParam != null && StringUtils.isNotBlank(multiDelimiterParam.toString())) {
        this.multiDelimiter = multiDelimiterParam.toString();
    }

    this.importStrategy = ImportStrategy.FULL;
    if (importStrategyParam != null && StringUtils.isNotBlank(importStrategyParam.toString())) {
        this.importStrategy = ImportStrategy.valueOf(importStrategyParam.toString());
    }

    this.updateBinary = false;
    if (updateBinaryParam != null && StringUtils.isNotBlank(updateBinaryParam.toString())) {
        this.updateBinary = StringUtils.equalsIgnoreCase(updateBinaryParam.toString(), "true");
    }

    this.fileLocation = "/dev/null";
    if (fileLocationParam != null && StringUtils.isNotBlank(fileLocationParam.toString())) {
        this.fileLocation = fileLocationParam.toString();
    }

    this.skipProperty = null;
    if (skipPropertyParam != null && StringUtils.isNotBlank(skipPropertyParam.toString())) {
        skipProperty = StringUtils.stripToNull(skipPropertyParam.toString());
    }

    this.mimeTypeProperty = null;
    if (mimeTypePropertyParam != null && StringUtils.isNotBlank(mimeTypePropertyParam.toString())) {
        mimeTypeProperty = StringUtils.stripToNull(mimeTypePropertyParam.toString());
    }

    this.absTargetPathProperty = null;
    if (absTargetPathPropertyParam != null && StringUtils.isNotBlank(absTargetPathPropertyParam.toString())) {
        this.absTargetPathProperty = StringUtils.stripToNull(absTargetPathPropertyParam.toString());
    }

    this.relSrcPathProperty = null;
    if (relSrcPathPropertyParam != null && StringUtils.isNotBlank(relSrcPathPropertyParam.toString())) {
        this.relSrcPathProperty = StringUtils.stripToNull(relSrcPathPropertyParam.toString());
    }

    this.uniqueProperty = null;
    if (uniquePropertyParam != null && StringUtils.isNotBlank(uniquePropertyParam.toString())) {
        this.uniqueProperty = StringUtils.stripToNull(uniquePropertyParam.toString());
    }

    this.ignoreProperties = new String[] { CsvAssetImporterServlet.TERMINATED };
    if (ignorePropertiesParam != null && StringUtils.isNotBlank(ignorePropertiesParam.toString())) {
        final String[] tmp = StringUtils.split(StringUtils.stripToNull(ignorePropertiesParam.toString()), ",");
        final List<String> list = new ArrayList<String>();

        for (final String t : tmp) {
            String val = StringUtils.stripToNull(t);
            if (val != null) {
                list.add(val);
            }
        }

        list.add(CsvAssetImporterServlet.TERMINATED);
        this.ignoreProperties = list.toArray(new String[] {});
    }

    if (fileParam != null && fileParam.getInputStream() != null) {
        this.file = fileParam.getInputStream();
    }

    this.throttle = DEFAULT_THROTTLE;
    if (throttleParam != null && StringUtils.isNotBlank(throttleParam.toString())) {
        try {
            this.throttle = Long.valueOf(throttleParam.toString());
            if (this.throttle < 0) {
                this.throttle = DEFAULT_THROTTLE;
            }
        } catch (Exception e) {
            this.throttle = DEFAULT_THROTTLE;
        }
    }

    batchSize = DEFAULT_BATCH_SIZE;
    if (batchSizeParam != null && StringUtils.isNotBlank(batchSizeParam.toString())) {
        try {
            this.batchSize = Integer.valueOf(batchSizeParam.toString());
            if (this.batchSize < 1) {
                this.batchSize = DEFAULT_BATCH_SIZE;
            }
        } catch (Exception e) {
            this.batchSize = DEFAULT_BATCH_SIZE;
        }
    }
}

From source file:cn.heu.hmps.util.web.Struts2Utils.java

/**
 * ?contentTypeheaders./*from  w  ww.j  a v a  2s  .  c  o  m*/
 */
private static HttpServletResponse initResponseHeader(final String contentType, final String... headers) {
    //?headers?
    String encoding = DEFAULT_ENCODING;
    boolean noCache = DEFAULT_NOCACHE;
    for (String header : headers) {
        String headerName = StringUtils.substringBefore(header, ":");
        String headerValue = StringUtils.substringAfter(header, ":");

        if (StringUtils.equalsIgnoreCase(headerName, HEADER_ENCODING)) {
            encoding = headerValue;
        } else if (StringUtils.equalsIgnoreCase(headerName, HEADER_NOCACHE)) {
            noCache = Boolean.parseBoolean(headerValue);
        } else {
            throw new IllegalArgumentException(headerName + "??header");
        }
    }

    HttpServletResponse response = ServletActionContext.getResponse();

    //headers?
    String fullContentType = contentType + ";charset=" + encoding;
    response.setContentType(fullContentType);
    if (noCache) {
        ServletUtils.setDisableCacheHeader(response);
    }

    return response;
}

From source file:com.sfs.whichdoctor.analysis.TrainingSummaryAnalysisDAOImpl.java

/**
 * Perform a training analysis search./*ww  w.  ja v a 2 s.co  m*/
 *
 * @param trainingSummary the existing training summary search
 *
 * @return the training summary bean
 *
 * @throws WhichDoctorAnalysisDaoException the which doctor analysis dao
 *             exception
 */
public final TrainingSummaryBean search(final TrainingSummaryBean trainingSummary)
        throws WhichDoctorAnalysisDaoException {

    TrainingSummaryBean search = trainingSummary.clone();

    if (search == null) {
        throw new NullPointerException("The training summary cannot be null");
    }

    /* Clear any existing results or people */
    search.clearResults();

    // Perform a PersonSearchDAO based on the array
    // of people GUIDs in the search object

    Collection<Object> peopleGUIDs = new ArrayList<Object>();

    if (search.getPeople() != null) {
        for (String name : search.getPeople().keySet()) {
            PersonBean person = search.getPeople().get(name);
            peopleGUIDs.add(person.getGUID());
        }
    }

    // Load the people who are part of this rotation summary
    SearchBean findPeople = this.searchDAO.initiate("person", new UserBean());
    findPeople.setLimit(0);
    findPeople.setSearchArray(peopleGUIDs, "People in training summary set");

    BuilderBean personDetails = new BuilderBean();
    // Set search to load training summary details
    for (String type : search.getTrainingTypes()) {
        if (type.compareToIgnoreCase("Basic Training") == 0) {
            personDetails.setParameter("TRAINING_BASIC", true);
        }
        if (type.compareToIgnoreCase("Advanced Training") == 0) {
            personDetails.setParameter("TRAINING_ADVANCED", true);
        }
        if (type.compareToIgnoreCase("Post-FRACP Training") == 0) {
            personDetails.setParameter("TRAINING_POSTFRACP", true);
        }
    }
    personDetails.setParameter("MEMBERSHIP", true);
    personDetails.setParameter("SPECIALTY", true);

    try {
        SearchResultsBean personResults = this.searchDAO.search(findPeople, personDetails);

        // Set the training summary people
        if (personResults != null) {
            Collection<PersonBean> people = new ArrayList<PersonBean>();
            for (Object result : personResults.getSearchResults()) {
                people.add((PersonBean) result);
            }
            search.setLoadedPeople(people);
        }
    } catch (Exception e) {
        dataLogger.error("Error performing person search: " + e.getMessage());
        throw new WhichDoctorAnalysisDaoException("Error performing person search: " + e.getMessage());
    }

    /**
     * Iterate through all the loaded people Put them into the relevant
     * specialty committee groups Depending on specialty status - training
     */
    for (Integer guid : search.getLoadedPeople().keySet()) {
        PersonBean person = search.getLoadedPeople().get(guid);
        if (person.getSpecialtyList() != null) {
            for (SpecialtyBean specialty : person.getSpecialtyList()) {
                if (StringUtils.equalsIgnoreCase(specialty.getStatus(), "Training for specialty")) {
                    search = addPersonToCommittee(search, specialty.getTrainingProgram(), person);
                }
            }
        }
    }

    SearchBean findRotations = this.searchDAO.initiate("rotation", new UserBean());
    findRotations.setLimit(0);

    // Set the search criteria to be the list of people GUIDs
    RotationBean rotationCriteria = (RotationBean) findRotations.getSearchCriteria();
    RotationBean rotationConstraint = (RotationBean) findRotations.getSearchConstraints();

    dataLogger.info("Setting " + peopleGUIDs.size() + " people GUID values");
    Collection<Integer> people = new ArrayList<Integer>();
    for (Object guid : peopleGUIDs) {
        people.add((Integer) guid);
    }
    rotationCriteria.setPeopleGUIDs(people);
    rotationCriteria.setSummaryTypes(search.getTrainingTypes());

    /* Set the start date for the rotations */
    rotationCriteria.setStartDate(search.getStartDate());
    rotationConstraint.setStartDate(DataFilter.parseDate("31/12/2037", false));
    /* Set the end date for the rotations */
    rotationCriteria.setEndDate(search.getEndDate());
    rotationConstraint.setEndDate(DataFilter.parseDate("1/1/1900", false));

    findRotations.setSearchCriteria(rotationCriteria);
    findRotations.setSearchConstraints(rotationConstraint);

    BuilderBean rotationDetails = new BuilderBean();
    rotationDetails.setParameter("ASSESSMENTS", true);
    rotationDetails.setParameter("SUPERVISORS", true);

    try {
        SearchResultsBean rotationResults = this.searchDAO.search(findRotations, rotationDetails);

        if (rotationResults != null) {
            Collection<RotationBean> rotations = new ArrayList<RotationBean>();
            if (rotationResults.getSearchResults() != null) {
                for (Object result : rotationResults.getSearchResults()) {
                    rotations.add((RotationBean) result);
                }
            }
            /* Set the training summary rotations */
            search.setResults(rotations);
        }

    } catch (Exception e) {
        dataLogger.error("Error performing rotation search: " + e.getMessage());
        throw new WhichDoctorAnalysisDaoException("Error performing rotation search: " + e.getMessage());
    }

    return search;
}

From source file:hydrograph.ui.common.property.util.Utils.java

private List<String> getOutputFieldList(String componentName, Map<String, Object> componentProperties) {
    List<String> outputFieldList = null;
    if (StringUtils.equalsIgnoreCase(componentName, Constants.JOIN)) {
        JoinMappingGrid joinMappingGrid = (JoinMappingGrid) componentProperties.get(JOIN_MAP);
        if (joinMappingGrid == null) {
            return null;
        }/*from  w ww.  j  a va2 s  .  c  o m*/
        outputFieldList = getOutputFieldsFromJoinMapping(joinMappingGrid);
    } else if (StringUtils.equalsIgnoreCase(componentName, Constants.LOOKUP)) {
        LookupMappingGrid lookupMappingGrid = (LookupMappingGrid) componentProperties.get(LOOKUP_MAP);
        if (lookupMappingGrid == null) {
            return null;
        }
        outputFieldList = getOutputFieldsFromLookupMapping(lookupMappingGrid);
    } else if (StringUtils.equalsIgnoreCase(Constants.TRANSFORM, componentName)
            || StringUtils.equalsIgnoreCase(Constants.AGGREGATE, componentName)
            || StringUtils.equalsIgnoreCase(Constants.NORMALIZE, componentName)
            || StringUtils.equalsIgnoreCase(Constants.GROUP_COMBINE, componentName)
            || StringUtils.equalsIgnoreCase(Constants.CUMULATE, componentName)) {
        TransformMapping transformMapping = (TransformMapping) componentProperties.get(OPERATION);
        if (transformMapping == null) {
            return null;
        }
        outputFieldList = getOutputFieldsFromTransformMapping(transformMapping.getOutputFieldList());
    }
    return outputFieldList;
}