cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject [1/7] cayenne git commit: Generate is as properties.
Date Fri, 19 Oct 2018 12:23:23 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master 7694a64d3 -> 7b5d73e4e


Generate is as properties.


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/3124d171
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/3124d171
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/3124d171

Branch: refs/heads/master
Commit: 3124d1717f72d39868f13931c815fdafb9c6f0f0
Parents: adcbf13
Author: kkomyak <const1993@gmail.com>
Authored: Mon Sep 17 14:54:48 2018 +0300
Committer: kkomyak <const1993@gmail.com>
Committed: Wed Sep 19 14:44:22 2018 +0300

----------------------------------------------------------------------
 cayenne-cgen/src/main/resources/templates/v4_1/singleclass.vm | 7 ++++++-
 cayenne-cgen/src/main/resources/templates/v4_1/superclass.vm  | 7 ++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/3124d171/cayenne-cgen/src/main/resources/templates/v4_1/singleclass.vm
----------------------------------------------------------------------
diff --git a/cayenne-cgen/src/main/resources/templates/v4_1/singleclass.vm b/cayenne-cgen/src/main/resources/templates/v4_1/singleclass.vm
index b9285a8..e586651 100644
--- a/cayenne-cgen/src/main/resources/templates/v4_1/singleclass.vm
+++ b/cayenne-cgen/src/main/resources/templates/v4_1/singleclass.vm
@@ -39,6 +39,9 @@ ${importUtils.addType("${basePackageName}.${baseClassName}")}##
 ${importUtils.addType("java.io.IOException")}##
 ${importUtils.addType("java.io.ObjectInputStream")}##
 ${importUtils.addType("java.io.ObjectOutputStream")}##
+#if( $object.DbEntity )
+${importUtils.addType("org.apache.cayenne.exp.ExpressionFactory")}##
+#end
 #if((${object.DeclaredAttributes} && !${object.DeclaredAttributes.isEmpty()}) ||
(${object.DeclaredRelationships} && !${object.DeclaredRelationships.isEmpty()}))
 ${importUtils.addType('org.apache.cayenne.exp.Property')}##
 #end
@@ -71,7 +74,9 @@ public#if("true" == "${object.isAbstract()}") abstract#end class ${subClassName}
 #end
 #if( $object.DbEntity )
 #foreach( $idAttr in ${object.DbEntity.PrimaryKeys} )
-    public static final String ${stringUtils.capitalizedAsConstant($idAttr.Name)}_PK_COLUMN
= "${idAttr.Name}";
+    #if(!$object.DeclaredAttributes.toString().contains($idAttr.Name))
+    public static final Property<Integer> ${stringUtils.capitalizedAsConstant($idAttr.Name)}_PK_COLUMN
= Property.create(ExpressionFactory.dbPathExp("db:${idAttr.Name}"), Integer.class);
+    #end
 #end
 #end
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3124d171/cayenne-cgen/src/main/resources/templates/v4_1/superclass.vm
----------------------------------------------------------------------
diff --git a/cayenne-cgen/src/main/resources/templates/v4_1/superclass.vm b/cayenne-cgen/src/main/resources/templates/v4_1/superclass.vm
index 91152d7..ab67534 100644
--- a/cayenne-cgen/src/main/resources/templates/v4_1/superclass.vm
+++ b/cayenne-cgen/src/main/resources/templates/v4_1/superclass.vm
@@ -41,6 +41,9 @@ ${importUtils.addType("${basePackageName}.${baseClassName}")}##
 ${importUtils.addType("java.io.IOException")}##
 ${importUtils.addType("java.io.ObjectInputStream")}##
 ${importUtils.addType("java.io.ObjectOutputStream")}##
+#if( $object.DbEntity )
+${importUtils.addType("org.apache.cayenne.exp.ExpressionFactory")}##
+#end
 #if((${object.DeclaredAttributes} && !${object.DeclaredAttributes.isEmpty()}) ||
(${object.DeclaredRelationships} && !${object.DeclaredRelationships.isEmpty()}))
 ${importUtils.addType('org.apache.cayenne.exp.Property')}##
 #end
@@ -79,7 +82,9 @@ public abstract class ${superClassName} extends ${baseClassName} {
 #end
 #if( $object.DbEntity )
 #foreach( $idAttr in ${object.DbEntity.PrimaryKeys} )
-    public static final String ${stringUtils.capitalizedAsConstant($idAttr.Name)}_PK_COLUMN
= "${idAttr.Name}";
+    #if(!$object.DeclaredAttributes.toString().contains($idAttr.Name))
+    public static final Property<Integer> ${stringUtils.capitalizedAsConstant($idAttr.Name)}_PK_COLUMN
= Property.create(ExpressionFactory.dbPathExp("db:${idAttr.Name}"), Integer.class);
+    #end
 #end
 #end
 


Mime
View raw message