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

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

Introduction

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

Prototype

public static String lowerCase(String str) 

Source Link

Document

Converts a String to lower case as per String#toLowerCase() .

Usage

From source file:org.sonar.server.qualityprofile.RegisterQualityProfiles.java

/**
 * @return profiles by language//from  ww w .  ja  v a 2s . c  o  m
 */
private ListMultimap<String, RulesProfile> profilesByLanguage() {
    ListMultimap<String, RulesProfile> byLang = ArrayListMultimap.create();
    for (ProfileDefinition definition : definitions) {
        ValidationMessages validation = ValidationMessages.create();
        RulesProfile profile = definition.createProfile(validation);
        validation.log(LOGGER);
        if (profile != null && !validation.hasErrors()) {
            byLang.put(StringUtils.lowerCase(profile.getLanguage()), profile);
        }
    }
    return byLang;
}

From source file:org.sonar.server.qualityprofile.RegisterQualityProfiles.java

static String templateKey(QProfileName key) {
    return StringUtils.lowerCase(key.getLanguage()) + ":" + key.getName();
}

From source file:org.sonar.server.startup.RegisterNewProfiles.java

private static String templateKey(String language, String profileName) {
    return StringUtils.lowerCase(language) + ":" + profileName;
}

From source file:org.sonar.server.startup.RegisterNewProfiles.java

/**
 * @return profiles by language//w w  w. j a v  a 2s .  c o  m
 */
private ListMultimap<String, RulesProfile> loadDefinitions() {
    ListMultimap<String, RulesProfile> byLang = ArrayListMultimap.create();
    for (ProfileDefinition definition : definitions) {
        ValidationMessages validation = ValidationMessages.create();
        RulesProfile profile = definition.createProfile(validation);
        validation.log(LOGGER);
        if (profile != null && !validation.hasErrors()) {
            byLang.put(StringUtils.lowerCase(profile.getLanguage()), profile);
        }
    }
    return byLang;
}

From source file:org.sonarsource.sonarlint.core.container.standalone.rule.StandaloneActiveRulesProvider.java

private static ListMultimap<String, RulesProfile> profilesByLanguage(ProfileDefinition[] profileDefinitions) {
    ListMultimap<String, RulesProfile> byLang = ArrayListMultimap.create();
    for (ProfileDefinition definition : profileDefinitions) {
        ValidationMessages validation = ValidationMessages.create();
        RulesProfile profile = definition.createProfile(validation);
        if (profile != null && !validation.hasErrors()) {
            byLang.put(StringUtils.lowerCase(profile.getLanguage()), profile);
        }/*from   w  w w.ja  va2s .co m*/
    }
    return byLang;
}

From source file:org.springframework.ldap.core.LdapRdnComponent.java

/**
 * Constructs an LdapRdnComponent, optionally decoding the value.
 * <p>//from  w w w .j  a v a 2  s  .  c  o m
 * Depending on the value of the "key case fold" System property, the keys
 * will be lowercased, uppercased, or preserve their original case. Default
 * is to convert them to lowercase.
 * 
 * @param key the Attribute name.
 * @param value the Attribute value.
 * @param decodeValue if <code>true</code> the value is decoded (typically
 * used when a DN is parsed from a String), otherwise the value is used as
 * specified.
 * @see DistinguishedName#KEY_CASE_FOLD_PROPERTY
 */
public LdapRdnComponent(String key, String value, boolean decodeValue) {
    Validate.notEmpty(key, "Key must not be empty");
    Validate.notEmpty(value, "Value must not be empty");

    String caseFold = System.getProperty(DistinguishedName.KEY_CASE_FOLD_PROPERTY);
    if (StringUtils.isBlank(caseFold) || caseFold.equals(DistinguishedName.KEY_CASE_FOLD_LOWER)) {
        this.key = StringUtils.lowerCase(key);
    } else if (caseFold.equals(DistinguishedName.KEY_CASE_FOLD_UPPER)) {
        this.key = StringUtils.upperCase(key);
    } else if (caseFold.equals(DistinguishedName.KEY_CASE_FOLD_NONE)) {
        this.key = key;
    } else {
        log.warn("\"" + caseFold + "\" invalid property value for " + DistinguishedName.KEY_CASE_FOLD_PROPERTY
                + "; expected \"" + DistinguishedName.KEY_CASE_FOLD_LOWER + "\", \""
                + DistinguishedName.KEY_CASE_FOLD_UPPER + "\", or \"" + DistinguishedName.KEY_CASE_FOLD_NONE
                + "\"");
        this.key = StringUtils.lowerCase(key);
    }
    if (decodeValue) {
        this.value = LdapEncoder.nameDecode(value);
    } else {
        this.value = value;
    }
}

