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:hydrograph.ui.engine.converter.impl.S3FileTransferConverterHelper.java

/**
 * authentication details/*from   w  w w. j  ava  2 s.co  m*/
 * @param ftp
 */
private void addAuthenticationDetails(S3FileTransfer s3FileTransfer) {
    Map<String, FTPAuthOperationDetails> authDetails = (Map<String, FTPAuthOperationDetails>) properties
            .get(PropertyNameConstants.FTP_AUTH.value());
    FTPAuthOperationDetails authenticationDetails = null;
    if (authDetails != null && !authDetails.isEmpty()) {
        for (Map.Entry<String, FTPAuthOperationDetails> map : authDetails.entrySet()) {
            authenticationDetails = map.getValue();
            if (StringUtils.equalsIgnoreCase(map.getKey(), Constants.AWS_S3_KEY)) {
                if (StringUtils.isNotBlank(authenticationDetails.getField1())) {
                    s3FileTransfer.setAccessKeyID(authenticationDetails.getField1());
                }
                if (StringUtils.isNotBlank(authenticationDetails.getField2())) {
                    s3FileTransfer.setSecretAccessKey(authenticationDetails.getField2());
                }
            } else {
                if (StringUtils.isNotBlank(authenticationDetails.getField2())) {
                    s3FileTransfer.setCrediationalPropertiesFile(authenticationDetails.getField2());
                }
            }
        }
    }
}

From source file:module.siadap.activities.CreateOrEditCompetenceEvaluationActivityInformation.java

/**
 * //from  ww w.j ava  2  s. c om
 * @param competence
 *            the competence to check if there's an equivalent set here
 * @return true if for the given competence we have in the {@link #getCompetences()} any competence with the same name and
 *         description (whitespace tolerant)
 */
public boolean hasEquivalentCompetence(Competence competence) {
    String competenceProcessedDescription = StringUtils.deleteWhitespace(competence.getDescription());
    String competenceProcessedName = StringUtils.deleteWhitespace(competence.getName());
    for (Competence availableCompetence : getCompetences()) {
        if (StringUtils.equalsIgnoreCase(StringUtils.deleteWhitespace(availableCompetence.getDescription()),
                competenceProcessedDescription)) {
            return true;
        }
    }
    return false;
}

From source file:com.microsoft.alm.plugin.idea.tfvc.core.TFSHistoryProvider.java

private static String getServerPath(final ChangeSet changeSet, final FilePath localPath) {
    if (changeSet != null && changeSet.getChanges().size() > 0 && localPath != null) {
        for (final PendingChange pc : changeSet.getChanges()) {
            if (StringUtils.equalsIgnoreCase(pc.getLocalItem(), localPath.getPath())) {
                return pc.getServerItem();
            }/*  w w w .j  a v  a2  s. c o  m*/
        }
    }

    return null;
}

From source file:de.hybris.platform.secureportaladdon.cockpit.config.impl.TaskCellRenderer.java

/**
 * @return True if this action is part of the B2B registration process, false otherwise
 *///from  w  ww  .j  a  va 2  s .c o  m
protected boolean isB2BRegistrationWorkflowAction(final WorkflowActionModel action) {
    return StringUtils.equalsIgnoreCase(action.getTemplate().getCode(),
            SecureportaladdonConstants.Workflows.Actions.REGISTRATION_APPROVAL);
}

From source file:hydrograph.ui.engine.ui.converter.UiConverter.java

/**
 * Replace the default values by parameters that were generated while parsing the engine xml.
 * /*from w  ww .jav  a 2 s  . co  m*/
 * @param propertyName
 * @return String
 */
protected String getValue(String propertyName) {
    LOGGER.debug("Getting Parameter for - {}", propertyName);
    List<ParameterData> parameterList = currentRepository.getParammeterFactory().get(componentId);
    if (parameterList != null) {
        for (ParameterData param : parameterList) {
            if (StringUtils.equalsIgnoreCase(param.getPropertyName(), propertyName)) {
                return param.getParameterName();
            }
        }
    }

    return null;
}

From source file:adalid.util.sql.SqlMerger.java

private String defaultProjectAlias() {
    boolean oracle = StringUtils.equalsIgnoreCase(_dbms, "oracle");
    return (oracle ? _schema : _database).toLowerCase();
}

From source file:com.edgenius.wiki.ext.todo.model.Todo.java

