← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18234: Sql view, merged SqlViewExpandStore and SQlViewStore.

 

------------------------------------------------------------
revno: 18234
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-02-12 10:28:20 +0100
message:
  Sql view, merged SqlViewExpandStore and SQlViewStore.
renamed:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/sqlview/SqlViewExpandStore.java => dhis-2/dhis-api/src/main/java/org/hisp/dhis/sqlview/SqlViewStore.java
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/sqlview/jdbc/JdbcSqlViewExpandStore.java => dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/sqlview/jdbc/JdbcSqlViewStore.java
modified:
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/sqlview/DefaultSqlViewService.java
  dhis-2/dhis-services/dhis-service-administration/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/sqlview/ValidateAddUpdateSqlViewAction.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/sqlview/SqlViewStore.java
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/sqlview/jdbc/JdbcSqlViewStore.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
=== renamed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/sqlview/SqlViewExpandStore.java' => 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/sqlview/SqlViewStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/sqlview/SqlViewExpandStore.java	2015-02-12 09:12:38 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/sqlview/SqlViewStore.java	2015-02-12 09:28:20 +0000
@@ -30,14 +30,16 @@
 
 import java.util.Map;
 
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
 import org.hisp.dhis.common.Grid;
 
 /**
  * @author Dang Duy Hieu
  */
-public interface SqlViewExpandStore
+public interface SqlViewStore
+    extends GenericIdentifiableObjectStore<SqlView>
 {
-    String ID = SqlViewExpandStore.class.getName();
+    String ID = SqlViewStore.class.getName();
 
     boolean viewTableExists( String viewTableName );
 

=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/sqlview/DefaultSqlViewService.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/sqlview/DefaultSqlViewService.java	2015-02-11 22:50:44 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/sqlview/DefaultSqlViewService.java	2015-02-12 09:28:20 +0000
@@ -32,7 +32,6 @@
 import java.util.Map;
 
 import org.apache.commons.lang.StringUtils;
-import org.hisp.dhis.common.GenericIdentifiableObjectStore;
 import org.hisp.dhis.common.Grid;
 import org.hisp.dhis.system.grid.ListGrid;
 import org.springframework.transaction.annotation.Transactional;
@@ -49,20 +48,13 @@
     // Dependencies
     // -------------------------------------------------------------------------
 
-    private GenericIdentifiableObjectStore<SqlView> sqlViewStore;
+    private SqlViewStore sqlViewStore;
 
-    public void setSqlViewStore( GenericIdentifiableObjectStore<SqlView> sqlViewStore )
+    public void setSqlViewStore( SqlViewStore sqlViewStore )
     {
         this.sqlViewStore = sqlViewStore;
     }
 
-    private SqlViewExpandStore sqlViewExpandStore;
-
-    public void setSqlViewExpandStore( SqlViewExpandStore sqlViewExpandStore )
-    {
-        this.sqlViewExpandStore = sqlViewExpandStore;
-    }
-
     // -------------------------------------------------------------------------
     // Implement methods
     // -------------------------------------------------------------------------
@@ -148,13 +140,13 @@
     @Override
     public boolean viewTableExists( String viewTableName )
     {
-        return sqlViewExpandStore.viewTableExists( viewTableName );
+        return sqlViewStore.viewTableExists( viewTableName );
     }
 
     @Override
     public String createViewTable( SqlView sqlViewInstance )
     {
-        return sqlViewExpandStore.createViewTable( sqlViewInstance );
+        return sqlViewStore.createViewTable( sqlViewInstance );
     }
 
     @Override
@@ -167,11 +159,11 @@
         {
             final String sql = substituteSql( sqlView.getSqlQuery(), variables );
             
-            sqlViewExpandStore.executeQuery( grid, sql );
+            sqlViewStore.executeQuery( grid, sql );
         }
         else
         {
-            sqlViewExpandStore.setUpDataSqlViewTable( grid, sqlView.getViewName(), criteria );
+            sqlViewStore.setUpDataSqlViewTable( grid, sqlView.getViewName(), criteria );
         }
         
         return grid;
@@ -205,12 +197,12 @@
     @Override
     public String testSqlGrammar( String sql )
     {
-        return sqlViewExpandStore.testSqlGrammar( sql );
+        return sqlViewStore.testSqlGrammar( sql );
     }
 
     @Override
     public void dropViewTable( String sqlViewTableName )
     {
-        sqlViewExpandStore.dropViewTable( sqlViewTableName );
+        sqlViewStore.dropViewTable( sqlViewTableName );
     }
 }
