← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20482: Resource table, moved table name into implementations

 

------------------------------------------------------------
revno: 20482
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-10-02 18:41:20 +0200
message:
  Resource table, moved table name into implementations
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/resourcetable/ResourceTable.java
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/table/CategoryOptionComboNameResourceTable.java
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/table/CategoryOptionGroupSetResourceTable.java
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/table/CategoryResourceTable.java
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/table/DataElementGroupSetResourceTable.java
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/table/DataElementResourceTable.java
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/table/IndicatorGroupSetResourceTable.java
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/table/OrganisationUnitGroupSetResourceTable.java
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/table/OrganisationUnitStructureResourceTable.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/resourcetable/ResourceTable.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/resourcetable/ResourceTable.java	2015-10-02 14:27:58 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/resourcetable/ResourceTable.java	2015-10-02 16:41:20 +0000
@@ -43,9 +43,7 @@
     protected static final Log log = LogFactory.getLog( ResourceTable.class );
     
     protected static final String TEMP_TABLE_SUFFIX = "_temp";
-    
-    protected String tableName;
-    
+        
     protected List<T> objects;
     
     protected String columnQuote;
@@ -58,9 +56,8 @@
     {
     }
     
-    protected ResourceTable( String tableName, List<T> objects, String columnQuote )
+    protected ResourceTable( List<T> objects, String columnQuote )
     {
-        this.tableName = tableName;
         this.objects = objects;
         this.columnQuote = columnQuote;
     }
@@ -68,15 +65,10 @@
     // -------------------------------------------------------------------------
     // Public methods
     // -------------------------------------------------------------------------
-
-    public final String getTableName()
-    {
-        return tableName;
-    }
     
     public final String getTempTableName()
     {
-        return tableName + TEMP_TABLE_SUFFIX;
+        return getTableName() + TEMP_TABLE_SUFFIX;
     }
     
     public final String getDropTableStatement()
@@ -102,6 +94,8 @@
     // Abstract methods
     // -------------------------------------------------------------------------
 
+    public abstract String getTableName();
+    
     public abstract String getCreateTempTableStatement();
     
     public abstract Optional<String> getPopulateTempTableStatement();

=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java	2015-10-02 16:28:45 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java	2015-10-02 16:41:20 +0000
@@ -151,7 +151,7 @@
     public void generateOrganisationUnitStructures()
     {
         resourceTableStore.generateResourceTable( new OrganisationUnitStructureResourceTable( 
-            "_orgunitstructure", null, statementBuilder.getColumnQuote(), 
+            null, statementBuilder.getColumnQuote(), 
             organisationUnitService, organisationUnitService.getMaxOfOrganisationUnitLevels() ) );
     }
     
@@ -160,7 +160,7 @@
     public void generateCategoryOptionComboNames()
     {
         resourceTableStore.generateResourceTable( new CategoryOptionComboNameResourceTable( 
-            "_categoryoptioncomboname", idObjectManager.getAllNoAcl( DataElementCategoryCombo.class ), 
+            idObjectManager.getAllNoAcl( DataElementCategoryCombo.class ), 
             statementBuilder.getColumnQuote() ) );
     }
 
@@ -169,7 +169,7 @@
     public void generateCategoryOptionGroupSetTable()
     {
         resourceTableStore.generateResourceTable( new CategoryOptionGroupSetResourceTable(
-            "_categoryoptiongroupsetstructure", idObjectManager.getAllNoAcl( CategoryOptionGroupSet.class ),
+            idObjectManager.getAllNoAcl( CategoryOptionGroupSet.class ),
             statementBuilder.getColumnQuote(), categoryService.getAllDataElementCategoryOptionCombos() ) );
     }
 
@@ -178,7 +178,7 @@
     public void generateDataElementGroupSetTable()
     {
         resourceTableStore.generateResourceTable( new DataElementGroupSetResourceTable(
-            "_dataelementgroupsetstructure", idObjectManager.getDataDimensionsNoAcl( DataElementGroupSet.class ),
+            idObjectManager.getDataDimensionsNoAcl( DataElementGroupSet.class ),
             statementBuilder.getColumnQuote() ) );
     }
 
@@ -187,7 +187,7 @@
     public void generateIndicatorGroupSetTable()
     {
         resourceTableStore.generateResourceTable( new IndicatorGroupSetResourceTable(
-            "_indicatorgroupsetstructure", idObjectManager.getAllNoAcl( IndicatorGroupSet.class ),
+            idObjectManager.getAllNoAcl( IndicatorGroupSet.class ),
             statementBuilder.getColumnQuote() ) );
     }
 
