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.dp2345.service.impl.MemberServiceImpl.java

@Transactional(readOnly = true)
public boolean emailUnique(String previousEmail, String currentEmail) {
    if (StringUtils.equalsIgnoreCase(previousEmail, currentEmail)) {
        return true;
    } else {/*from   w  w w.j a  va2 s.c o  m*/
        if (memberDao.emailExists(currentEmail)) {
            return false;
        } else {
            return true;
        }
    }
}

From source file:com.microsoft.alm.plugin.idea.common.starters.VstsStarter.java

@Override
protected void processUri(final String uri) throws RuntimeException, UnsupportedEncodingException {
    final String[] args = uri.split("/\\?");

    if (args.length != 2) {
        throw new RuntimeException(TfPluginBundle.message(TfPluginBundle.STARTER_ERRORS_MALFORMED_URI));
    }//from  w  w w .  j  a  va2  s. co m

    final String command = args[0];
    final Map<String, String> attributes = parseUri(args[1]);

    // can be expanded upon if more commands are added
    StarterBase starter;
    if (StringUtils.equalsIgnoreCase(SimpleCheckoutStarter.SUB_COMMAND_NAME, command)) {
        starter = SimpleCheckoutStarter.createWithUriAttributes(attributes);
    } else {
        throw new RuntimeException(
                TfPluginBundle.message(TfPluginBundle.STARTER_ERRORS_SUB_COMMAND_NOT_RECOGNIZED, command));
    }
    starter.processCommand();
}

From source file:com.microsoft.alm.plugin.external.models.ItemInfo.java

public boolean isFolder() {
    return !StringUtils.equalsIgnoreCase(type, "file");
}

From source file:net.shopxx.service.impl.MerchantServiceImpl.java

@Transactional(readOnly = true)
public boolean emailUnique(String previousEmail, String currentEmail) {
    if (StringUtils.equalsIgnoreCase(previousEmail, currentEmail)) {
        return true;
    } else {//from  w  ww.j a  va 2s  . c o m
        if (merchantDao.emailExists(currentEmail)) {
            return false;
        } else {
            return true;
        }
    }
}

From source file:io.github.mywarp.mywarp.command.util.Matches.java

private Matches(String query, Iterable<E> elements, Function<E, String> stringFunction,
        Comparator<E> comparator) {
    for (E element : elements) {
        String toTest = stringFunction.apply(element);
        if (toTest == null) {
            continue;
        }/*from   w ww .ja  v a 2 s.co  m*/

        if (toTest.equals(query)) {
            equalMatches.add(element);
        } else if (StringUtils.equalsIgnoreCase(toTest, query)) {
            equalIgnoreCaseMatches.add(element);
        } else if (toTest.contains(query)) {
            containsMatches.add(element);
        } else if (StringUtils.containsIgnoreCase(toTest, query)) {
            containsIgnoreCaseMatches.add(element);
        }
    }

    equalMatches.sort(comparator);
    equalIgnoreCaseMatches.sort(comparator);
    containsMatches.sort(comparator);
    containsIgnoreCaseMatches.sort(comparator);
}

From source file:com.microsoft.alm.plugin.external.commands.StatusCommand.java

/**
 * Parses the output of the status command when formatted as xml.
 * SAMPLE/*from   ww w.  java  2 s.  c om*/
 * <?xml version="1.0" encoding="utf-8"?>
 * <status>
 * <pending-changes/>
 * <candidate-pending-changes>
 * <pending-change server-item="$/tfsTest_01/test.txt" version="0" owner="jason" date="2016-07-13T12:36:51.060-0400" lock="none" change-type="add" workspace="MyNewWorkspace2" computer="JPRICKET-DEV2" local-item="D:\tmp\test\test.txt"/>
 * </candidate-pending-changes>
 * </status>
 */
