camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/2] camel git commit: Prefix picklist enum names with owning SObjectDescription name
Date Tue, 14 Jun 2016 06:10:36 GMT
Repository: camel
Updated Branches:
  refs/heads/camel-2.17.x 2450bcad5 -> d8726e793
  refs/heads/master 92268c1fa -> 1cecacf9b


Prefix picklist enum names with owning SObjectDescription name

Signed-off-by: Sune Keller <absukl@almbrand.dk>


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1cecacf9
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1cecacf9
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1cecacf9

Branch: refs/heads/master
Commit: 1cecacf9ba4207bce4ba8e75142a701f4eae5909
Parents: 92268c1
Author: Sune Keller <absukl@almbrand.dk>
Authored: Sun Jan 31 13:16:44 2016 +0100
Committer: Sune Keller <absukl@almbrand.dk>
Committed: Mon Jun 13 16:42:47 2016 +0200

----------------------------------------------------------------------
 .../java/org/apache/camel/maven/CamelSalesforceMojo.java  | 10 ++++++----
 .../src/main/resources/sobject-picklist.vm                |  1 -
 .../src/main/resources/sobject-pojo.vm                    |  2 +-
 3 files changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/1cecacf9/components/camel-salesforce/camel-salesforce-maven-plugin/src/main/java/org/apache/camel/maven/CamelSalesforceMojo.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-maven-plugin/src/main/java/org/apache/camel/maven/CamelSalesforceMojo.java
b/components/camel-salesforce/camel-salesforce-maven-plugin/src/main/java/org/apache/camel/maven/CamelSalesforceMojo.java
index f2bbde9..2787ff9 100644
--- a/components/camel-salesforce/camel-salesforce-maven-plugin/src/main/java/org/apache/camel/maven/CamelSalesforceMojo.java
+++ b/components/camel-salesforce/camel-salesforce-maven-plugin/src/main/java/org/apache/camel/maven/CamelSalesforceMojo.java
@@ -571,7 +571,8 @@ public class CamelSalesforceMojo extends AbstractMojo {
             // write required Enumerations for any picklists
             for (SObjectField field : description.getFields()) {
                 if (utility.isPicklist(field) || utility.isMultiSelectPicklist(field)) {
-                    fileName = utility.enumTypeName(field.getName()) + JAVA_EXT;
+                    String enumName = description.getName() + "_" + utility.enumTypeName(field.getName());
+                    fileName = enumName + JAVA_EXT;
                     File enumFile = new File(pkgDir, fileName);
                     writer = new BufferedWriter(new FileWriter(enumFile));
 
@@ -579,6 +580,7 @@ public class CamelSalesforceMojo extends AbstractMojo {
                     context.put("packageName", packageName);
                     context.put("utility", utility);
                     context.put("field", field);
+                    context.put("enumName", enumName);
                     context.put("generatedDate", generatedDate);
 
                     Template queryTemplate = engine.getTemplate(SOBJECT_PICKLIST_VM);
@@ -695,14 +697,14 @@ public class CamelSalesforceMojo extends AbstractMojo {
             return !BASE_FIELDS.contains(name);
         }
 
-        public String getFieldType(SObjectField field) throws MojoExecutionException {
+        public String getFieldType(SObjectDescription description, SObjectField field) throws
MojoExecutionException {
             // check if this is a picklist
             if (isPicklist(field)) {
                 // use a pick list enum, which will be created after generating the SObject
class
-                return enumTypeName(field.getName());
+                return description.getName() + "_" + enumTypeName(field.getName());
             } else if (isMultiSelectPicklist(field)) {
                 // use a pick list enum array, enum will be created after generating the
SObject class
-                return enumTypeName(field.getName()) + "[]";
+                return description.getName() + "_" + enumTypeName(field.getName()) + "[]";
             } else {
                 // map field to Java type
                 final String soapType = field.getSoapType();

http://git-wip-us.apache.org/repos/asf/camel/blob/1cecacf9/components/camel-salesforce/camel-salesforce-maven-plugin/src/main/resources/sobject-picklist.vm
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-maven-plugin/src/main/resources/sobject-picklist.vm
b/components/camel-salesforce/camel-salesforce-maven-plugin/src/main/resources/sobject-picklist.vm
index bb3a22f..50da67a 100644
--- a/components/camel-salesforce/camel-salesforce-maven-plugin/src/main/resources/sobject-picklist.vm
+++ b/components/camel-salesforce/camel-salesforce-maven-plugin/src/main/resources/sobject-picklist.vm
@@ -24,7 +24,6 @@ package $packageName;
 import org.codehaus.jackson.annotate.JsonCreator;
 import org.codehaus.jackson.annotate.JsonValue;
 
-#set ( $enumName = $utility.enumTypeName($field.Name) )
 /**
  * Salesforce Enumeration DTO for picklist $field.Name
  */

http://git-wip-us.apache.org/repos/asf/camel/blob/1cecacf9/components/camel-salesforce/camel-salesforce-maven-plugin/src/main/resources/sobject-pojo.vm
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-maven-plugin/src/main/resources/sobject-pojo.vm
b/components/camel-salesforce/camel-salesforce-maven-plugin/src/main/resources/sobject-pojo.vm
index b69a3d8..0e3cfa1 100644
--- a/components/camel-salesforce/camel-salesforce-maven-plugin/src/main/resources/sobject-pojo.vm
+++ b/components/camel-salesforce/camel-salesforce-maven-plugin/src/main/resources/sobject-pojo.vm
@@ -52,7 +52,7 @@ public class $desc.Name extends AbstractSObjectBase {
 #foreach ( $field in $desc.Fields )
 #if ( $utility.notBaseField($field.Name) )
 #set ( $fieldName = $field.Name )
-#set ( $fieldType = $utility.getFieldType($field) )
+#set ( $fieldType = $utility.getFieldType($desc, $field) )
 #set ( $isMultiSelectPicklist = $utility.isMultiSelectPicklist($field) )
     // $fieldName
 #if ( $utility.isBlobField($field) )


Mime
View raw message