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.opentestsystem.shared.mna.client.domain.MAAlternateKey.java

/**
 * Cleans the input by trimming spaces from the ends of the string
 * and also lowercasing for consistency.
 * /*from  www.j  a  v  a 2s  .  com*/
 * @param input
 * @return
 */
private String cleanValue(final String input) {
    String rvalue = ""; // NOPMD
    if (input != null) {
        rvalue = StringUtils.lowerCase(StringUtils.trim(input));
    }
    return rvalue;
}

From source file:org.pentaho.di.core.util.KeyValue.java

/**
 * Constructor. Key will be converted to lower case.
 *
 * @param key//  w ww. j av a 2s. c om
 *          key to set.
 * @param value
 *          value to set, may be null.
 * @throws IllegalArgumentException
 *           if key is invalid.
 */
public KeyValue(final String key, final T value) throws IllegalArgumentException {
    final String keyToSet = StringUtils.lowerCase(key);
    assertKey(keyToSet);
    this.key = keyToSet;
    this.value = value;
}

From source file:org.pentaho.di.core.util.KeyValue.java

/**
 * @param trueValues/*  w  w  w .  jav a  2  s  .c  o  m*/
 *          string true values.
 * @param ignoreCase
 *          ignore case?
 * @return boolean value, null if value is null.
 */
public Boolean booleanValue(final List<String> trueValues, final boolean ignoreCase) {
    if (this.value == null) {
        return null;
    }
    if (this.value instanceof Boolean) {
        return (Boolean) this.value;
    }
    final String stringValue = this.stringValue();
    if (ignoreCase) {
        return trueValues.contains(StringUtils.lowerCase(stringValue));
    }
    return trueValues.contains(stringValue);
}

From source file:org.pentaho.di.core.util.KeyValueSet.java

/**
 * @param key//  w  w w  .java 2s.c  o m
 *          the key.
 * @return key value or null.
 */
public KeyValue<?> get(final String key) {
    if (key == null) {
        return null;
    }
    return this.entries.get(StringUtils.lowerCase(key));
}

From source file:org.projectforge.business.teamcal.event.TeamEventDao.java

/**
 * Get all locations of the user's calendar events (not deleted ones) with modification date within last year.
 *
 * @param searchString/*from  ww w .j  av  a2 s. c o m*/
 */
@SuppressWarnings("unchecked")
public List<String> getLocationAutocompletion(final String searchString, final TeamCalDO[] calendars) {
    if (calendars == null || calendars.length == 0) {
        return null;
    }
    if (StringUtils.isBlank(searchString) == true) {
        return null;
    }
    checkLoggedInUserSelectAccess();
    final String s = "select distinct location from " + clazz.getSimpleName()
            + " t where deleted=false and t.calendar in :cals and lastUpdate > :lastUpdate and lower(t.location) like :location) order by t.location";
    final Query query = getSession().createQuery(s);
    query.setParameterList("cals", calendars);
    final DateHolder dh = new DateHolder();
    dh.add(Calendar.YEAR, -1);
    query.setDate("lastUpdate", dh.getDate());
    query.setString("location", "%" + StringUtils.lowerCase(searchString) + "%");
    final List<String> list = query.list();
    return list;
}

From source file:org.projectforge.business.timesheet.TimesheetDao.java

/**
 * Get all locations of the user's time sheet (not deleted ones) with modification date within last year.
 * //from  w w  w .  ja v a2  s  .c om
 * @param searchString
 */
@SuppressWarnings("unchecked")
public List<String> getLocationAutocompletion(final String searchString) {
    checkLoggedInUserSelectAccess();
    if (StringUtils.isBlank(searchString) == true) {
        return null;
    }
    final String s = "select distinct location from " + clazz.getSimpleName()
            + " t where deleted=false and t.user.id = ? and lastUpdate > ? and lower(t.location) like ?) order by t.location";
    final Query query = getSession().createQuery(s);
    query.setInteger(0, ThreadLocalUserContext.getUser().getId());
    final DateHolder dh = new DateHolder();
    dh.add(Calendar.YEAR, -1);
    query.setDate(1, dh.getDate());
    query.setString(2, "%" + StringUtils.lowerCase(searchString) + "%");
    final List<String> list = query.list();
    return list;
}

