@Override public String getName(Class clss) { String className = PlasmaConfig.getInstance() .getQueryDSLImplementationClassName(clss.getUri(), clss.getName()); className = this.replaceReservedCharacters(className); return className; }
private String getQualifiedName(String uri, String name) { Namespace sdoNamespace = PlasmaConfig.getInstance().getSDONamespaceByURI(uri); String packageName = sdoNamespace.getProvisioning().getPackageName(); String subpackage = PlasmaConfig.getInstance() .getSDO() .getGlobalProvisioning() .getQueryDSL() .getImplementation() .getChildPackageName(); if (subpackage != null && subpackage.trim().length() > 0) packageName = packageName + "." + subpackage; String className = PlasmaConfig.getInstance().getQueryDSLImplementationClassName(uri, name); className = this.replaceReservedCharacters(className); String qualifiedName = packageName + "." + className; return qualifiedName; }
protected String createStaticFieldDeclarations(Package pkg, Class clss) { InterfaceProvisioning interfaceProvisioning = PlasmaConfig.getInstance().getSDOInterfaceProvisioning(pkg.getUri()); if (interfaceProvisioning == null) interfaceProvisioning = this.globalInterfaceProvisioning; TextBuilder buf = new TextBuilder(LINE_SEP, this.context.getIndentationToken()); // the namespace URI buf.appendln( 1, "/** The <a href=\"http://plasma-sdo.org\">SDO</a> namespace URI associated with the <a href=\"http://docs.plasma-sdo.org/api/org/plasma/sdo/PlasmaType.html\">Type</a> for this class. */"); buf.appendln(1, "public static final String NAMESPACE_URI = \""); buf.append(clss.getUri()); buf.append("\";"); buf.append(LINE_SEP); // the entity name buf.appendln( 1, "/** The entity or <a href=\"http://docs.plasma-sdo.org/api/org/plasma/sdo/PlasmaType.html\">Type</a> logical name associated with this class. */"); buf.appendln(1, "public static final String TYPE_NAME_"); buf.append(toConstantName(clss.getName())); buf.append(" = \""); buf.append(clss.getName()); buf.append("\";"); buf.appendln(1, ""); switch (interfaceProvisioning.getPropertyNameStyle()) { case ENUMS: switch (interfaceProvisioning.getEnumSource()) { case DERIVED: // the static enums buf.appendln( 1, "/** The declared logical property names for this <a href=\"http://docs.plasma-sdo.org/api/org/plasma/sdo/PlasmaType.html\">Type</a>. */"); buf.appendln(1, "public static enum PROPERTY {"); int enumCount = 0; for (Property field : clss.getProperties()) { if (enumCount > 0) buf.append(","); buf.append(this.newline(2)); String javadoc = createStaticFieldDeclarationJavadoc(clss, field, 2); buf.append(javadoc); buf.append(this.newline(2)); buf.append(field.getName()); enumCount++; } buf.appendln(1, "}"); break; case EXTERNAL: // noop break; default: throw new TextProvisioningException( "unexpected enum source, " + interfaceProvisioning.getEnumSource()); } break; case CONSTANTS: // static constants buf.appendln(1, ""); for (Property field : clss.getProperties()) { String javadoc = createStaticFieldDeclarationJavadoc(clss, field, 1); buf.appendln(1, javadoc); buf.appendln(1, "public static final String "); buf.append(toConstantName(field.getName())); buf.append(" = \""); buf.append(field.getName()); buf.append("\";"); } buf.appendln(1, ""); break; default: } return buf.toString(); }
private String createTypeDeclarationJavadoc(Package pkg, Class clss) { TextBuilder buf = new TextBuilder(LINE_SEP, this.context.getIndentationToken()); buf.append("/**"); // begin javadoc // add formatted doc from UML if exists // always put model definition first so it appears // on package summary line for class String docs = getWrappedDocmentations(clss.getDocumentations(), 0); if (docs.trim().length() > 0) { buf.append(docs); // if we have model docs, set up the next section w/a "header" buf.append(newline(0)); buf.append(" * <p></p>"); } buf.append(newline(0)); buf.append(" * Generated interface representing the domain model entity <b>"); buf.append(clss.getName()); buf.append( "</b>. This <a href=\"http://plasma-sdo.org\">SDO</a> interface directly reflects the"); buf.append(newline(0)); buf.append(" * class (single or multiple) inheritance lattice of the source domain model(s) "); buf.append(" and is part of namespace <b>"); buf.append(clss.getUri()); buf.append( "</b> defined within the <a href=\"http://docs.plasma-sdo.org/api/org/plasma/config/package-summary.html\">Configuration</a>."); // data store mapping if (clss.getAlias() != null && clss.getAlias().getPhysicalName() != null) { buf.append(newline(0)); buf.append(" *"); buf.append(newline(0)); buf.append(" * <p></p>"); buf.append(newline(0)); buf.append(" * <b>Data Store Mapping:</b>"); buf.append(newline(0)); buf.append(" * Corresponds to the physical data store entity <b>"); buf.append(clss.getAlias().getPhysicalName()); buf.append("</b>."); buf.append(newline(0)); buf.append(" * <p></p>"); buf.append(newline(0)); buf.append(" *"); } // add @see items for referenced classes Map<String, Class> classMap = new TreeMap<String, Class>(); if (clss.getSuperClasses() != null && clss.getSuperClasses().size() > 0) this.collectProvisioningSuperclasses(pkg, clss, classMap); // for interfaces we have definitions for all methods generated // based on local fields, not fields from superclasses collectProvisioningClasses(pkg, clss, classMap); for (Class refClass : classMap.values()) { Namespace sdoNamespace = PlasmaConfig.getInstance().getSDONamespaceByURI(refClass.getUri()); String packageName = sdoNamespace.getProvisioning().getPackageName(); String packageQualifiedName = packageName + "." + refClass.getName(); buf.append(newline(0)); buf.append(" * @see "); buf.append(packageQualifiedName); buf.append(" "); buf.append(refClass.getName()); } buf.append(newline(0)); buf.append(" */"); // end javadoc return buf.toString(); }