related to issue 24104: clean up
authorAsier Lostalé <asier.lostale@openbravo.com>
Fri, 09 Aug 2013 12:48:41 +0200
changeset 20965 38dc65517c76
parent 20964 0b8c20d9ec64
child 20966 d4d102140b5c
related to issue 24104: clean up

Cleanup of small items
src-test/org/openbravo/test/dal/ComputedColumnsTest.java
src/org/openbravo/base/gen/entity.ftl
src/org/openbravo/base/gen/entityComputedColumns.ftl
src/org/openbravo/base/model/Entity.java
src/org/openbravo/dal/core/DalMappingGenerator.java
src/org/openbravo/dal/core/template_main.hbm.xml
src/org/openbravo/dal/xml/StaxXMLEntityConverter.java
--- a/src-test/org/openbravo/test/dal/ComputedColumnsTest.java	Fri Aug 09 08:38:25 2013 +0200
+++ b/src-test/org/openbravo/test/dal/ComputedColumnsTest.java	Fri Aug 09 12:48:41 2013 +0200
@@ -52,7 +52,7 @@
     // load one order
     OBCriteria<Order> qOrder = OBDal.getInstance().createCriteria(Order.class);
     qOrder.setMaxResults(1);
-    Order order = qOrder.list().get(0);
+    Order order = (Order) qOrder.uniqueResult();
 
     // check it is in memory but computed columns are not already loaded
     assertTrue("DAL Order loaded",
--- a/src/org/openbravo/base/gen/entity.ftl	Fri Aug 09 08:38:25 2013 +0200
+++ b/src/org/openbravo/base/gen/entity.ftl	Fri Aug 09 12:48:41 2013 +0200
@@ -50,16 +50,17 @@
     public static final String PROPERTY_${p.name?upper_case} = "${p.name}";
     </#if>
     </#list>
-    
+
     <#if entity.hasComputedColumns()>
+
     // Computed columns properties, these properties cannot be directly accessed, they need
     // to be read through _commputedColumns proxy. They cannot be directly used in HQL, OBQuery
     // nor OBCriteria. 
     <#list entity.computedColumnProperties as p>
     public static final String COMPUTED_COLUMN_${p.name?upper_case} = "${p.name}";
     </#list>
+
     </#if>
-
     public ${entity.simpleClassName}() {
     <#list entity.properties as p>
         <#if p.hasDefaultValue() && !p.computedColumn>
@@ -112,9 +113,8 @@
     @SuppressWarnings("unchecked")
     public ${theList(entity)}<${p.shorterNameTargetEntity}> get${p.name?cap_first}() {
       <#if !p.computedColumn>
-      return (${theList(entity)}<${p.shorterNameTargetEntity}>) get(PROPERTY_${p.name?upper_case});        
+      return (${theList(entity)}<${p.shorterNameTargetEntity}>) get(PROPERTY_${p.name?upper_case});
       <#else>
-      //ss
       return (${theList(entity)}<${p.shorterNameTargetEntity}>) get(COMPUTED_COLUMN_${p.name?upper_case});
       </#if>
     }
@@ -194,8 +194,8 @@
 		}		
 	}
 	</#if>
-	
 	<#if entity.hasComputedColumns()>
+
     @Override
     public Object get(String propName) {
       <#list entity.computedColumnProperties as p>
--- a/src/org/openbravo/base/gen/entityComputedColumns.ftl	Fri Aug 09 08:38:25 2013 +0200
+++ b/src/org/openbravo/base/gen/entityComputedColumns.ftl	Fri Aug 09 12:48:41 2013 +0200
@@ -38,8 +38,7 @@
 /**
  * Virtual entity class to hold computed columns for entity ${entity.name}.
  *
- * NOTE: This class should not be instantiated directly. To instantiate this
- * class the {@link org.openbravo.base.provider.OBProvider} should be used.
+ * NOTE: This class should not be instantiated directly.
  */
 public class ${entity.simpleClassName}_ComputedColumns extends BaseOBObject implements ClientEnabled, OrganizationEnabled {
     private static final long serialVersionUID = 1L;
--- a/src/org/openbravo/base/model/Entity.java	Fri Aug 09 08:38:25 2013 +0200
+++ b/src/org/openbravo/base/model/Entity.java	Fri Aug 09 12:48:41 2013 +0200
@@ -234,7 +234,7 @@
     return computedColumnProperties;
   }
 
-  public void initializeComputedColumns(Table t, Entity e) {
+  void initializeComputedColumns(Table t, Entity e) {
     setTableName(t.getTableName() + "_CC");
     setTableId(t.getId() + "_CC");
     setClassName(e.getPackageName() + "." + e.getSimpleClassName()
@@ -804,7 +804,7 @@
     return getJavaImportsInternal(properties);
   }
 
-  List<String> getJavaImportsInternal(List<Property> propertyList) {
+  private List<String> getJavaImportsInternal(List<Property> propertyList) {
     List<String> imports = new ArrayList<String>();
     Set<String> simpleImports = new HashSet<String>();
     imports.add("org.openbravo.base.structure.BaseOBObject");
--- a/src/org/openbravo/dal/core/DalMappingGenerator.java	Fri Aug 09 08:38:25 2013 +0200
+++ b/src/org/openbravo/dal/core/DalMappingGenerator.java	Fri Aug 09 12:48:41 2013 +0200
@@ -86,6 +86,10 @@
   public String generateMapping() {
     final String hibernateFileLocation = OBPropertiesProvider.getInstance()
         .getOpenbravoProperties().getProperty(HIBERNATE_FILE_PROPERTY);
+
+    // If readMappingFromFile is true and the mapping is already generated to a file, this file will
+    // be read instead of generating a new one. Useful while developing changes in mapping to edit
+    // the file before generating it.
     final String readMappingFromFile = OBPropertiesProvider.getInstance().getOpenbravoProperties()
         .getProperty(HIBERNATE_READ_FILE_PROPERTY);
 
--- a/src/org/openbravo/dal/core/template_main.hbm.xml	Fri Aug 09 08:38:25 2013 +0200
+++ b/src/org/openbravo/dal/core/template_main.hbm.xml	Fri Aug 09 12:48:41 2013 +0200
@@ -13,7 +13,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2008-2013 Openbravo SLU 
+ * All portions are Copyright (C) 2008-2011 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
--- a/src/org/openbravo/dal/xml/StaxXMLEntityConverter.java	Fri Aug 09 08:38:25 2013 +0200
+++ b/src/org/openbravo/dal/xml/StaxXMLEntityConverter.java	Fri Aug 09 12:48:41 2013 +0200
@@ -162,7 +162,7 @@
       checkDanglingObjects();
       return result;
     } catch (XMLStreamException e) {
-      log.error("Error del horror", e);
+      log.error("Error parsing", e);
       throw new EntityXMLException(e);
     }
   }