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

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

Introduction

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

Prototype

public static String capitalize(String str) 

Source Link

Document

Capitalizes a String changing the first letter to title case as per Character#toTitleCase(char) .

Usage

From source file:com.netxforge.netxstudio.models.export.MasterDataExporterRevenge.java

private void _generateCell(EReference eReference, Sheet sheet) {

    // Generate name.
    {/*from w ww  . j  a  va  2  s.com*/
        // Style, cell color.
        CellStyle referenceStyle = workBook.createCellStyle();
        referenceStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
        referenceStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);

        // Style, font
        HSSFFont referenceFont = workBook.createFont();
        referenceFont.setFontName("Verdana");
        referenceFont.setColor(HSSFColor.DARK_RED.index);
        referenceStyle.setFont(referenceFont);

        // Style, border.
        referenceStyle.setBorderBottom(CellStyle.BORDER_MEDIUM);

        Row row = sheet.getRow(0);
        if (row == null) {
            row = sheet.createRow(0);
        }
        short lastCellNum = row.getLastCellNum();
        if (lastCellNum == -1) {
            lastCellNum = 0;
        }
        Cell cell = row.createCell(lastCellNum);
        cell.setCellValue(StringUtils.capitalize(eReference.getName()));
        cell.setCellStyle(referenceStyle);
    }
    // Generate type
    {

        CellStyle typeStyle = workBook.createCellStyle();
        typeStyle.setBorderBottom(CellStyle.BORDER_MEDIUM);

        Row row = sheet.getRow(1);
        if (row == null) {
            row = sheet.createRow(1);
        }
        short lastCellNum = row.getLastCellNum();
        if (lastCellNum == -1) {
            lastCellNum = 0;
        }
        Cell cell = row.createCell(lastCellNum);
        cell.setCellValue(eReference.getEType().getName());
        cell.setCellStyle(typeStyle);
    }
}

From source file:ddf.metrics.reporting.internal.rrd4j.RrdMetricsRetriever.java

private String getTimestamp(MutableDateTime chunkStart, MutableDateTime chunkEnd, int columnCounter,
        SUMMARY_INTERVALS summaryInterval) {
    StringBuilder title = new StringBuilder();
    title.append(StringUtils.capitalize(summaryInterval.toString())).append(" ").append(columnCounter)
            .append("\n");
    String timestamp = SUMMARY_TIMESTAMP;
    switch (summaryInterval) {
    case minute:/*from  ww w .  jav  a 2s  .c  om*/
    case hour:
        break;
    case day:
    case week:
        timestamp = "dd-MM-y";
        break;
    case month:
        timestamp = "MM-y";
        break;
    }
    title.append(chunkStart.toDateTime(DateTimeZone.getDefault()).toString(timestamp)).append(" to ")
            .append(chunkEnd.toDateTime(DateTimeZone.getDefault()).toString(timestamp));
    return title.toString();
}

From source file:com.haulmont.cuba.web.gui.components.WebDataGrid.java

protected void addColumnInternal(ColumnImpl column, int index) {
    addContainerProperty(column);//from  w w w. jav a2 s .  c o  m

    columns.put(column.getId(), column);
    columnsOrder.add(index, column);

    final String caption = StringUtils
            .capitalize(column.getCaption() != null ? column.getCaption() : generateColumnCaption(column));
    column.setCaption(caption);

    if (column.getOwner() == null) {
        column.setOwner(this);
    }

    Grid.Column gridColumn = component.getColumn(column.getColumnPropertyId());
    if (gridColumn != null) {
        setupGridColumnProperties(gridColumn, column);
    }

    component.setColumnOrder(getColumnPropertyIds());
}

From source file:com.evolveum.midpoint.model.impl.importer.ObjectImporter.java

/**
 * Try to parse the schema using schema processor. Report errors.
 *
 * @param dynamicSchema//from  w w  w. j  a va 2s.  c  o  m
 * @param schemaName
 * @param objectResult
 */
