Java Code Examples for org.apache.commons.lang.StringUtils#upperCase()

The following examples show how to use org.apache.commons.lang.StringUtils#upperCase() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
public BarGraphDataListResponse generateBarGraphDataResponseWithRanges(QueryResponse response, String typeField, boolean typeUppercase) {
  BarGraphDataListResponse dataList = new BarGraphDataListResponse();
  if (response == null) {
    return dataList;
  }
  NamedList<List<PivotField>> facetPivotResponse = response.getFacetPivot();
  if (response.getFacetPivot() == null) {
    return dataList;
  }
  List<PivotField> pivotFields = facetPivotResponse.get(typeField);
  for (int pivotIndex = 0; pivotIndex < pivotFields.size(); pivotIndex++) {
    PivotField pivotField = facetPivotResponse.get(typeField).get(pivotIndex);
    List<NameValueData> nameValues = generateNameValueDataList(pivotField.getFacetRanges());
    BarGraphData barGraphData = new BarGraphData();
    barGraphData.setDataCount(nameValues);
    String typeValue = typeUppercase ? StringUtils.upperCase(pivotField.getValue().toString()) : pivotField.getValue().toString();
    barGraphData.setName(typeValue);
    dataList.getGraphData().add(barGraphData);
  }
  return dataList;
}
 
Example 2
/**
 * Add sql annotation string.
 *
 * @param cdata the cdata
 * @param oName the o name
 * @param tbName the tb name
 * @return the string
 */
private String addSqlAnnotation(String cdata, String oName, String tbName) {

    String sqlAnnotation = StringUtils.upperCase(CamelCaseUtils.toInlineName(CamelCaseUtils
            .toCamelCase("ms_" + tbName + "_" + oName)));
    if (StringUtils.startsWithIgnoreCase(oName, "insert ")
            || StringUtils.startsWithIgnoreCase(oName, "update")
            || StringUtils.startsWithIgnoreCase(oName, "delete")) {
        if (StringUtils.contains(cdata, "update ")) {
            return StringUtils.replace(cdata, "update ", "update /*" + sqlAnnotation + "*/ ");
        }
        if (StringUtils.contains(cdata, "UPDATE ")) {
            return StringUtils.replace(cdata, "UPDATE ", "UPDATE /*" + sqlAnnotation + "*/ ");
        }
        if (StringUtils.contains(cdata, "insert ")) {
            return StringUtils.replace(cdata, "insert ", "insert /*" + sqlAnnotation + "*/ ");
        }
        if (StringUtils.contains(cdata, "INSERT ")) {
            return StringUtils.replace(cdata, "INSERT ", "INSERT /*" + sqlAnnotation + "*/ ");
        }
        if (StringUtils.contains(cdata, "delete ")) {
            return StringUtils.replace(cdata, "delete ", "delete /*" + sqlAnnotation + "*/ ");
        }
        if (StringUtils.contains(cdata, "DELETE ")) {
            return StringUtils.replace(cdata, "DELETE ", "DELETE /*" + sqlAnnotation + "*/ ");
        }
    } else {
        if (StringUtils.contains(cdata, "select ")) {
            return StringUtils.replace(cdata, "select ", "select /*" + sqlAnnotation + "*/ ");
        }
        if (StringUtils.contains(cdata, "SELECT ")) {
            return StringUtils.replace(cdata, "SELECT", "SELECT /*" + sqlAnnotation + "*/ ");
        }
    }

    return cdata;
}
 
Example 3
/**
 * Gets create table sql.
 *
 * @param resultSet the result set
 * @return the create table sql
 * @throws SQLException the sql exception
 */
private String getCreateTableSql(ResultSet resultSet) throws SQLException {
    String createTableSql = StringUtils.upperCase(resultSet.getString(2));
    createTableSql = StringUtils.replace(createTableSql, "`", "");
    createTableSql = createTableSql.replaceAll("\\s{1,}=\\s{1,}", "=");
    createTableSql = createTableSql.replaceAll("\\(\\d*\\)", "");
    createTableSql = createTableSql.replaceAll("COMMENT\\s{1,}'", "COMMON='");
    createTableSql = createTableSql.replaceAll(", ", " ");
    createTableSql = createTableSql.replaceAll(",", "");
    createTableSql = createTableSql.replaceAll("'", "");
    return createTableSql;
}
 
Example 4
Source Project: atlas   File: ImportTransformer.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Object apply(Object o) {
    Object ret = o;

    if(o instanceof String) {
        ret = StringUtils.upperCase((String) o);
    }

    return ret;
}
 
Example 5
/**
 * 别名定义
 */
public ColumnTranslator alias(String srcColumn, String targetColumn) {
    String sourceColumn = StringUtils.upperCase(srcColumn);
    Set<String> targetColumnSet = columnAlias.get(sourceColumn);
    if (targetColumnSet == null) {
        targetColumnSet = new HashSet<String>(2);
        columnAlias.put(sourceColumn, targetColumnSet);
    }
    targetColumnSet.add(StringUtils.upperCase(targetColumn));
    return this;
}
 