\ No newline at end of file

=== renamed file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/sqlview/jdbc/JdbcSqlViewExpandStore.java' => 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/sqlview/jdbc/JdbcSqlViewStore.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/sqlview/jdbc/JdbcSqlViewExpandStore.java	2015-02-12 09:12:38 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/sqlview/jdbc/JdbcSqlViewStore.java	2015-02-12 09:28:20 +0000
@@ -28,27 +28,27 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import java.util.Map;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.hisp.dhis.common.Grid;
+import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore;
 import org.hisp.dhis.jdbc.StatementBuilder;
 import org.hisp.dhis.sqlview.SqlView;
-import org.hisp.dhis.sqlview.SqlViewExpandStore;
+import org.hisp.dhis.sqlview.SqlViewStore;
 import org.hisp.dhis.system.util.SqlHelper;
 import org.springframework.jdbc.BadSqlGrammarException;
-import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.jdbc.support.rowset.SqlRowSet;
 
-import java.util.Map;
-
 /**
  * @author Dang Duy Hieu
- * @version $Id JdbcSqlViewExpandStore.java July 06, 2010$
  */
-public class JdbcSqlViewExpandStore
-    implements SqlViewExpandStore
+public class JdbcSqlViewStore
+    extends HibernateIdentifiableObjectStore<SqlView>
+    implements SqlViewStore
 {
-    private static final Log log = LogFactory.getLog( JdbcSqlViewExpandStore.class );
+    private static final Log log = LogFactory.getLog( JdbcSqlViewStore.class );
 
     private static final String PREFIX_CREATEVIEW_QUERY = "CREATE VIEW ";
     private static final String PREFIX_SELECT_QUERY = "SELECT * FROM ";
@@ -57,13 +57,6 @@
     // Dependencies
     // -------------------------------------------------------------------------
 
-    private JdbcTemplate jdbcTemplate;
-
-    public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
-    {
-        this.jdbcTemplate = jdbcTemplate;
-    }
-
     private StatementBuilder statementBuilder;
 
     public void setStatementBuilder( StatementBuilder statementBuilder )

=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-administration/src/main/resources/META-INF/dhis/beans.xml	2015-01-13 15:01:23 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/resources/META-INF/dhis/beans.xml	2015-02-12 09:28:20 +0000
@@ -88,19 +88,15 @@
     
   <!-- Sql View -->
 
-  <bean id="org.hisp.dhis.sqlview.SqlViewStore" class="org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore">
+  <bean id="org.hisp.dhis.sqlview.SqlViewStore" class="org.hisp.dhis.sqlview.jdbc.JdbcSqlViewStore">
     <property name="clazz" value="org.hisp.dhis.sqlview.SqlView" />
     <property name="sessionFactory" ref="sessionFactory" />
-  </bean>
-
-  <bean id="org.hisp.dhis.sqlview.SqlViewExpandStore" class="org.hisp.dhis.sqlview.jdbc.JdbcSqlViewExpandStore">
     <property name="jdbcTemplate" ref="jdbcTemplate" />
     <property name="statementBuilder" ref="statementBuilder" />
   </bean>
 
   <bean id="org.hisp.dhis.sqlview.SqlViewService" class="org.hisp.dhis.sqlview.DefaultSqlViewService">
     <property name="sqlViewStore" ref="org.hisp.dhis.sqlview.SqlViewStore" />
-    <property name="sqlViewExpandStore" ref="org.hisp.dhis.sqlview.SqlViewExpandStore" />
   </bean>
   
   <!-- Scheduled tasks -->

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/sqlview/ValidateAddUpdateSqlViewAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/sqlview/ValidateAddUpdateSqlViewAction.java	2015-02-12 09:12:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/sqlview/ValidateAddUpdateSqlViewAction.java	2015-02-12 09:28:20 +0000
@@ -126,7 +126,7 @@
 
         if ( mode.equals( ADD ) && sqlViewService.getSqlView( name ) != null )
         {
-            message = i18n.getString( "name_in_used" );
+            message = i18n.getString( "name_in_use" );
 
             return INPUT;
         }