private void checkSchema(XmlSchemaType dynamicSchema, String schemaName, OperationResult objectResult) {
    OperationResult result = objectResult.createSubresult(
            ObjectImporter.class.getName() + ".check" + StringUtils.capitalize(schemaName) + "Schema");

    Element xsdElement = ObjectTypeUtil.findXsdElement(dynamicSchema);

    if (dynamicSchema == null || xsdElement == null) {
        result.recordStatus(OperationResultStatus.NOT_APPLICABLE, "Missing dynamic " + schemaName + " schema");
        return;
    }

    try {
        PrismSchema.parse(xsdElement, true, schemaName, prismContext);
    } catch (SchemaException e) {
        result.recordFatalError("Error during " + schemaName + " schema integrity check: " + e.getMessage(), e);
        return;
    }
    result.recordSuccess();
}

From source file:com.netxforge.netxstudio.models.export.MasterDataExporterRevenge_sxssf.java

private void _generateCell(EReference eReference, Sheet sheet) {

    // Generate name.
    {/* w  w  w  .ja v a 2s. co  m*/
        // Style, cell color.
        CellStyle referenceStyle = workBook.createCellStyle();
        referenceStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
        referenceStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);

        // Style, font
        Font referenceFont = workBook.createFont();
        referenceFont.setFontName("Verdana");
        referenceFont.setColor(IndexedColors.DARK_RED.getIndex());
        referenceStyle.setFont(referenceFont);

        // Style, border.
        referenceStyle.setBorderBottom(CellStyle.BORDER_MEDIUM);

        Row row = sheet.getRow(0);
        if (row == null) {
            row = sheet.createRow(0);
        }
        short lastCellNum = row.getLastCellNum();
        if (lastCellNum == -1) {
            lastCellNum = 0;
        }
        Cell cell = row.createCell(lastCellNum);
        cell.setCellValue(StringUtils.capitalize(eReference.getName()));
        cell.setCellStyle(referenceStyle);
    }
    // Generate type
    {

        CellStyle typeStyle = workBook.createCellStyle();
        typeStyle.setBorderBottom(CellStyle.BORDER_MEDIUM);

        Row row = sheet.getRow(1);
        if (row == null) {
            row = sheet.createRow(1);
        }
        short lastCellNum = row.getLastCellNum();
        if (lastCellNum == -1) {
            lastCellNum = 0;
        }
        Cell cell = row.createCell(lastCellNum);
        cell.setCellValue(eReference.getEType().getName());
        cell.setCellStyle(typeStyle);
    }
}

From source file:com.epimorphics.registry.store.StoreBaseImpl.java

@Override
public List<String> search(SearchRequest request) {
    try {/* ww  w. ja v a 2s .  c  om*/
        // SelectBuilder doesn't support property paths so use brute force
        // string bashing
        String query = request.isSearchVersions() ? QUERY_VERSION_TEMPLATE : QUERY_TEMPLATE;
        query = query.replace("?text", safeLiteral(request.getQuery()));
        String filterStr = "";

        if (request.getStatus() != null) {
            String statusRef = "reg:status" + StringUtils.capitalize(request.getStatus());
            filterStr = String.format("   ?item version:currentVersion/reg:status %s.\n", statusRef);
        }

        filterStr += FilterSpec.asQuery(request.getFilters(), "entity");
        query = query.replace("#$FILTER$", filterStr);

        if (request.getLimit() != null) {
            query += "LIMIT " + request.getLimit() + " ";
        }

        if (request.getOffset() != null) {
            query += "OFFSET " + request.getOffset();
        }

        log.debug("Search query = " + query.toString());

        QueryExecution exec = QueryExecutionFactory.create(query, store.asDataset());
        try {
            ResultSet results = exec.execSelect();
            List<String> matches = new ArrayList<String>();
            while (results.hasNext()) {
                QuerySolution row = results.next();
                matches.add(row.getResource("item").getURI());
            }
            return matches;
        } finally {
            exec.close();
        }

    } catch (Exception e) {
        log.error("Search query failed, misconfigured store?", e);
        return Collections.emptyList();
    }
}