From source file:org.talend.dataprofiler.core.ui.action.actions.CreateAnalysisOnHDFSAction.java

/**
 * DOC yyin Comment method "findCreatedTable".
 * // ww w .j  a v  a2s . c  o m
 * @param hiveConnectionItem
 * @param createTableName
 * @return
 */
private DBTableRepNode findCreatedTable(DatabaseConnectionItem hiveConnectionItem, String createTableName) {
    if (hiveConnectionItem == null) {
        return null;
    }
    // TDQ-10462 the table from the hive connection, only use lowercase.
    IRepositoryNode tableNode = TableUtils.findTableInConnection(hiveConnectionItem,
            StringUtils.lowerCase(createTableName));
    if (tableNode != null && tableNode instanceof DBTableRepNode) {
        return (DBTableRepNode) tableNode;
    }
    return null;
}

From source file:org.talend.dataquality.email.checkerImpl.LocalPartColumnContentCheckerImpl.java

private String getCasedString(String caseString) {
    String casedOne = caseString;
    if (StringUtils.equals(LOWER, usedCaseToGenerate)) {
        return StringUtils.lowerCase(caseString);
    } else if (StringUtils.equals(UPPER, usedCaseToGenerate)) {
        return StringUtils.upperCase(caseString);
    }/*from  w  ww.j  a  va 2s . c  o  m*/
    return casedOne;
}

From source file:org.talend.metadata.managment.model.MetadataFillFactory.java

public static boolean isJdbcNetezza(String dbType, String driverClass) {
    if (!StringUtils.isBlank(dbType) && !StringUtils.isBlank(driverClass)) {
        return StringUtils.equals(EDatabaseTypeName.GENERAL_JDBC.getDisplayName(), dbType)
                && StringUtils.indexOf(StringUtils.lowerCase(driverClass), "netezza") > -1; //$NON-NLS-1$    
    }//from  w w w  .j a  va  2  s . com
    return false;
}

From source file:org.telscenter.sail.webapp.presentation.web.controllers.forgotaccount.student.PasswordReminderWizardController.java

/**
 * This method is called after the onBind and onBindAndValidate method. It
 * acts in the same way as the validator
 * //from w  ww  .  j a  va2s  .c  om
 * @see org.springframework.web.servlet.mvc.AbstractWizardFormController#validatePage(java.lang.Object,
 *      org.springframework.validation.Errors, int)
 */
@Override
protected void validatePage(Object command, Errors errors, int page) {

    ReminderParameters reminderParameters = (ReminderParameters) command;

    switch (page) {
    case 0:
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "username", "error.no-username");

        if (errors.getErrorCount() == 0) {
            try {
                String username = reminderParameters.getUsername();

                if (username == null) {
                    errors.rejectValue("username", "error.username-not-found");
                    break;
                } else {
                    username = StringUtils.trimToNull(username);
                    User user = userService.retrieveUserByUsername(username);

                    /* check to see if user exists and ensure that user is a student */
                    if (user == null || !(user.getUserDetails() instanceof StudentUserDetails)) {
                        errors.rejectValue("username", "error.username-not-found");
                    }
                }
            } catch (EmptyResultDataAccessException e) {
                //TODO: archana needs to update these
                errors.rejectValue("username", "error.username-not-found");
            }
        }

        break;
    case 1:
        //TODO: archana needs to update these
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "submittedAccountAnswer",
                "error.submitted-account-question-blank");

        String submittedAccountAnswer = reminderParameters.getSubmittedAccountAnswer();

        String accountAnswer = reminderParameters.getAccountAnswer();

        accountAnswer = StringUtils.lowerCase(accountAnswer);

        submittedAccountAnswer = StringUtils.lowerCase(submittedAccountAnswer);

        if (!accountAnswer.equals(submittedAccountAnswer)) {
            //TODO: archana needs to update these
            errors.reject("error.submitted-account-question");
        }

        break;
    case 2:

        //TODO: archana needs to update these
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "verifyPassword", "error.verify-newpassword");

        //TODO: archana needs to update these
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "newPassword", "error.verify-newpassword");

        if (errors.hasErrors()) {
            break;
        }

        String newPassword = reminderParameters.getNewPassword();

        String verifyPassword = reminderParameters.getVerifyPassword();

        verifyPassword = StringUtils.lowerCase(verifyPassword);

        newPassword = StringUtils.lowerCase(newPassword);

        verifyPassword = StringUtils.lowerCase(verifyPassword);

        if (!verifyPassword.equals(newPassword)) {
            //TODO: archana needs to update these
            errors.reject("error.verify-newpassword");
        }
        break;
    default:
        break;
    }
}