Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMColumnTransformer.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMColumnTransformer.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMColumnTransformer.java (original) +++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMColumnTransformer.java Mon Aug 27 09:48:33 2018 @@ -61,7 +61,7 @@ public class OMColumnTransformer /** The transformer for inheritance elements. */ private static OMInheritanceTransformer inheritanceTransformer - = new OMInheritanceTransformer(); + = new OMInheritanceTransformer(); /** Names which cannot be used as constants for column names. */ private static final Set<String> RESERVED_CONSTANT_NAMES; @@ -86,27 +86,27 @@ public class OMColumnTransformer /** Constant for the getDefaultTimestamp method name. */ static final String GET_DEFAULT_TIMESTAMP_METHOD_NAME - = "getCurrentTimestamp"; + = "getCurrentTimestamp"; /** Prevents reserved java words. */ private static WrapReservedJavaWords reservedJavaWordsWrapper - = new WrapReservedJavaWords(); + = new WrapReservedJavaWords(); static { - Set<String> reservedConstantNames = new HashSet<String>(); + Set<String> reservedConstantNames = new HashSet<>(); reservedConstantNames.add("DATABASE"); reservedConstantNames.add("TABLE_NAME"); reservedConstantNames.add("TABLE"); RESERVED_CONSTANT_NAMES - = Collections.unmodifiableSet(reservedConstantNames); + = Collections.unmodifiableSet(reservedConstantNames); } public void transform( final SourceElement columnElement, final ControllerState controllerState, final int columnPosition) - throws SourceTransformerException + throws SourceTransformerException { checkElementName(columnElement); checkColumnNameExists(columnElement); @@ -198,8 +198,8 @@ public class OMColumnTransformer == null) { String idMethod - = (String) columnElement.getParent().getAttribute( - TorqueSchemaAttributeName.ID_METHOD); + = (String) columnElement.getParent().getAttribute( + TorqueSchemaAttributeName.ID_METHOD); // idMethod can not be null because it is already set by the // table transformer if (!"none".equals(idMethod)) @@ -211,29 +211,29 @@ public class OMColumnTransformer else { columnElement.setAttribute( - TorqueSchemaAttributeName.AUTO_INCREMENT, - Boolean.FALSE.toString()); + TorqueSchemaAttributeName.AUTO_INCREMENT, + Boolean.FALSE.toString()); } } // set protected attribute if (columnElement.getAttribute( - TorqueSchemaAttributeName.PROTECTED) + TorqueSchemaAttributeName.PROTECTED) == null) { columnElement.setAttribute( - TorqueSchemaAttributeName.PROTECTED, - Boolean.FALSE.toString()); + TorqueSchemaAttributeName.PROTECTED, + Boolean.FALSE.toString()); } // set inheritance attribute if (columnElement.getAttribute( - TorqueSchemaAttributeName.INHERITANCE) + TorqueSchemaAttributeName.INHERITANCE) == null) { columnElement.setAttribute( - TorqueSchemaAttributeName.INHERITANCE, - Boolean.FALSE.toString()); + TorqueSchemaAttributeName.INHERITANCE, + Boolean.FALSE.toString()); } // set required attribute @@ -258,9 +258,9 @@ public class OMColumnTransformer } protected void setDomainAttributes( - final SourceElement columnElement, - final ControllerState controllerState) - throws SourceTransformerException + final SourceElement columnElement, + final ControllerState controllerState) + throws SourceTransformerException { SqlType domain = SchemaTypeHelper.getDomain( columnElement, @@ -270,7 +270,7 @@ public class OMColumnTransformer return; } if (columnElement.getAttribute(TorqueSchemaAttributeName.TYPE) - == null + == null && domain.getSqlTypeName() != null) { columnElement.setAttribute( @@ -278,7 +278,7 @@ public class OMColumnTransformer domain.getSqlTypeName()); } if (columnElement.getAttribute(TorqueSchemaAttributeName.DEFAULT) - == null + == null && domain.getDefaultValue() != null) { columnElement.setAttribute( @@ -286,14 +286,14 @@ public class OMColumnTransformer domain.getDefaultValue()); } if (columnElement.getAttribute(TorqueSchemaAttributeName.SIZE) == null - && domain.getSize() != null) + && domain.getSize() != null) { columnElement.setAttribute( TorqueSchemaAttributeName.SIZE, domain.getSize()); } if (columnElement.getAttribute(TorqueSchemaAttributeName.SCALE) == null - && domain.getScale() != null) + && domain.getScale() != null) { columnElement.setAttribute( TorqueSchemaAttributeName.SCALE, @@ -310,8 +310,8 @@ public class OMColumnTransformer protected void setAccessModifierAttributes(final SourceElement columnElement) { boolean isProtected = "true".equals( - columnElement.getAttribute( - TorqueSchemaAttributeName.PROTECTED)); + columnElement.getAttribute( + TorqueSchemaAttributeName.PROTECTED)); String accessModifier; if (isProtected) @@ -341,10 +341,10 @@ public class OMColumnTransformer * @return the java type of the column */ protected JavaType setFieldJavaType( - final SourceElement columnElement, - final SchemaType schemaType, - final String enumClassName) - throws SourceTransformerException + final SourceElement columnElement, + final SchemaType schemaType, + final String enumClassName) + throws SourceTransformerException { JavaType result; String javaType = (String) columnElement.getAttribute( @@ -354,7 +354,7 @@ public class OMColumnTransformer result = TypeMap.getJavaObjectType(schemaType); } else if (TorqueSchemaJavaType.PRIMITIVE.getValue().equals(javaType) - || javaType == null) + || javaType == null) { result = TypeMap.getJavaPrimitiveType(schemaType); } @@ -407,8 +407,8 @@ public class OMColumnTransformer throws SourceTransformerException { String columnName - = (String) columnElement.getAttribute( - TorqueSchemaAttributeName.NAME); + = (String) columnElement.getAttribute( + TorqueSchemaAttributeName.NAME); if (columnName == null) { throw new SourceTransformerException("The attribute " @@ -506,7 +506,7 @@ public class OMColumnTransformer String columnName = (String) columnElement.getAttribute( TorqueSchemaAttributeName.NAME); String qualifiedColumnName - = tableName + "." + columnName; + = tableName + "." + columnName; columnElement.setAttribute( ColumnAttributeName.QUALIFIED_COLUMN_NAME, qualifiedColumnName); @@ -624,19 +624,19 @@ public class OMColumnTransformer * is encountered */ protected void setDefaultValueAttribute( - final SourceElement columnElement, - final JavaType javaType, - final ControllerState controllerState) - throws SourceTransformerException + final SourceElement columnElement, + final JavaType javaType, + final ControllerState controllerState) + throws SourceTransformerException { // special case inheritance by class name // In this case, the class name of the object must be written into the // column as default, overriding any SQL default values. if (TorqueSchemaInheritance.SINGLE.getValue().equals( - columnElement.getAttribute( + columnElement.getAttribute( TorqueSchemaAttributeName.INHERITANCE)) - && columnElement.getChildren(TorqueSchemaElementName.INHERITANCE) - .isEmpty()) + && columnElement.getChildren(TorqueSchemaElementName.INHERITANCE) + .isEmpty()) { columnElement.setAttribute( JavaFieldAttributeName.DEFAULT_VALUE, @@ -657,7 +657,7 @@ public class OMColumnTransformer { boolean useDatabaseDefaultValue = "true".equals( columnElement.getAttribute( - TorqueSchemaAttributeName.USE_DATABASE_DEFAULT_VALUE)); + TorqueSchemaAttributeName.USE_DATABASE_DEFAULT_VALUE)); fieldDefaultValue = getDefaultValueWithDefaultSet( javaType, defaultAttributeValue, @@ -675,7 +675,7 @@ public class OMColumnTransformer fieldDefaultValue = getDefaultValueWithoutDefaultSet(javaType); } if (!"null".equals(fieldDefaultValue) - && Boolean.parseBoolean((String) columnElement.getAttribute(ColumnAttributeName.IS_ENUM))) + && Boolean.parseBoolean((String) columnElement.getAttribute(ColumnAttributeName.IS_ENUM))) { fieldDefaultValue = (String) columnElement.getAttribute(ColumnAttributeName.ENUM_CLASS_NAME) + ".getByValue(" + fieldDefaultValue + ")"; @@ -701,19 +701,19 @@ public class OMColumnTransformer * @throws SourceTransformerException if an illegal default value is used. */ protected String getDefaultValueWithDefaultSet( - final JavaType javaType, - final String defaultValue, - final boolean useDatabaseDefaultValue, - final SourceElement columnElement) - throws SourceTransformerException + final JavaType javaType, + final String defaultValue, + final boolean useDatabaseDefaultValue, + final SourceElement columnElement) + throws SourceTransformerException { boolean primitiveFieldType = javaType.isPrimitive(); String fieldDefaultValue; if (JavaType.BOOLEAN_PRIMITIVE == javaType) { if ("Y".equals(defaultValue) - || "1".equals(defaultValue) - || "true".equalsIgnoreCase(defaultValue)) + || "1".equals(defaultValue) + || "true".equalsIgnoreCase(defaultValue)) { fieldDefaultValue = "true"; } @@ -725,8 +725,8 @@ public class OMColumnTransformer else if (JavaType.BOOLEAN_OBJECT == javaType) { if ("Y".equals(defaultValue) - || "1".equals(defaultValue) - || "true".equalsIgnoreCase(defaultValue)) + || "1".equals(defaultValue) + || "true".equalsIgnoreCase(defaultValue)) { fieldDefaultValue = "Boolean.TRUE"; } @@ -780,11 +780,11 @@ public class OMColumnTransformer String methodName; if (columnElement.getParent().getAttribute( TableAttributeName.GET_CURRENT_DATE_METHOD_NAME) - != null) + != null) { methodName = columnElement.getParent().getAttribute( TableAttributeName.GET_CURRENT_DATE_METHOD_NAME) - .toString(); + .toString(); } else { @@ -797,11 +797,11 @@ public class OMColumnTransformer String methodName; if (columnElement.getParent().getAttribute( TableAttributeName.GET_CURRENT_TIME_METHOD_NAME) - != null) + != null) { methodName = columnElement.getParent().getAttribute( TableAttributeName.GET_CURRENT_TIME_METHOD_NAME) - .toString(); + .toString(); } else { @@ -814,11 +814,11 @@ public class OMColumnTransformer String methodName; if (columnElement.getParent().getAttribute( TableAttributeName.GET_CURRENT_TIMESTAMP_METHOD_NAME) - != null) + != null) { methodName = columnElement.getParent().getAttribute( TableAttributeName.GET_CURRENT_TIMESTAMP_METHOD_NAME) - .toString(); + .toString(); } else { @@ -852,8 +852,8 @@ public class OMColumnTransformer else { fieldDefaultValue - = "new " + javaType.getFullClassName() - + "(" + defaultValue + ")"; + = "new " + javaType.getFullClassName() + + "(" + defaultValue + ")"; } return fieldDefaultValue; } @@ -872,18 +872,18 @@ public class OMColumnTransformer try { SimpleDateFormat dateFormat - = new SimpleDateFormat(DEFAULT_DATE_FORMAT); + = new SimpleDateFormat(DEFAULT_DATE_FORMAT); dateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); return dateFormat.parse(defaultValue); } catch (ParseException e) { throw new SourceTransformerException( - "The default value " - + defaultValue - + " does not match the format String " - + DEFAULT_DATE_FORMAT - + " for date values"); + "The default value " + + defaultValue + + " does not match the format String " + + DEFAULT_DATE_FORMAT + + " for date values"); } } @@ -957,7 +957,7 @@ public class OMColumnTransformer final SourceElement columnElement) { if (columnElement.getAttribute( - TorqueSchemaAttributeName.USE_DATABASE_DEFAULT_VALUE) + TorqueSchemaAttributeName.USE_DATABASE_DEFAULT_VALUE) != null) { return; @@ -1108,7 +1108,7 @@ public class OMColumnTransformer protected void setEnumValueJavaNameAttribute( final SourceElement enumValueElement) - throws SourceTransformerException + throws SourceTransformerException { if (enumValueElement.getAttribute(TorqueSchemaAttributeName.JAVA_NAME) != null) { @@ -1125,9 +1125,9 @@ public class OMColumnTransformer } protected void setEnumValueJavaValueAttribute( - final SourceElement enumValueElement, - final JavaType columnJavaType) - throws SourceTransformerException + final SourceElement enumValueElement, + final JavaType columnJavaType) + throws SourceTransformerException { if (enumValueElement.getAttribute(EnumValueAttributeName.JAVA_VALUE) != null) {
Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMForeignKeyColumnTransformer.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMForeignKeyColumnTransformer.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMForeignKeyColumnTransformer.java (original) +++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMForeignKeyColumnTransformer.java Mon Aug 27 09:48:33 2018 @@ -85,7 +85,7 @@ public class OMForeignKeyColumnTransform public void transform( SourceElement column, ControllerState controllerState) - throws SourceTransformerException + throws SourceTransformerException { if (!TorqueSchemaElementName.COLUMN.getName().equals(column.getName())) { @@ -93,40 +93,40 @@ public class OMForeignKeyColumnTransform + column.getName()); } Object localColumnName - = column.getAttribute(TorqueSchemaAttributeName.NAME); + = column.getAttribute(TorqueSchemaAttributeName.NAME); SourceElement localTable = column.getParent(); Object localTableName - = localTable.getAttribute(TorqueSchemaAttributeName.NAME); + = localTable.getAttribute(TorqueSchemaAttributeName.NAME); SourceElement database = localTable.getParent(); // create the referencedColumn elements { List<SourceElement> tableForeignKeys - = localTable.getChildren( - TorqueSchemaElementName.FOREIGN_KEY.getName()); + = localTable.getChildren( + TorqueSchemaElementName.FOREIGN_KEY.getName()); // find foreign keys with this column as local reference // and create a referencedColumn element for each. for (SourceElement foreignKey : tableForeignKeys) { List<SourceElement> references - = foreignKey.getChildren( - TorqueSchemaElementName.REFERENCE.getName()); + = foreignKey.getChildren( + TorqueSchemaElementName.REFERENCE.getName()); for (SourceElement reference : references) { if (localColumnName.equals(reference.getAttribute( TorqueSchemaAttributeName.LOCAL))) { SourceElement referencedColumn - = new SourceElement( - ColumnChildElementName.REFERENCED_COLUMN); + = new SourceElement( + ColumnChildElementName.REFERENCED_COLUMN); referencedColumn.getChildren().add(foreignKey); String foreignTableName - = (String) foreignKey.getAttribute( - TorqueSchemaAttributeName.FOREIGN_TABLE); + = (String) foreignKey.getAttribute( + TorqueSchemaAttributeName.FOREIGN_TABLE); String foreignColumnName - = (String) reference.getAttribute( - TorqueSchemaAttributeName.FOREIGN); + = (String) reference.getAttribute( + TorqueSchemaAttributeName.FOREIGN); SourceElement foreignTable = FindHelper.findTable( database, foreignTableName, @@ -135,9 +135,9 @@ public class OMForeignKeyColumnTransform { throw new SourceTransformerException( "Foreign table with name " - + foreignTableName - + " not found for a foreignKey of table " - + localTableName); + + foreignTableName + + " not found for a foreignKey of table " + + localTableName); } SourceElement foreignColumn = FindHelper.findColumn( foreignTable, @@ -146,11 +146,11 @@ public class OMForeignKeyColumnTransform { throw new SourceTransformerException( "Referenced Column with table name " - + foreignTableName - + " and column name " - + foreignColumnName - + " not found for a foreignKey of table " - + localTableName); + + foreignTableName + + " and column name " + + foreignColumnName + + " not found for a foreignKey of table " + + localTableName); } referencedColumn.getChildren().add(foreignColumn); column.getChildren().add(referencedColumn); @@ -162,15 +162,15 @@ public class OMForeignKeyColumnTransform //create the referencing-column elements List<SourceElement> allTables - = database.getChildren(TorqueSchemaElementName.TABLE.getName()); + = database.getChildren(TorqueSchemaElementName.TABLE.getName()); for (SourceElement foreignTable : allTables) { String foreignTableName - = (String) foreignTable.getAttribute( - TorqueSchemaAttributeName.NAME); + = (String) foreignTable.getAttribute( + TorqueSchemaAttributeName.NAME); List<SourceElement> foreignKeys - = foreignTable.getChildren( - TorqueSchemaElementName.FOREIGN_KEY.getName()); + = foreignTable.getChildren( + TorqueSchemaElementName.FOREIGN_KEY.getName()); for (SourceElement foreignKey : foreignKeys) { if (!localTableName.equals(foreignKey.getAttribute( @@ -179,21 +179,21 @@ public class OMForeignKeyColumnTransform continue; } List<SourceElement> references - = foreignKey.getChildren( - TorqueSchemaElementName.REFERENCE.getName()); + = foreignKey.getChildren( + TorqueSchemaElementName.REFERENCE.getName()); for (SourceElement reference : references) { Object referenceForeignColumnName - = reference.getAttribute( - TorqueSchemaAttributeName.FOREIGN); + = reference.getAttribute( + TorqueSchemaAttributeName.FOREIGN); String referenceLocalColumnName - = (String) reference.getAttribute( - TorqueSchemaAttributeName.LOCAL); + = (String) reference.getAttribute( + TorqueSchemaAttributeName.LOCAL); if (localColumnName.equals(referenceForeignColumnName)) { SourceElement referencingColumn - = new SourceElement( - ColumnChildElementName.REFERENCING_COLUMN); + = new SourceElement( + ColumnChildElementName.REFERENCING_COLUMN); referencingColumn.getChildren().add(foreignKey); referencingColumn.getChildren().add(foreignTable); SourceElement localColumn = FindHelper.findColumn( @@ -203,10 +203,10 @@ public class OMForeignKeyColumnTransform { throw new SourceTransformerException( "Local Column with column name " - + referenceLocalColumnName - + " not found in one of the foreignKeys" - + " of table " - + foreignTableName); + + referenceLocalColumnName + + " not found in one of the foreignKeys" + + " of table " + + foreignTableName); } referencingColumn.getChildren().add(localColumn); column.getChildren().add(referencingColumn); Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMForeignKeyTransformer.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMForeignKeyTransformer.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMForeignKeyTransformer.java (original) +++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMForeignKeyTransformer.java Mon Aug 27 09:48:33 2018 @@ -67,7 +67,7 @@ public class OMForeignKeyTransformer public void transform( final SourceElement foreignKey, final ControllerState controllerState) - throws SourceTransformerException + throws SourceTransformerException { if (!TorqueSchemaElementName.FOREIGN_KEY.getName().equals( foreignKey.getName())) @@ -82,7 +82,7 @@ public class OMForeignKeyTransformer String foreignTableName = (String) foreignKey.getAttribute( TorqueSchemaAttributeName.FOREIGN_TABLE); SourceElement foreignTable - = FindHelper.findTable(database, foreignTableName, true); + = FindHelper.findTable(database, foreignTableName, true); foreignKey.getChildren().add(foreignTable); for (SourceElement reference : foreignKey.getChildren( @@ -128,21 +128,21 @@ public class OMForeignKeyTransformer public void transformSecondPass( final SourceElement foreignKey, final ControllerState controllerState) - throws SourceTransformerException + throws SourceTransformerException { modifyForeignFieldSecondPass(foreignKey, controllerState); } - /** - * Create a foreign-field element which describes a field - * in the foreign table referencing the local table. - * As more than one foreign object can point - * to this object, the filed needs to be a collection. - * + /** + * Create a foreign-field element which describes a field + * in the foreign table referencing the local table. + * As more than one foreign object can point + * to this object, the filed needs to be a collection. + * * @param foreignKey the foreign-key element to which the foreign-field * element should be added. * @param controllerState the current controller state. - */ + */ private void addForeignField( final SourceElement foreignKey, final ControllerState controllerState) @@ -155,7 +155,7 @@ public class OMForeignKeyTransformer { // the field name for the variable used String foreignFieldName = (String) controllerState.getOption( - TemplateOptionName.OM_FOREIGN_FIELD_NAME_PREFIX) + TemplateOptionName.OM_FOREIGN_FIELD_NAME_PREFIX) + localTable.getAttribute( TableAttributeName.DB_OBJECT_CLASS_NAME) + controllerState.getOption( @@ -163,12 +163,12 @@ public class OMForeignKeyTransformer + referencedBySuffix; // the field name to create the name of the getter and setter String getterSetterFieldName - = (String) localTable.getAttribute( - TableAttributeName.DB_OBJECT_CLASS_NAME) - + referencedBySuffix; + = (String) localTable.getAttribute( + TableAttributeName.DB_OBJECT_CLASS_NAME) + + referencedBySuffix; SourceElement foreignFieldElement - = new SourceElement( - ForeignKeyChildElementName.FOREIGN_FIELD); + = new SourceElement( + ForeignKeyChildElementName.FOREIGN_FIELD); foreignFieldElement.setAttribute( JavaFieldAttributeName.FIELD_NAME, @@ -183,7 +183,7 @@ public class OMForeignKeyTransformer + "Criteria"; foreignFieldElement.setAttribute( ForeignKeyChildAttributeName - .FOREIGN_COLUMN_CRITERIA_CACHE_FIELD, + .FOREIGN_COLUMN_CRITERIA_CACHE_FIELD, criteriaFieldName); } @@ -205,9 +205,9 @@ public class OMForeignKeyTransformer "null"); { String getterName = FieldHelper.getGetterName( - getterSetterFieldName, - fieldType, - controllerState) + getterSetterFieldName, + fieldType, + controllerState) + "s"; foreignFieldElement.setAttribute( JavaFieldAttributeName.GETTER_NAME, @@ -215,11 +215,11 @@ public class OMForeignKeyTransformer } { String setterName = FieldHelper.getSetterName( - getterSetterFieldName) + getterSetterFieldName) + "s"; foreignFieldElement.setAttribute( JavaFieldAttributeName.SETTER_NAME, - setterName); + setterName); } { String adderName = FieldHelper.getAdderName( @@ -256,7 +256,7 @@ public class OMForeignKeyTransformer { String initType = (String) controllerState.getOption( TemplateOptionName.OM_FOREIGN_FIELD_INIT_TYPE) - + "<" + fieldContainedType + ">"; + + "<" + fieldContainedType + ">"; foreignFieldElement.setAttribute( JavaFieldAttributeName.INITIALIZER_TYPE, initType); @@ -273,7 +273,7 @@ public class OMForeignKeyTransformer } { String setAndSaveMethodName - = FieldHelper.getSetAndSaveMethodName( + = FieldHelper.getSetAndSaveMethodName( getterSetterFieldName, "", controllerState); @@ -285,26 +285,26 @@ public class OMForeignKeyTransformer // Name for the doSelectJoinXXX method in the Peer Class // of the foreign table. String peerJoinSelectMethodName - = "doSelectJoin" - + foreignTable.getAttribute( - TorqueSchemaAttributeName.JAVA_NAME) - + referencedBySuffix; + = "doSelectJoin" + + foreignTable.getAttribute( + TorqueSchemaAttributeName.JAVA_NAME) + + referencedBySuffix; foreignFieldElement.setAttribute( ForeignKeyChildAttributeName - .PEER_JOIN_SELECT_METHOD, + .PEER_JOIN_SELECT_METHOD, peerJoinSelectMethodName); } { // Name for the doSelectJoinAllExceptXXX method // in the Peer Class of the foreign table. String peerJoinAllExceptSelectMethodName - = "doSelectJoinAllExcept" - + foreignTable.getAttribute( - TorqueSchemaAttributeName.JAVA_NAME) - + referencedBySuffix; + = "doSelectJoinAllExcept" + + foreignTable.getAttribute( + TorqueSchemaAttributeName.JAVA_NAME) + + referencedBySuffix; foreignFieldElement.setAttribute( ForeignKeyChildAttributeName - .PEER_JOIN_ALL_EXCEPT_SELECT_METHOD, + .PEER_JOIN_ALL_EXCEPT_SELECT_METHOD, peerJoinAllExceptSelectMethodName); } foreignKey.getChildren().add(foreignFieldElement); @@ -328,7 +328,7 @@ public class OMForeignKeyTransformer final ControllerState controllerState) { SourceElement foreignFieldElement - = foreignKey.getChild(ForeignKeyChildElementName.FOREIGN_FIELD); + = foreignKey.getChild(ForeignKeyChildElementName.FOREIGN_FIELD); if (foreignFieldElement == null) { return; @@ -337,14 +337,14 @@ public class OMForeignKeyTransformer JavaFieldAttributeName.SETTER_NAME); // setter gets a "s" appended, remove that String regularSetterName - = setterName.substring(0, setterName.length() - 1); + = setterName.substring(0, setterName.length() - 1); String fieldName - = FieldHelper.getFieldNameFromSetterName(regularSetterName); + = FieldHelper.getFieldNameFromSetterName(regularSetterName); String fillerName = FieldHelper.getFillerName( fieldName, "", controllerState); - // check whether there is a local-field in the referenced table + // check whether there is a local-field in the referenced table // which has the same filler name SourceElement referencedTable = foreignKey.getChild( TorqueSchemaElementName.TABLE); @@ -354,15 +354,15 @@ public class OMForeignKeyTransformer TorqueSchemaElementName.FOREIGN_KEY)) { SourceElement referencedTableLocalField - = referencedTableForeignKey.getChild( - ForeignKeyChildElementName.LOCAL_FIELD); + = referencedTableForeignKey.getChild( + ForeignKeyChildElementName.LOCAL_FIELD); if (referencedTableLocalField == null) { continue; } String referencedTableFiller - = (String) referencedTableLocalField.getAttribute( - JavaFieldAttributeName.FILLER_NAME); + = (String) referencedTableLocalField.getAttribute( + JavaFieldAttributeName.FILLER_NAME); if (fillerName.equals(referencedTableFiller)) { fillerNamingConflictFound = true; @@ -374,7 +374,7 @@ public class OMForeignKeyTransformer fillerName = FieldHelper.getFillerName( fieldName, (String) controllerState.getOption( - TemplateOptionName.OM_FILLER_REFERENCING_DISTICTION), + TemplateOptionName.OM_FILLER_REFERENCING_DISTICTION), controllerState); } foreignFieldElement.setAttribute( @@ -401,22 +401,22 @@ public class OMForeignKeyTransformer foreignKey, controllerState); // the field name to create the name of the bean getter and setter String beanGetterSetterFieldName - = (String) localTable.getAttribute( - TableAttributeName.BEAN_CLASS_NAME) - + referencedBySuffix; + = (String) localTable.getAttribute( + TableAttributeName.BEAN_CLASS_NAME) + + referencedBySuffix; // the field name for the variable used String foreignFieldInBeanName - = (String) controllerState.getOption( - TemplateOptionName.OM_FOREIGN_FIELD_NAME_PREFIX) - + localTable.getAttribute( - TableAttributeName.BEAN_CLASS_NAME) - + controllerState.getOption( - TemplateOptionName.OM_FOREIGN_FIELD_NAME_SUFFIX) - + referencedBySuffix; + = (String) controllerState.getOption( + TemplateOptionName.OM_FOREIGN_FIELD_NAME_PREFIX) + + localTable.getAttribute( + TableAttributeName.BEAN_CLASS_NAME) + + controllerState.getOption( + TemplateOptionName.OM_FOREIGN_FIELD_NAME_SUFFIX) + + referencedBySuffix; SourceElement foreignFieldInBeanElement - = new SourceElement( - ForeignKeyChildElementName.FOREIGN_FIELD_IN_BEAN); + = new SourceElement( + ForeignKeyChildElementName.FOREIGN_FIELD_IN_BEAN); foreignFieldInBeanElement.setAttribute( JavaFieldAttributeName.FIELD_NAME, @@ -452,9 +452,9 @@ public class OMForeignKeyTransformer "null"); { String getterName = FieldHelper.getGetterName( - beanGetterSetterFieldName, - fieldType, - controllerState) + beanGetterSetterFieldName, + fieldType, + controllerState) + "s"; foreignFieldInBeanElement.setAttribute( JavaFieldAttributeName.GETTER_NAME, @@ -462,11 +462,11 @@ public class OMForeignKeyTransformer } { String setterName = FieldHelper.getSetterName( - beanGetterSetterFieldName) + beanGetterSetterFieldName) + "s"; foreignFieldInBeanElement.setAttribute( JavaFieldAttributeName.SETTER_NAME, - setterName); + setterName); } foreignKey.getChildren().add(foreignFieldInBeanElement); } @@ -489,9 +489,9 @@ public class OMForeignKeyTransformer String referencedBySuffix = getLocalReferencedBySuffix( foreignKey, controllerState); String beanGetterSetterFieldName - = (String) foreignTable.getAttribute( - TableAttributeName.BEAN_CLASS_NAME) - + referencedBySuffix; + = (String) foreignTable.getAttribute( + TableAttributeName.BEAN_CLASS_NAME) + + referencedBySuffix; // the field name for the variable used String localBeanFieldName = (String) controllerState.getOption( TemplateOptionName.OM_LOCAL_FIELD_NAME_PREFIX) @@ -501,8 +501,8 @@ public class OMForeignKeyTransformer TemplateOptionName.OM_LOCAL_FIELD_NAME_SUFFIX) + referencedBySuffix; SourceElement localFieldInBeanElement - = new SourceElement( - ForeignKeyChildElementName.LOCAL_FIELD_IN_BEAN); + = new SourceElement( + ForeignKeyChildElementName.LOCAL_FIELD_IN_BEAN); localFieldInBeanElement.setAttribute( JavaFieldAttributeName.FIELD_NAME, @@ -562,13 +562,13 @@ public class OMForeignKeyTransformer + referencedBySuffix; // the field name to create the getter and setter names String getterSetterFieldName - = (String) foreignTable.getAttribute( - TableAttributeName.DB_OBJECT_CLASS_NAME) - + referencedBySuffix; + = (String) foreignTable.getAttribute( + TableAttributeName.DB_OBJECT_CLASS_NAME) + + referencedBySuffix; SourceElement localFieldElement - = new SourceElement( - ForeignKeyChildElementName.LOCAL_FIELD); + = new SourceElement( + ForeignKeyChildElementName.LOCAL_FIELD); localFieldElement.setAttribute( JavaFieldAttributeName.FIELD_NAME, @@ -638,13 +638,13 @@ public class OMForeignKeyTransformer StringBuilder result = new StringBuilder(); List<SourceElement> referencesToSameTable - = FindHelper.findForeignKeyByReferencedTable( - localTable, - foreignTableName); + = FindHelper.findForeignKeyByReferencedTable( + localTable, + foreignTableName); if (referencesToSameTable.size() > 1 || foreignKey.getAttribute( TorqueSchemaAttributeName.FOREIGN_TABLE) - .equals(localTableName)) + .equals(localTableName)) { result.append((String) controllerState.getOption( TemplateOptionName.OM_LOCAL_FIELD_NAME_RELATED_BY)); @@ -652,13 +652,13 @@ public class OMForeignKeyTransformer TorqueSchemaElementName.REFERENCE)) { SourceElement localColumnElement - = reference.getChildren( - ReferenceChildElementName.LOCAL_COLUMN) - .get(0); + = reference.getChildren( + ReferenceChildElementName.LOCAL_COLUMN) + .get(0); SourceElement localColumn - = localColumnElement.getChildren( - TorqueSchemaElementName.COLUMN) - .get(0); + = localColumnElement.getChildren( + TorqueSchemaElementName.COLUMN) + .get(0); String fieldName = (String) localColumn.getAttribute( JavaFieldAttributeName.FIELD_NAME); result.append( @@ -691,9 +691,9 @@ public class OMForeignKeyTransformer StringBuilder result = new StringBuilder(); List<SourceElement> referencingSameTable - = FindHelper.findForeignKeyByReferencedTable( - localTable, - foreignTableName); + = FindHelper.findForeignKeyByReferencedTable( + localTable, + foreignTableName); if (referencingSameTable.size() > 1) { result.append((String) controllerState.getOption( @@ -702,13 +702,13 @@ public class OMForeignKeyTransformer TorqueSchemaElementName.REFERENCE)) { SourceElement localColumnElement - = reference.getChildren( - ReferenceChildElementName.LOCAL_COLUMN) - .get(0); + = reference.getChildren( + ReferenceChildElementName.LOCAL_COLUMN) + .get(0); SourceElement localColumn - = localColumnElement.getChildren( - TorqueSchemaElementName.COLUMN) - .get(0); + = localColumnElement.getChildren( + TorqueSchemaElementName.COLUMN) + .get(0); String fieldName = (String) localColumn.getAttribute( JavaFieldAttributeName.FIELD_NAME); result.append( @@ -734,10 +734,10 @@ public class OMForeignKeyTransformer reference.getAttribute( TorqueSchemaAttributeName.FOREIGN); SourceElement foreignColumnElement - = new SourceElement( - ReferenceChildElementName.FOREIGN_COLUMN); + = new SourceElement( + ReferenceChildElementName.FOREIGN_COLUMN); SourceElement column - = FindHelper.findColumn(foreignTable, foreignColumnName); + = FindHelper.findColumn(foreignTable, foreignColumnName); foreignColumnElement.getChildren().add(column); reference.getChildren().add(foreignColumnElement); } @@ -756,25 +756,25 @@ public class OMForeignKeyTransformer protected void createLocalElementForReference( final SourceElement localTable, final SourceElement reference) - throws SourceTransformerException + throws SourceTransformerException { { String localColumnName = (String) reference.getAttribute( TorqueSchemaAttributeName.LOCAL); SourceElement localColumnElement - = new SourceElement( - ReferenceChildElementName.LOCAL_COLUMN); + = new SourceElement( + ReferenceChildElementName.LOCAL_COLUMN); SourceElement column - = FindHelper.findColumn(localTable, localColumnName); + = FindHelper.findColumn(localTable, localColumnName); if (column == null) { Object localTableName = localTable.getAttribute( TorqueSchemaAttributeName.NAME); throw new SourceTransformerException( "Error defining foreign key in table " + localTableName - + " : Could not find local column " + localColumnName - + " in table " + localTableName); + + " : Could not find local column " + localColumnName + + " in table " + localTableName); } localColumnElement.getChildren().add(column); reference.getChildren().add(localColumnElement); @@ -791,27 +791,27 @@ public class OMForeignKeyTransformer foreignKey, controllerState); String foreignKeyGetterName = (String) controllerState.getOption( TemplateOptionName.OM_FOREIGN_KEY_GETTER_PREFIX) - + foreignTable.getAttribute( - TableAttributeName.DB_OBJECT_CLASS_NAME) - + controllerState.getOption( - TemplateOptionName.OM_FOREIGN_KEY_GETTER_SUFFIX) - + referencedBySuffix; + + foreignTable.getAttribute( + TableAttributeName.DB_OBJECT_CLASS_NAME) + + controllerState.getOption( + TemplateOptionName.OM_FOREIGN_KEY_GETTER_SUFFIX) + + referencedBySuffix; foreignKey.setAttribute( ForeignKeyAttributeName.FOREIGN_KEY_GETTER, foreignKeyGetterName); boolean referencesPrimaryKey = false; List<SourceElement> foreignTablePrimaryKeys - = foreignTable.getChild(TableChildElementName.PRIMARY_KEYS) - .getChildren(TorqueSchemaElementName.COLUMN); + = foreignTable.getChild(TableChildElementName.PRIMARY_KEYS) + .getChildren(TorqueSchemaElementName.COLUMN); List<SourceElement> foreignTableForeignKeyColumns - = new ArrayList<SourceElement>(); + = new ArrayList<>(); for (SourceElement reference : foreignKey.getChildren(TorqueSchemaElementName.REFERENCE)) { SourceElement column = reference.getChild( ReferenceChildElementName.FOREIGN_COLUMN) - .getChild(TorqueSchemaElementName.COLUMN); + .getChild(TorqueSchemaElementName.COLUMN); foreignTableForeignKeyColumns.add(column); } if (foreignTablePrimaryKeys.size() @@ -847,8 +847,8 @@ public class OMForeignKeyTransformer parent.getName())) { result.append("[") - .append(parent.getAttribute(TorqueSchemaAttributeName.FILENAME)) - .append("]"); + .append(parent.getAttribute(TorqueSchemaAttributeName.FILENAME)) + .append("]"); } result.append("/"); getParentPath(parent, result); Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMInheritanceTransformer.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMInheritanceTransformer.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMInheritanceTransformer.java (original) +++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMInheritanceTransformer.java Mon Aug 27 09:48:33 2018 @@ -33,7 +33,7 @@ public class OMInheritanceTransformer public void transform( SourceElement inheritanceElement, ControllerState controllerState) - throws SourceTransformerException + throws SourceTransformerException { if (!TorqueSchemaElementName.INHERITANCE.getName().equals( inheritanceElement.getName())) @@ -47,16 +47,16 @@ public class OMInheritanceTransformer { throw new IllegalArgumentException( "Attribute \"" - + TorqueSchemaAttributeName.KEY - + "\" not set in Element " - + TorqueSchemaElementName.INHERITANCE); + + TorqueSchemaAttributeName.KEY + + "\" not set in Element " + + TorqueSchemaElementName.INHERITANCE); } inheritanceElement.setAttribute( InheritanceAttributeName.CLASSKEY_CONSTANT, "CLASSKEY_" + key.toUpperCase()); SourceElement tableElement - = inheritanceElement.getParent().getParent(); + = inheritanceElement.getParent().getParent(); String className = (String) inheritanceElement.getAttribute( TorqueSchemaAttributeName.CLASS.getName()); if (className == null) @@ -96,17 +96,17 @@ public class OMInheritanceTransformer if (lastDot != -1) { unqualifiedClassname - = extendsAttribute.substring(lastDot + 1); + = extendsAttribute.substring(lastDot + 1); } else { unqualifiedClassname = extendsAttribute; } beanExtends = controllerState.getOption( - "torque.om.className.beanClassNamePrefix") + "torque.om.className.beanClassNamePrefix") + unqualifiedClassname + controllerState.getOption( - "torque.om.className.beanClassNameSuffix"); + "torque.om.className.beanClassNameSuffix"); inheritanceElement.setAttribute( InheritanceAttributeName.BEAN_EXTENDS, beanExtends); @@ -118,17 +118,17 @@ public class OMInheritanceTransformer if (lastDot != -1) { unqualifiedClassname - = className.substring(lastDot + 1); + = className.substring(lastDot + 1); } else { unqualifiedClassname = className; } String beanClassName = controllerState.getOption( - "torque.om.className.beanClassNamePrefix") + "torque.om.className.beanClassNamePrefix") + unqualifiedClassname + controllerState.getOption( - "torque.om.className.beanClassNameSuffix"); + "torque.om.className.beanClassNameSuffix"); inheritanceElement.setAttribute( InheritanceAttributeName.BEAN_CLASS_NAME, beanClassName); @@ -139,4 +139,4 @@ public class OMInheritanceTransformer tableElement.getAttribute( TableAttributeName.BEAN_PACKAGE)); } - } +} Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMJoinGetterTransformer.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMJoinGetterTransformer.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMJoinGetterTransformer.java (original) +++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMJoinGetterTransformer.java Mon Aug 27 09:48:33 2018 @@ -81,7 +81,7 @@ public class OMJoinGetterTransformer public void transform( final SourceElement tableElement, final ControllerState controllerState) - throws SourceTransformerException + throws SourceTransformerException { if (!controllerState.getBooleanOption(OM_GENERATE_JOIN_GETTERS)) { @@ -108,19 +108,19 @@ public class OMJoinGetterTransformer TorqueSchemaElementName.TABLE); String localReferencedBySuffix - = OMForeignKeyTransformer.getForeignReferencedBySuffix( - foreignKey, controllerState); + = OMForeignKeyTransformer.getForeignReferencedBySuffix( + foreignKey, controllerState); String localGetterSetterFieldName - = (String) foreignTable.getAttribute( - TableAttributeName.DB_OBJECT_CLASS_NAME) - + localReferencedBySuffix; + = (String) foreignTable.getAttribute( + TableAttributeName.DB_OBJECT_CLASS_NAME) + + localReferencedBySuffix; String foreignReferencedBySuffix - = OMForeignKeyTransformer.getForeignReferencedBySuffix( - remoteForeignKey, controllerState); + = OMForeignKeyTransformer.getForeignReferencedBySuffix( + remoteForeignKey, controllerState); String foreignGetterSetterFieldName - = (String) remoteForeignTable.getAttribute( - TableAttributeName.DB_OBJECT_CLASS_NAME) - + foreignReferencedBySuffix; + = (String) remoteForeignTable.getAttribute( + TableAttributeName.DB_OBJECT_CLASS_NAME) + + foreignReferencedBySuffix; String joinGetterFieldName = localGetterSetterFieldName + controllerState.getStringOption(OM_JOIN_GETTER_SEPARATOR) + foreignGetterSetterFieldName; @@ -164,8 +164,8 @@ public class OMJoinGetterTransformer { if (!TorqueSchemaElementName.TABLE.getName().equals( tableElement.getName()) - && !TorqueSchemaElementName.VIEW.getName().equals( - tableElement.getName())) + && !TorqueSchemaElementName.VIEW.getName().equals( + tableElement.getName())) { throw new IllegalArgumentException("Illegal element Name " + tableElement.getName()); Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMReferencingForeignKeyTableTransformer.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMReferencingForeignKeyTableTransformer.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMReferencingForeignKeyTableTransformer.java (original) +++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMReferencingForeignKeyTableTransformer.java Mon Aug 27 09:48:33 2018 @@ -69,26 +69,26 @@ public class OMReferencingForeignKeyTabl public void transform( SourceElement table, ControllerState controllerState) - throws SourceTransformerException + throws SourceTransformerException { SourceElement database = table.getParent(); String tableName = (String) table.getAttribute( TorqueSchemaAttributeName.NAME.getName()); List<SourceElement> referencingForeignKeys - = new ArrayList<SourceElement>(); + = new ArrayList<>(); for (SourceElement otherTable : database.getChildren( TorqueSchemaElementName.TABLE.getName())) { List<SourceElement> referencingFromOtherTable - = FindHelper.findForeignKeyByReferencedTable( - otherTable, - tableName); + = FindHelper.findForeignKeyByReferencedTable( + otherTable, + tableName); referencingForeignKeys.addAll(referencingFromOtherTable); } SourceElement referencingForeignKeysElement - = new SourceElement( - TableChildElementName.REFERENCING_FOREIGN_KEYS); + = new SourceElement( + TableChildElementName.REFERENCING_FOREIGN_KEYS); table.getChildren().add(referencingForeignKeysElement); for (SourceElement foreignKey : referencingForeignKeys) Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTableAndViewTransformer.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTableAndViewTransformer.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTableAndViewTransformer.java (original) +++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTableAndViewTransformer.java Mon Aug 27 09:48:33 2018 @@ -56,20 +56,20 @@ public class OMTableAndViewTransformer e /** The transformer for the column child elements. */ private static OMColumnTransformer columnTransformer - = new OMColumnTransformer();; + = new OMColumnTransformer();; /** The transformer for the foreign keys referencing this table. */ private static OMReferencingForeignKeyTableTransformer - referencingForeignKeyTableTransformer - = new OMReferencingForeignKeyTableTransformer(); + referencingForeignKeyTableTransformer + = new OMReferencingForeignKeyTableTransformer(); /** The transformer collecting the primary key columns in this table. */ private static CollectAttributeSetTrueTransformer primaryKeyTransformer - = new CollectAttributeSetTrueTransformer(); + = new CollectAttributeSetTrueTransformer(); /** Prevents reserved java words. */ private static WrapReservedJavaWords reservedJavaWordsWrapper - = new WrapReservedJavaWords(); + = new WrapReservedJavaWords(); public OMTableAndViewTransformer() throws SourceTransformerException { @@ -101,7 +101,7 @@ public class OMTableAndViewTransformer e public SourceElement transform( Object tableModel, ControllerState controllerState) - throws SourceTransformerException + throws SourceTransformerException { SourceElement tableElement = (SourceElement) tableModel; checkElementName(tableElement); @@ -159,8 +159,8 @@ public class OMTableAndViewTransformer e { if (!TorqueSchemaElementName.TABLE.getName().equals( tableElement.getName()) - && !TorqueSchemaElementName.VIEW.getName().equals( - tableElement.getName())) + && !TorqueSchemaElementName.VIEW.getName().equals( + tableElement.getName())) { throw new IllegalArgumentException("Illegal element Name " + tableElement.getName()); @@ -179,8 +179,8 @@ public class OMTableAndViewTransformer e */ public static void setJavaNameAttribute( SourceElement tableElement, - ControllerState controllerState) - throws SourceTransformerException + ControllerState controllerState) + throws SourceTransformerException { // set javaName attribute Object javaName = tableElement.getAttribute( @@ -262,28 +262,28 @@ public class OMTableAndViewTransformer e List<SourceElement> idMethodParams = tableElement.getChildren( TorqueSchemaElementName.ID_METHOD_PARAMETER); if (idMethodParams.isEmpty() - && tableElement.getAttribute(TableAttributeName.SEQUENCE_NAME) == null) + && tableElement.getAttribute(TableAttributeName.SEQUENCE_NAME) == null) { tableElement.setAttribute( TableAttributeName.SEQUENCE_NAME, (String) tableElement.getAttribute( - TorqueSchemaAttributeName.NAME) - + "_SEQ"); + TorqueSchemaAttributeName.NAME) + + "_SEQ"); } else { tableElement.setAttribute( TableAttributeName.SEQUENCE_NAME, - idMethodParams.get(0).getAttribute( + idMethodParams.get(0).getAttribute( TorqueSchemaAttributeName.VALUE.getName())); } } protected void setManagerClassNameAttributes( - SourceElement tableElement, - ControllerState controllerState) - throws SourceTransformerException + SourceElement tableElement, + ControllerState controllerState) + throws SourceTransformerException { // Managers must be named after an interface if there is one. String interfaceName = (String) tableElement.getAttribute( @@ -292,17 +292,17 @@ public class OMTableAndViewTransformer e { String managerClassName = controllerState.getStringOption( TemplateOptionName.OM_MANAGER_CLASS_NAME_PREFIX) - + tableElement.getAttribute(TorqueSchemaAttributeName.JAVA_NAME) - + controllerState.getStringOption( - TemplateOptionName.OM_MANAGER_CLASS_NAME_SUFFIX); + + tableElement.getAttribute(TorqueSchemaAttributeName.JAVA_NAME) + + controllerState.getStringOption( + TemplateOptionName.OM_MANAGER_CLASS_NAME_SUFFIX); tableElement.setAttribute( TableAttributeName.MANAGER_CLASS_NAME, managerClassName); String baseManagerClassName = controllerState.getStringOption( "torque.om.className.baseManagerClassNamePrefix") - + tableElement.getAttribute(TorqueSchemaAttributeName.JAVA_NAME) - + controllerState.getStringOption( - "torque.om.className.baseManagerClassNameSuffix"); + + tableElement.getAttribute(TorqueSchemaAttributeName.JAVA_NAME) + + controllerState.getStringOption( + "torque.om.className.baseManagerClassNameSuffix"); tableElement.setAttribute( TableAttributeName.BASE_MANAGER_CLASS_NAME, baseManagerClassName); @@ -337,7 +337,7 @@ public class OMTableAndViewTransformer e else { interfaceName = interfaceName.substring(0, 1).toUpperCase() - + interfaceName.substring(1); + + interfaceName.substring(1); } if (tableElement.getAttribute(TableAttributeName.MANAGER_CLASS_NAME) @@ -345,9 +345,9 @@ public class OMTableAndViewTransformer e { String managerClassName = controllerState.getOption( TemplateOptionName.OM_MANAGER_CLASS_NAME_PREFIX) - + interfaceName - + controllerState.getOption( - TemplateOptionName.OM_MANAGER_CLASS_NAME_SUFFIX); + + interfaceName + + controllerState.getOption( + TemplateOptionName.OM_MANAGER_CLASS_NAME_SUFFIX); tableElement.setAttribute( TableAttributeName.MANAGER_CLASS_NAME, managerClassName); @@ -357,9 +357,9 @@ public class OMTableAndViewTransformer e { String baseManagerClassName = controllerState.getOption( "torque.om.className.baseManagerClassNamePrefix") - + interfaceName - + controllerState.getOption( - "torque.om.className.baseManagerClassNameSuffix"); + + interfaceName + + controllerState.getOption( + "torque.om.className.baseManagerClassNameSuffix"); tableElement.setAttribute( TableAttributeName.BASE_MANAGER_CLASS_NAME, baseManagerClassName); @@ -368,8 +368,8 @@ public class OMTableAndViewTransformer e } public void createInheritanceColumnChildIfNecessary( - SourceElement tableElement) - throws SourceTransformerException + SourceElement tableElement) + throws SourceTransformerException { boolean inheritanceFound = false; for (SourceElement columnElement : tableElement.getChildren( @@ -377,20 +377,20 @@ public class OMTableAndViewTransformer e { if (TorqueSchemaInheritance.SINGLE.getValue().equals( columnElement.getAttribute( - TorqueSchemaAttributeName.INHERITANCE))) + TorqueSchemaAttributeName.INHERITANCE))) { if (inheritanceFound) { throw new SourceTransformerException( "more than one column with " - + TorqueSchemaAttributeName.INHERITANCE - + " set to \"single\" found in table " - + tableElement.getAttribute( - tableElement.getName())); + + TorqueSchemaAttributeName.INHERITANCE + + " set to \"single\" found in table " + + tableElement.getAttribute( + tableElement.getName())); } SourceElement inheritanceColumnElement - = new SourceElement( - TableChildElementName.INHERITANCE_COLUMN); + = new SourceElement( + TableChildElementName.INHERITANCE_COLUMN); inheritanceColumnElement.getChildren().add(columnElement); tableElement.getChildren().add(inheritanceColumnElement); inheritanceFound = true; @@ -535,16 +535,16 @@ public class OMTableAndViewTransformer e // - Attribute saveMethodsInDbObjects in table // - option TemplateOptionName.OM_SAVE_METHODS_IN_DB_OBJECTS String saveMethodLocationOptionName - = TemplateOptionName.OM_SAVE_METHODS_IN_DB_OBJECTS.getName(); + = TemplateOptionName.OM_SAVE_METHODS_IN_DB_OBJECTS.getName(); String saveMethodLocationAttributeName - = saveMethodLocationOptionName.substring( - saveMethodLocationOptionName.lastIndexOf('.') + 1); + = saveMethodLocationOptionName.substring( + saveMethodLocationOptionName.lastIndexOf('.') + 1); boolean saveMethodsInDbObjects; if (tableElement.getAttribute(saveMethodLocationAttributeName) != null) { saveMethodsInDbObjects = Boolean.parseBoolean( tableElement.getAttribute(saveMethodLocationAttributeName) - .toString()); + .toString()); } else { @@ -579,7 +579,7 @@ public class OMTableAndViewTransformer e { if (tableElement.getAttribute( TableAttributeName.GET_CURRENT_DATE_METHOD_NAME) - == null) + == null) { tableElement.setAttribute( TableAttributeName.GET_CURRENT_DATE_METHOD_NAME, @@ -590,7 +590,7 @@ public class OMTableAndViewTransformer e { if (tableElement.getAttribute( TableAttributeName.GET_CURRENT_TIME_METHOD_NAME) - == null) + == null) { tableElement.setAttribute( TableAttributeName.GET_CURRENT_TIME_METHOD_NAME, @@ -598,13 +598,13 @@ public class OMTableAndViewTransformer e } } else if (CURRENT_TIMESTAMP.equalsIgnoreCase(defaultValue) - && tableElement.getAttribute( - TableAttributeName.GET_CURRENT_TIMESTAMP_METHOD_NAME) + && tableElement.getAttribute( + TableAttributeName.GET_CURRENT_TIMESTAMP_METHOD_NAME) == null) { tableElement.setAttribute( - TableAttributeName.GET_CURRENT_TIMESTAMP_METHOD_NAME, - GET_DEFAULT_TIMESTAMP_METHOD_NAME); + TableAttributeName.GET_CURRENT_TIMESTAMP_METHOD_NAME, + GET_DEFAULT_TIMESTAMP_METHOD_NAME); } } } Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTransformer.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTransformer.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTransformer.java (original) +++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTransformer.java Mon Aug 27 09:48:33 2018 @@ -64,7 +64,7 @@ public class OMTransformer implements So * @see OMForeignKeyColumnTransformer */ private static final OMForeignKeyColumnTransformer foreignKeyColumnTransformer - = new OMForeignKeyColumnTransformer(); + = new OMForeignKeyColumnTransformer(); /** * The transformer which adds references to the referenced and referencing @@ -73,7 +73,7 @@ public class OMTransformer implements So * @see OMForeignKeyTransformer */ private static final OMForeignKeyTransformer foreignKeyTransformer - = new OMForeignKeyTransformer(); + = new OMForeignKeyTransformer(); /** * The transformer which adds transforms the table/view and column elements @@ -89,7 +89,7 @@ public class OMTransformer implements So * @see LoadExternalSchemaTransformer */ private static final SourceTransformer loadExternalSchemaTransformer - = new LoadExternalSchemaTransformer(); + = new LoadExternalSchemaTransformer(); /** * The transformer which includes the included schemata. @@ -97,11 +97,11 @@ public class OMTransformer implements So * @see LoadExternalSchemaTransformer */ private static final SourceTransformer includeSchemaTransformer - = new IncludeSchemaTransformer(); + = new IncludeSchemaTransformer(); /** The transformer which creates the joinGetters. */ private static OMJoinGetterTransformer joinGetterTransformer - = new OMJoinGetterTransformer(); + = new OMJoinGetterTransformer(); static { @@ -123,10 +123,11 @@ public class OMTransformer implements So * * @throws SourceTransformerException if the transformation fails. */ + @Override public SourceElement transform( final Object modelRoot, final ControllerState controllerState) - throws SourceTransformerException + throws SourceTransformerException { final SourceElement root = (SourceElement) modelRoot; TemplateOptionName.checkRequiredOptions( @@ -143,13 +144,13 @@ public class OMTransformer implements So // load referenced external schemata loadExternalSchemaTransformer.transform(root, controllerState); - final List<SourceElement> allTablesAndViews = new ArrayList<SourceElement>(); + final List<SourceElement> allTablesAndViews = new ArrayList<>(); allTablesAndViews.addAll( root.getChild(DatabaseChildElementName.ALL_TABLES) - .getChildren(TorqueSchemaElementName.TABLE)); + .getChildren(TorqueSchemaElementName.TABLE)); allTablesAndViews.addAll( root.getChild(DatabaseChildElementName.ALL_VIEWS) - .getChildren(TorqueSchemaElementName.VIEW)); + .getChildren(TorqueSchemaElementName.VIEW)); for (final SourceElement tableOrViewElement : allTablesAndViews) { @@ -169,7 +170,7 @@ public class OMTransformer implements So } for (final SourceElement foreignKeyElement : tableOrViewElement.getChildren( - TorqueSchemaElementName.FOREIGN_KEY)) + TorqueSchemaElementName.FOREIGN_KEY)) { foreignKeyTransformer.transform( foreignKeyElement, @@ -181,7 +182,7 @@ public class OMTransformer implements So { for (final SourceElement foreignKeyElement : tableOrViewElement.getChildren( - TorqueSchemaElementName.FOREIGN_KEY)) + TorqueSchemaElementName.FOREIGN_KEY)) { foreignKeyTransformer.transformSecondPass( foreignKeyElement, Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/ReferenceChildElementName.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/ReferenceChildElementName.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/ReferenceChildElementName.java (original) +++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/ReferenceChildElementName.java Mon Aug 27 09:48:33 2018 @@ -57,6 +57,7 @@ public enum ReferenceChildElementName im * * @return the name of the referenced source element. */ + @Override public String getName() { return name; Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/TableAttributeName.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/TableAttributeName.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/TableAttributeName.java (original) +++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/TableAttributeName.java Mon Aug 27 09:48:33 2018 @@ -134,6 +134,7 @@ public enum TableAttributeName implement * * @return the name of the referenced source element attribute. */ + @Override public String getName() { return name; Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/TableChildElementName.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/TableChildElementName.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/TableChildElementName.java (original) +++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/TableChildElementName.java Mon Aug 27 09:48:33 2018 @@ -76,6 +76,7 @@ public enum TableChildElementName implem * * @return the name of the referenced source element. */ + @Override public String getName() { return name; Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTableTransformer.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTableTransformer.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTableTransformer.java (original) +++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTableTransformer.java Mon Aug 27 09:48:33 2018 @@ -73,7 +73,7 @@ public class DatabaseMapInitTableTransfo public SourceElement transform( Object tableModel, ControllerState controllerState) - throws SourceTransformerException + throws SourceTransformerException { SourceElement tableElement = (SourceElement) tableModel; if (!TorqueSchemaElementName.TABLE.getName().equals( @@ -89,4 +89,4 @@ public class DatabaseMapInitTableTransfo OMTableAndViewTransformer.setPeerImplGetterAttribute(tableElement); return tableElement; } - } +} Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTransformer.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTransformer.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTransformer.java (original) +++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTransformer.java Mon Aug 27 09:48:33 2018 @@ -69,7 +69,7 @@ public class DatabaseMapInitTransformer /** The transformer for table elements. */ private final DatabaseMapInitTableTransformer tableTransformer - = new DatabaseMapInitTableTransformer(); + = new DatabaseMapInitTableTransformer(); /** * Constructor. @@ -106,7 +106,7 @@ public class DatabaseMapInitTransformer public SourceElement transform( Object modelRoot, ControllerState controllerState) - throws SourceTransformerException + throws SourceTransformerException { SourceElement rootElement = (SourceElement) modelRoot; if (!CombinedFileSource.ROOT_ELEMENT_NAME.equals( @@ -116,14 +116,14 @@ public class DatabaseMapInitTransformer + rootElement.getName()); } SourceElement databaseSetsElement - = new SourceElement(DATABASE_SETS_ELEMENT); + = new SourceElement(DATABASE_SETS_ELEMENT); rootElement.getChildren().add(databaseSetsElement); for (SourceElement fileElement : rootElement.getChildren(CombinedFileSource.FILE_ELEMENT_NAME)) { SourceElement databaseElement - = fileElement.getChild(TorqueSchemaElementName.DATABASE); + = fileElement.getChild(TorqueSchemaElementName.DATABASE); if (databaseElement == null) { throw new IllegalArgumentException("The root element of file " @@ -148,14 +148,14 @@ public class DatabaseMapInitTransformer CombinedFileSource.PATH_ATTRIBUTE_NAME); File pathFile = new File(path); SourceTransformer loadExternalSchemaTransformer - = new LoadExternalSchemaTransformer( - pathFile.getParentFile()); + = new LoadExternalSchemaTransformer( + pathFile.getParentFile()); loadExternalSchemaTransformer.transform( databaseElement, controllerState); SourceElement allTablesRoot - = databaseElement.getChild(DatabaseChildElementName.ALL_TABLES); + = databaseElement.getChild(DatabaseChildElementName.ALL_TABLES); SourceElement databaseSetElement = getDatabaseSetWithDatabaseName( databaseSetsElement, @@ -186,7 +186,7 @@ public class DatabaseMapInitTransformer controllerState); super.transform(databaseSetElement, controllerState); for (SourceElement tableElement - : databaseSetElement.getChildren(TorqueSchemaElementName.TABLE)) + : databaseSetElement.getChildren(TorqueSchemaElementName.TABLE)) { tableTransformer.transform(tableElement, controllerState); } @@ -209,18 +209,18 @@ public class DatabaseMapInitTransformer ControllerState controllerState) { String databaseMapInitClassName - = controllerState.getOption( - TemplateOptionName.OM_DATABASE_MAP_INIT_CLASS_NAME_PREFIX) - + camelbacker.process(databaseName) - + controllerState.getOption( - TemplateOptionName.OM_DATABASE_MAP_INIT_CLASS_NAME_SUFFIX); + = controllerState.getOption( + TemplateOptionName.OM_DATABASE_MAP_INIT_CLASS_NAME_PREFIX) + + camelbacker.process(databaseName) + + controllerState.getOption( + TemplateOptionName.OM_DATABASE_MAP_INIT_CLASS_NAME_SUFFIX); sourceElement.setAttribute( DatabaseAttributeName.DATABASE_MAP_INIT_CLASS_NAME, databaseMapInitClassName); String baseMapInitClassName - = controllerState.getOption( - TemplateOptionName.OM_BASE_DATABASE_MAP_INIT_CLASS_NAME_PREFIX) - + databaseMapInitClassName; + = controllerState.getOption( + TemplateOptionName.OM_BASE_DATABASE_MAP_INIT_CLASS_NAME_PREFIX) + + databaseMapInitClassName; sourceElement.setAttribute( DatabaseAttributeName.BASE_DATABASE_MAP_INIT_CLASS_NAME, baseMapInitClassName); @@ -240,4 +240,4 @@ public class DatabaseMapInitTransformer } return null; } - } +} --------------------------------------------------------------------- To unsubscribe, e-mail: torque-dev-unsubscr...@db.apache.org For additional commands, e-mail: torque-dev-h...@db.apache.org