Example usage for org.apache.commons.lang3 StringUtils equalsIgnoreCase

List of usage examples for org.apache.commons.lang3 StringUtils equalsIgnoreCase

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils equalsIgnoreCase.

Prototype

public static boolean equalsIgnoreCase(final CharSequence str1, final CharSequence str2) 

Source Link

Document

Compares two CharSequences, returning true if they represent equal sequences of characters, ignoring case.

null s are handled without exceptions.

Usage

From source file:com.hybris.mobile.lib.commerce.data.product.ProductBase.java

public boolean isLowStock() {
    return stock != null && stock.getStockLevelStatus() != null
            && StringUtils.equalsIgnoreCase(stock.getStockLevelStatus(), StockLevelEnum.LOW_STOCK.getStatus());
}

From source file:com.nridge.ds.solr.SolrSchemaXML.java

private Field.Type mapSolrFieldType(String aSolrFieldType) {
    if (StringUtils.equalsIgnoreCase(aSolrFieldType, "int"))
        return Field.Type.Integer;
    else if (StringUtils.equalsIgnoreCase(aSolrFieldType, "long"))
        return Field.Type.Long;
    else if (StringUtils.equalsIgnoreCase(aSolrFieldType, "float"))
        return Field.Type.Float;
    else if (StringUtils.equalsIgnoreCase(aSolrFieldType, "double"))
        return Field.Type.Double;
    else if (StringUtils.equalsIgnoreCase(aSolrFieldType, "boolean"))
        return Field.Type.Boolean;
    else if ((StringUtils.equalsIgnoreCase(aSolrFieldType, "date"))
            || (StringUtils.equalsIgnoreCase(aSolrFieldType, "time")))
        return Field.Type.DateTime;
    else/*from   w ww. ja  v a2s  .com*/
        return Field.Type.Text;
}

From source file:com.hybris.mobile.lib.commerce.data.product.ProductBase.java

public boolean isInStock() {
    return stock != null && stock.getStockLevelStatus() != null
            && StringUtils.equalsIgnoreCase(stock.getStockLevelStatus(), StockLevelEnum.IN_STOCK.getStatus());
}

From source file:com.bekwam.resignator.model.ConfigurationDataSourceImpl.java

@Override
public void renameProfile(String oldProfileName, String newProfileName) throws IOException {

    if (logger.isDebugEnabled()) {
        logger.debug("[RENAME] old={}, new={}", oldProfileName, newProfileName);
    }//ww  w .ja va  2  s  .  c  o m

    //
    // if needed, rename the item in recent profiles
    //
    for (int i = 0; i < activeConf.getRecentProfiles().size(); i++) {
        if (StringUtils.equalsIgnoreCase(activeConf.getRecentProfiles().get(i), oldProfileName)) {
            if (logger.isDebugEnabled()) {
                logger.debug("[RENAME] renaming item in recent profiles");
            }
            activeConf.getRecentProfiles().set(i, newProfileName);
        }
    }

    if (StringUtils.equalsIgnoreCase(activeProfile.getProfileName(), oldProfileName)) {

        if (logger.isDebugEnabled()) {
            logger.debug("[RENAME] renaming the active profile");
        }
        //
        // rename the active profilename property
        //
        activeProfile.setProfileName(newProfileName);

        //
        // save everything to disk
        //
        saveProfile();

    } else {

        if (logger.isDebugEnabled()) {
            logger.debug("[RENAME] renaming profile that is NOT the active profile");
        }

        //
        // rename target is not the active record; save directly to dao
        //

        if (configuration.isPresent()) {
            for (int j = 0; j < configuration.get().getProfiles().size(); j++) {
                Profile p = configuration.get().getProfiles().get(j);
                if (StringUtils.equalsIgnoreCase(p.getProfileName(), oldProfileName)) {
                    Profile np = new Profile(newProfileName, p.getReplaceSignatures(), p.getArgsType());
                    np.setSourceFile(p.getSourceFile());
                    np.setTargetFile(p.getTargetFile());
                    np.setJarsignerConfig(p.getJarsignerConfig());
                    configuration.get().getProfiles().set(j, np);
                    saveConfiguration();
                    break;
                }
            }
        }
    }
}

From source file:mailbox.EmailHandler.java

private static Set<Project> getProjects(IMAPMessage msg, User sender, List<String> errors)
        throws MessagingException {
    Set<Project> projects = new HashSet<>();
    for (EmailAddressWithDetail address : getMailAddressesToYobi(msg.getAllRecipients())) {
        Project project;/*from w w  w. j a  v  a  2  s  .  c o  m*/
        String detail = address.getDetail();

        if (StringUtils.isEmpty(detail)) {
            // TODO: Do we need send help message?
            continue;
        }

        Lang lang = Lang.apply(sender.getPreferredLanguage());

        if (StringUtils.equalsIgnoreCase(detail, "help")) {
            reply(msg, sender, getHelpMessage(lang, sender));
            continue;
        }

        try {
            project = getProjectFromDetail(detail);
        } catch (IllegalDetailException e) {
            errors.add(Messages.get(lang, "viaEmail.error.email", address.toString()));
            continue;
        }

        if (project == null || !AccessControl.isAllowed(sender, project.asResource(), Operation.READ)) {
            errors.add(Messages.get(lang, "viaEmail.error.forbidden.or.notfound", address.toString()));
            continue;
        }

        projects.add(project);
    }
    return projects;
}

From source file:com.nridge.core.base.io.xml.DocumentOpXML.java

/**
 * Parses an XML DOM element and loads it into a document list.
 *
 * @param anElement DOM element.//from w  w w  . ja  v  a 2s. c o  m
 * @throws java.io.IOException I/O related exception.
 */
