svn commit: r1856882 [1/2] - in /db/torque/torque4/trunk/torque-templates: ./ src/main/java/org/apache/torque/templates/transformer/om/ src/main/java/org/apache/torque/templates/transformer/sql/ src/main/java/org/apache/torque/templates/typemapping/ sr...

classic Classic list List threaded Threaded
1 message Options
gk
Reply | Threaded
Open this post in threaded view
|

svn commit: r1856882 [1/2] - in /db/torque/torque4/trunk/torque-templates: ./ src/main/java/org/apache/torque/templates/transformer/om/ src/main/java/org/apache/torque/templates/transformer/sql/ src/main/java/org/apache/torque/templates/typemapping/ sr...

gk
Author: gk
Date: Wed Apr  3 14:46:59 2019
New Revision: 1856882

URL: http://svn.apache.org/viewvc?rev=1856882&view=rev
Log:
- extracted java related transformer class from OMColumnTransformer
- fixed not generated enum imports in vm-templates
- add not generated, expected test classes (schema.xml)
- removed not allowed empty scale attribute
- add enum JavaType, but this is not yet generated correctly, cf. OMColumnJavaTransformer#setFieldJavaType
- add missing dependency
- set eol to native to test expected sql

Added:
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMColumnJavaTransformer.java   (with props)
    db/torque/torque4/trunk/torque-templates/src/test/java/a/
    db/torque/torque4/trunk/torque-templates/src/test/java/a/b/
    db/torque/torque4/trunk/torque-templates/src/test/java/a/b/SomeEnum.java   (with props)
    db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/TestInterface.java   (with props)
Modified:
    db/torque/torque4/trunk/torque-templates/pom.xml
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMColumnTransformer.java
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTableAndViewTransformer.java
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLModelTransformer.java
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLTransformer.java
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/typemapping/JavaType.java
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/base/baseBean.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/baseDbObjectForView.vm
    db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-datamodel.css   (contents, props changed)
    db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-datamodel.xml   (props changed)
    db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-ext-schema-create.sql   (contents, props changed)
    db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-ext-schema-idtable-init.sql   (contents, props changed)
    db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-ext-schema.html   (props changed)
    db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-extext-schema-create.sql   (contents, props changed)
    db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-extext-schema-idtable-init.sql   (contents, props changed)
    db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-extext-schema.html   (props changed)
    db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-schema-create.sql   (contents, props changed)
    db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-schema-idtable-init.sql   (contents, props changed)
    db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-schema.html   (props changed)
    db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/jdbc2schema/expected-schema.xml   (props changed)
    db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/jdbc2schema/jdbc2schemaTest.sql   (contents, props changed)
    db/torque/torque4/trunk/torque-templates/src/test/schema/schema.xml

Modified: db/torque/torque4/trunk/torque-templates/pom.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/pom.xml?rev=1856882&r1=1856881&r2=1856882&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/pom.xml (original)
+++ db/torque/torque4/trunk/torque-templates/pom.xml Wed Apr  3 14:46:59 2019
@@ -44,6 +44,12 @@
       <version>${project.version}</version>
     </dependency>
     <dependency>
