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:mrcg.MRCGInstance.java

private void createEditActions() throws Exception {
    for (JavaClass jclass : types.values()) {
        if (!(jclass.isEnum() || jclass.isMapping() || skipGui(jclass))) {
            Set<String> imports = new HashSet<String>();

            String classUpper = StringUtils.capitalize(jclass.getName());
            String classLower = jclass.getName().toLowerCase();
            String pkg = basePackage + ".generated.gui.admin.action." + classLower;
            String classname = "GeneratedEdit" + classUpper + "Action";

            Map<String, Object> map = new HashMap<String, Object>();
            map.put("basePackage", basePackage);
            map.put("classUpper", classUpper);
            map.put("classLower", classLower);
            map.put("libraryPackage", libraryPackage);
            map.put("logicsPackage", logicsPackage);
            map.put("logicFacade", JavaType.LOGIC_FACADE.getName());

            String v = "@ValidateNestedProperties({\n";
            for (JavaField jf : jclass.getFields()) {
                if (!jf.isStatic() && !DONT_VALIDATE.contains(jf.getName())) {
                    v += "\t\t@Validate(field=\"" + jf.getName() + "\"";

                    String label = Utils.firstNonNull(jf.getLabel(), jf.getNameAsLabel());
                    v += ", label=\"" + label + "\"";

                    if (jf.isRequired()) {
                        v += ", required=true";
                    }/*www .j a  v  a 2  s . c  o m*/
                    if (jf.isDateField()) {
                        imports.add(libraryPackage + ".stripes.LocalDateTimeConverter");
                        v += ", converter=LocalDateTimeConverter.class";
                    } else if (jf.isEmailField()) {
                        imports.add("net.sourceforge.stripes.validation.EmailTypeConverter");
                        v += ", converter=EmailTypeConverter.class";
                    }
                    v += "),\n";
                }
            }
            v += "\t})";
            map.put("validation", v);

            map.put("imports", imports);

            velocity(classToFile(pkg, classname), getResourcePath("GeneratedEditAction.vel"), map, true);

            // Edit Action
            pkg = basePackage + ".gui.admin.action." + classLower;
            classname = "Edit" + classUpper + "Action";
            velocity(classToFile(pkg, classname), getResourcePath("EditAction.vel"), map, false);
        }
    }
}

From source file:com.fiveamsolutions.nci.commons.search.SearchCallback.java

/**
 * Extracts the non-null values from the collection and adjusts them for case insensitivity, if necessary.
 *///  w w  w.  j a  v a  2 s .  com
private Collection<Object> getNonNullValues(Collection<?> col, Class<? extends Object> fieldClass,
        String propName, boolean caseSenstive)
        throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
    Method m2 = fieldClass.getMethod("get" + StringUtils.capitalize(propName));
    Collection<Object> valueCollection = new HashSet<Object>();
    for (Object collectionObj : col) {
        Object val = m2.invoke(collectionObj);
        if (val != null && !isStringAndBlank(val)) {
            if (canBeUsedInLikeExpression(val) && !caseSenstive) {
                String strValue = (String) val;
                valueCollection.add(strValue.toLowerCase(Locale.getDefault()));
            } else {
                valueCollection.add(val);
            }
        }
    }
    return valueCollection;
}

From source file:net.sf.firemox.xml.XmlTools.java

/**
 * @param node/* ww w.  j ava  2 s .  c  o m*/
 * @param tagAttr
 * @param out
 * @param nameSpace
 * @throws IOException
 *           error while writing.
 */