@Override
public void load(Element anElement) throws IOException {
    String nodeName = anElement.getNodeName();
    if (StringUtils.equalsIgnoreCase(nodeName, IO.XML_OPERATION_NODE_NAME))
        loadOperation(anElement);
}

From source file:com.liferay.google.GoogleOAuth.java

protected User updateUser(User user, Userinfoplus userinfo) throws Exception {

    String emailAddress = userinfo.getEmail();
    String firstName = userinfo.getGivenName();
    String lastName = userinfo.getFamilyName();
    boolean male = Validator.equals(userinfo.getGender(), "male");

    if (emailAddress.equals(user.getEmailAddress()) && firstName.equals(user.getFirstName())
            && lastName.equals(user.getLastName()) && (male == user.isMale())) {

        return user;
    }//from  w  w w . jav  a 2 s .c  om

    Contact contact = user.getContact();

    Calendar birthdayCal = CalendarFactoryUtil.getCalendar();

    birthdayCal.setTime(contact.getBirthday());

    int birthdayMonth = birthdayCal.get(Calendar.MONTH);
    int birthdayDay = birthdayCal.get(Calendar.DAY_OF_MONTH);
    int birthdayYear = birthdayCal.get(Calendar.YEAR);

    long[] groupIds = null;
    long[] organizationIds = null;
    long[] roleIds = null;
    List<UserGroupRole> userGroupRoles = null;
    long[] userGroupIds = null;

    ServiceContext serviceContext = new ServiceContext();

    if (!StringUtils.equalsIgnoreCase(emailAddress, user.getEmailAddress())) {

        UserLocalServiceUtil.updateEmailAddress(user.getUserId(), StringPool.BLANK, emailAddress, emailAddress);
    }

    UserLocalServiceUtil.updateEmailAddressVerified(user.getUserId(), true);

    return UserLocalServiceUtil.updateUser(user.getUserId(), StringPool.BLANK, StringPool.BLANK,
            StringPool.BLANK, false, user.getReminderQueryQuestion(), user.getReminderQueryAnswer(),
            user.getScreenName(), emailAddress, 0, user.getOpenId(), user.getLanguageId(), user.getTimeZoneId(),
            user.getGreeting(), user.getComments(), firstName, user.getMiddleName(), lastName,
            contact.getPrefixId(), contact.getSuffixId(), male, birthdayMonth, birthdayDay, birthdayYear,
            contact.getSmsSn(), contact.getAimSn(), contact.getFacebookSn(), contact.getIcqSn(),
            contact.getJabberSn(), contact.getMsnSn(), contact.getMySpaceSn(), contact.getSkypeSn(),
            contact.getTwitterSn(), contact.getYmSn(), contact.getJobTitle(), groupIds, organizationIds,
            roleIds, userGroupRoles, userGroupIds, serviceContext);
}

From source file:com.nridge.ds.solr.SolrSchemaXML.java

private void assignSolrFieldFeature(DataField aField, String aName, String aValue) {
    if (StringUtils.equalsIgnoreCase(aName, "indexed")) {
        if (StrUtl.stringToBoolean(aValue))
            aField.enableFeature("isIndexed");
    } else if (StringUtils.equalsIgnoreCase(aName, "stored")) {
        if (StrUtl.stringToBoolean(aValue))
            aField.enableFeature("isStored");
    } else if (StringUtils.equalsIgnoreCase(aName, "docValues")) {
        if (StrUtl.stringToBoolean(aValue))
            aField.enableFeature("isDocValue");
    } else if (StringUtils.equalsIgnoreCase(aName, "multiValued")) {
        if (StrUtl.stringToBoolean(aValue))
            aField.setMultiValueFlag(true);
    } else//from w  w w. ja v  a2s  .  c o  m
        aField.addFeature(aName, aValue);
}

From source file:io.wcm.handler.mediasource.inline.InlineRendition.java

/**
 * Checks if the file extension of the current binary matches with the requested extensions from the media args.
 * @return true if file extension matches
 *//*w w  w  .j av a  2 s .c  o m*/
private boolean isMatchingFileExtension() {
    String[] fileExtensions = mediaArgs.getFileExtensions();
    if (fileExtensions == null || fileExtensions.length == 0) {
        return true;
    }
    for (String fileExtension : fileExtensions) {
        if (StringUtils.equalsIgnoreCase(fileExtension, getFileExtension())) {
            return true;
        }
    }
    return false;
}

From source file:com.mirth.connect.client.core.ServerConnection.java

private HttpRequestBase createRequestBase(String method) {
    HttpRequestBase requestBase = null;//from   w  w w . j  a v  a  2s.c  om

    if (StringUtils.equalsIgnoreCase(HttpGet.METHOD_NAME, method)) {
        requestBase = new HttpGet();
    } else if (StringUtils.equalsIgnoreCase(HttpPost.METHOD_NAME, method)) {
        requestBase = new HttpPost();
    } else if (StringUtils.equalsIgnoreCase(HttpPut.METHOD_NAME, method)) {
        requestBase = new HttpPut();
    } else if (StringUtils.equalsIgnoreCase(HttpDelete.METHOD_NAME, method)) {
        requestBase = new HttpDelete();
    } else if (StringUtils.equalsIgnoreCase(HttpOptions.METHOD_NAME, method)) {
        requestBase = new HttpOptions();
    } else if (StringUtils.equalsIgnoreCase(HttpPatch.METHOD_NAME, method)) {
        requestBase = new HttpPatch();
    }

    requestBase.setConfig(requestConfig);
    return requestBase;
}