Example 6
/**
 * 根据{@linkplain DatabaseMetaData}获取正确的表名
 *
 * <pre>
 * metaData中的storesUpperCaseIdentifiers,storesUpperCaseQuotedIdentifiers,storesLowerCaseIdentifiers,
 * storesLowerCaseQuotedIdentifiers,storesMixedCaseIdentifiers,storesMixedCaseQuotedIdentifiers
 * </pre>
 */
private static String getIdentifierName(String name, DatabaseMetaData metaData) throws SQLException {
    if (metaData.storesMixedCaseIdentifiers()) {
        return name; // 保留原始名
    } else if (metaData.storesUpperCaseIdentifiers()) {
        return StringUtils.upperCase(name);
    } else if (metaData.storesLowerCaseIdentifiers()) {
        return StringUtils.lowerCase(name);
    } else {
        return name;
    }
}
 
Example 7
@Override
public Object apply(Object o) {
    Object ret = o;

    if(o instanceof String) {
        ret = StringUtils.upperCase((String) o);
    }

    return ret;
}
 
Example 8
Source Project: tddl5   File: ColumnMeta.java    License: Apache License 2.0 5 votes vote down vote up
public ColumnMeta(String tableName, String name, DataType dataType, String alias, boolean nullable){
    this.tableName = StringUtils.upperCase(tableName);
    this.name = StringUtils.upperCase(name);
    this.alias = StringUtils.upperCase(alias);
    this.dataType = dataType;
    this.nullable = nullable;
    this.autoIncrement = false;
}
 
Example 9
Source Project: tddl5   File: ColumnMeta.java    License: Apache License 2.0 5 votes vote down vote up
public ColumnMeta(String tableName, String name, DataType dataType, String alias, boolean nullable,
                  boolean autoIncrement){
    this.tableName = StringUtils.upperCase(tableName);
    this.name = StringUtils.upperCase(name);
    this.alias = StringUtils.upperCase(alias);
    this.dataType = dataType;
    this.nullable = nullable;
    this.autoIncrement = autoIncrement;
}
 
Example 10
Source Project: tddl   File: ColumnMeta.java    License: Apache License 2.0 5 votes vote down vote up
public ColumnMeta(String tableName, String name, DataType dataType, String alias, boolean nullable){
    this.tableName = StringUtils.upperCase(tableName);
    this.name = StringUtils.upperCase(name);
    this.alias = StringUtils.upperCase(alias);
    this.dataType = dataType;
    this.nullable = nullable;
}
 
Example 11
/**
 * populate the given tax ramification document with the information provided by the given travel advance
 */
protected void populateTaxRamificationDocument(TaxableRamificationDocument taxRamificationDocument, TravelAdvance travelAdvance) {
    taxRamificationDocument.setArInvoiceDocNumber(travelAdvance.getArInvoiceDocNumber());

    taxRamificationDocument.setTravelAdvanceDocumentNumber(travelAdvance.getDocumentNumber());
    taxRamificationDocument.setTravelAdvance(travelAdvance);

    TravelAuthorizationDocument travelAuthorizationDocument = this.getTravelAuthorizationDocument(travelAdvance);
    String travelDocumentIdentifier = travelAuthorizationDocument.getTravelDocumentIdentifier();
    taxRamificationDocument.setTravelDocumentIdentifier(travelDocumentIdentifier);

    TravelerDetail travelerDetail = travelAuthorizationDocument.getTraveler();
    this.refreshTraverler(travelerDetail);
    taxRamificationDocument.setTravelerDetailId(travelerDetail.getId());
    taxRamificationDocument.setTravelerDetail(travelerDetail);

    AccountsReceivableCustomerInvoice customerInvoice = this.getOpenCustomerInvoice(travelAdvance);
    taxRamificationDocument.setOpenAmount(customerInvoice.getOpenAmount());
    taxRamificationDocument.setInvoiceAmount(customerInvoice.getTotalDollarAmount());
    taxRamificationDocument.setDueDate(customerInvoice.getInvoiceDueDate());

    String taxRamificationNotice = this.getNotificationText();
    taxRamificationDocument.setTaxableRamificationNotice(taxRamificationNotice);

    taxRamificationDocument.getDocumentHeader().setOrganizationDocumentNumber(String.valueOf(travelDocumentIdentifier));

    String travelerPrincipalName = StringUtils.upperCase(travelerDetail.getPrincipalName());
    String description = this.getNotificationSubject() + travelerPrincipalName;
    taxRamificationDocument.getDocumentHeader().setDocumentDescription(StringUtils.left(description, KFSConstants.getMaxLengthOfDocumentDescription()));
}
 