+      <groupId>org.apache.torque</groupId>
+      <artifactId>torque-runtime</artifactId>
+      <version>${project.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
       <groupId>org.apache.commons</groupId>
       <artifactId>commons-lang3</artifactId>
     </dependency>

Added: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMColumnJavaTransformer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMColumnJavaTransformer.java?rev=1856882&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMColumnJavaTransformer.java (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMColumnJavaTransformer.java Wed Apr  3 14:46:59 2019
@@ -0,0 +1,585 @@
+package org.apache.torque.templates.transformer.om;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.TimeZone;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.apache.torque.generator.control.ControllerState;
+import org.apache.torque.generator.processor.string.Camelbacker;
+import org.apache.torque.generator.processor.string.ConstantNameCreator;
+import org.apache.torque.generator.processor.string.WrapReservedJavaWords;
+import org.apache.torque.generator.source.SourceElement;
+import org.apache.torque.generator.source.transform.SourceTransformerException;
+import org.apache.torque.templates.TemplateOptionName;
+import org.apache.torque.templates.TorqueSchemaAttributeName;
+import org.apache.torque.templates.TorqueSchemaElementName;
+import org.apache.torque.templates.TorqueSchemaJavaType;
+import org.apache.torque.templates.typemapping.JavaType;
+import org.apache.torque.templates.typemapping.SchemaType;
+import org.apache.torque.templates.typemapping.TypeMap;
+
+/**
+ * Does java related mappings.
+ */
+public class OMColumnJavaTransformer
+{
+    private static Logger log = LogManager.getLogger(OMColumnJavaTransformer.class);
+    
+    /** The camelbacker to create the java name from the column name. */
+    private static Camelbacker javaNameCamelbacker = new Camelbacker();
+
+    /** Creates constant names from values. */
+    private static ConstantNameCreator constantNameCreator = new ConstantNameCreator();
+
+    /** The Date format for Dates in Default values. */
+    private static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss.S";
+
+    /** Constant for the CURRENT_DATE default value for Dates. */
+    static final String CURRENT_DATE = "CURRENT_DATE";
+
+    /** Constant for the CURRENT_TIME default value for Dates. */
+    static final String CURRENT_TIME = "CURRENT_TIME";
+
+    /** Constant for the CURRENT_TIMESTAMP default value for Dates. */
+    static final String CURRENT_TIMESTAMP = "CURRENT_TIMESTAMP";
+
+    /** Constant for the getDefaultDate method name. */
+    static final String GET_DEFAULT_DATE_METHOD_NAME = "getCurrentDate";
+
+    /** Constant for the getDefaultTime method name. */
+    static final String GET_DEFAULT_TIME_METHOD_NAME = "getCurrentTime";
+
+    /** Constant for the getDefaultTimestamp method name. */
+    static final String GET_DEFAULT_TIMESTAMP_METHOD_NAME
+    = "getCurrentTimestamp";
+
+    /** Prevents reserved java words. */
+    private static WrapReservedJavaWords reservedJavaWordsWrapper
+        = new WrapReservedJavaWords();
+
+    /**
+     * Sets the javaType attribute of the column element
+     * if it is not already set and a default value is set.
+     *
+     * @param columnElement the column element, not null.
+     */
+    protected void setJavaTypeAttribute(final SourceElement columnElement)
+    {
+        if (columnElement.getAttribute(TorqueSchemaAttributeName.JAVA_TYPE)
+                != null)
+        {
+            return;
+        }
+        SourceElement databaseElement = columnElement.getParent().getParent();
+        String defaultJavaType = (String) databaseElement.getAttribute(
+                TorqueSchemaAttributeName.DEFAULT_JAVA_TYPE);
+        if (defaultJavaType != null)
+        {
+            columnElement.setAttribute(
+                    TorqueSchemaAttributeName.JAVA_TYPE,
+                    defaultJavaType);
+        }
+    }
+
+
+    /**
+     * Sets the javaName attribute of the column element if it is not
+     * already set.
+     *
+     * @param columnElement the column element, not null.
+     */
+    protected void setJavaNameAttribute(final SourceElement columnElement)
+    {
+        if (columnElement.getAttribute(TorqueSchemaAttributeName.JAVA_NAME)
+                != null)
+        {
+            return;
+        }
+        String columnName = (String) columnElement.getAttribute(
+                TorqueSchemaAttributeName.NAME);
+        String javaName = javaNameCamelbacker.process(columnName);
+        columnElement.setAttribute(
+                TorqueSchemaAttributeName.JAVA_NAME,
+                javaName);
+        //log.debug("javaName: {}", javaName);
+    }
+
+    /**
+     * Sets the fieldName attribute of the column element if it is not
+     * already set.
+     * The javaName attribute of the column must be set.
+     *
+     * @param columnElement the column element, not null.
+     */
+    protected void setFieldNameAttribute(final SourceElement columnElement)
+    {
+        if (columnElement.getAttribute(JavaFieldAttributeName.FIELD_NAME)
+                != null)
+        {
+            return;
+        }
+        String javaName = (String) columnElement.getAttribute(
+                TorqueSchemaAttributeName.JAVA_NAME);
+        String fieldName = StringUtils.uncapitalize(javaName);
+        fieldName = reservedJavaWordsWrapper.process(fieldName);
+        columnElement.setAttribute(
+                JavaFieldAttributeName.FIELD_NAME,
+                fieldName);
+    }
+
+    /**
+     * Calculates the java default value of a column in case a default value
+     * is set.
+     *
+     * @param javaType The java type of the column.
+     * @param defaultValue The default value from the schema.
+     * @param useDatabaseDefaultValue whether the database default value should
+     *        be used.
+     * @param columnElement the current column element for which
+     *        the default value should be calculated.
+     *
+     * @return The java default value.
+     *
+     * @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
+    {
+        boolean primitiveFieldType = javaType.isPrimitive();
+        String fieldDefaultValue;
+        if (JavaType.BOOLEAN_PRIMITIVE == javaType)
+        {
+            if ("Y".equals(defaultValue)
+                    || "1".equals(defaultValue)
+                    || "true".equalsIgnoreCase(defaultValue))
+            {
+                fieldDefaultValue = "true";
+            }
+            else
+            {
+                fieldDefaultValue = "false";
+            }
+        }
+        else if (JavaType.BOOLEAN_OBJECT == javaType)
+        {
+            if ("Y".equals(defaultValue)
+                    || "1".equals(defaultValue)
+                    || "true".equalsIgnoreCase(defaultValue))
+            {
+                fieldDefaultValue = "Boolean.TRUE";
+            }
+            else
+            {
+                fieldDefaultValue = "Boolean.FALSE";
+            }
+        }
+        else if (JavaType.STRING == javaType)
+        {
+            fieldDefaultValue = "\"" + defaultValue + "\"";
+        }
+        else if (JavaType.SHORT_OBJECT == javaType)
+        {
+            // The following is better than casting with (short)
+            // because a range check is performed,
+            fieldDefaultValue = "Short.valueOf(\"" + defaultValue + "\")";
+        }
+        else if (JavaType.BYTE_OBJECT == javaType)
+        {
+            // The following is better than casting with (byte)
+            // because a range check is performed,
+            fieldDefaultValue = "Byte.valueOf(\"" + defaultValue + "\")";
+        }
+        else if (JavaType.INTEGER_OBJECT == javaType)
+        {
+            fieldDefaultValue = "Integer.valueOf(" + defaultValue + ")";
+        }
+        else if (JavaType.LONG_OBJECT == javaType)
+        {
+            fieldDefaultValue = "Long.valueOf(" + defaultValue + "L)";
+        }
+        else if (JavaType.DATE == javaType)
+        {
+            if (CURRENT_DATE.equalsIgnoreCase(defaultValue)
+                    || CURRENT_TIME.equalsIgnoreCase(defaultValue)
+                    || CURRENT_TIMESTAMP.equalsIgnoreCase(defaultValue))
+            {
+                if (useDatabaseDefaultValue)
+                {
+                    // if the database default value is used do not use
+                    // current time in java as it might be different
+                    fieldDefaultValue = "null";
+                }
+                else
+                {
+                    // the database does not provide a default so use
+                    // java current time.
+                    if (CURRENT_DATE.equalsIgnoreCase(defaultValue))
+                    {
+                        String methodName;
+                        if (columnElement.getParent().getAttribute(
+                                TableAttributeName.GET_CURRENT_DATE_METHOD_NAME)
+                                != null)
+                        {
+                            methodName = columnElement.getParent().getAttribute(
+                                    TableAttributeName.GET_CURRENT_DATE_METHOD_NAME)
+                                    .toString();
+                        }
+                        else
+                        {
+                            methodName = GET_DEFAULT_DATE_METHOD_NAME;
+                        }
+                        fieldDefaultValue = methodName + "()";
+                    }
+                    else if (CURRENT_TIME.equalsIgnoreCase(defaultValue))
+                    {
+                        String methodName;
+                        if (columnElement.getParent().getAttribute(
+                                TableAttributeName.GET_CURRENT_TIME_METHOD_NAME)
+                                != null)
+                        {
+                            methodName = columnElement.getParent().getAttribute(
+                                    TableAttributeName.GET_CURRENT_TIME_METHOD_NAME)
+                                    .toString();
+                        }
+                        else
+                        {
+                            methodName = GET_DEFAULT_TIME_METHOD_NAME;
+                        }
+                        fieldDefaultValue = methodName + "()";
+                    }
+                    else
+                    {
+                        String methodName;
+                        if (columnElement.getParent().getAttribute(
+                                TableAttributeName.GET_CURRENT_TIMESTAMP_METHOD_NAME)
+                                != null)
+                        {
+                            methodName = columnElement.getParent().getAttribute(
+                                    TableAttributeName.GET_CURRENT_TIMESTAMP_METHOD_NAME)
+                                    .toString();
+                        }
+                        else
+                        {
+                            methodName = GET_DEFAULT_TIMESTAMP_METHOD_NAME;
+                        }
+                        fieldDefaultValue = methodName + "()";
+                    }
+                }
+            }
+            else
+            {
+                if (useDatabaseDefaultValue)
+                {
+                    // if the database default value is used, do not use
+                    // current time in java as it might be different
+                    // and have a custom format.
+                    fieldDefaultValue = "null";
+                }
+                else
+                {
+                    fieldDefaultValue = "new Date("
+                            + getDefaultValueAsDate(defaultValue).getTime()
+                            + "L)";
+                }
+            }
+        }
+        else if (primitiveFieldType)
+        {
+            fieldDefaultValue = defaultValue;
+        }
+        else
+        {
+            fieldDefaultValue
+            = "new " + javaType.getFullClassName()
+            + "(" + defaultValue + ")";
+        }
+        return fieldDefaultValue;
+    }
+
+    /**
+     * Parses the default value String as Date.
+     *
+     * @param defaultValue the String to parse.
+     * @return the parsed date.
+     *
+     * @throws SourceTransformerException if the date cannot be parsed.
+     */
+    public static Date getDefaultValueAsDate(final String defaultValue)
+            throws SourceTransformerException
+    {
+        try
+        {
+            SimpleDateFormat dateFormat
+                = 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");
+        }
+    }
+
+    /**
+     * Calculates the java default value of a column in case a default value
+     * is not set.
+     *
+     * @param javaType The java type of the column.
+     *
+     * @return The java default value.
+     * @throws SourceTransformerException if the value cannot be found
+     */
+    protected String getDefaultValueWithoutDefaultSet(final JavaType javaType)
+            throws SourceTransformerException
+    {
+        String fieldDefaultValue;
+        boolean primitiveFieldType = javaType.isPrimitive();
+        if (primitiveFieldType)
+        {
+            if (JavaType.BOOLEAN_PRIMITIVE == javaType)
+            {
+                fieldDefaultValue = "false";
+            }
+            else if (JavaType.BYTE_PRIMITIVE == javaType)
+            {
+                fieldDefaultValue = "(byte) 0";
+            }
+            else if (JavaType.SHORT_PRIMITIVE == javaType)
+            {
+                fieldDefaultValue = "(short) 0";
+            }
+            else if (JavaType.INTEGER_PRIMITIVE == javaType)
+            {
+                fieldDefaultValue = "0";
+            }
+            else if (JavaType.LONG_PRIMITIVE == javaType)
+            {
+                fieldDefaultValue = "0L";
+            }
+            else if (JavaType.FLOAT_PRIMITIVE == javaType)
+            {
+                fieldDefaultValue = "0";
+            }
+            else if (JavaType.DOUBLE_PRIMITIVE == javaType)
+            {
+                fieldDefaultValue = "0";
+            }
+            else if (JavaType.CHAR_PRIMITIVE == javaType)
+            {
+                fieldDefaultValue = "'\0'";
+            }
+            else
+            {
+                throw new SourceTransformerException(
+                        "unknown primitive type" + javaType);
+            }
+        }
+        else
+        {
+            fieldDefaultValue = "null";
+        }
+        return fieldDefaultValue;
+    }
+    
+    /**
+     * Returns the java type of the field representing a database column.
+     *
+     * @param columnElement the column element, not null.
+     * @param schemaType the schema type, not null.
+     * @param enumClassName the class name of the enum, or null if the column is not an enum.
+     *
+     * @return the java type of the column
+     * @throws SourceTransformerException if error in transform
+     */
+    protected JavaType setFieldJavaType(
+            final SourceElement columnElement,
+            final SchemaType schemaType,
+            final String enumClassName)
+                    throws SourceTransformerException
+    {
+        JavaType result;
+        String javaType = (String) columnElement.getAttribute(
+                TorqueSchemaAttributeName.JAVA_TYPE);
+        if (TorqueSchemaJavaType.OBJECT.getValue().equals(javaType))
+        {
+            result = TypeMap.getJavaObjectType(schemaType);
+        }
+        else if (TorqueSchemaJavaType.PRIMITIVE.getValue().equals(javaType)
+                || javaType == null)
+        {
+            result = TypeMap.getJavaPrimitiveType(schemaType);
+        }
+        else
+        {
+            String columnName = (String) columnElement.getAttribute(
+                    TorqueSchemaAttributeName.NAME);
+            throw new SourceTransformerException("Unknown javaType "
+                    + javaType
+                    + " in column "
+                    + columnName);
+        }
+        if (enumClassName != null)
+        {
+            // enumclassName is correct for Java class generation, but not for column type mapping in peers -> JavaType.ENUM
+            columnElement.setAttribute(JavaFieldAttributeName.FIELD_TYPE, enumClassName);
+            //columnElement.setAttribute(JavaFieldAttributeName.FIELD_TYPE, JavaType.ENUM.getClassName());
+            
+            // this seems to be more correct
+            columnElement.setAttribute(TorqueSchemaAttributeName.JAVA_NAME, enumClassName);
+            
+            columnElement.setAttribute(ColumnAttributeName.ENUM_VALUE_CLASS_NAME, result.getFullClassName());
+        }
+        else
+        {
+            columnElement.setAttribute(JavaFieldAttributeName.FIELD_TYPE, result.getFullClassName());
+        }
+        return result;
+    }
+
+    /**
+     * Sets the enumClassName, enumPackage and generateEnum Attributes
+     * if either enumValue child elements are present or the enumName
+     * attribute is set on the column.
+     * Afterwards, the enumClassName attribute contains the unqualified name
+     * of the enum, the enumPackage attribute contains the enum package,
+     * and the generateEnum attribute contains "true" if the enum needs
+     * to be generated.
+     *
+     * This requires that the javaName attribute is set on the column
+     * and that the dbObjectPackage element is set on the table.
+     *
+     * @param columnElement the column element to set the elements in, not null.
+     * @param controllerState the controller state, not null.
+     *
+     * @return the class name of the enum, or null if the column is not an enum column.
+     */
+    public static String setEnumAttributes(
+            final SourceElement columnElement,
+            final ControllerState controllerState)
+    {
+        String enumClassName = (String) columnElement.getAttribute(TorqueSchemaAttributeName.ENUM_NAME);
+        // whether to generate an enum class. This is not the same as columnIsEnum because
+        // we have the case of pre-defined enums (no enum-value attributes given).
+        boolean generateEnum = columnElement.getChild(TorqueSchemaElementName.ENUM_VALUE) != null;
+
+        String enumPackage;
+        boolean columnIsEnum = false;
+        if (enumClassName != null)
+        {
+            columnIsEnum = true;
+            int lastIndexOfDot = enumClassName.lastIndexOf('.');
+            if (lastIndexOfDot != -1)
+            {
+                enumPackage = enumClassName.substring(0, lastIndexOfDot);
+                enumClassName = enumClassName.substring(lastIndexOfDot + 1);
+            }
+            else
+            {
+                enumPackage = (String) columnElement.getParent().getAttribute(
+                        TableAttributeName.DB_OBJECT_PACKAGE);
+            }
+        }
+        else
+        {
+            if (columnElement.getChild(TorqueSchemaElementName.ENUM_VALUE) != null)
+            {
+                columnIsEnum = true;
+            }
+            enumClassName = controllerState.getStringOption(TemplateOptionName.OM_ENUM_NAME_PREFIX)
+                    + columnElement.getAttribute(TorqueSchemaAttributeName.JAVA_NAME)
+                    + controllerState.getStringOption(TemplateOptionName.OM_ENUM_NAME_SUFFIX);
+            enumPackage = (String) columnElement.getParent().getAttribute(
+                    TableAttributeName.DB_OBJECT_PACKAGE);
+        }
+        columnElement.setAttribute(
+                ColumnAttributeName.ENUM_CLASS_NAME,
+                enumClassName);
+        columnElement.setAttribute(
+                ColumnAttributeName.ENUM_PACKAGE,
+                enumPackage);
+        columnElement.setAttribute(
+                ColumnAttributeName.GENERATE_ENUM,
+                Boolean.toString(generateEnum));
+        columnElement.setAttribute(
+                ColumnAttributeName.IS_ENUM,
+                Boolean.toString(columnIsEnum));
+
+        if (columnIsEnum)
+        {
+            log.debug("set enumClassName to {}", enumClassName);
+            return enumClassName;
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+    protected void setEnumValueJavaNameAttribute(
+            final SourceElement enumValueElement)
+                    throws SourceTransformerException
+    {
+        if (enumValueElement.getAttribute(TorqueSchemaAttributeName.JAVA_NAME) != null)
+        {
+            return;
+        }
+        String value = (String) enumValueElement.getAttribute(TorqueSchemaAttributeName.VALUE);
+        if (value == null)
+        {
+            throw new SourceTransformerException("value attribute must be set on all enum-value elements in enum column "
+                    + enumValueElement.getParent());
+        }
+        String javaName = constantNameCreator.process(value);
+        enumValueElement.setAttribute(TorqueSchemaAttributeName.JAVA_NAME, javaName);
+    }
+
+    protected void setEnumValueJavaValueAttribute(
+            final SourceElement enumValueElement,
+            final JavaType columnJavaType)
+                    throws SourceTransformerException
+    {
+        if (enumValueElement.getAttribute(EnumValueAttributeName.JAVA_VALUE) != null)
+        {
+            return;
+        }
+        SourceElement columnElement = enumValueElement.getParent();
+        String javaValue = getDefaultValueWithDefaultSet(
+                columnJavaType,
+                (String) enumValueElement.getAttribute(TorqueSchemaAttributeName.VALUE),
+                false,
+                columnElement);
+        enumValueElement.setAttribute(EnumValueAttributeName.JAVA_VALUE, javaValue);
+    }
+}

Propchange: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMColumnJavaTransformer.java
------------------------------------------------------------------------------
    svn:eol-style = native

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=1856882&r1=1856881&r2=1856882&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 Wed Apr  3 14:46:59 2019
@@ -1,35 +1,13 @@
 package org.apache.torque.templates.transformer.om;
 
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
 import java.util.Collections;
-import java.util.Date;
 import java.util.HashSet;
 import java.util.Set;
-import java.util.TimeZone;
 
 import org.apache.commons.lang3.StringUtils;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.apache.torque.generator.control.ControllerState;
-import org.apache.torque.generator.processor.string.Camelbacker;
 import org.apache.torque.generator.processor.string.ConstantNameCreator;
 import org.apache.torque.generator.processor.string.WrapReservedJavaWords;
 import org.apache.torque.generator.source.SourceElement;
@@ -38,7 +16,6 @@ import org.apache.torque.templates.Templ
 import org.apache.torque.templates.TorqueSchemaAttributeName;
 import org.apache.torque.templates.TorqueSchemaElementName;
 import org.apache.torque.templates.TorqueSchemaInheritance;
-import org.apache.torque.templates.TorqueSchemaJavaType;
 import org.apache.torque.templates.transformer.SchemaTypeHelper;
 import org.apache.torque.templates.typemapping.JavaType;
 import org.apache.torque.templates.typemapping.ResultSetGetter;
@@ -53,11 +30,7 @@ import org.apache.torque.templates.typem
  */
 public class OMColumnTransformer
 {
-    /** The camelbacker to create the java name from the column name. */
-    private static Camelbacker javaNameCamelbacker = new Camelbacker();
-
-    /** Creates constant names from values. */
-    private static ConstantNameCreator constantNameCreator = new ConstantNameCreator();
+    private static Logger log = LogManager.getLogger(OMColumnTransformer.class);
 
     /** The transformer for inheritance elements. */
     private static OMInheritanceTransformer inheritanceTransformer
@@ -66,31 +39,11 @@ public class OMColumnTransformer
     /** Names which cannot be used as constants for column names. */
     private static final Set<String> RESERVED_CONSTANT_NAMES;
 
-    /** The Date format for Dates in Default values. */
-    private static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss.S";
-
-    /** Constant for the CURRENT_DATE default value for Dates. */
-    static final String CURRENT_DATE = "CURRENT_DATE";
-
-    /** Constant for the CURRENT_TIME default value for Dates. */
-    static final String CURRENT_TIME = "CURRENT_TIME";
-
-    /** Constant for the CURRENT_TIMESTAMP default value for Dates. */
-    static final String CURRENT_TIMESTAMP = "CURRENT_TIMESTAMP";
-
-    /** Constant for the getDefaultDate method name. */
-    static final String GET_DEFAULT_DATE_METHOD_NAME = "getCurrentDate";
-
-    /** Constant for the getDefaultTime method name. */
-    static final String GET_DEFAULT_TIME_METHOD_NAME = "getCurrentTime";
-
-    /** Constant for the getDefaultTimestamp method name. */
-    static final String GET_DEFAULT_TIMESTAMP_METHOD_NAME
-    = "getCurrentTimestamp";
-
     /** Prevents reserved java words. */
     private static WrapReservedJavaWords reservedJavaWordsWrapper
         = new WrapReservedJavaWords();
+    
+    protected OMColumnJavaTransformer javaTransformer = new OMColumnJavaTransformer();
 
     static
     {
@@ -116,8 +69,8 @@ public class OMColumnTransformer
     {
         checkElementName(columnElement);
         checkColumnNameExists(columnElement);
-        setJavaTypeAttribute(columnElement);
-        setJavaNameAttribute(columnElement);
+        javaTransformer.setJavaTypeAttribute(columnElement);
+        javaTransformer.setJavaNameAttribute(columnElement);
 
         columnElement.setAttribute(
                 ColumnAttributeName.POSITION,
@@ -130,8 +83,8 @@ public class OMColumnTransformer
         columnElement.setAttribute("schemaType", schemaType);
         setDomainAttributes(columnElement, controllerState);
 
-        String enumClassName = setEnumAttributes(columnElement, controllerState);
-        JavaType fieldJavaType = setFieldJavaType(columnElement, schemaType, enumClassName);
+        String enumClassName = OMColumnJavaTransformer.setEnumAttributes(columnElement, controllerState);
+        JavaType fieldJavaType = javaTransformer.setFieldJavaType(columnElement, schemaType, enumClassName);
         JavaType fieldJavaObjectType = TypeMap.getJavaObjectType(schemaType);
         columnElement.setAttribute(
                 ColumnAttributeName.FIELD_OBJECT_TYPE,
@@ -160,32 +113,8 @@ public class OMColumnTransformer
         for (SourceElement enumValueElement : columnElement.getChildren(
                 TorqueSchemaElementName.ENUM_VALUE.getName()))
         {
-            setEnumValueJavaNameAttribute(enumValueElement);
-            setEnumValueJavaValueAttribute(enumValueElement, fieldJavaType);
-        }
-    }
-
-    /**
-     * Sets the javaType attribute of the column element
-     * if it is not already set and a default value is set.
-     *
-     * @param columnElement the column element, not null.
-     */
-    protected void setJavaTypeAttribute(final SourceElement columnElement)
-    {
-        if (columnElement.getAttribute(TorqueSchemaAttributeName.JAVA_TYPE)
-                != null)
-        {
-            return;
-        }
-        SourceElement databaseElement = columnElement.getParent().getParent();
-        String defaultJavaType = (String) databaseElement.getAttribute(
-                TorqueSchemaAttributeName.DEFAULT_JAVA_TYPE);
-        if (defaultJavaType != null)
-        {
-            columnElement.setAttribute(
-                    TorqueSchemaAttributeName.JAVA_TYPE,
-                    defaultJavaType);
+            javaTransformer.setEnumValueJavaNameAttribute(enumValueElement);
+            javaTransformer.setEnumValueJavaValueAttribute(enumValueElement, fieldJavaType);
         }
     }
 
@@ -336,56 +265,6 @@ public class OMColumnTransformer
                 accessModifier);
     }
 
-
-    /**
-     * Returns the java type of the field representing a database column.
-     *
-     * @param columnElement the column element, not null.
-     * @param schemaType the schema type, not null.
-     * @param enumClassName the class name of the enum, or null if the column is not an enum.
-     *
-     * @return the java type of the column
-     * @throws SourceTransformerException if error in transform
-     */
-    protected JavaType setFieldJavaType(
-            final SourceElement columnElement,
-            final SchemaType schemaType,
-            final String enumClassName)
-                    throws SourceTransformerException
-    {
-        JavaType result;
-        String javaType = (String) columnElement.getAttribute(
-                TorqueSchemaAttributeName.JAVA_TYPE);
-        if (TorqueSchemaJavaType.OBJECT.getValue().equals(javaType))
-        {
-            result = TypeMap.getJavaObjectType(schemaType);
-        }
-        else if (TorqueSchemaJavaType.PRIMITIVE.getValue().equals(javaType)
-                || javaType == null)
-        {
-            result = TypeMap.getJavaPrimitiveType(schemaType);
-        }
-        else
-        {
-            String columnName = (String) columnElement.getAttribute(
-                    TorqueSchemaAttributeName.NAME);
-            throw new SourceTransformerException("Unknown javaType "
-                    + javaType
-                    + " in column "
-                    + columnName);
-        }
-        if (enumClassName != null)
-        {
-            columnElement.setAttribute(JavaFieldAttributeName.FIELD_TYPE, enumClassName);
-            columnElement.setAttribute(ColumnAttributeName.ENUM_VALUE_CLASS_NAME, result.getFullClassName());
-        }
-        else
-        {
-            columnElement.setAttribute(JavaFieldAttributeName.FIELD_TYPE, result.getFullClassName());
-        }
-        return result;
-    }
-
     /**
      * Checks that the name of the column element is correct.
      *
@@ -427,27 +306,6 @@ public class OMColumnTransformer
     }
 
     /**
-     * Sets the javaName attribute of the column element if it is not
-     * already set.
-     *
-     * @param columnElement the column element, not null.
-     */
-    protected void setJavaNameAttribute(final SourceElement columnElement)
-    {
-        if (columnElement.getAttribute(TorqueSchemaAttributeName.JAVA_NAME)
-                != null)
-        {
-            return;
-        }
-        String columnName = (String) columnElement.getAttribute(
-                TorqueSchemaAttributeName.NAME);
-        String javaName = javaNameCamelbacker.process(columnName);
-        columnElement.setAttribute(
-                TorqueSchemaAttributeName.JAVA_NAME,
-                javaName);
-    }
-
-    /**
      * Sets the fieldName attribute of the column element if it is not
      * already set.
      * The javaName attribute of the column must be set.
@@ -665,7 +523,7 @@ public class OMColumnTransformer
             boolean useDatabaseDefaultValue = "true".equals(
                     columnElement.getAttribute(
                             TorqueSchemaAttributeName.USE_DATABASE_DEFAULT_VALUE));
-            fieldDefaultValue = getDefaultValueWithDefaultSet(
+            fieldDefaultValue = javaTransformer.getDefaultValueWithDefaultSet(
                     javaType,
                     defaultAttributeValue,
                     useDatabaseDefaultValue,
@@ -679,7 +537,7 @@ public class OMColumnTransformer
         }
         else
         {
-            fieldDefaultValue = getDefaultValueWithoutDefaultSet(javaType);
+            fieldDefaultValue = javaTransformer.getDefaultValueWithoutDefaultSet(javaType);
         }
         if (!"null".equals(fieldDefaultValue)
                 && Boolean.parseBoolean((String) columnElement.getAttribute(ColumnAttributeName.IS_ENUM)))
@@ -692,268 +550,6 @@ public class OMColumnTransformer
                 fieldDefaultValue);
     }
 
-    /**
-     * Calculates the java default value of a column in case a default value
-     * is set.
-     *
-     * @param javaType The java type of the column.
-     * @param defaultValue The default value from the schema.
-     * @param useDatabaseDefaultValue whether the database default value should
-     *        be used.
-     * @param columnElement the current column element for which
-     *        the default value should be calculated.
-     *
-     * @return The java default value.
-     *
-     * @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
-    {
-        boolean primitiveFieldType = javaType.isPrimitive();
-        String fieldDefaultValue;
-        if (JavaType.BOOLEAN_PRIMITIVE == javaType)
-        {
-            if ("Y".equals(defaultValue)
-                    || "1".equals(defaultValue)
-                    || "true".equalsIgnoreCase(defaultValue))
-            {
-                fieldDefaultValue = "true";
-            }
-            else
-            {
-                fieldDefaultValue = "false";
-            }
-        }
-        else if (JavaType.BOOLEAN_OBJECT == javaType)
-        {
-            if ("Y".equals(defaultValue)
-                    || "1".equals(defaultValue)
-                    || "true".equalsIgnoreCase(defaultValue))
-            {
-                fieldDefaultValue = "Boolean.TRUE";
-            }
-            else
-            {
-                fieldDefaultValue = "Boolean.FALSE";
-            }
-        }
-        else if (JavaType.STRING == javaType)
-        {
-            fieldDefaultValue = "\"" + defaultValue + "\"";
-        }
-        else if (JavaType.SHORT_OBJECT == javaType)
-        {
-            // The following is better than casting with (short)
-            // because a range check is performed,
-            fieldDefaultValue = "Short.valueOf(\"" + defaultValue + "\")";
-        }
-        else if (JavaType.BYTE_OBJECT == javaType)
-        {
-            // The following is better than casting with (byte)
-            // because a range check is performed,
-            fieldDefaultValue = "Byte.valueOf(\"" + defaultValue + "\")";
-        }
-        else if (JavaType.INTEGER_OBJECT == javaType)
-        {
-            fieldDefaultValue = "Integer.valueOf(" + defaultValue + ")";
-        }
-        else if (JavaType.LONG_OBJECT == javaType)
-        {
-            fieldDefaultValue = "Long.valueOf(" + defaultValue + "L)";
-        }
-        else if (JavaType.DATE == javaType)
-        {
-            if (CURRENT_DATE.equalsIgnoreCase(defaultValue)
-                    || CURRENT_TIME.equalsIgnoreCase(defaultValue)
-                    || CURRENT_TIMESTAMP.equalsIgnoreCase(defaultValue))
-            {
-                if (useDatabaseDefaultValue)
-                {
-                    // if the database default value is used do not use
-                    // current time in java as it might be different
-                    fieldDefaultValue = "null";
-                }
-                else
-                {
-                    // the database does not provide a default so use
-                    // java current time.
-                    if (CURRENT_DATE.equalsIgnoreCase(defaultValue))
-                    {
-                        String methodName;
-                        if (columnElement.getParent().getAttribute(
-                                TableAttributeName.GET_CURRENT_DATE_METHOD_NAME)
-                                != null)
-                        {
-                            methodName = columnElement.getParent().getAttribute(
-                                    TableAttributeName.GET_CURRENT_DATE_METHOD_NAME)
-                                    .toString();
-                        }
-                        else
-                        {
-                            methodName = GET_DEFAULT_DATE_METHOD_NAME;
-                        }
-                        fieldDefaultValue = methodName + "()";
-                    }
-                    else if (CURRENT_TIME.equalsIgnoreCase(defaultValue))
-                    {
-                        String methodName;
-                        if (columnElement.getParent().getAttribute(
-                                TableAttributeName.GET_CURRENT_TIME_METHOD_NAME)
-                                != null)
-                        {
-                            methodName = columnElement.getParent().getAttribute(
-                                    TableAttributeName.GET_CURRENT_TIME_METHOD_NAME)
-                                    .toString();
-                        }
-                        else
-                        {
-                            methodName = GET_DEFAULT_TIME_METHOD_NAME;
-                        }
-                        fieldDefaultValue = methodName + "()";
-                    }
-                    else
-                    {
-                        String methodName;
-                        if (columnElement.getParent().getAttribute(
-                                TableAttributeName.GET_CURRENT_TIMESTAMP_METHOD_NAME)
-                                != null)
-                        {
-                            methodName = columnElement.getParent().getAttribute(
-                                    TableAttributeName.GET_CURRENT_TIMESTAMP_METHOD_NAME)
-                                    .toString();
-                        }
-                        else
-                        {
-                            methodName = GET_DEFAULT_TIMESTAMP_METHOD_NAME;
-                        }
-                        fieldDefaultValue = methodName + "()";
-                    }
-                }
-            }
-            else
-            {
-                if (useDatabaseDefaultValue)
-                {
-                    // if the database default value is used, do not use
-                    // current time in java as it might be different
-                    // and have a custom format.
-                    fieldDefaultValue = "null";
-                }
-                else
-                {
-                    fieldDefaultValue = "new Date("
-                            + getDefaultValueAsDate(defaultValue).getTime()
-                            + "L)";
-                }
-            }
-        }
-        else if (primitiveFieldType)
-        {
-            fieldDefaultValue = defaultValue;
-        }
-        else
-        {
-            fieldDefaultValue
-            = "new " + javaType.getFullClassName()
-            + "(" + defaultValue + ")";
-        }
-        return fieldDefaultValue;
-    }
-
-    /**
-     * Parses the default value String as Date.
-     *
-     * @param defaultValue the String to parse.
-     * @return the parsed date.
-     *
-     * @throws SourceTransformerException if the date cannot be parsed.
-     */
-    public static Date getDefaultValueAsDate(final String defaultValue)
-            throws SourceTransformerException
-    {
-        try
-        {
-            SimpleDateFormat dateFormat
-                = 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");
-        }
-    }
-
-    /**
-     * Calculates the java default value of a column in case a default value
-     * is not set.
-     *
-     * @param javaType The java type of the column.
-     *
-     * @return The java default value.
-     * @throws SourceTransformerException if the value cannot be found
-     */
-    protected String getDefaultValueWithoutDefaultSet(final JavaType javaType)
-            throws SourceTransformerException
-    {
-        String fieldDefaultValue;
-        boolean primitiveFieldType = javaType.isPrimitive();
-        if (primitiveFieldType)
-        {
-            if (JavaType.BOOLEAN_PRIMITIVE == javaType)
-            {
-                fieldDefaultValue = "false";
-            }
-            else if (JavaType.BYTE_PRIMITIVE == javaType)
-            {
-                fieldDefaultValue = "(byte) 0";
-            }
-            else if (JavaType.SHORT_PRIMITIVE == javaType)
-            {
-                fieldDefaultValue = "(short) 0";
-            }
-            else if (JavaType.INTEGER_PRIMITIVE == javaType)
-            {
-                fieldDefaultValue = "0";
-            }
-            else if (JavaType.LONG_PRIMITIVE == javaType)
-            {
-                fieldDefaultValue = "0L";
-            }
-            else if (JavaType.FLOAT_PRIMITIVE == javaType)
-            {
-                fieldDefaultValue = "0";
-            }
-            else if (JavaType.DOUBLE_PRIMITIVE == javaType)
-            {
-                fieldDefaultValue = "0";
-            }
-            else if (JavaType.CHAR_PRIMITIVE == javaType)
-            {
-                fieldDefaultValue = "'\0'";
-            }
-            else
-            {
-                throw new SourceTransformerException(
-                        "unknown primitive type" + javaType);
-            }
-        }
-        else
-        {
-            fieldDefaultValue = "null";
-        }
-        return fieldDefaultValue;
-    }
 
     /**
      * Sets the useDatabaseDefaultValue attribute of the column element to its
@@ -1035,118 +631,5 @@ public class OMColumnTransformer
                 ColumnAttributeName.SAMPLE_OBJECT,
                 sampleObject);
     }
-
-    /**
-     * Sets the enumClassName, enumPackage and generateEnum Attributes
-     * if either enumValue child elements are present or the enumName
-     * attribute is set on the column.
-     * Afterwards, the enumClassName attribute contains the unqualified name
-     * of the enum, the enumPackage attribute contains the enum package,
-     * and the generateEnum attribute contains "true" if the enum needs
-     * to be generated.
-     *
-     * This requires that the javaName attribute is set on the column
-     * and that the dbObjectPackage element is set on the table.
-     *
-     * @param columnElement the column element to set the elements in, not null.
-     * @param controllerState the controller state, not null.
-     *
-     * @return the class name of the enum, or null if the column is not an enum column.
-     */
-    public static String setEnumAttributes(
-            final SourceElement columnElement,
-            final ControllerState controllerState)
-    {
-        String enumClassName = (String) columnElement.getAttribute(TorqueSchemaAttributeName.ENUM_NAME);
-        // whether to generate an enum class. This is not the same as columnIsEnum because
-        // we have the case of pre-defined enums (no enum-value attributes given).
-        boolean generateEnum = columnElement.getChild(TorqueSchemaElementName.ENUM_VALUE) != null;
-
-        String enumPackage;
-        boolean columnIsEnum = false;
-        if (enumClassName != null)
-        {
-            columnIsEnum = true;
-            int lastIndexOfDot = enumClassName.lastIndexOf('.');
-            if (lastIndexOfDot != -1)
-            {
-                enumPackage = enumClassName.substring(0, lastIndexOfDot);
-                enumClassName = enumClassName.substring(lastIndexOfDot + 1);
-            }
-            else
-            {
-                enumPackage = (String) columnElement.getParent().getAttribute(
-                        TableAttributeName.DB_OBJECT_PACKAGE);
-            }
-        }
-        else
-        {
-            if (columnElement.getChild(TorqueSchemaElementName.ENUM_VALUE) != null)
-            {
-                columnIsEnum = true;
-            }
-            enumClassName = controllerState.getStringOption(TemplateOptionName.OM_ENUM_NAME_PREFIX)
-                    + columnElement.getAttribute(TorqueSchemaAttributeName.JAVA_NAME)
-                    + controllerState.getStringOption(TemplateOptionName.OM_ENUM_NAME_SUFFIX);
-            enumPackage = (String) columnElement.getParent().getAttribute(
-                    TableAttributeName.DB_OBJECT_PACKAGE);
-        }
-        columnElement.setAttribute(
-                ColumnAttributeName.ENUM_CLASS_NAME,
-                enumClassName);
-        columnElement.setAttribute(
-                ColumnAttributeName.ENUM_PACKAGE,
-                enumPackage);
-        columnElement.setAttribute(
-                ColumnAttributeName.GENERATE_ENUM,
-                Boolean.toString(generateEnum));
-        columnElement.setAttribute(
-                ColumnAttributeName.IS_ENUM,
-                Boolean.toString(columnIsEnum));
-
-        if (columnIsEnum)
-        {
-            return enumClassName;
-        }
-        else
-        {
-            return null;
-        }
-    }
-
-    protected void setEnumValueJavaNameAttribute(
-            final SourceElement enumValueElement)
-                    throws SourceTransformerException
-    {
-        if (enumValueElement.getAttribute(TorqueSchemaAttributeName.JAVA_NAME) != null)
-        {
-            return;
-        }
-        String value = (String) enumValueElement.getAttribute(TorqueSchemaAttributeName.VALUE);
-        if (value == null)
-        {
-            throw new SourceTransformerException("value attribute must be set on all enum-value elements in enum column "
-                    + enumValueElement.getParent());
-        }
-        String javaName = constantNameCreator.process(value);
-        enumValueElement.setAttribute(TorqueSchemaAttributeName.JAVA_NAME, javaName);
-    }
-
-    protected void setEnumValueJavaValueAttribute(
-            final SourceElement enumValueElement,
-            final JavaType columnJavaType)
-                    throws SourceTransformerException
-    {
-        if (enumValueElement.getAttribute(EnumValueAttributeName.JAVA_VALUE) != null)
-        {
-            return;
-        }
-        SourceElement columnElement = enumValueElement.getParent();
-        String javaValue = getDefaultValueWithDefaultSet(
-                columnJavaType,
-                (String) enumValueElement.getAttribute(TorqueSchemaAttributeName.VALUE),
-                false,
-                columnElement);
-        enumValueElement.setAttribute(EnumValueAttributeName.JAVA_VALUE, javaValue);
-    }
+    
 }

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=1856882&r1=1856881&r2=1856882&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 Wed Apr  3 14:46:59 2019
@@ -19,12 +19,12 @@ package org.apache.torque.templates.tran
  * under the License.
  */
 
-import static org.apache.torque.templates.transformer.om.OMColumnTransformer.CURRENT_DATE;
-import static org.apache.torque.templates.transformer.om.OMColumnTransformer.CURRENT_TIME;
-import static org.apache.torque.templates.transformer.om.OMColumnTransformer.CURRENT_TIMESTAMP;
-import static org.apache.torque.templates.transformer.om.OMColumnTransformer.GET_DEFAULT_DATE_METHOD_NAME;
-import static org.apache.torque.templates.transformer.om.OMColumnTransformer.GET_DEFAULT_TIMESTAMP_METHOD_NAME;
-import static org.apache.torque.templates.transformer.om.OMColumnTransformer.GET_DEFAULT_TIME_METHOD_NAME;
+import static org.apache.torque.templates.transformer.om.OMColumnJavaTransformer.CURRENT_DATE;
+import static org.apache.torque.templates.transformer.om.OMColumnJavaTransformer.CURRENT_TIME;
+import static org.apache.torque.templates.transformer.om.OMColumnJavaTransformer.CURRENT_TIMESTAMP;
+import static org.apache.torque.templates.transformer.om.OMColumnJavaTransformer.GET_DEFAULT_DATE_METHOD_NAME;
+import static org.apache.torque.templates.transformer.om.OMColumnJavaTransformer.GET_DEFAULT_TIMESTAMP_METHOD_NAME;
+import static org.apache.torque.templates.transformer.om.OMColumnJavaTransformer.GET_DEFAULT_TIME_METHOD_NAME;
 
 import java.io.InputStreamReader;
 import java.io.Reader;
@@ -34,6 +34,8 @@ import java.util.Objects;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.commons.lang3.StringUtils;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.apache.torque.generator.control.ControllerState;
 import org.apache.torque.generator.processor.string.Camelbacker;
 import org.apache.torque.generator.processor.string.WrapReservedJavaWords;
@@ -52,6 +54,8 @@ import org.apache.torque.templates.trans
  */
 public class OMTableAndViewTransformer extends AttributeTransformer
 {
+    
+    private static Logger log = LogManager.getLogger(OMTableAndViewTransformer.class);
     /** Constant for the dot. */
     private static final String DOT = ".";
 
@@ -212,6 +216,7 @@ public class OMTableAndViewTransformer e
                     TorqueSchemaAttributeName.JAVA_NAME,
                     javaName);
         }
+        log.debug("javaName: {}", javaName);
     }
 
     protected void setUnqualifiedNameAttribute(SourceElement tableElement)
@@ -571,6 +576,8 @@ public class OMTableAndViewTransformer e
         for (SourceElement column : tableElement.getChildren(
                 TorqueSchemaElementName.COLUMN))
         {
+            log.trace("column.getAttribute(JavaFieldAttributeName.FIELD_TYPE): {}",column.getAttribute(JavaFieldAttributeName.FIELD_TYPE));
+            log.debug("column: {}",column);
             if ("java.util.Date".equals(
                     column.getAttribute(JavaFieldAttributeName.FIELD_TYPE)))
             {

Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLModelTransformer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLModelTransformer.java?rev=1856882&r1=1856881&r2=1856882&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLModelTransformer.java (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLModelTransformer.java Wed Apr  3 14:46:59 2019
@@ -45,7 +45,7 @@ import org.apache.torque.templates.platf
 import org.apache.torque.templates.transformer.IncludeSchemaTransformer;
 import org.apache.torque.templates.transformer.LoadExternalSchemaTransformer;
 import org.apache.torque.templates.transformer.SchemaTypeHelper;
-import org.apache.torque.templates.transformer.om.OMColumnTransformer;
+import org.apache.torque.templates.transformer.om.OMColumnJavaTransformer;
 import org.apache.torque.templates.transformer.om.OMTransformer;
 import org.apache.torque.templates.typemapping.SchemaType;
 import org.apache.torque.templates.typemapping.SqlType;
@@ -297,7 +297,7 @@ public class SQLModelTransformer impleme
                 else
                 {
                     final Date defaultDate
-                    = OMColumnTransformer.getDefaultValueAsDate(
+                    = OMColumnJavaTransformer.getDefaultValueAsDate(
                             sqlType.getDefaultValue());
                     if (SchemaType.DATE == schemaType)
                     {
@@ -453,7 +453,7 @@ public class SQLModelTransformer impleme
                 || SchemaType.TIMESTAMP == schemaType))
         {
             Date defaultDate
-            = OMColumnTransformer.getDefaultValueAsDate(enumValue.value);
+            = OMColumnJavaTransformer.getDefaultValueAsDate(enumValue.value);
             if (SchemaType.DATE == schemaType)
             {
                 enumValue.sqlValue = platform.getDateString(defaultDate);

Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLTransformer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLTransformer.java?rev=1856882&r1=1856881&r2=1856882&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLTransformer.java (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLTransformer.java Wed Apr  3 14:46:59 2019
@@ -41,7 +41,7 @@ import org.apache.torque.templates.trans
 import org.apache.torque.templates.transformer.LoadExternalSchemaTransformer;
 import org.apache.torque.templates.transformer.SchemaTypeHelper;
 import org.apache.torque.templates.transformer.om.DatabaseChildElementName;
-import org.apache.torque.templates.transformer.om.OMColumnTransformer;
+import org.apache.torque.templates.transformer.om.OMColumnJavaTransformer;
 import org.apache.torque.templates.transformer.om.OMTransformer;
 import org.apache.torque.templates.transformer.om.TableChildElementName;
 import org.apache.torque.templates.typemapping.SchemaType;
@@ -353,7 +353,7 @@ public class SQLTransformer implements S
                 else
                 {
                     Date defaultDate
-                    = OMColumnTransformer.getDefaultValueAsDate(
+                    = OMColumnJavaTransformer.getDefaultValueAsDate(
                             sqlType.getDefaultValue());
                     if (SchemaType.DATE == schemaType)
                     {

Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/typemapping/JavaType.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/typemapping/JavaType.java?rev=1856882&r1=1856881&r2=1856882&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/typemapping/JavaType.java (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/typemapping/JavaType.java Wed Apr  3 14:46:59 2019
@@ -65,7 +65,9 @@ public enum JavaType
     /** primitive byte array. */
     BYTE_PRIMITIVE_ARRAY("byte[]", false, false, null),
     /** java.util.Date. */
-    DATE("Date", false, false, "java.util.");
+    DATE("Date", false, false, "java.util."),
+    /** java.lang.Enum. */
+    ENUM("Enum", false, false, null);
 
     /** The class name without package name. */
     private String className;

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/base/baseBean.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/base/baseBean.vm?rev=1856882&r1=1856881&r2=1856882&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/base/baseBean.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/base/baseBean.vm Wed Apr  3 14:46:59 2019
@@ -53,7 +53,7 @@ import ${foreignBeanPackage}.${foreignBe
 #foreach ($columnElement in $torqueGen.getSourceElement().getChildren("column"))
   #set ($colEnumPackage = $columnElement.getAttribute("enumPackage"))
   #set ($colEnumClassName = $columnElement.getAttribute("enumClassName"))
-  #if ($columnElement.getAttribute("isEnum") == "true" && $colEnumPackage != $baseDbObjectPackage)
+  #if ($columnElement.getAttribute("isEnum") == "true" && $colEnumPackage != $baseBeanPackage)
 import ${colEnumPackage}.${colEnumClassName};
   #end
 #end

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/baseDbObjectForView.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/baseDbObjectForView.vm?rev=1856882&r1=1856881&r2=1856882&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/baseDbObjectForView.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/baseDbObjectForView.vm Wed Apr  3 14:46:59 2019
@@ -62,6 +62,13 @@ import org.apache.torque.util.Transactio
 #end
 import org.apache.commons.lang.ObjectUtils;
 
+#foreach ($columnElement in $torqueGen.getSourceElement().getChildren("column"))
+  #set ($colEnumPackage = $columnElement.getAttribute("enumPackage"))
+  #set ($colEnumClassName = $columnElement.getAttribute("enumClassName"))
+  #if ($columnElement.getAttribute("isEnum") == "true" && $colEnumPackage != $baseDbObjectPackage)
+import ${colEnumPackage}.${colEnumClassName};
+  #end
+#end
 
 #if ($torqueGen.booleanOption("torque.om.complexObjectModel"))
 #foreach ($col in $table.Columns)

Added: db/torque/torque4/trunk/torque-templates/src/test/java/a/b/SomeEnum.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/test/java/a/b/SomeEnum.java?rev=1856882&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/test/java/a/b/SomeEnum.java (added)
+++ db/torque/torque4/trunk/torque-templates/src/test/java/a/b/SomeEnum.java Wed Apr  3 14:46:59 2019
@@ -0,0 +1,69 @@
+package a.b;
+
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/**
+ * Example predefined Enum
+ *
+ */
+public enum SomeEnum {
+    
+    /** Represents the database value x. */
+    A("a"),
+    /** Represents the database value y. */
+    B("b"),
+    /** Represents the database value z. */
+    C("c");
+    
+    /** The database value represented by the enum value. */
+    private String value;
+    
+    /**
+     * Constructor.
+     *
+     * @param value The database value represented by the enum value.
+     */
+    private SomeEnum(String value)
+    {
+        this.value = value;
+    }
+
+    
+    public String getValue()
+    {
+        return value;
+    }
+    
+    public static SomeEnum getByValue(String arg)
+    {
+        if (arg == null)
+        {
+            return null;
+        }
+        for (SomeEnum candidate : values())
+        {
+            if (arg.equals(candidate.getValue()))
+            {
+                return candidate;
+            }
+        }
+        throw new IllegalArgumentException("Value " + arg + " is not defined in enum SomeEnum");
+    }
+}

Propchange: db/torque/torque4/trunk/torque-templates/src/test/java/a/b/SomeEnum.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/TestInterface.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/TestInterface.java?rev=1856882&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/TestInterface.java (added)
+++ db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/TestInterface.java Wed Apr  3 14:46:59 2019
@@ -0,0 +1,22 @@
+package org.apache.torque;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+public interface TestInterface {
+
+}

Propchange: db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/TestInterface.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-datamodel.css
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-datamodel.css?rev=1856882&r1=1856881&r2=1856882&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-datamodel.css (original)
+++ db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-datamodel.css Wed Apr  3 14:46:59 2019
@@ -1,118 +1,118 @@
-## Licensed to the Apache Software Foundation (ASF) under one
-## or more contributor license agreements.  See the NOTICE file
-## distributed with this work for additional information
-## regarding copyright ownership.  The ASF licenses this file
-## to you under the Apache License, Version 2.0 (the
-## "License"); you may not use this file except in compliance
-## with the License.  You may obtain a copy of the License at
-##
-##   http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing,
-## software distributed under the License is distributed on an
-## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-## KIND, either express or implied.  See the License for the
-## specific language governing permissions and limitations
-## under the License.
-##
-/*
-Copyright 2001-2005 The Apache Software Foundation.
-
-Licensed under the Apache License, Version 2.0 (the "License")
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-/*
-===============================================================
-css stylesheet for the html documentation generated by Torque
-will not be overwritten any more once the file exists
-===============================================================
-*/
-
-/* for the html body */
-body { font-family: Verdana; font-size: 10pt; color:black; }
-/* for all links */
-.link { }
-
-/* for the whole summary table */
-.summarytable { margin:0px; padding:0px; border-collapse:collapse; width:100%; }
-/* for all td's of the summary table */
-.summaryborder { border:1px solid black; }
-
-/* for the headline of the summary table */
-.summaryhead { }
-/* for all td's of the headline of the summary table */
-.summaryheadbackground { background-color:#CCCCCC; }
-/* for the different cells of the headline of the summary table */
-/* e.g. use display:none for not displaying a certain column  */
-.summaryheadtablename { }
-.summaryheadjavaname { }
-.summaryheaddescription { }
-
-/* for all regular rows of the summary table */
-.summaryrow { }
-/* for all td's in regular rows of the summary table */
-.summarybackground { background-color:white; }
-/* for the different cells in the regular rows of the summary table */
-/* e.g. use display:none for not displaying a certain column */
-.summarytablename { }
-.summaryjavaname { }
-.summarydescription { }
-
-/* for the hrefs in the summary table */
-.summarytablenamelink { }
-
-/* for the headline of the detail tables */
-.detailtable { margin:0px; padding:0px; border-collapse:collapse; width:100%; }
-/* for all td's of the summary table */
-.detailborder { border:1px solid black; }
-
-/* for the headline of the detail tables */
-.detailhead { }
-/* for all td's in the headline of the detail tables */
-.detailheadbackground { background-color:#CCCCCC; }
-/* for the different cells in the headline of the detail tables */
-/* e.g. use display:none for not displaying a certain column */
-.detailheadname { }
-.detailheadtype { }
-.detailheadsize { }
-.detailheaddefault { }
-.detailheadjavaname { }
-.detailheadpk { }
-.detailheadfk { }
-.detailheadnotnull { }
-.detailheaddescription { }
-
-/* for all regular rows in the detail tables */
-.detailrow { }
-/* for all td's in the regular rows in the detail tables */
-.detailbackground { background-color:white; }
-/* for the different cells in the regular rows of the detail tables */
-/* e.g use display:none for not displaying a certain column */
-.detailname { }
-.detailtype { }
-.detailsize { }
-.detaildefault { }
-.detailjavaname { }
-.detailpk { }
-.detailfk { }
-.detailnotnull { }
-.detaildescription { }
-
-/* for the links to the referenced tables for foreign key column names */
-.detailforeignkeylink { color:#44AA44; }
-/* for the name cell of primary keys */
-.primarykey { background-color:#FFCCCC; }
-/* for the name cell of foreign keys */
-.foreignkey { }
-/* for the name cell of not null columns */
-.notnull { }
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##   http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+/*
+Copyright 2001-2005 The Apache Software Foundation.
+
+Licensed under the Apache License, Version 2.0 (the "License")
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+/*
+===============================================================
+css stylesheet for the html documentation generated by Torque
+will not be overwritten any more once the file exists
+===============================================================
+*/
+
+/* for the html body */
+body { font-family: Verdana; font-size: 10pt; color:black; }
+/* for all links */
+.link { }
+
+/* for the whole summary table */
+.summarytable { margin:0px; padding:0px; border-collapse:collapse; width:100%; }
+/* for all td's of the summary table */
+.summaryborder { border:1px solid black; }
+
+/* for the headline of the summary table */
+.summaryhead { }
+/* for all td's of the headline of the summary table */
+.summaryheadbackground { background-color:#CCCCCC; }
+/* for the different cells of the headline of the summary table */
+/* e.g. use display:none for not displaying a certain column  */
+.summaryheadtablename { }
+.summaryheadjavaname { }
+.summaryheaddescription { }
+
+/* for all regular rows of the summary table */
+.summaryrow { }
+/* for all td's in regular rows of the summary table */
+.summarybackground { background-color:white; }
+/* for the different cells in the regular rows of the summary table */
+/* e.g. use display:none for not displaying a certain column */
+.summarytablename { }
+.summaryjavaname { }
+.summarydescription { }
+
+/* for the hrefs in the summary table */
+.summarytablenamelink { }
+
+/* for the headline of the detail tables */
+.detailtable { margin:0px; padding:0px; border-collapse:collapse; width:100%; }
+/* for all td's of the summary table */
+.detailborder { border:1px solid black; }
+
+/* for the headline of the detail tables */
+.detailhead { }
+/* for all td's in the headline of the detail tables */
+.detailheadbackground { background-color:#CCCCCC; }
+/* for the different cells in the headline of the detail tables */
+/* e.g. use display:none for not displaying a certain column */
+.detailheadname { }
+.detailheadtype { }
+.detailheadsize { }
+.detailheaddefault { }
+.detailheadjavaname { }
+.detailheadpk { }
+.detailheadfk { }
+.detailheadnotnull { }
+.detailheaddescription { }
+
+/* for all regular rows in the detail tables */
+.detailrow { }
+/* for all td's in the regular rows in the detail tables */
+.detailbackground { background-color:white; }
+/* for the different cells in the regular rows of the detail tables */
+/* e.g use display:none for not displaying a certain column */
+.detailname { }
+.detailtype { }
+.detailsize { }
+.detaildefault { }
+.detailjavaname { }
+.detailpk { }
+.detailfk { }
+.detailnotnull { }
+.detaildescription { }
+
+/* for the links to the referenced tables for foreign key column names */
+.detailforeignkeylink { color:#44AA44; }
+/* for the name cell of primary keys */
+.primarykey { background-color:#FFCCCC; }
+/* for the name cell of foreign keys */
+.foreignkey { }
+/* for the name cell of not null columns */
+.notnull { }

Propchange: db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-datamodel.css
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-datamodel.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-ext-schema-create.sql
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-ext-schema-create.sql?rev=1856882&r1=1856881&r2=1856882&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-ext-schema-create.sql (original)
+++ db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-ext-schema-create.sql Wed Apr  3 14:46:59 2019
@@ -1,19 +1,19 @@
-## Licensed to the Apache Software Foundation (ASF) under one
-## or more contributor license agreements.  See the NOTICE file
-## distributed with this work for additional information
-## regarding copyright ownership.  The ASF licenses this file
-## to you under the Apache License, Version 2.0 (the
-## "License"); you may not use this file except in compliance
-## with the License.  You may obtain a copy of the License at
-##
-##   http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing,
-## software distributed under the License is distributed on an
-## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-## KIND, either express or implied.  See the License for the
-## specific language governing permissions and limitations
-## under the License.
-##
-drop database if exists ext;
-create database ext;
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##   http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+drop database if exists ext;
+create database ext;

Propchange: db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-ext-schema-create.sql
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-ext-schema-idtable-init.sql
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-ext-schema-idtable-init.sql?rev=1856882&r1=1856881&r2=1856882&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-ext-schema-idtable-init.sql (original)
+++ db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-ext-schema-idtable-init.sql Wed Apr  3 14:46:59 2019
@@ -1,19 +1,19 @@
-## Licensed to the Apache Software Foundation (ASF) under one
-## or more contributor license agreements.  See the NOTICE file
-## distributed with this work for additional information
-## regarding copyright ownership.  The ASF licenses this file
-## to you under the Apache License, Version 2.0 (the
-## "License"); you may not use this file except in compliance
-## with the License.  You may obtain a copy of the License at
-##
-##   http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing,
-## software distributed under the License is distributed on an
-## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-## KIND, either express or implied.  See the License for the
-## specific language governing permissions and limitations
-## under the License.
-##
-insert into ID_TABLE (id_table_id, table_name, next_id, quantity) VALUES (101, 'ext', 1000, 10);
-
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##   http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+insert into ID_TABLE (id_table_id, table_name, next_id, quantity) VALUES (101, 'ext', 1000, 10);
+

Propchange: db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-ext-schema-idtable-init.sql
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-ext-schema.html
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-extext-schema-create.sql
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-extext-schema-create.sql?rev=1856882&r1=1856881&r2=1856882&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-extext-schema-create.sql (original)
+++ db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-extext-schema-create.sql Wed Apr  3 14:46:59 2019
@@ -1,19 +1,19 @@
-## Licensed to the Apache Software Foundation (ASF) under one
-## or more contributor license agreements.  See the NOTICE file
-## distributed with this work for additional information
-## regarding copyright ownership.  The ASF licenses this file
-## to you under the Apache License, Version 2.0 (the
-## "License"); you may not use this file except in compliance
-## with the License.  You may obtain a copy of the License at
-##
-##   http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing,
-## software distributed under the License is distributed on an
-## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-## KIND, either express or implied.  See the License for the
-## specific language governing permissions and limitations
-## under the License.
-##
-drop database if exists extext;
-create database extext;
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##   http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+drop database if exists extext;
+create database extext;

Propchange: db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-extext-schema-create.sql
------------------------------------------------------------------------------
    svn:eol-style = native



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]