FAQ
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/d8726e79
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d8726e79
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d8726e79

Branch: refs/heads/camel-2.17.x
Commit: d8726e79385441ef950493654301bbefda693e02
Parents: 2450bca
Author: Sune Keller <absukl@almbrand.dk>
Authored: Sun Jan 31 13:16:44 2016 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Tue Jun 14 08:10:17 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/d8726e79/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/d8726e79/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/d8726e79/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) )

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 2 | next ›
Discussion Overview
groupcommits @
categoriescamel
postedJun 14, '16 at 6:10a
activeJun 14, '16 at 6:10a
posts2
users1
websitecamel.apache.org

1 user in discussion

Davsclaus: 2 posts

People

Translate

site design / logo © 2017 Grokbase