/**
 * Set Status string, which will replace old statuses if existing or added into status list.
 * /*from  w  w  w .j  av  a 2 s.  co m*/
 * @param statusString
 */
public void setStatusString(String statusString, String deleteAction) {
    if (StringUtils.isBlank(statusString)) {
        statusString = TodoMacro.DEFAULT_STATUS;
        deleteAction = TodoMacro.DEFAULT_DELETE_ON;
    }

    statuses = new ArrayList<TodoStatus>();

    //Normally, status separated by comma, however, status can not include space because it will use as HTML "class" attribute
    //so, here also split it by space, means, status can be separated by comma and space. 
    String[] list = statusString.split("[, ]+");

    //sequence from large to short
    int idx = 0;
    for (String str : list) {
        TodoStatus status = new TodoStatus();
        status.setText(str);
        status.setSequence(idx);
        status.setPersisted(true);
        status.setDeleteAction(StringUtils.equalsIgnoreCase(deleteAction, str));
        statuses.add(status);
        idx++;
    }

}

From source file:com.archsystemsinc.ipms.sec.webapp.controller.ReportsController.java

private void getProject(final Model model, HttpServletRequest request, Long id) {
    Project project = projectService.findOne(id);
    request.setAttribute("projectId", id);
    model.addAttribute("projects", projectService.findAll());
    final List<Issue> issues = new ArrayList<Issue>();

    issues.addAll(project.getIssues());/* ww  w.j  av a 2s.c  o  m*/
    int openProgressIssues = 0;
    for (Issue issue : issues) {
        if (StringUtils.equalsIgnoreCase(issue.getStatus(), IssueStatus.Open.toString())
                || StringUtils.equalsIgnoreCase(issue.getStatus(), IssueStatus.In_Progress.toString())) {
            openProgressIssues++;
        }
    }

    double issueResolutionRate = 0;
    if (issues != null && issues.size() > 0)
        issueResolutionRate = openProgressIssues / issues.size();
    DecimalFormat formatter = new DecimalFormat("0.00");
    formatter.format(issueResolutionRate);
    model.addAttribute("issues", project.getIssues());
    model.addAttribute("issueResolutionRate", issueResolutionRate);
    final List<ActionItem> actionItems = new ArrayList<ActionItem>();
    actionItems.addAll(project.getActionItems());
    Collections.sort(actionItems);
    int openProgressActionItems = 0;
    for (ActionItem actionItem : actionItems) {
        if (StringUtils.equalsIgnoreCase(actionItem.getStatus(), IssueStatus.Open.toString())
                || StringUtils.equalsIgnoreCase(actionItem.getStatus(), IssueStatus.In_Progress.toString())) {
            openProgressActionItems++;
        }
    }
    double actionItemResolutionRate = 0;
    if (actionItems != null && actionItems.size() > 0)

        actionItemResolutionRate = openProgressActionItems / actionItems.size();
    formatter.format(issueResolutionRate);
    model.addAttribute("issues", project.getIssues());
    model.addAttribute("actionItems", project.getActionItems());
    model.addAttribute("actionItemResolutionRate", actionItemResolutionRate);
    model.addAttribute("lessonsLearned", project.getLessonsLearned());
    model.addAttribute("risks", project.getRisks());

    final List<Meeting> meetings = meetingService.findAll();
    model.addAttribute("meetings", meetings);
}

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

protected <T> T toObjectType(String data, Class<T> klass) {
    data = StringUtils.trim(data);//from ww w  . j a  v a  2s . c  o  m

    if (Double.class.equals(klass)) {
        try {
            return klass.cast(Double.parseDouble(data));
        } catch (NumberFormatException ex) {
            return null;
        }
    } else if (Long.class.equals(klass)) {
        try {
            return klass.cast(Long.parseLong(data));
        } catch (NumberFormatException ex) {
            return null;
        }
    } else if (Integer.class.equals(klass)) {
        try {
            return klass.cast(Long.parseLong(data));
        } catch (NumberFormatException ex) {
            return null;
        }
    } else if (StringUtils.equalsIgnoreCase("true", data) && Boolean.class.equals(klass)) {
        return klass.cast(Boolean.TRUE);
    } else if (StringUtils.equalsIgnoreCase("false", data) && Boolean.class.equals(klass)) {
        return klass.cast(Boolean.FALSE);
    } else if (Date.class.equals(klass) || Calendar.class.equals(klass)) {
        return klass.cast(ISODateTimeFormat.dateTimeParser().parseDateTime(data).toCalendar(Locale.US));
    } else {
        return klass.cast(data);
    }
}