public static void writeAttrOptions(XmlParser.Node node, String tagAttr, OutputStream out, String nameSpace)
        throws IOException {
    final String colorAttr = node.getAttribute(tagAttr);
    if (colorAttr != null) {
        final String method = "get" + StringUtils.capitalize(nameSpace);
        try {
            final Integer retVal = (Integer) XmlTools.class.getMethod(method, String.class).invoke(null,
                    colorAttr);
            if (retVal == null) {
                XmlConfiguration.error("Unknown " + nameSpace + " : '" + colorAttr + "'");
                writeConstant(out, 0);
            } else {
                writeConstant(out, retVal);
            }
        } catch (Throwable e2) {
            XmlConfiguration.error("Error found in 'get" + nameSpace + "' : " + e2.getMessage());
            writeConstant(out, 0);
        }
    } else {
        final XmlParser.Node expr = node.get(tagAttr);
        if (expr == null) {
            XmlConfiguration.error("Neither element '" + tagAttr + "' neither attribute '" + tagAttr
                    + "' have been found in element '" + node.getTag() + "'. Context=" + node);
            return;
        }
        writeComplexValue(out, expr);
    }
}

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

private void _generateCell(EAttribute eAttribute, Sheet sheet) {

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

        // Style, font
        HSSFFont attributeFont = workBook.createFont();
        attributeFont.setFontName("Verdana");
        attributeFont.setColor(HSSFColor.BLUE.index);
        attributeStyle.setFont(attributeFont);

        // Style, border.
        attributeStyle.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(eAttribute.getName()));
        cell.setCellStyle(attributeStyle);
    }
    // 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(eAttribute.getEType().getName());
        cell.setCellStyle(typeStyle);
    }
}

From source file:com.evolveum.midpoint.common.refinery.RefinedObjectClassDefinition.java

private static RefinedObjectClassDefinition parseRefinedObjectClass(
        ResourceObjectTypeDefinitionType schemaHandlingObjDefType, ResourceType resourceType,
        RefinedResourceSchema rSchema, PrismContext prismContext, ShadowKindType kind, String intent,
        String typeDesc, String contextDescription) throws SchemaException {

    ObjectClassComplexTypeDefinition objectClassDef;
    if (schemaHandlingObjDefType.getObjectClass() != null) {
        QName objectClass = schemaHandlingObjDefType.getObjectClass();
        objectClassDef = rSchema.getOriginalResourceSchema().findObjectClassDefinition(objectClass);
        if (objectClassDef == null) {
            throw new SchemaException("Object class " + objectClass + " as specified in " + typeDesc + " type "
                    + schemaHandlingObjDefType.getIntent() + " was not found in the resource schema of "
                    + contextDescription);
        }//from w  w w  . ja  v  a2s. c  om
    } else {
        throw new SchemaException("Definition of " + typeDesc + " type " + schemaHandlingObjDefType.getIntent()
                + " does not have objectclass, in " + contextDescription);
    }

    RefinedObjectClassDefinition rOcDef = new RefinedObjectClassDefinition(prismContext, resourceType,
            objectClassDef);
    rOcDef.setKind(kind);
    rOcDef.schemaHandlingObjectTypeDefinitionType = schemaHandlingObjDefType;

    if (intent == null && kind == ShadowKindType.ACCOUNT) {
        intent = SchemaConstants.INTENT_DEFAULT;
    }

    if (intent != null) {
        rOcDef.setIntent(intent);
    } else {
        throw new SchemaException(StringUtils.capitalize(typeDesc)
                + " type definition does not have intent, in " + contextDescription);
    }

    if (schemaHandlingObjDefType.getDisplayName() != null) {
        rOcDef.setDisplayName(schemaHandlingObjDefType.getDisplayName());
    } else {
        if (objectClassDef.getDisplayName() != null) {
            rOcDef.setDisplayName(objectClassDef.getDisplayName());
        }
    }

    if (schemaHandlingObjDefType.getDescription() != null) {
        rOcDef.setDescription(schemaHandlingObjDefType.getDescription());
    }

    if (schemaHandlingObjDefType.isDefault() != null) {
        rOcDef.setDefault(schemaHandlingObjDefType.isDefault());
    } else {
        rOcDef.setDefault(objectClassDef.isDefaultInAKind());
    }

    if (schemaHandlingObjDefType.getBaseContext() != null) {
        rOcDef.setBaseContext(schemaHandlingObjDefType.getBaseContext());
    }

    return rOcDef;
}