From source file:gov.nih.nci.ncicb.tcga.dcc.qclive.common.action.validation.ClinicalXmlValidator.java

private String convertNodeNameToBarcodeType(final String nodeName) {
    String[] words = nodeName.split("_");

    for (int i = 0; i < words.length; i++) {
        words[i] = StringUtils.capitalize(words[i]);
    }/* w w w .  j  a  v a2  s . co  m*/
    return StringUtils.join(words, " ");
}

From source file:com.netxforge.netxstudio.models.export.MasterDataExporterRevenge.java

private void _generateMultiReferenceSource(EClass eClass, Sheet sheet) {
    // Generate name.
    {/*w w  w. j av  a  2 s  . c o m*/
        // Style, cell color.
        CellStyle referenceStyle = workBook.createCellStyle();
        referenceStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
        referenceStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);

        // Style, font
        HSSFFont referenceFont = workBook.createFont();
        referenceFont.setFontName("Verdana");
        referenceFont.setColor(HSSFColor.DARK_RED.index);
        referenceStyle.setFont(referenceFont);

        // Style, border.
        referenceStyle.setBorderBottom(CellStyle.BORDER_MEDIUM);

        Row row = sheet.getRow(0);
        if (row == null) {
            row = sheet.createRow(0);
        }
        short lastCellNum = row.getLastCellNum();
        if (lastCellNum == -1) {
            lastCellNum = 0;
        }
        Cell cell = row.createCell(lastCellNum);
        cell.setCellValue(StringUtils.capitalize(eClass.getName()));
        cell.setCellStyle(referenceStyle);
    }
    // Generate type
    {

        CellStyle typeStyle = workBook.createCellStyle();
        typeStyle.setBorderBottom(CellStyle.BORDER_MEDIUM);

        Row row = sheet.getRow(1);
        if (row == null) {
            row = sheet.createRow(1);
        }
        short lastCellNum = row.getLastCellNum();
        if (lastCellNum == -1) {
            lastCellNum = 0;
        }
        Cell cell = row.createCell(lastCellNum);
        cell.setCellStyle(typeStyle);
    }
}

From source file:de.iteratec.iteraplan.businesslogic.exchange.xmi.exporter.XmiServiceForTabReporting.java

private String capitalize(String s) {
    return StringUtils.capitalize(s);
}

From source file:com.evolveum.midpoint.model.impl.importer.ObjectImporter.java

/**
 * Validate the provided XML snippet with schema definition fetched in runtime.
 *
 * @param contentElements DOM tree to validate
 * @param elementRef      the "correct" name of the root element
 * @param dynamicSchema   dynamic schema
 * @param schemaName//from  www. java 2s.c o m
 * @param objectResult
 */
private PrismContainer validateDynamicSchema(List<Object> contentElements, QName elementRef,
        XmlSchemaType dynamicSchema, String schemaName, OperationResult objectResult) {
    OperationResult result = objectResult.createSubresult(
            ObjectImporter.class.getName() + ".validate" + StringUtils.capitalize(schemaName) + "Schema");

    Element xsdElement = ObjectTypeUtil.findXsdElement(dynamicSchema);
    if (xsdElement == null) {
        result.recordStatus(OperationResultStatus.NOT_APPLICABLE, "No " + schemaName + " schema present");
        return null;
    }

    com.evolveum.midpoint.prism.schema.PrismSchema schema = null;
    try {
        schema = com.evolveum.midpoint.prism.schema.PrismSchema.parse(xsdElement, true, schemaName,
                prismContext);
    } catch (SchemaException e) {
        result.recordFatalError("Error during " + schemaName + " schema parsing: " + e.getMessage(), e);
        LOGGER.trace("Validation error: {}" + e.getMessage());
        return null;
    }

    PrismContainerDefinition containerDefinition = schema.findItemDefinition(elementRef,
            PrismContainerDefinition.class);

    PrismContainer propertyContainer = null;

    result.recordSuccess();
    return propertyContainer;

}