From source file:org.projectforge.core.BaseDao.java

/**
 * Only generic check access will be done. The matching entries will not be checked!
 * @param property Property of the data base entity.
 * @param searchString String the user has typed in.
 * @return All matching entries (like search) for the given property modified or updated in the last 2 years.
 *//*from w w  w. j ava 2s . c  o m*/
@SuppressWarnings("unchecked")
public List<String> getAutocompletion(final String property, final String searchString) {
    checkLoggedInUserSelectAccess();
    if (StringUtils.isBlank(searchString) == true) {
        return null;
    }
    final String hql = "select distinct " + property + " from " + clazz.getSimpleName()
            + " t where deleted=false and lastUpdate > ? and lower(t." + property + ") like ?) order by t."
            + property;
    final Query query = getSession().createQuery(hql);
    final DateHolder dh = new DateHolder();
    dh.add(Calendar.YEAR, -2); // Search only for entries of the last 2 years.
    query.setDate(0, dh.getDate());
    query.setString(1, "%" + StringUtils.lowerCase(searchString) + "%");
    final List<String> list = query.list();
    return list;
}

From source file:org.projectforge.framework.persistence.api.BaseDao.java

/**
 * Only generic check access will be done. The matching entries will not be checked!
 *
 * @param property Property of the data base entity.
 * @param searchString String the user has typed in.
 * @return All matching entries (like search) for the given property modified or updated in the last 2 years.
 *///www  . j  a va  2s  . c  o m
@Override
@SuppressWarnings("unchecked")
public List<String> getAutocompletion(final String property, final String searchString) {
    checkLoggedInUserSelectAccess();
    if (StringUtils.isBlank(searchString) == true) {
        return null;
    }
    final String hql = "select distinct " + property + " from " + clazz.getSimpleName()
            + " t where deleted=false and lastUpdate > ? and lower(t." + property + ") like ?) order by t."
            + property;
    final Query query = getSession().createQuery(hql);
    final DateHolder dh = new DateHolder();
    dh.add(Calendar.YEAR, -2); // Search only for entries of the last 2 years.
    query.setDate(0, dh.getDate());
    query.setString(1, "%" + StringUtils.lowerCase(searchString) + "%");
    final List<String> list = query.list();
    return list;
}

From source file:org.projectforge.timesheet.TimesheetDao.java

/**
 * Get all locations of the user's time sheet (not deleted ones) with modification date within last year.
 * @param searchString/*from ww  w .  ja  v a  2  s.c om*/
 */
@SuppressWarnings("unchecked")
public List<String> getLocationAutocompletion(final String searchString) {
    checkLoggedInUserSelectAccess();
    if (StringUtils.isBlank(searchString) == true) {
        return null;
    }
    final String s = "select distinct location from " + clazz.getSimpleName()
            + " t where deleted=false and t.user.id = ? and lastUpdate > ? and lower(t.location) like ?) order by t.location";
    final Query query = getSession().createQuery(s);
    query.setInteger(0, PFUserContext.getUser().getId());
    final DateHolder dh = new DateHolder();
    dh.add(Calendar.YEAR, -1);
    query.setDate(1, dh.getDate());
    query.setString(2, "%" + StringUtils.lowerCase(searchString) + "%");
    final List<String> list = query.list();
    return list;
}

From source file:org.rundeck.api.ApiPathBuilder.java

/**
 * Append the given parameter (key and value). This will only append the parameter if it is not null, and make sure
 * to add the right separator ("?" or "&") before. The key and value will be separated by the "=" character. Also,
 * the value will be converted to lower-case.
 *
 * @param key of the parameter. Must not be null or empty
 * @param value of the parameter. May be null
 * @return this, for method chaining//w  w  w  .j  a  v a  2 s.c  o m
 */
public ApiPathBuilder param(String key, Enum<?> value) {
    if (value != null) {
        param(key, StringUtils.lowerCase(value.toString()));
    }
    return this;
}