From source file:com.evolveum.midpoint.model.impl.lens.LensElementContext.java

protected String getDebugDumpTitle() {
    return StringUtils.capitalize(getElementDesc());
}

From source file:com.sfs.whichdoctor.dao.WhichDoctorDAOImpl.java

/**
 * Renames the identified DN within the datastore to the new DN.
 *
 * @param originalDN the original dn/*ww w  .  j  a v a 2  s  .  c  o m*/
 * @param newDN the new dn
 * @param checkUser the check user
 * @param privileges the privileges
 *
 * @throws WhichDoctorDaoException the which doctor dao exception
 */
public final void renameDN(final String originalDN, final String newDN, final UserBean checkUser,
        final PrivilegesBean privileges) throws WhichDoctorDaoException {
    if (originalDN == null) {
        throw new WhichDoctorDaoException("The original User DN cannot be null");
    }
    if (originalDN.compareTo("") == 0) {
        throw new WhichDoctorDaoException("The original User DN cannot be an empty string");
    }
    if (newDN == null) {
        throw new WhichDoctorDaoException("The User DN cannot be null");
    }
    if (newDN.compareTo("") == 0) {
        throw new WhichDoctorDaoException("The User DN cannot be an empty string");
    }
    if (!privileges.getPrivilege(checkUser, "systemAdmin", "modify")) {
        throw new WhichDoctorDaoException("Insufficient user credentials to rename user DN");
    }

    /** Loop through the SQLBean values and execute relevant updates **/

    String[] types = { "update", "replace", "delete" };
    final int maxCount = 100;

    for (String type : types) {
        for (int i = 0; i < maxCount; i++) {
            String sql = null;
            try {
                final String sqlIndex = "whichdoctor/renameDn/" + type + i;
                dataLogger.debug("SQL Index: " + sqlIndex);
                sql = this.getSQL().getValue(sqlIndex);
                dataLogger.debug(StringUtils.capitalize(type) + " SQL: " + sql);
            } catch (Exception e) {
                sql = null;
            }

            ArrayList<String> variables = new ArrayList<String>();

            if (StringUtils.equals(type, "update")) {
                variables.add(newDN);
                variables.add(originalDN);
            }
            if (StringUtils.equals(type, "replace")) {
                variables.add(originalDN);
                variables.add(newDN);
            }
            if (StringUtils.equals(type, "delete")) {
                variables.add(originalDN);
            }

            if (StringUtils.isNotBlank(sql)) {
                try {
                    this.getJdbcTemplateWriter().update(sql, variables.toArray());
                } catch (DataAccessException dae) {
                    dataLogger.error("Error renaming User DN: " + dae.getMessage());
                }
            }
        }
    }
}

From source file:ml.shifu.shifu.container.meta.MetaFactory.java

/**
 * Get the method-style name of the property. (UPPER the first character:))
 * /*www.  j  av  a  2  s  . c o  m*/
 * @param fieldName
 *            the field name
 * @return first character Upper style
 */
private static String getMethodName(String fieldName) {
    return StringUtils.capitalize(fieldName);
}

From source file:kupkb_experiments.OntologyBuilder.java