Example 12
@SuppressWarnings("unchecked")
private Type createStateForType(Class<? extends State> ctype, String value) throws BindingConfigParseException {

    if (ctype != null && value != null) {

        List<Class<? extends State>> stateTypeList = new ArrayList<Class<? extends State>>();
        stateTypeList.add(ctype);

        String finalValue = value;

        // Note to Kai or Thomas: sonos devices return some "true" "false"
        // values for specific variables. We convert those
        // into ON OFF if the commandTypes allow so. This is a little hack,
        // but IMHO OnOffType should
        // be enhanced, or a TrueFalseType should be developed
        if (ctype.equals(OnOffType.class)) {
            finalValue = StringUtils.upperCase(value);
            if (finalValue.equals("TRUE") || finalValue.equals("1")) {
                finalValue = "ON";
            } else if (finalValue.equals("FALSE") || finalValue.equals("0")) {
                finalValue = "OFF";
            }
        }

        State state = TypeParser.parseState(stateTypeList, finalValue);

        return state;
    } else {
        return null;
    }
}
 
Example 13
Source Project: pxf   File: S3ProtocolHandler.java    License: Apache License 2.0 4 votes vote down vote up
private boolean useS3Select(RequestContext context) {
    String format = StringUtils.upperCase(context.getFormat());
    String compressionType = StringUtils.upperCase(context.getOption(S3SelectAccessor.COMPRESSION_TYPE));
    OutputFormat outputFormat = context.getOutputFormat();
    S3Mode selectMode = S3Mode.fromString(context.getOption(S3_SELECT_OPTION));
    boolean isS3SelectSupportedFormat = SUPPORTED_FORMATS.contains(format);

    if (!isS3SelectSupportedFormat) {
        if (selectMode == S3Mode.ON) {
            throw new IllegalArgumentException(String.format("%s optimization is not supported for format '%s'. Use %s=OFF for this format", S3_SELECT_OPTION, format, S3_SELECT_OPTION));
        }
        return false;
    }

    boolean isS3SelectSupportedCompressionType = StringUtils.isBlank(compressionType) ||
            SUPPORTED_COMPRESSION_TYPES.get(format).contains(compressionType);

    if (!isS3SelectSupportedCompressionType) {
        if (selectMode == S3Mode.ON) {
            throw new IllegalArgumentException(String.format("%s optimization is not supported for compression type '%s'. Use %s=OFF for this compression codec", S3_SELECT_OPTION, compressionType, S3_SELECT_OPTION));
        }
        return false;
    }

    switch (selectMode) {
        case ON:
            return formatSupported(outputFormat, format, S3Mode.ON, true);
        case AUTO:
            // if supported for ON and beneficial, use it
            // if file has header line, use S3 Select because reading with headers is not supported
            // if supported for ON and not beneficial -> if supported for OFF -> use OFF, else use ON
            // if not supported for ON -> if supported for OFF -> use OFF, else ERROR out
            if (formatSupported(outputFormat, format, S3Mode.ON, false)) {
                if (willBenefitFromSelect(context) || fileHasHeaderLine(format, context)) {
                    return true;
                } else {
                    return !formatSupported(outputFormat, format, S3Mode.OFF, false);
                }
            } else {
                return !formatSupported(outputFormat, format, S3Mode.OFF, true);
            }
        default:
            return false;
    }
}
 
Example 14
Source Project: iaf   File: Misc.java    License: Apache License 2.0 4 votes vote down vote up
public static String toSortName(String name) {
	// replace low line (x'5f') by asterisk (x'2a) so it's sorted before any digit and letter 
	return StringUtils.upperCase(StringUtils.replace(name,"_", "*"));
}
 
Example 15
Source Project: yugong   File: ColumnMeta.java    License: GNU General Public License v2.0 4 votes vote down vote up
public ColumnMeta(String columnName, int columnType){
    this.name = StringUtils.upperCase(columnName);// 统一为大写
    this.type = columnType;
}
 
Example 16
Source Project: yugong   File: ColumnMeta.java    License: GNU General Public License v2.0 4 votes vote down vote up
public void setName(String name) {
    this.name = StringUtils.upperCase(name);
}
 
Example 17
Source Project: azure-devops-intellij   File: WorkspaceHelper.java    License: MIT License 4 votes vote down vote up
private static String getProxyPropertyName(final String serverURI) {
    // add prefix, remove any trailing slash, uppercase
    return "PROXY_" + StringUtils.upperCase(StringUtils.stripEnd(serverURI, "/"));
}
 
Example 18
/**
 * Str string.
 *
 * @param resultSet the result set
 * @param column the column def
 * @return the string
 * @throws SQLException the sql exception
 */
private String Str(ResultSet resultSet, String column) throws SQLException {
    return StringUtils.upperCase(resultSet.getString(column));
}
 
Example 19
/**
 * File 2 db name string.
 *
 * @param tableFile the table file
 * @return the string
 */
protected String file2TableName(File tableFile) {
    return StringUtils.upperCase(StringUtils.substring(tableFile.getName(), 0, tableFile
            .getName().indexOf(".")));
}
 
Example 20
/**
 * Gets the customerNumber attribute.
 *
 * @return Returns the customerNumber
 *
 */
@Override
   public String getCustomerNumber() {
	return StringUtils.upperCase(customerNumber);
}