@Override
public List<PendingChange> parseOutput(final String stdout, final String stderr) {
    super.throwIfError(stderr);
    final List<PendingChange> changes = new ArrayList<PendingChange>(100);
    final NodeList nodes = super.evaluateXPath(stdout, "/status/*/pending-change");

    // Convert all the xpath nodes to pending change models
    if (nodes != null) {
        for (int i = 0; i < nodes.getLength(); i++) {
            final NamedNodeMap attributes = nodes.item(i).getAttributes();
            final boolean isCandidate = StringUtils
                    .equalsIgnoreCase(nodes.item(i).getParentNode().getNodeName(), CANDIDATE_TAG);
            final Node sourceItem = attributes.getNamedItem("source-item"); // not always present
            changes.add(new PendingChange(attributes.getNamedItem("server-item").getNodeValue(),
                    attributes.getNamedItem("local-item").getNodeValue(),
                    attributes.getNamedItem("version").getNodeValue(),
                    attributes.getNamedItem("owner").getNodeValue(),
                    attributes.getNamedItem("date").getNodeValue(),
                    attributes.getNamedItem("lock").getNodeValue(),
                    attributes.getNamedItem("change-type").getNodeValue(),
                    attributes.getNamedItem("workspace").getNodeValue(),
                    attributes.getNamedItem("computer").getNodeValue(), isCandidate,
                    sourceItem != null ? sourceItem.getNodeValue() : StringUtils.EMPTY));
        }
    }
    return changes;
}

From source file:com.sfs.whichdoctor.formatter.TrainingStatusFormatter.java

public static String getField(final TrainingStatusBean status, final TrainingStatusAnalysisBean trainingStatus,
        final String field, final String format, final PreferencesBean preferences) {

    String value = "";

    if (status == null || field == null) {
        return value;
    }//from  w  ww.  ja  v  a  2s  . c om

    PersonBean person = new PersonBean();
    if (status.getPerson() != null) {
        person = status.getPerson();
    }

    if (field.compareTo("MIN") == 0) {
        value = String.valueOf(person.getPersonIdentifier());
    }
    if (field.compareTo("Person's Name") == 0) {
        value = OutputFormatter.toCasualName(person);
    }
    if (field.compareTo("Preferred Name") == 0) {
        value = person.getPreferredName();
    }
    if (field.compareTo("Last Name") == 0) {
        value = person.getLastName();
    }
    if (field.compareTo("Membership Status") == 0) {
        value = person.getMembershipField("Status");
    }
    if (field.compareTo("Division") == 0) {
        value = person.getMembershipField("Division");
    }
    if (field.compareTo("Membership Type") == 0) {
        value = person.getMembershipField("Membership Type");
    }
    if (field.compareTo("Training Type") == 0) {
        value = person.getMembershipField("Training Type");
    }

    if (field.compareTo("Training Program") == 0) {
        value = status.getTrainingOrganisation() + " - " + status.getTrainingProgram();
    }

    if (field.compareTo("Training Year") == 0) {
        value = String.valueOf(status.getYear());
    }

    if (field.compareTo("PREP/pre-PREP") == 0) {
        value = Formatter.convertBoolean(status.isPrep());
    }

    if (field.compareTo("Online Tools") == 0) {
        StringBuilder sb = new StringBuilder();

        if (status.getOnlineToolsStatus() != null) {
            for (String key : status.getOnlineToolsStatus().keySet()) {
                OnlineToolStatus ot = status.getOnlineToolsStatus().get(key);

                if (sb.length() > 0) {
                    if (StringUtils.equalsIgnoreCase(format, "html")) {
                        sb.append("<br />");
                    } else {
                        sb.append(", ");
                    }
                }

                sb.append(ot.getName());
                sb.append(": ");
                sb.append(ot.getCompletedCount());
                sb.append(" / ");
                sb.append(ot.getRequiredCount());
            }
        }
        value = sb.toString();
    }

    if (field.compareTo("AT: Interim Report(s) I") == 0) {
        value = getReportsByType(status, "Interim Report 1", format);
    }

    if (field.compareTo("AT: Final Supervisor Report(s)") == 0) {
        value = getReportsByType(status, "Final Report", format);
    }

    if (field.compareTo("AT: Trainee's Report(s)") == 0) {
        value = getReportsByType(status, "Trainee's Report (NZ)", format);
    }

    if (field.compareTo("BT: Mid-Year Progress Report(s)") == 0) {
        value = getReportsByType(status, "Mid Year Report", format);
    }

    if (field.compareTo("BT: Annual Progress Report(s)") == 0) {
        value = getReportsByType(status, "Annual Progress Report", format);
    }

    if (field.compareTo("Written Exams") == 0) {
        value = getExamsByType(status, "Written Exam", format);
    }

    if (field.compareTo("Clinical Exams") == 0) {
        value = getExamsByType(status, "Clinical Exam", format);
    }

    if (field.compareTo("Manual Assessments") == 0) {
        StringBuilder sb = new StringBuilder();

        if (status.getAssessmentsStatus() != null) {
            for (String key : status.getAssessmentsStatus().keySet()) {
                AssessmentStatus as = status.getAssessmentsStatus().get(key);

                if (sb.length() > 0) {
                    if (StringUtils.equalsIgnoreCase(format, "html")) {
                        sb.append("<br />");
                    } else {
                        sb.append(", ");
                    }
                }

                sb.append(as.getAssessmentType());
                if (StringUtils.isNotBlank(as.getProjectType())) {
                    sb.append(" - ");
                    sb.append(as.getProjectType());
                }
                sb.append(": ");
                sb.append(as.getSubmissionCount());
                sb.append(" / ");
                sb.append(as.getRequiredCount());
            }
        }
        value = sb.toString();
    }

    if (value == null) {
        value = "";
    }

    return value;
}

