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

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

Introduction

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

Prototype

public static String upperCase(String str) 

Source Link

Document

Converts a String to upper case as per String#toUpperCase() .

Usage

From source file:com.hangum.tadpole.engine.sql.util.ObjectCompileUtil.java

/**
 * object ?  - ? ?   ?? . //from  ww w .java 2  s. c om
 * 
 * @param userDB
 * @param ddlType
 * @param objectName
 * @return
 */
public static String validateObject(UserDBDAO userDB, QUERY_DDL_TYPE ddlType, String objectName) {
    if (StringUtils.isEmpty(objectName))
        return "";
    String retMsg = ""; //$NON-NLS-1$

    if (userDB.getDBDefine() == DBDefine.ORACLE_DEFAULT | userDB.getDBDefine() == DBDefine.TIBERO_DEFAULT) {
        try {
            String strObjectName = StringUtils.upperCase(objectName);
            if (ddlType == QUERY_DDL_TYPE.PROCEDURE) {
                retMsg = OracleObjectCompileUtils.otherObjectCompile(QUERY_DDL_TYPE.PROCEDURE, "PROCEDURE", //$NON-NLS-1$
                        strObjectName, userDB);
            } else if (ddlType == QUERY_DDL_TYPE.PACKAGE) {
                retMsg = OracleObjectCompileUtils.packageCompile(strObjectName, userDB);
            } else if (ddlType == QUERY_DDL_TYPE.FUNCTION) {
                retMsg = OracleObjectCompileUtils.otherObjectCompile(QUERY_DDL_TYPE.FUNCTION, "FUNCTION", //$NON-NLS-1$
                        strObjectName, userDB);
            } else if (ddlType == QUERY_DDL_TYPE.TRIGGER) {
                retMsg = OracleObjectCompileUtils.otherObjectCompile(QUERY_DDL_TYPE.TRIGGER, "TRIGGER", //$NON-NLS-1$
                        strObjectName, userDB);
            } else if (ddlType == QUERY_DDL_TYPE.SYNONYM) {
                retMsg = OracleObjectCompileUtils.otherObjectCompile(QUERY_DDL_TYPE.SYNONYM, "SYNONYM", //$NON-NLS-1$
                        strObjectName, userDB);
            }
        } catch (Exception e) {
            logger.error("object compile", e);
        }
    }

    return retMsg;
}

From source file:gobblin.data.management.retention.sql.SqlUdfs.java

private static long date_diff(long timestamp1, long timestamp2, String unitString) {

    try {/*  ww  w .j  av a 2s.  c  o  m*/
        TimeUnit unit = TimeUnit.valueOf(TimeUnit.class, StringUtils.upperCase(unitString));
        return unit.convert(timestamp1 - timestamp2, TimeUnit.MILLISECONDS);
    } catch (IllegalArgumentException e) {
        log.error("Valid input for unitString is java.util.concurrent.TimeUnit", e);
    }

    return 0l;
}

From source file:com.edm.app.auth.Auth.java

public static void robot(String robotPath) {
    BufferedReader reader = null;
    try {/*from   w w w  .  ja  va2s.  com*/
        reader = new BufferedReader(new InputStreamReader(new FileInputStream(robotPath), "UTF-8"));
        String line = null;

        while ((line = reader.readLine()) != null) {
            if (StringUtils.isBlank(line)) {
                continue;
            }
            String key = StringUtils.substringBefore(line, "=");
            String val = StringUtils.substringAfter(line, "=");
            boolean r = StringUtils.equals(md5.encode(StringUtils.upperCase(key)),
                    "cebb21b542877339c40e7e8ecc96796e");
            if (StringUtils.isNotBlank(key) && r) {
                if (StringUtils.isNotBlank(val)) {
                    ROBOT = StringUtils.lowerCase(val);
                    break;
                }
            }
        }
    } catch (Exception e) {
        logger.error("(Auth:robot) error: ", e);
    } finally {
        try {
            if (reader != null) {
                reader.close();
            }
        } catch (IOException e) {
        }
    }
}

From source file:io.kahu.hawaii.domain.EnumProperty.java

public EnumProperty(String value, Object[] possibleValues) {
    super(StringUtils.upperCase(value));
    allowedValues = new ArrayList<String>();
    for (Object possibleValue : possibleValues) {
        allowedValues.add(StringUtils.upperCase(possibleValue.toString()));
    }/*from  ww w . ja  v a  2 s . co  m*/
}

From source file:com.epam.cme.facades.product.FrequencyTabDataComparator.java

@Override
protected int compareInstances(final FrequencyTabData thisFrequencyData,
        final FrequencyTabData thatFrequencyData) {
    final TermOfServiceFrequency thisToSFrequency = TermOfServiceFrequency
            .valueOf(StringUtils.upperCase(thisFrequencyData.getTermOfServiceFrequency().getCode()));
    final TermOfServiceFrequency thatToSFrequency = TermOfServiceFrequency
            .valueOf(StringUtils.upperCase(thatFrequencyData.getTermOfServiceFrequency().getCode()));
    if (thisToSFrequency.equals(thatToSFrequency) && !thisToSFrequency.equals(TermOfServiceFrequency.NONE)) {
        return thisFrequencyData.getTermOfServiceNumber() - thatFrequencyData.getTermOfServiceNumber();
    } else {/*from w w w  .ja  v a  2 s  .  c  o m*/
        return thisToSFrequency.compareTo(thatToSFrequency);
    }
}