public OWLOntology generateOWL(KUPExperiment exp) {

    this.experiment = exp;

    expNames.add(exp.getExperimentID());

    Set<OWLAxiom> axioms = new HashSet<OWLAxiom>();

    try {/*from  w ww  . j a  v  a 2 s  .com*/
        ontology = manager.createOntology(IRI.create(experiment.getBaseOntologyURI()));
        System.out.println("New ontology created: " + ontology.getOntologyID().toString());
    } catch (OWLOntologyCreationException e) {
        e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
    }

    // create the assay individual and type it

    OWLNamedIndividual experimentAssay = factory
            .getOWLNamedIndividual(IRI.create(experiment.getBaseOntologyURI() + "_assay"));

    System.err.println("assay description:" + experiment.getAssayDescription());
    if (experiment.getAssayDescription() != null) {
        OWLAnnotation expannotation = factory.getOWLAnnotation(
                factory.getOWLAnnotationProperty(OWLRDFVocabulary.RDFS_COMMENT.getIRI()),
                factory.getOWLLiteral(experiment.getAssayDescription()));
        axioms.add(factory.getOWLAnnotationAssertionAxiom(experimentAssay.getIRI(), expannotation));
    }

    //            OWLClass assayType = factory.getOWLClass(IRI.create(kupkb_experiments.KUPNamespaces.KUPKB + experiment.getAssayType()));
    OWLClass c1 = getOWLClassFromString(experiment.getAssayType());
    if (c1 == null) {
        System.err
                .println("Program terminated, could not resolve assay type for :" + experiment.getAssayType());
        System.exit(0);
    }

    OWLAxiom ax = factory.getOWLClassAssertionAxiom(c1, experimentAssay);
    axioms.add(ax);
    System.out.println("Creating assay type axiom: " + ax.toString());

    for (KUPAnalysis analysis : experiment.getAnalysis()) {

        // create the analysis individual
        OWLIndividual analysisID = factory.getOWLNamedIndividual(IRI.create(analysis.getAnalysisID()));
        //                OWLClass analysisType = factory.getOWLClass(IRI.create(kupkb_experiments.KUPNamespaces.KUPKB + experiment.getAnalysisType()));

        OWLClass analysisType = getOWLClassFromString(experiment.getAnalysisType());
        if (analysisType == null) {
            System.err.println(
                    "Program terminated, could not resolve analysis type for :" + experiment.getAnalysisType());
            System.exit(0);
        }

        OWLAxiom ax1 = factory.getOWLClassAssertionAxiom(analysisType, analysisID);
        axioms.add(ax1);
        System.out.println("Creating analysis type axiom: " + ax1.toString());

        OWLAxiom ax2 = factory.getOWLObjectPropertyAssertionAxiom(
                factory.getOWLObjectProperty(KUPVocabulary.ANALYSIS_OF.getIRI()), analysisID, experimentAssay);
        axioms.add(ax2);
        System.out.println("Creating analysis to assay relation axiom: " + ax2.toString());

        // get the annotations for this analysis
        for (KUPAnnotation annotation : analysis.getAnnotations()) {

            // relate to annotation
            OWLIndividual experimentFactor = factory
                    .getOWLNamedIndividual(IRI.create(annotation.getAnnotationID()));
            OWLClass annotationType = factory.getOWLClass(KUPVocabulary.KUPANNOTATION.getIRI());

            OWLAxiom ax3 = factory.getOWLClassAssertionAxiom(annotationType, experimentFactor);
            axioms.add(ax3);
            System.out.println("Creating annotation type axiom: " + ax3.toString());

            OWLAxiom ax4 = factory.getOWLObjectPropertyAssertionAxiom(
                    factory.getOWLObjectProperty(KUPVocabulary.ANNOTATED_WITH.getIRI()), analysisID,
                    experimentFactor);
            axioms.add(ax4);
            System.out.println("Creating analysis to assay annotation axiom: " + ax4.toString());

            // pre analytical technuique
            if (experiment.getPreAnalyticalTechnuique() != null) {
                OWLClass cls = getOWLClassFromString(experiment.getPreAnalyticalTechnuique());

                if (cls == null) {
                    System.err.println("Program terminated, could not resolve pre analytical technique for :"
                            + experiment.getPreAnalyticalTechnuique());
                    System.exit(0);
                }

                OWLAxiom ax4a = factory.getOWLObjectPropertyAssertionAxiom(
                        factory.getOWLObjectProperty(KUPVocabulary.PRE_AN_TECH.getIRI()), experimentFactor,
                        factory.getOWLNamedIndividual(cls.getIRI()));
                axioms.add(ax4a);
                System.out.println("Creating pre-analytical technique : " + ax4a.toString());
            }

            // describe annotation
            for (String bioMaterial : annotation.getBioMaterial()) {
                System.out.println("looking up: " + bioMaterial);
                OWLClass entity = getOWLClassFromString(bioMaterial);

                if (entity != null) {
                    // we need to pun this individual
                    OWLAxiom tmpAx = factory.getOWLObjectPropertyAssertionAxiom(
                            factory.getOWLObjectProperty(KUPVocabulary.HAS_BIO_MATERERIAL.getIRI()),
                            experimentFactor, factory.getOWLNamedIndividual(entity.getIRI()));
                    System.out.println("Creating bioMaterial annotation axiom: " + tmpAx.toString());
                    axioms.add(tmpAx);
                } else if (bioMaterial.startsWith("MA")) {
                    // we need to pun this individual
                    OWLAxiom tmpAx = factory.getOWLObjectPropertyAssertionAxiom(
                            factory.getOWLObjectProperty(KUPVocabulary.HAS_BIO_MATERERIAL.getIRI()),
                            experimentFactor,
                            factory.getOWLNamedIndividual(IRI.create(KUPNamespaces.MAO + bioMaterial)));
                    System.out.println("Creating bioMaterial annotation axiom: " + tmpAx.toString());
                    axioms.add(tmpAx);
                } else if (bioMaterial.startsWith("CL")) {
                    // we need to pun this individual
                    OWLAxiom tmpAx = factory.getOWLObjectPropertyAssertionAxiom(
                            factory.getOWLObjectProperty(KUPVocabulary.HAS_BIO_MATERERIAL.getIRI()),
                            experimentFactor,
                            factory.getOWLNamedIndividual(IRI.create(KUPNamespaces.CTO + bioMaterial)));
                    System.out.println("Creating bioMaterial annotation axiom: " + tmpAx.toString());
                    axioms.add(tmpAx);
                } else if (entity == null) {
                    System.err
                            .println("Program terminated, could not resolve bio material for :" + bioMaterial);
                    System.exit(0);
                } else {
                    System.err.println("Something went wrong at: " + bioMaterial);
                    System.exit(0);
                }

            }

            for (String disease : annotation.getHasDisease()) {
                OWLClass entity = getOWLClassFromString(disease);
                if (entity != null) {
                    OWLAxiom tmpAx = factory.getOWLObjectPropertyAssertionAxiom(
                            factory.getOWLObjectProperty(KUPVocabulary.HAS_DISEASE.getIRI()), experimentFactor,
                            factory.getOWLNamedIndividual(entity.getIRI()));
                    System.out.println("Creating disease annotation axiom: " + tmpAx.toString());
                    axioms.add(tmpAx);
                } else {
                    if (!disease.equals("")) {
                        System.err.println("Something went wrong creating: " + disease);
                        System.exit(0);
                    }
                }
            }

            for (String quality : annotation.getQualities()) {
                OWLClass entity = getOWLClassFromString(quality);
                if (entity != null) {
                    OWLAxiom tmpAx = factory.getOWLObjectPropertyAssertionAxiom(
                            factory.getOWLObjectProperty(KUPVocabulary.HAS_QUALITY.getIRI()), experimentFactor,
                            factory.getOWLNamedIndividual(entity.getIRI()));
                    System.out.println("Creating qualities annotation axiom: " + tmpAx.toString());
                    axioms.add(tmpAx);
                } else {
                    if (!quality.equals("")) {
                        System.err.println("Something went wrong creating: " + quality);
                        System.exit(0);
                    }
                }

            }

            // bio condition
            if (!annotation.getCondition().equals("")) {
                OWLClass cs = getOWLClassFromString(annotation.getCondition());
                if (cs == null) {
                    System.err.println("Something went wrong creating: " + annotation.getCondition());
                    System.exit(0);
                }
                OWLAxiom ax6 = factory.getOWLObjectPropertyAssertionAxiom(
                        factory.getOWLObjectProperty(KUPVocabulary.HAS_BIO_CONDITION.getIRI()),
                        experimentFactor, factory.getOWLNamedIndividual(cs.getIRI()));
                System.out.println("Creating condition axiom: " + ax6.toString());
                axioms.add(ax6);
            }

            // role
            if (!annotation.getRole().equals("")) {
                OWLClass cls = getOWLClassFromString(annotation.getRole());
                if (cls == null) {
                    System.err.println("Something went wrong creating: " + annotation.getRole());
                    System.exit(0);
                }

                OWLAxiom ax7 = factory.getOWLObjectPropertyAssertionAxiom(
                        factory.getOWLObjectProperty(KUPVocabulary.HAS_ROLE.getIRI()), experimentFactor,
                        factory.getOWLNamedIndividual(cls.getIRI()));
                System.out.println("Creating role axiom: " + ax7.toString());
                axioms.add(ax7);
            }

            // taxonomy
            if (!annotation.getTaxonomy().equals("")) {
                OWLClass cls = getOWLClassFromString(annotation.getTaxonomy());
                if (cls == null) {
                    cls = factory
                            .getOWLClass(IRI.create(KUPNamespaces.Bio2RDFTAXON + annotation.getTaxonomy()));
                }
                OWLAxiom ax8 = factory.getOWLObjectPropertyAssertionAxiom(
                        factory.getOWLObjectProperty(KUPVocabulary.TAXONOMY_PROPERTY.getIRI()),
                        experimentFactor, factory.getOWLNamedIndividual(cls.getIRI()));
                taxonomy = annotation.getTaxonomy();
                System.out.println("Creating taxonomy axiom: " + ax8.toString());
                axioms.add(ax8);
            }

        }

        // create the compound list
        for (CompoundList comList : analysis.getCompoundList()) {

            OWLNamedIndividual compoundList = factory
                    .getOWLNamedIndividual(IRI.create(comList.getCompoundListID()));
            OWLClass listType = getOWLClassFromString(experiment.getListType());

            OWLAxiom ax10 = factory.getOWLClassAssertionAxiom(listType, compoundList);
            System.out.println("Creating compound list axiom: " + ax10.toString());
            axioms.add(ax10);

            // add produces relation
            OWLAxiom ax11 = factory.getOWLObjectPropertyAssertionAxiom(
                    factory.getOWLObjectProperty(KUPVocabulary.PRODUCES.getIRI()), analysisID, compoundList);
            System.out.println("Creating compound list relation axiom: " + ax11.toString());
            axioms.add(ax11);

            long randomint = System.currentTimeMillis();
            for (CompoundList.ListMember member : comList.getMembers()) {

                IRI id = getCompoundIDasIRI(member);
                // work out what the id is
                if (id != null) {
                    String compoundIdShortForm = shortFormProvider.getShortForm(factory.getOWLClass(id));

                    OWLObjectProperty hasMemberP = factory
                            .getOWLObjectProperty(KUPVocabulary.HAS_MEMBER.getIRI());
                    OWLIndividual compoundListMember = factory
                            .getOWLNamedIndividual(IRI.create(experiment.getBaseOntologyURI() + "_listmember_"
                                    + randomint + "_" + compoundIdShortForm));
                    OWLClass listMemberClass = getRelatedClass(listType, hasMemberP);
                    OWLAxiom ax13 = factory.getOWLClassAssertionAxiom(listMemberClass, compoundListMember);
                    System.out.println("Creating compound list member axiom: " + ax13.toString());
                    axioms.add(ax13);

                    // relate compound list to a member
                    OWLAxiom ax14 = factory.getOWLObjectPropertyAssertionAxiom(hasMemberP, compoundList,
                            compoundListMember);
                    System.out.println("Creating compound list member relation axiom: " + ax14.toString());
                    axioms.add(ax14);

                    // relate to gene id
                    OWLAxiom ax15 = factory.getOWLObjectPropertyAssertionAxiom(
                            factory.getOWLObjectProperty(KUPVocabulary.HAS_DBREF.getIRI()), compoundListMember,
                            factory.getOWLNamedIndividual(id));
                    System.out.println(
                            "Creating compound list member relation to compound axiom: " + ax15.toString());
                    axioms.add(ax15);

                    // get expression
                    if (member.getExpressionStrength() != null) {

                        if (!member.getExpressionStrength().equals("")) {
                            // hack to handle lowercase up and down

                            String expressionString = member.getExpressionStrength();
                            if (expressionString.equals("up") || expressionString.equals("down")) {
                                expressionString = StringUtils.capitalize(expressionString);
                            }
                            OWLEntity expression = getOWLClassFromString(expressionString);
                            if (expression == null) {
                                System.err.println("ERROR: Couldn't find class for " + expressionString);
                                System.exit(0);
                            } else {
                                OWLAxiom ax16 = factory.getOWLObjectPropertyAssertionAxiom(
                                        factory.getOWLObjectProperty(KUPVocabulary.HAS_EXPRESSION.getIRI()),
                                        compoundListMember, factory.getOWLNamedIndividual(expression.getIRI()));
                                System.out.println("Adding has Expression axiom: " + ax16.toString());
                                axioms.add(ax16);

                            }

                        }
                    }

                    if (member.getDifferential() != null) {
                        if (!member.getDifferential().equals("")) {
                            OWLEntity expression = getOWLClassFromString(member.getDifferential());
                            if (expression == null) {
                                System.err
                                        .println("ERROR: Couldn't find class for " + member.getDifferential());
                                System.exit(0);
                            } else {
                                OWLAxiom ax17 = factory.getOWLObjectPropertyAssertionAxiom(
                                        factory.getOWLObjectProperty(KUPVocabulary.HAS_EXPRESSION.getIRI()),
                                        compoundListMember, factory.getOWLNamedIndividual(expression.getIRI()));
                                System.out.println("Adding has Expression axiom: " + ax17.toString());
                                axioms.add(ax17);

                            }
                        }
                    }

                    if (member.getRatio() != null) {
                        if (!member.getRatio().equals("")) {
                            OWLAxiom ax18 = factory.getOWLDataPropertyAssertionAxiom(
                                    factory.getOWLDataProperty(KUPVocabulary.FOLD_CHANGE.getIRI()),
                                    compoundListMember, member.getRatio());
                            System.out.println("Adding ratio axiom: " + ax18.toString());
                            axioms.add(ax18);
                        }
                    }

                    if (member.getPValue() != null) {
                        if (!member.getPValue().equals("")) {
                            OWLAxiom ax19 = factory.getOWLDataPropertyAssertionAxiom(
                                    factory.getOWLDataProperty(KUPVocabulary.P_VALUE.getIRI()),
                                    compoundListMember, member.getPValue());
                            System.out.println("Adding pValue axiom: " + ax19.toString());
                            axioms.add(ax19);
                        }
                    }

                    if (member.getFdrValue() != null) {
                        if (!member.getFdrValue().equals("")) {
                            OWLAxiom ax20 = factory.getOWLDataPropertyAssertionAxiom(
                                    factory.getOWLDataProperty(KUPVocabulary.FDR_VALUE.getIRI()),
                                    compoundListMember, member.getFdrValue());
                            System.out.println("Adding fdr axiom: " + ax20.toString());
                            axioms.add(ax20);
                        }
                    }

                }

            }
        }
    }

    manager.addAxioms(ontology, axioms);

    return ontology;
}

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

private void _generateCell(EAttribute eAttribute, Sheet sheet) {

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

        // Style, font
        Font attributeFont = workBook.createFont();
        attributeFont.setFontName("Verdana");
        attributeFont.setColor(IndexedColors.BLUE.getIndex());
        attributeStyle.setFont(attributeFont);

        // Style, border.
        attributeStyle.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(eAttribute.getName()));
        cell.setCellStyle(attributeStyle);
    }
    // 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(eAttribute.getEType().getName());
        cell.setCellStyle(typeStyle);
    }
}