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: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 w w  .j av  a2s .c  o m*/
    return casedOne;
}

From source file:org.talend.dq.dbms.DbmsLanguageFactory.java

public static boolean compareDbmsLanguage(String lang1, String lang2) {
    if (lang1 == null || lang2 == null) {
        return false;
    }/*from   w  w w. j  ava2  s .c om*/
    // When source language is defaule or target language is default they are must equals between lang1 and lang2,
    // else will cause of error mapping.
    // For example default will mapping MySQL, PostgreSQL,Microsoft SQL Server
    if (StringUtils.equalsIgnoreCase(lang1, DbmsLanguage.SQL)
            || StringUtils.equalsIgnoreCase(lang2, DbmsLanguage.SQL)) {
        return StringUtils.equalsIgnoreCase(lang1, lang2);
    }
    // MOD xqliu 2011-12-20 TDQ-4232, FOR AS400
    if (StringUtils.contains(lang1, DbmsLanguage.AS400) && StringUtils.contains(lang2, DbmsLanguage.AS400)) {
        return true;
    }
    if (StringUtils.contains(lang1, DbmsLanguage.AS400) && !StringUtils.contains(lang2, DbmsLanguage.AS400)) {
        return false;
    }
    if (!StringUtils.contains(lang1, DbmsLanguage.AS400) && StringUtils.contains(lang2, DbmsLanguage.AS400)) {
        return false;
    }
    // ~ TDQ-4232
    // MOD mzhao 2010-08-02 bug 14464, for AS400
    if (StringUtils.contains(lang1, DbmsLanguage.AS400)
            && StringUtils.contains(StringUtils.upperCase(lang2), lang1)) {
        return true;
    }
    // MOD 2008-08-04 scorreia: for DB2 database, dbName can be "DB2/NT" or "DB2/6000" or "DB2"...
    if (lang1.startsWith(DbmsLanguage.DB2)) {
        if (StringUtils.contains(lang2, DbmsLanguage.AS400)) {
            return false;
        }
        return StringUtils.upperCase(lang1).startsWith(StringUtils.upperCase(lang2))
                || StringUtils.upperCase(lang2).startsWith(StringUtils.upperCase(lang1));
    } else
    // MOD 2010-01-26 zshen: for informix database, dbName can be "informix" or "informix Dynamic Server"
    if (lang1.startsWith(DbmsLanguage.INFOMIX)) {
        return StringUtils.upperCase(lang1).startsWith(StringUtils.upperCase(lang2))
                || StringUtils.upperCase(lang2).startsWith(StringUtils.upperCase(lang1));
    }
    if (StringUtils.contains(lang1, DbmsLanguage.VERTICA)
            && StringUtils.contains(lang2, DbmsLanguage.VERTICA)) {
        return true;
    }
    // MOD 2014-02-10 for TDQ-8600 Column Analysis fails with Netezza
    if (StringUtils.contains(lang1, DbmsLanguage.NETEZZA)
            && StringUtils.contains(lang2, DbmsLanguage.NETEZZA)) {
        return true;
    }
    // MOD 2014-02-27 for TDQ-8601
    if (StringUtils.contains(lang1, DbmsLanguage.HIVE) && StringUtils.contains(lang2, DbmsLanguage.HIVE)) {
        return true;
    }

    return StringUtils.contains(StringUtils.upperCase(lang1), StringUtils.upperCase(lang2))
            || StringUtils.contains(StringUtils.upperCase(lang2), StringUtils.upperCase(lang1));
}

From source file:org.talend.dq.dbms.NetezzaDbmsLanguage.java

@Override
public String toQualifiedName(String catalog, String schema, String table) {
    String c = catalog;/*from   w w w.ja va 2 s .c  om*/
    String s = schema;
    // TDQ-9543: the correct structure of Netezza include both catalog and schema, if the catalog is not blank but
    // schema is blank, should set catalog with empty by force, otherwise the generate sql should be like
    // "select * from catalog.table", this will cause error; another point is that catalog is blank but schema is
    // not blank, don't need to do anything for this because the sql like "select * from schema.table" is ok
    if (!StringUtils.isBlank(c) && StringUtils.isBlank(s)) {
        c = StringUtils.EMPTY;
    }
    // the catalog and schema of Netezza must be UpperCase
    c = StringUtils.upperCase(c);
    s = StringUtils.upperCase(s);
    return super.toQualifiedName(c, s, table);
}

From source file:org.talend.repository.ui.wizards.metadata.connection.database.DatabaseForm.java

private String getUppercaseNetezzaUrl(String url) {
    if (StringUtils.isBlank(url)) {
        return url;
    }//from ww  w  .  j a v  a 2 s  .  c om
    String uppcaseUrl = url;
    int lastIndexOf = StringUtils.lastIndexOf(url, "/"); //$NON-NLS-1$
    if (lastIndexOf > 0 && lastIndexOf < url.length() - 1) {
        String part1 = StringUtils.substring(url, 0, lastIndexOf + 1);
        String part2 = StringUtils.substring(url, lastIndexOf + 1);
        if (!StringUtils.isEmpty(part2)) {
            int indexOf = StringUtils.indexOf(part2, "?"); //$NON-NLS-1$
            if (indexOf > -1) {
                String sid = StringUtils.substring(part2, 0, indexOf);
                part2 = StringUtils.upperCase(sid) + StringUtils.substring(part2, indexOf, part2.length());
            } else {
                part2 = StringUtils.upperCase(part2);
            }
            uppcaseUrl = part1 + part2;
        }
    }
    return uppcaseUrl;
}

From source file:org.talend.repository.ui.wizards.metadata.connection.database.DatabaseWizard.java