From source file:com.dp2345.service.impl.ProductServiceImpl.java

@Transactional(readOnly = true)
public boolean snUnique(String previousSn, String currentSn) {
    if (StringUtils.equalsIgnoreCase(previousSn, currentSn)) {
        return true;
    } else {//w  ww . ja  va2s . co  m
        if (productDao.snExists(currentSn)) {
            return false;
        } else {
            return true;
        }
    }
}

From source file:com.dp2345.service.impl.ShopServiceImpl.java

@Transactional(readOnly = true)
public boolean emailUnique(String previousEmail, String currentEmail) {
    if (StringUtils.equalsIgnoreCase(previousEmail, currentEmail)) {
        return true;
    } else {//from  w  ww  . j  av  a  2  s . com
        if (shopDao.emailExists(currentEmail)) {
            return false;
        } else {
            return true;
        }
    }
}

From source file:com.edgenius.wiki.render.impl.LinkReplacerFilter.java

@Override
public void replace(StringBuffer buffer, MatchResult result, RenderContext context) {
    LinkModel link = getLinkModel(result, context.getCurrentRegion());
    LinkReplacer replacer = (LinkReplacer) context.getGlobalParam(LinkReplacer.class.getName());

    if (replacer.getType() == WikiConstants.AUTO_FIX_COPY_LINK) {
        //change spaceUname: append @spaceUname after link
        if (StringUtils.isBlank(link.getSpaceUname())
                || StringUtils.equals(link.getSpaceUname(), replacer.getFromSpaceUname())) {
            buffer.append(getLink(replacer.getFromSpaceUname(), link));
            return;
        }//from   ww w.  j a  v  a 2  s  . c  om
    } else if (replacer.getType() == WikiConstants.AUTO_FIX_TITLE_CHANGE_LINK) {
        //change pageTitle: change old title to new one

        //link has not assign space, then from(content's space) must be same with the space of updated title page 
        if (((StringUtils.isBlank(link.getSpaceUname())
                && StringUtils.equalsIgnoreCase(replacer.getFromSpaceUname(), replacer.getToSpaceUname()))
                //if assigned space, then it must be same with the space of updated title page
                || StringUtils.equalsIgnoreCase(link.getSpaceUname(), replacer.getToSpaceUname()))
                //title must be same
                && StringUtils.equalsIgnoreCase(StringUtils.trim(link.getLink()),
                        StringUtils.trim(replacer.getOldTitle()))) {
            link.setLink(replacer.getNewTitle());
            buffer.append(getLink(null, link));
            return;
        }
    }

    String body;
    //append original text if no change
    if (context.getCurrentRegion() != null) {
        body = context.getCurrentRegion().getBody();
    } else {
        body = result.group(0);
    }

    buffer.append(body);

}