@@ -196,7 +196,7 @@
     public void generateOrganisationUnitGroupSetTable()
     {
         resourceTableStore.generateResourceTable( new OrganisationUnitGroupSetResourceTable(
-            "_organisationunitgroupsetstructure", idObjectManager.getDataDimensionsNoAcl( OrganisationUnitGroupSet.class ),
+            idObjectManager.getDataDimensionsNoAcl( OrganisationUnitGroupSet.class ),
             statementBuilder.getColumnQuote() ) );
     }
 
@@ -205,7 +205,7 @@
     public void generateCategoryTable()
     {
         resourceTableStore.generateResourceTable( new CategoryResourceTable( 
-            "_categorystructure", idObjectManager.getDataDimensionsNoAcl( DataElementCategory.class ),
+            idObjectManager.getDataDimensionsNoAcl( DataElementCategory.class ),
             statementBuilder.getColumnQuote() ) );
     }
 
@@ -214,7 +214,7 @@
     public void generateDataElementTable()
     {
         resourceTableStore.generateResourceTable( new DataElementResourceTable( 
-            "_dataelementstructure", idObjectManager.getAllNoAcl( DataElement.class ),
+            idObjectManager.getAllNoAcl( DataElement.class ),
             statementBuilder.getColumnQuote() ) );
     }
 

