Example usage for org.apache.commons.lang StringUtils equals

List of usage examples for org.apache.commons.lang StringUtils equals

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils equals.

Prototype

public static boolean equals(String str1, String str2) 

Source Link

Document

Compares two Strings, returning true if they are equal.

Usage

From source file:io.github.jeddict.jcode.util.PersistenceUtil.java

public static void removeProperty(PersistenceUnit punit, String key) {
    if (punit.getProperties() != null || punit.getProperties().getProperty2() != null) {
        Arrays.stream(punit.getProperties().getProperty2()).filter(p1 -> StringUtils.equals(p1.getName(), key))
                .findAny().ifPresent(p1 -> punit.getProperties().removeProperty2(p1));
    }//from w w w .  ja  v  a2  s . c  o  m
}

From source file:com.gantzgulch.sharing.matchers.UserMatcher.java

public static Matcher<List<User>> containsId(final String id) {
    return new BaseMatcher<List<User>>() {

        @Override//w  w  w. j a  v a2 s.  c om
        public boolean matches(Object arg0) {
            List<User> users = Cast.cast(arg0);
            return Iterables.any(users, new Predicate<User>() {
                @Override
                public boolean apply(User input) {
                    return StringUtils.equals(input.getId(), id);
                }
            });
        }

        @Override
        public void describeTo(Description arg0) {
            arg0.appendText("User with id : " + id);
        }
    };
}

From source file:com.apexxs.neonblack.scoring.Scorer.java

public List<DetectedLocation> score(List<DetectedLocation> locs) {
    StringScorers ss = new StringScorers();

    for (DetectedLocation loc : locs) {
        if (StringUtils.equals(loc.detectedBy, "RGX"))
            continue;

        if (loc.geoNamesEntries.size() > 0) {
            String detectedName;/*from w  ww  . j a  v a2s .co m*/
            if (!StringUtils.isEmpty(loc.synonym)) {
                detectedName = loc.synonym;
            } else {
                detectedName = loc.name;
            }

            for (GeoNamesEntry entry : loc.geoNamesEntries) {
                Float levenshtein = ss.getLevenshtien(detectedName, entry.name);
                entry.setLevenshteinScore(levenshtein);
            }
        }
    }
    return locs;
}

From source file:com.pedra.storefront.forms.validation.GuestRegisterValidator.java

@Override
public void validate(final Object object, final Errors errors) {
    final GuestRegisterForm guestRegisterForm = (GuestRegisterForm) object;
    final String newPasswd = guestRegisterForm.getPwd();
    final String checkPasswd = guestRegisterForm.getCheckPwd();

    if (StringUtils.isNotEmpty(newPasswd) && StringUtils.isNotEmpty(checkPasswd)
            && !StringUtils.equals(newPasswd, checkPasswd)) {
        errors.rejectValue("checkPwd", "validation.checkPwd.equals");
    } else {/*from ww  w .  j a  v a 2 s  .  c  o m*/
        if (StringUtils.isEmpty(newPasswd)) {
            errors.rejectValue("pwd", "register.pwd.invalid");
        } else if (StringUtils.length(newPasswd) < 6 || StringUtils.length(newPasswd) > 255) {
            errors.rejectValue("pwd", "register.pwd.invalid");
        }

        if (StringUtils.isEmpty(checkPasswd)) {
            errors.rejectValue("checkPwd", "register.checkPwd.invalid");
        } else if (StringUtils.length(checkPasswd) < 6 || StringUtils.length(checkPasswd) > 255) {
            errors.rejectValue("checkPwd", "register.checkPwd.invalid");
        }
    }
}

From source file:acromusashi.stream.topology.state.StormSummaryExtractor.java

/**
 * ?????????ID?//from w w  w  .  j  a v  a2s.com
 *
 * @param clusterSummary 
 * @param topologyName ???
 * @return ??????ID?????null?
 */
public static String extractStormTopologyId(ClusterSummary clusterSummary, String topologyName) {

    List<TopologySummary> topologyList = clusterSummary.get_topologies();

    for (TopologySummary targetTopology : topologyList) {
        // ?????????ID?
        if (StringUtils.equals(topologyName, targetTopology.get_name()) == true) {
            return targetTopology.get_id();
        }
    }

    return null;
}