/**
 * uppercase the sid and url of Netezza connection.
 * /*from  w  w w. j av a  2s  .c o  m*/
 * @param netezzaConnection
 */
private void uppercaseNetezzaSidUrl(DatabaseConnection netezzaConnection) {
    if (netezzaConnection == null) {
        return;
    }
    netezzaConnection.setSID(StringUtils.upperCase(netezzaConnection.getSID()));
    String url = netezzaConnection.getURL();
    if (StringUtils.isBlank(url)) {
        return;
    }
    int lastIndexOf = StringUtils.lastIndexOf(url, "/"); //$NON-NLS-1$
    if (lastIndexOf > 0 && lastIndexOf < url.length() - 1) {
        String part1 = StringUtils.substring(url, 0, lastIndexOf + 1);
        String part2 = StringUtils.substring(url, lastIndexOf + 1);
        if (!StringUtils.isEmpty(part2)) {
            int indexOf = StringUtils.indexOf(part2, "?"); //$NON-NLS-1$
            if (indexOf > -1) {
                String sid = StringUtils.substring(part2, 0, indexOf);
                part2 = StringUtils.upperCase(sid) + StringUtils.substring(part2, indexOf, part2.length());
            } else {
                part2 = StringUtils.upperCase(part2);
            }
            netezzaConnection.setURL(part1 + part2);
        }
    }
}

From source file:org.tinygroup.xmlparser.ea.MetadataGenerateEA2Table.java

private StandardType getStdType(String type, String length, BusinessType bizType) {
    StandardType stdType = stdTypeMap.get(type);
    if (stdType == null) {
        stdType = new StandardType();
        stdTypeMap.put(type, stdType);//from   w  w  w  .  j a v  a  2s  . c  om
        stdType.setId(Guid.createGUID());
        stdType.setName(type);
        stdType.setTitle(StringUtils.upperCase(type));
    }
    bizType.setTypeId(stdType.getId());
    if (bizType.getPlaceholderValueList() != null) {
        for (PlaceholderValue phv : bizType.getPlaceholderValueList()) {
            boolean status = false;
            if (stdType.getPlaceholderList() != null) {
                for (Placeholder placeholder : stdType.getPlaceholderList()) {
                    if (StringUtils.equals(placeholder.getName(), phv.getName())) {
                        status = true;
                        break;
                    }
                }
            }
            if (!status) {
                Placeholder ph = new Placeholder();
                ph.setName(phv.getName());
                if (stdType.getPlaceholderList() == null) {
                    stdType.setPlaceholderList(new ArrayList<Placeholder>());
                }
                stdType.getPlaceholderList().add(ph);
            }
        }
    }
    if (stdType.getDialectTypeList() == null) {
        stdType.setDialectTypeList(new ArrayList<DialectType>());
    }
    if (stdType.getDialectTypeList().size() == 0) {
        DialectType javaDialect = new DialectType();
        javaDialect.setLanguage("java");
        stdType.getDialectTypeList().add(javaDialect);

        DialectType mysqlDialect = new DialectType();
        mysqlDialect.setLanguage("mysql");
        mysqlDialect.setBaseType(type);
        if (StringUtils.isNotBlank(length)) {
            mysqlDialect.setExtType(length);
        }
        stdType.getDialectTypeList().add(mysqlDialect);
    }

    return stdType;
}

From source file:org.tinygroup.xmlparser.ea.MetadataGenerateEA2Table.java

private StandardField getStdfield(String name, String title, String type, String length) {
    StdfieldPair key = new StdfieldPair(name, "");
    StandardField stdfield = stdfieldMap.get(key);
    if (stdfield == null) {
        stdfield = new StandardField();
        stdfieldMap.put(key, stdfield);/*from  w w  w  .  j a v  a2  s .c o m*/
        stdfield.setId(Guid.createGUID());
        stdfield.setName(name);
        stdfield.setTitle(StringUtils.upperCase(StringUtils.isBlank(title) ? name : title));
        stdfield.setTypeId(getBizType(type, length).getId());
    }
    return stdfield;
}

From source file:org.tinygroup.xmlparser.ea.MetadataGenerateEA2Table.java

private BusinessType getBizType(String type, String length) {
    BizTypePair key = new BizTypePair(type, length);
    BusinessType bizType = bizTypesMap.get(key);
    if (bizType == null) {
        bizType = new BusinessType();
        bizTypesMap.put(key, bizType);/*from  w  ww.  j a va 2 s  . co m*/
        bizType.setId(Guid.createGUID());
        bizType.setName(type + StringUtils.defaultString(length));
        bizType.setTitle(StringUtils.upperCase(type + StringUtils.defaultString(length)));
        if (StringUtils.isNotBlank(type) && StringUtils.isNotBlank(length)) {
            PlaceholderValue value = new PlaceholderValue();
            value.setName("length");
            value.setValue(length);
            if (bizType.getPlaceholderValueList() == null) {
                bizType.setPlaceholderValueList(new ArrayList<PlaceholderValue>());
            }
            bizType.getPlaceholderValueList().add(value);
        }
    }
    getStdType(type, length, bizType);
    return bizType;
}

From source file:org.xwiki.notifications.internal.email.NotificationUserIterator.java

private boolean isSameInterval(Object interval) {
    return interval != null && this.interval
            .equals(NotificationEmailInterval.valueOf(StringUtils.upperCase((String) interval)));
}

From source file:pt.webdetails.cpf.repository.api.FileAccess.java

public static FileAccess parse(String fileAccess) {
    try {/*w w w  . j  a v  a  2 s  . com*/
        return FileAccess.valueOf(StringUtils.upperCase(fileAccess));
    } catch (Exception e) {
        return null;
    }
}