=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/table/CategoryOptionComboNameResourceTable.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/table/CategoryOptionComboNameResourceTable.java	2015-10-02 13:58:22 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/table/CategoryOptionComboNameResourceTable.java	2015-10-02 16:41:20 +0000
@@ -44,9 +44,15 @@
 public class CategoryOptionComboNameResourceTable
     extends ResourceTable<DataElementCategoryCombo>
 {
-    public CategoryOptionComboNameResourceTable( String tableName, List<DataElementCategoryCombo> objects, String columnQuote )
-    {
-        super( tableName, objects, columnQuote );
+    public CategoryOptionComboNameResourceTable( List<DataElementCategoryCombo> objects, String columnQuote )
+    {
+        super( objects, columnQuote );
+    }
+    
+    @Override
+    public String getTableName()
+    {
+        return "_categoryoptioncomboname";
     }
     
     @Override

=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/table/CategoryOptionGroupSetResourceTable.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/table/CategoryOptionGroupSetResourceTable.java	2015-10-02 16:14:33 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/table/CategoryOptionGroupSetResourceTable.java	2015-10-02 16:41:20 +0000
@@ -45,14 +45,20 @@
 {
     private List<DataElementCategoryOptionCombo> categoryOptionCombos;
     
-    public CategoryOptionGroupSetResourceTable( String tableName, 
-        List<CategoryOptionGroupSet> objects, String columnQuote, List<DataElementCategoryOptionCombo> categoryOptionCombos )
+    public CategoryOptionGroupSetResourceTable( List<CategoryOptionGroupSet> objects, 
+        String columnQuote, List<DataElementCategoryOptionCombo> categoryOptionCombos )
     {
-        super( tableName, objects, columnQuote );
+        super( objects, columnQuote );
         this.categoryOptionCombos = categoryOptionCombos;
     }
 
     @Override
+    public String getTableName()
+    {
+        return "_categoryoptiongroupsetstructure";
+    }
+    
+    @Override
     public String getCreateTempTableStatement()
     {
         String statement = "create table " + getTempTableName() + " (" +

=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/table/CategoryResourceTable.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/table/CategoryResourceTable.java	2015-10-02 16:14:33 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/table/CategoryResourceTable.java	2015-10-02 16:41:20 +0000
@@ -41,12 +41,18 @@
 public class CategoryResourceTable
     extends ResourceTable<DataElementCategory>
 {
-    public CategoryResourceTable( String tableName, List<DataElementCategory> objects, String columnQuote )
+    public CategoryResourceTable( List<DataElementCategory> objects, String columnQuote )
     {
-        super( tableName, objects, columnQuote );        
+        super( objects, columnQuote );
     }
 
     @Override
+    public String getTableName()
+    {
+        return "_categorystructure";
+    }
+    
+    @Override
     public String getCreateTempTableStatement()
     {
         String statement = "create table " + getTempTableName() + " (" +

=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/table/DataElementGroupSetResourceTable.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/table/DataElementGroupSetResourceTable.java	2015-10-02 16:14:33 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/table/DataElementGroupSetResourceTable.java	2015-10-02 16:41:20 +0000
@@ -41,9 +41,15 @@
 public class DataElementGroupSetResourceTable
     extends ResourceTable<DataElementGroupSet>
 {
-    public DataElementGroupSetResourceTable( String tableName, List<DataElementGroupSet> objects, String columnQuote )
-    {
-        super( tableName, objects, columnQuote );
+    public DataElementGroupSetResourceTable( List<DataElementGroupSet> objects, String columnQuote )
+    {
+        super( objects, columnQuote );
+    }
+
+    @Override
+    public String getTableName()
+    {
+        return "_dataelementgroupsetstructure";
     }
     
     @Override

=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/table/DataElementResourceTable.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/table/DataElementResourceTable.java	2015-10-02 16:28:45 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/table/DataElementResourceTable.java	2015-10-02 16:41:20 +0000
@@ -45,9 +45,15 @@
 public class DataElementResourceTable
     extends ResourceTable<DataElement>
 {
-    public DataElementResourceTable( String tableName, List<DataElement> objects, String columnQuote )
-    {
-        super( tableName, objects, columnQuote );
+    public DataElementResourceTable( List<DataElement> objects, String columnQuote )
+    {
+        super( objects, columnQuote );
+    }
+
+    @Override
+    public String getTableName()
+    {
+        return "_dataelementstructure";
     }
     
     @Override

=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/table/IndicatorGroupSetResourceTable.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/table/IndicatorGroupSetResourceTable.java	2015-10-02 16:14:33 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/table/IndicatorGroupSetResourceTable.java	2015-10-02 16:41:20 +0000
@@ -41,9 +41,15 @@
 public class IndicatorGroupSetResourceTable
     extends ResourceTable<IndicatorGroupSet>
 {
-    public IndicatorGroupSetResourceTable( String tableName, List<IndicatorGroupSet> objects, String columnQuote )
-    {
-        super( tableName, objects, columnQuote );
+    public IndicatorGroupSetResourceTable( List<IndicatorGroupSet> objects, String columnQuote )
+    {
+        super( objects, columnQuote );
+    }
+
+    @Override
+    public String getTableName()
+    {
+        return "_indicatorgroupsetstructure";
     }
     
     @Override

=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/table/OrganisationUnitGroupSetResourceTable.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/table/OrganisationUnitGroupSetResourceTable.java	2015-10-02 16:14:33 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/table/OrganisationUnitGroupSetResourceTable.java	2015-10-02 16:41:20 +0000
@@ -41,12 +41,18 @@
 public class OrganisationUnitGroupSetResourceTable
     extends ResourceTable<OrganisationUnitGroupSet>
 {
-    public OrganisationUnitGroupSetResourceTable( String tableName, List<OrganisationUnitGroupSet> objects, String columnQuote )
+    public OrganisationUnitGroupSetResourceTable( List<OrganisationUnitGroupSet> objects, String columnQuote )
     {
-        super( tableName, objects, columnQuote );
+        super( objects, columnQuote );
     }
 
     @Override
+    public String getTableName()
+    {
+        return "_organisationunitgroupsetstructure";
+    }
+    
+    @Override
     public String getCreateTempTableStatement()
     {
         String statement = "create table " + getTempTableName() + " (" +

=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/table/OrganisationUnitStructureResourceTable.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/table/OrganisationUnitStructureResourceTable.java	2015-10-02 13:58:22 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/table/OrganisationUnitStructureResourceTable.java	2015-10-02 16:41:20 +0000
@@ -49,13 +49,19 @@
     
     private int organisationUnitLevels;
     
-    public OrganisationUnitStructureResourceTable( String tableName, List<OrganisationUnit> objects, 
+    public OrganisationUnitStructureResourceTable( List<OrganisationUnit> objects, 
         String columnQuote, OrganisationUnitService organisationUnitService, int organisationUnitLevels )
     {
-        super( tableName, objects, columnQuote );
+        super( objects, columnQuote );
         this.organisationUnitService = organisationUnitService;
         this.organisationUnitLevels = organisationUnitLevels;
     }
+
+    @Override
+    public String getTableName()
+    {
+        return "_orgunitstructure";
+    }
     
     @Override
     public String getCreateTempTableStatement()