From source file:com.sfs.whichdoctor.export.prepare.RevenueAnalysisExportHandler.java

/**
 * Gets the display options./*from   w ww .j  a  v  a  2s . c  om*/
 *
 * @param request the request
 *
 * @return the display options
 */
public final BuilderBean getDisplayOptions(final HttpServletRequest request) {
    BuilderBean display = new BuilderBean();

    String revenueType = request.getParameter("RevenueType");
    if (StringUtils.equals(revenueType, "batchAnalysis")) {
        display.setParameter("Batch Number", true);
    }
    if (StringUtils.equals(revenueType, "streamAnalysis")) {
        display.setParameter("Revenue Stream", true);
    }
    display.setParameter("Total Revenue Value", true);
    display.setParameter("GST Breakdown", true);
    display.setParameter("Total Revenue", true);

    // Set payments display bean
    BuilderBean payments = new BuilderBean();
    payments.setParameter("MIN", true);
    payments.setParameter("Person Issued To", true);
    payments.setParameter("Organisation Issued To", true);
    payments.setParameter("Prefix", true);
    payments.setParameter("Receipt Number", true);
    payments.setParameter("Type", true);
    payments.setParameter("Description", true);
    payments.setParameter("Batch Number", true);
    payments.setParameter("Issued Date", true);
    payments.setParameter("Cancelled", true);
    payments.setParameter("Debit Prefix", true);
    payments.setParameter("Debit Number", true);
    payments.setParameter("Debit Issued", true);
    payments.setParameter("Debit Description", true);
    payments.setParameter("Debit Value", true);
    payments.setParameter("Debit GST Value", true);
    payments.setParameter("Debit Total Value", true);
    payments.setParameter("Payment Value", true);
    payments.setParameter("Debit Cancelled", true);
    payments.setParameter("Debit GST Rate", true);
    payments.setParameter("Negative Payment", true);
    display.addSection("Payments", payments);

    return display;
}

From source file:gov.nih.nci.cabig.caaers.tools.editors.AbstractStudyDiseaseEditor.java

@Override
public void setAsText(String text) throws IllegalArgumentException {
    for (AbstractStudyDisease<? extends DomainObject> disease : diseases) {
        if (StringUtils.equals(text, disease.getId().toString())) {
            setValue(disease);//from   w  ww . java2s  .  c o m
            return;
        }
    }
    setValue(null);
}

From source file:com.switchfly.compress.Asset.java

@Override
public boolean equals(Object o) {
    if (!(o instanceof Asset)) {
        return false;
    }/*from ww w.j a  va2 s  .c o  m*/
    Asset asset = (Asset) o;
    return StringUtils.equals(getUrl(), asset.getUrl());
}

From source file:de.hybris.platform.acceleratorstorefrontcommons.forms.validation.UpdatePasswordFormValidator.java

@Override
public void validate(Object object, Errors errors) {
    final UpdatePwdForm updatePasswordForm = (UpdatePwdForm) object;
    final String newPassword = updatePasswordForm.getPwd();
    final String checkPassword = updatePasswordForm.getCheckPwd();

    if (StringUtils.isNotEmpty(newPassword) && StringUtils.isNotEmpty(checkPassword)
            && !StringUtils.equals(newPassword, checkPassword)) {
        errors.rejectValue("checkPwd", "validation.checkPwd.equals");
    } else if (StringUtils.isEmpty(checkPassword)) {
        errors.rejectValue("checkPwd", "updatePwd.checkPwd.invalid");
    }//ww w  . j  a  va 2s.c o m
}

From source file:com.dp2345.controller.admin.ProfileController.java

/**
 * ???//  ww  w .java2  s .com
 */
@RequestMapping(value = "/check_current_password", method = RequestMethod.GET)
public @ResponseBody boolean checkCurrentPassword(String currentPassword) {
    if (StringUtils.isEmpty(currentPassword)) {
        return false;
    }
    Admin admin = adminService.getCurrent();
    if (StringUtils.equals(DigestUtils.md5Hex(currentPassword), admin.getPassword())) {
        return true;
    } else {
        return false;
    }
}