From source file:com.sfs.whichdoctor.webservice.RotationXmlOutputImpl.java

/**
 * Builds a list of rotations in the first-gen XML format.
 *
 * @param rotations the rotation array//from  ww  w.j  a  v  a 2s  .  com
 * @param personIdentifier the person identifier
 * @param division the division
 *
 * @return the rotations in the legacy XML format
 */
public final String getFirstGenRotations(final List<RotationBean> rotations, final int personIdentifier,
        final String division) {

    int totalApprovedCore = 0;
    int totalApprovedNonCore = 0;
    int totalCertifiedCore = 0;
    int totalCertifiedNonCore = 0;
    int totalEligibleUnits = 0;
    int rotationCount = 0;
    double trainingTime = 0;

    Collection<RotationBean> basicRotations = new ArrayList<RotationBean>();
    Collection<Element> rtnsXml = new ArrayList<Element>();

    // Only the basic training rotations are required for legacy output
    for (RotationBean rtn : rotations) {
        if (StringUtils.equalsIgnoreCase(rtn.getRotationType(), "Basic Training")) {
            basicRotations.add(rtn);
        }
    }

    for (RotationBean rtn : basicRotations) {

        int approvedCore = 0;
        int approvedNonCore = 0;
        int certifiedCore = 0;
        int certifiedNonCore = 0;

        int eligibleUnits = (int) Formatter.round((rtn.getTotalDays() / WORKING_DAYS), 0);

        totalEligibleUnits += eligibleUnits;

        if (rtn.getAccreditation() != null) {
            for (AccreditationBean acn : rtn.getAccreditation()) {
                if (acn.getCore()) {
                    approvedCore += acn.getWeeksApproved();
                    certifiedCore += acn.getWeeksCertified();
                } else {
                    approvedNonCore += acn.getWeeksApproved();
                    certifiedNonCore += acn.getWeeksCertified();
                }
            }
        }
        rotationCount++;

        totalApprovedCore += approvedCore;
        totalApprovedNonCore += approvedNonCore;
        totalCertifiedCore += certifiedCore;
        totalCertifiedNonCore += certifiedNonCore;

        Calendar startDate = Calendar.getInstance();
        Calendar endDate = Calendar.getInstance();
        if (rtn.getStartDate() != null) {
            startDate.setTime(rtn.getStartDate());
        }
        if (rtn.getEndDate() != null) {
            endDate.setTime(rtn.getEndDate());
        }

        // Add to the total training time
        trainingTime += rtn.getTrainingTime();

        Map<Integer, RelationshipBean> supervisors = this.relationshipDAO.getSupervisorMap(rtn);

        rtnsXml.add(RotationXmlHelper.getFirstGenRotationInfo(rtn, division, startDate, endDate, approvedCore,
                approvedNonCore, certifiedCore, certifiedNonCore, eligibleUnits, supervisors,
                this.relationshipMapping));
    }

    if (rotationCount > 0) {
        trainingTime = Formatter.round(trainingTime / rotationCount * PERCENTAGE_MULTIPLIER, 2);
    }

    Element xml = new Element("rotations");
    xml.setAttribute("min", String.valueOf(personIdentifier));

    xml.addContent(new Element("timeperc").setText(String.valueOf(trainingTime)));
    String partfull = "Part-time";
    if (trainingTime >= PERCENTAGE_MULTIPLIER) {
        partfull = "Full-time";
    }
    xml.addContent(new Element("partfull").setText(partfull));

    xml.addContent(new Element("totalcoreunits").setText(String.valueOf(totalApprovedCore)));
    xml.addContent(new Element("totalnoncoreunits").setText(String.valueOf(totalApprovedNonCore)));

    xml.addContent(new Element("totalaccredcoreunits").setText(String.valueOf(totalCertifiedCore)));
    xml.addContent(new Element("totalaccrednoncoreunits").setText(String.valueOf(totalCertifiedNonCore)));

    xml.addContent(new Element("totaleligunits").setText(String.valueOf(totalEligibleUnits)));

    xml.addContent(new Element("unitmeasure").setText("weeks"));
    xml.addContent(rtnsXml);

    XMLOutputter outputter = new XMLOutputter();
    Format format = Format.getCompactFormat();
    format.setOmitDeclaration(true);

    outputter.setFormat(format);

    return outputter.outputString(new Document(xml));
}