svn commit: r596815 - in /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model: ModelChild.java ModelEntity.java ModelField.java ModelIndex.java ModelReader.java ModelRelation.java ModelViewEntity.java

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

svn commit: r596815 - in /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model: ModelChild.java ModelEntity.java ModelField.java ModelIndex.java ModelReader.java ModelRelation.java ModelViewEntity.java

jacopoc
Author: jacopoc
Date: Tue Nov 20 12:35:35 2007
New Revision: 596815

URL: http://svn.apache.org/viewvc?rev=596815&view=rev
Log:
Added support for the <description> element to the ModelChild class, which all of ModelField, ModelIndex, and ModelRelation extend.
Thanks to Adrian Crum for the patch: OFBIZ-1389

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelChild.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelField.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelIndex.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelReader.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelRelation.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelChild.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelChild.java?rev=596815&r1=596814&r2=596815&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelChild.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelChild.java Tue Nov 20 12:35:35 2007
@@ -27,6 +27,8 @@
 public abstract class ModelChild implements Serializable {
 
     protected ModelEntity parentModelEntity;
+    /** The description for documentation purposes */
+    protected String description = "";
 
     protected ModelChild() {}
     protected ModelChild(ModelEntity parentModelEntity) {
@@ -40,4 +42,14 @@
     public ModelEntity getModelEntity() {
         return parentModelEntity;
     }
+
+    /** The description for documentation purposes */
+    public String getDescription() {
+        return this.description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
 }

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java?rev=596815&r1=596814&r2=596815&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java Tue Nov 20 12:35:35 2007
@@ -113,6 +113,9 @@
 
     protected boolean autoClearCache = true;
 
+    /** The location of this entity's definition */
+    protected String location = "";
+
     // ===== CONSTRUCTORS =====
     /** Default Constructor */
     public ModelEntity() {}
@@ -377,6 +380,16 @@
         this.autoClearCache = autoClearCache;
     }
 
+    /* Get the location of this entity's definition */
+    public String getLocation() {
+        return this.location;
+    }
+
+    /* Set the location of this entity's definition */
+    public void setLocation(String location) {
+        this.location = location;
+    }
+
     /** An indicator to specify if this entity requires locking for updates */
     public boolean getDoLock() {
         return this.doLock;
@@ -1342,4 +1355,5 @@
         return this.toXmlElement(document, this.getPackageName());
     }
 }
+
 

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelField.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelField.java?rev=596815&r1=596814&r2=596815&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelField.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelField.java Tue Nov 20 12:35:35 2007
@@ -47,9 +47,6 @@
     /** validators to be called when an update is done */
     protected List<String> validators = new ArrayList<String>();
 
-    /** The description for documentation purposes */
-    protected String description = "";
-
     /** Default Constructor */
     public ModelField() {}
 
@@ -165,15 +162,6 @@
 
     public String removeValidator(int index) {
         return this.validators.remove(index);
-    }
-
-    /** The description for documentation purposes */
-    public String getDescription() {
-        return this.description;
-    }
-
-    public void setDescription(String description) {
-        this.description = description;
     }
 
     public boolean equals(Object obj) {

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelIndex.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelIndex.java?rev=596815&r1=596814&r2=596815&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelIndex.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelIndex.java Tue Nov 20 12:35:35 2007
@@ -57,6 +57,7 @@
 
         this.name = UtilXml.checkEmpty(indexElement.getAttribute("name")).intern();
         this.unique = "true".equals(UtilXml.checkEmpty(indexElement.getAttribute("unique")));
+        this.description = StringUtil.internString(UtilXml.childElementValue(indexElement, "description"));
 
         NodeList indexFieldList = indexElement.getElementsByTagName("index-field");
         for (int i = 0; i < indexFieldList.getLength(); i++) {
@@ -64,7 +65,8 @@
 
             if (indexFieldElement.getParentNode() == indexElement) {
                 String fieldName = indexFieldElement.getAttribute("name").intern();
-                this.fieldNames.add(fieldName);            }
+                this.fieldNames.add(fieldName);
+            }
         }
     }
 

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelReader.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelReader.java?rev=596815&r1=596814&r2=596815&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelReader.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelReader.java Tue Nov 20 12:35:35 2007
@@ -165,6 +165,11 @@
 
         // utilTimer.timerString("  After createModelEntity -- " + i + " --");
         if (modelEntity != null) {
+            try {
+                modelEntity.setLocation(entityResourceHandler.getFullLocation());
+            } catch (GenericConfigException e) {
+                Debug.logWarning("Error getting ResourceHandler full location: " + e.getMessage(), module);
+            }
             entityCache.put(entityName, modelEntity);
             // utilTimer.timerString("  After entityCache.put -- " + i + " --");
             if (isEntity) {

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelRelation.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelRelation.java?rev=596815&r1=596814&r2=596815&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelRelation.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelRelation.java Tue Nov 20 12:35:35 2007
@@ -75,6 +75,7 @@
         this.title = UtilXml.checkEmpty(relationElement.getAttribute("title")).intern();
         this.relEntityName = UtilXml.checkEmpty(relationElement.getAttribute("rel-entity-name")).intern();
         this.fkName = UtilXml.checkEmpty(relationElement.getAttribute("fk-name")).intern();
+        this.description = StringUtil.internString(UtilXml.childElementValue(relationElement, "description"));
 
         NodeList keyMapList = relationElement.getElementsByTagName("key-map");
         for (int i = 0; i < keyMapList.getLength(); i++) {

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java?rev=596815&r1=596814&r2=596815&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java Tue Nov 20 12:35:35 2007
@@ -358,6 +358,7 @@
                 newModelField.setColName(modelMemberEntity.getEntityAlias() + "." + aliasedModelField.getColName());
                 newModelField.setName(modelMemberEntity.getEntityAlias() + "." + aliasedModelField.getName());
                 newModelField.setType(aliasedModelField.getType());
+                newModelField.setDescription(aliasedModelField.getDescription());
                 newModelField.setIsPk(false);
                 aliasedModelEntity.addField(newModelField);
             }
@@ -369,6 +370,7 @@
             ModelField field = new ModelField();
             field.setModelEntity(this);
             field.name = alias.name;
+            field.description = alias.description;
 
             // if this is a groupBy field, add it to the groupBys list
             if (alias.groupBy) {
@@ -631,6 +633,7 @@
                 expandedAlias.colAlias = ModelUtil.javaNameToDbName(UtilXml.checkEmpty(expandedAlias.name));
                 expandedAlias.function = function;
                 expandedAlias.groupBy = groupBy;
+                expandedAlias.description = modelField.getDescription();
               
                 aliases.add(expandedAlias);
             }