From source file:com.switchfly.inputvalidation.sanitizer.CurrencyCodeSanitizer.java

@Override
public String execute(String content) {
    if (StringUtils.isBlank(content)) {
        return content;
    }/*from   ww w  . j  a  v a 2 s . c  om*/
    try {
        return Currency.getInstance(StringUtils.upperCase(content)).toString();
    } catch (Exception e) {
        HtmlSanitizer htmlSanitizer = new HtmlSanitizer();
        String sanitized = htmlSanitizer.execute(content);
        _logger.warn("Invalid currency code (" + sanitized + "). Setting currency code to \"USD\".");
        return "USD";
    }
}

From source file:com.hangum.tadpole.engine.sql.parser.ddl.ParserDDL.java

/**
 * ddl parser/* www  . ja v  a  2 s  .com*/
 * 
 * @param sql
 * @param queryInfoDTO
 * @return
 */
public QueryInfoDTO parseQuery(String sql, QueryInfoDTO queryInfoDTO) {
    sql = StringUtils.upperCase(StringUtils.trim(sql));

    for (DefineDDL ddl : DefineDDL.values()) {
        //         if(logger.isDebugEnabled()) logger.debug(ddl.getRegExp());

        Matcher matcher = Pattern.compile(ddl.getRegExp(), ParserDefine.PATTERN_FLAG).matcher(sql);
        if (matcher.find()) {
            //            if(logger.isDebugEnabled()) logger.debug("=> finding: " + ddl.getRegExp());
            queryInfoDTO.setQueryDDLType(ddl.getDdlType());
            queryInfoDTO.setQueryStatus(ddl.getDdlStatus());
            queryInfoDTO.setObjectName(getObjectName(matcher, sql));

            break;
        }
    }

    return queryInfoDTO;
}

From source file:io.kahu.hawaii.domain.EnumProperty.java

public EnumProperty(String value, List<?> possibleValues) {
    super(StringUtils.upperCase(value));
    allowedValues = new ArrayList<String>();
    for (Object possibleValue : possibleValues) {
        allowedValues.add(StringUtils.upperCase(possibleValue.toString()));
    }//from  w w w  .j av  a2 s.  c  o  m
}

From source file:com.haulmont.cuba.security.global.UserUtils.java

private static String parseParam(String param, String firstName, String lastName, String middleName)
        throws ParseException {
    if (param == null || param.length() == 0)
        throw new ParseException("Pattern error", 0);
    String last = StringUtils.substringAfter(param, "|");
    String first = StringUtils.upperCase(StringUtils.substringBefore(param, "|"));
    if (first == null || first.length() == 0)
        throw new ParseException("Pattern error", 0);
    char type = first.charAt(0);
    boolean all = true;
    int length = 0;
    if (first.length() > 1) {
        char ch = first.charAt(1);
        switch (ch) {
        case 'F':
        case 'L':
        case 'M':
            if (first.length() != 2 || type != ch)
                throw new ParseException("Pattern error", 2);
            break;
        default:/*from   www.  ja  v a  2 s.  c  o m*/
            length = Integer.parseInt(first.substring(1, first.length()));
            break;
        }
    } else {
        all = false;
        length = 1;
    }
    switch (type) {
    case 'F':
        first = firstName;
        break;
    case 'L':
        first = lastName;
        break;
    case 'M':
        first = middleName;
        break;
    default:
        throw new ParseException("Pattern error", 0);
    }
    if (!all) {
        first = StringUtils.left(first, length);
    }
    return (first.length() > 0) ? first + last : "";
}

From source file:com.hangum.tadpole.engine.sql.parser.UpdateDeleteParser.java

/**
 * ddl parser//from ww  w .jav  a 2 s . c om
 * 
 * @param sql
 * @param queryInfoDTO
 * @return
 */
public QueryDMLInfoDTO parseQuery(String sql, QueryDMLInfoDTO queryInfoDTO) {
    sql = StringUtils.upperCase(StringUtils.trim(sql));

    for (TABLE_PARSER ddl : TABLE_PARSER.values()) {
        //         if(logger.isDebugEnabled()) logger.debug(ddl.getRegExp());

        Matcher matcher = Pattern.compile(ddl.getRegExp(), ParserDefine.PATTERN_FLAG).matcher(sql);
        if (matcher.find()) {
            //            if(logger.isDebugEnabled()) logger.debug("=> finding: " + ddl.getRegExp());
            queryInfoDTO.setDmlType(ddl.getDmlType());
            queryInfoDTO.setObjectName(getObjectName(matcher, sql));

            break;
        }
    }

    return queryInfoDTO;
}