dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #07479
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2133: Improved resource tables web module
------------------------------------------------------------
revno: 2133
committer: Lars <larshelg@larshelg-laptop>
branch nick: trunk
timestamp: Thu 2010-09-16 12:04:16 +0200
message:
Improved resource tables web module
removed:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/sqlview/DropAllSqlViewTablesAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/sqlview/RegenerateAllSqlViewTablesAction.java
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/sqlview/SqlViewExpandStore.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/sqlview/SqlViewService.java
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/jdbc/JdbcSqlViewExpandStore.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/resourcetable/GenerateResourceTableAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/resourceTable.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/sqlView.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/resourceTableForm.vm
--
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/sqlview/SqlViewExpandStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/sqlview/SqlViewExpandStore.java 2010-08-24 07:43:37 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/sqlview/SqlViewExpandStore.java 2010-09-16 10:04:16 +0000
@@ -22,7 +22,7 @@
boolean createView( SqlView sqlViewInstance );
- void dropView( Object object );
+ void dropViewTable( String sqlViewName );
void setUpDataSqlViewTable( SqlViewTable sqlViewTable, String viewTableName );
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/sqlview/SqlViewService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/sqlview/SqlViewService.java 2010-08-24 07:43:37 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/sqlview/SqlViewService.java 2010-09-16 10:04:16 +0000
@@ -67,14 +67,17 @@
boolean isViewTableExists( String viewTableName );
+ boolean createAllViewTables();
+
boolean createViewTable( SqlView sqlViewInstance );
- void dropViewTable( Object object );
+ void dropViewTable( String viewName );
+
+ void dropAllSqlViewTables();
SqlViewTable getDataSqlViewTable( String viewTableName );
String testSqlGrammar( String sql );
String setUpJoinQuery( Collection<String> tableList );
-
}
=== 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 2010-08-24 07:43:37 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/sqlview/DefaultSqlViewService.java 2010-09-16 10:04:16 +0000
@@ -103,16 +103,16 @@
return query.replaceAll( ";\\s+", ";" ).replaceAll( ";+", ";" ).replaceAll( "\\s+", " " ).trim();
}
+ // -------------------------------------------------------------------------
+ // SqlView expanded
+ // -------------------------------------------------------------------------
+
@Override
public String setUpViewTableName( String input )
{
return sqlViewExpandStore.setUpViewTableName( input );
}
- // -------------------------------------------------------------------------
- // SqlView expanded
- // -------------------------------------------------------------------------
-
@Override
public Collection<String> getAllSqlViewNames()
{
@@ -126,6 +126,24 @@
}
@Override
+ public boolean createAllViewTables()
+ {
+ boolean success = true;
+
+ for ( SqlView sqlView : getAllSqlViews() )
+ {
+ setUpViewTableName( sqlView.getName() );
+
+ if ( !createViewTable( sqlView ) )
+ {
+ success = false;
+ }
+ }
+
+ return success;
+ }
+
+ @Override
public boolean createViewTable( SqlView sqlViewInstance )
{
return sqlViewExpandStore.createView( sqlViewInstance );
@@ -160,9 +178,17 @@
}
@Override
- public void dropViewTable( Object object )
+ public void dropViewTable( String sqlViewTableName )
{
- sqlViewExpandStore.dropView( object );
+ sqlViewExpandStore.dropViewTable( sqlViewTableName );
}
+ @Override
+ public void dropAllSqlViewTables()
+ {
+ for ( String viewName : getAllSqlViewNames() )
+ {
+ dropViewTable( viewName );
+ }
+ }
}
\ No newline at end of file
=== modified 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/JdbcSqlViewExpandStore.java 2010-08-25 06:53:37 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/sqlview/jdbc/JdbcSqlViewExpandStore.java 2010-09-16 10:04:16 +0000
@@ -27,8 +27,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.hisp.dhis.system.util.ReflectionUtils.isCollection;
-
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
@@ -192,22 +190,6 @@
return true;
}
- @SuppressWarnings( "unchecked" )
- public void dropView( Object object )
- {
- if ( isCollection( object ) )
- {
- for ( String viewName : (Collection<String>) object )
- {
- dropViewTable( viewName );
- }
- }
- else if ( object != null )
- {
- dropViewTable( (String) object );
- }
- }
-
@Override
public void setUpDataSqlViewTable( SqlViewTable sqlViewTable, String viewTableName )
{
@@ -263,6 +245,25 @@
}
@Override
+ public void dropViewTable( String viewName )
+ {
+ final StatementHolder holder = statementManager.getHolder();
+
+ try
+ {
+ holder.getStatement().executeUpdate( PREFIX_DROPVIEW_QUERY + viewName );
+ }
+ catch ( SQLException ex )
+ {
+ throw new RuntimeException( "Failed to drop view: " + viewName, ex );
+ }
+ finally
+ {
+ holder.close();
+ }
+ }
+
+ @Override
public String setUpJoinQuery( Collection<String> tableList )
{
String joinQuery = "";
@@ -1092,23 +1093,4 @@
return input;
}
-
- private void dropViewTable( String viewName )
- {
- final StatementHolder holder = statementManager.getHolder();
-
- try
- {
- holder.getStatement().executeUpdate( PREFIX_DROPVIEW_QUERY + viewName );
- }
- catch ( SQLException ex )
- {
- throw new RuntimeException( "Failed to drop view: " + viewName, ex );
- }
- finally
- {
- holder.close();
- }
- }
-
}
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/resourcetable/GenerateResourceTableAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/resourcetable/GenerateResourceTableAction.java 2010-09-16 08:49:51 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/resourcetable/GenerateResourceTableAction.java 2010-09-16 10:04:16 +0000
@@ -27,7 +27,10 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.hisp.dhis.resourcetable.ResourceTableService;
+import org.hisp.dhis.sqlview.SqlViewService;
import com.opensymphony.xwork2.ActionSupport;
@@ -38,10 +41,19 @@
public class GenerateResourceTableAction
extends ActionSupport
{
+ private static final Log log = LogFactory.getLog( GenerateResourceTableAction.class );
+
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
-
+
+ private SqlViewService sqlViewService;
+
+ public void setSqlViewService( SqlViewService sqlViewService )
+ {
+ this.sqlViewService = sqlViewService;
+ }
+
private ResourceTableService resourceTableService;
public void setResourceTableService( ResourceTableService resourceTableService )
@@ -102,6 +114,10 @@
public String execute()
throws Exception
{
+ sqlViewService.dropAllSqlViewTables();
+
+ log.info( "Dropped all sql views" );
+
if ( organisationUnit )
{
resourceTableService.generateOrganisationUnitStructures();
@@ -132,6 +148,12 @@
resourceTableService.generateCategoryOptionComboNames();
}
+ log.info( "Generated resource tables" );
+
+ sqlViewService.createAllViewTables();
+
+ log.info( "Created all views" );
+
return SUCCESS;
}
}
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/sqlview/DropAllSqlViewTablesAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/sqlview/DropAllSqlViewTablesAction.java 2010-08-24 07:43:37 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/sqlview/DropAllSqlViewTablesAction.java 1970-01-01 00:00:00 +0000
@@ -1,156 +0,0 @@
-package org.hisp.dhis.dataadmin.action.sqlview;
-
-/*
- * Copyright (c) 2004-2010, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import org.hisp.dhis.sqlview.SqlViewService;
-
-import com.opensymphony.xwork2.ActionSupport;
-
-/**
- * @author Dang Duy Hieu
- * @version $Id DropAllSqlViewTablesAction.java July 07, 2010$
- */
-public class DropAllSqlViewTablesAction
- extends ActionSupport
-{
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private SqlViewService sqlViewService;
-
- public void setSqlViewService( SqlViewService sqlViewService )
- {
- this.sqlViewService = sqlViewService;
- }
-
- // -------------------------------------------------------------------------
- // Input
- // -------------------------------------------------------------------------
-
- private boolean organisationUnit;
-
- public void setOrganisationUnit( boolean organisationUnit )
- {
- this.organisationUnit = organisationUnit;
- }
-
- private boolean groupSet;
-
- public void setGroupSet( boolean groupSet )
- {
- this.groupSet = groupSet;
- }
-
- private boolean dataElementGroupSetStructure;
-
- public void setDataElementGroupSetStructure( boolean dataElementGroupSetStructure )
- {
- this.dataElementGroupSetStructure = dataElementGroupSetStructure;
- }
-
- private boolean indicatorGroupSetStructure;
-
- public void setIndicatorGroupSetStructure( boolean indicatorGroupSetStructure )
- {
- this.indicatorGroupSetStructure = indicatorGroupSetStructure;
- }
-
- private boolean organisationUnitGroupSetStructure;
-
- public void setOrganisationUnitGroupSetStructure( boolean organisationUnitGroupSetStructure )
- {
- this.organisationUnitGroupSetStructure = organisationUnitGroupSetStructure;
- }
-
- private boolean categoryStructure;
-
- public void setCategoryStructure( boolean categoryStructure )
- {
- this.categoryStructure = categoryStructure;
- }
-
- private boolean categoryOptionComboName;
-
- public void setCategoryOptionComboName( boolean categoryOptionComboName )
- {
- this.categoryOptionComboName = categoryOptionComboName;
- }
-
- // -------------------------------------------------------------------------
- // Output
- // -------------------------------------------------------------------------
-
- public boolean isOrganisationUnit()
- {
- return organisationUnit;
- }
-
- public boolean isGroupSet()
- {
- return groupSet;
- }
-
- public boolean isDataElementGroupSetStructure()
- {
- return dataElementGroupSetStructure;
- }
-
- public boolean isIndicatorGroupSetStructure()
- {
- return indicatorGroupSetStructure;
- }
-
- public boolean isOrganisationUnitGroupSetStructure()
- {
- return organisationUnitGroupSetStructure;
- }
-
- public boolean isCategoryStructure()
- {
- return categoryStructure;
- }
-
- public boolean isCategoryOptionComboName()
- {
- return categoryOptionComboName;
- }
-
- // -------------------------------------------------------------------------
- // Action implementation
- // -------------------------------------------------------------------------
-
- public String execute()
- throws Exception
- {
- sqlViewService.dropViewTable( sqlViewService.getAllSqlViewNames() );
-
- return SUCCESS;
- }
-
-}
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/sqlview/RegenerateAllSqlViewTablesAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/sqlview/RegenerateAllSqlViewTablesAction.java 2010-08-24 07:43:37 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/sqlview/RegenerateAllSqlViewTablesAction.java 1970-01-01 00:00:00 +0000
@@ -1,108 +0,0 @@
-package org.hisp.dhis.dataadmin.action.sqlview;
-
-/*
- * Copyright (c) 2004-2010, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import org.hisp.dhis.i18n.I18n;
-import org.hisp.dhis.sqlview.SqlView;
-import org.hisp.dhis.sqlview.SqlViewService;
-
-import com.opensymphony.xwork2.ActionSupport;
-
-/**
- * Drops all sql-view tables first do regenerate the selected resource tables
- * and all of sql-view tables
- *
- * @author Dang Duy Hieu
- * @version $Id RegenerateAllSqlViewTablesAction.java July 06, 2010$
- */
-public class RegenerateAllSqlViewTablesAction
- extends ActionSupport
-{
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private SqlViewService sqlViewService;
-
- public void setSqlViewService( SqlViewService sqlViewService )
- {
- this.sqlViewService = sqlViewService;
- }
-
- private I18n i18n;
-
- public void setI18n( I18n i18n )
- {
- this.i18n = i18n;
- }
-
- // -------------------------------------------------------------------------
- // Output
- // -------------------------------------------------------------------------
-
- private String message;
-
- public String getMessage()
- {
- return message;
- }
-
- // -------------------------------------------------------------------------
- // Action implementation
- // -------------------------------------------------------------------------
-
- public String execute()
- {
- message = "";
-
- for ( SqlView sqlView : sqlViewService.getAllSqlViews() )
- {
- String viewName = sqlViewService.setUpViewTableName( sqlView.getName() );
-
- if ( !sqlViewService.createViewTable( sqlView ) )
- {
- message = i18n.getString( "failed_to_create_view_table_for" ) + ": " + sqlView.getName();
-
- return ERROR;
- }
-
- message += "<br/>[ " + viewName + " ]";
- }
-
- if ( message.equals( "" ) )
- {
- message = i18n.getString( "there_is_no_view_created" );
- }
- else
- {
- message = i18n.getString( "view_tables_created" ) + ": " + message;
- }
-
- return SUCCESS;
- }
-}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml 2010-09-15 13:42:47 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml 2010-09-16 10:04:16 +0000
@@ -60,8 +60,7 @@
<!-- Maintenance -->
- <bean
- id="org.hisp.dhis.dataadmin.action.maintenance.PerformMaintenanceAction"
+ <bean id="org.hisp.dhis.dataadmin.action.maintenance.PerformMaintenanceAction"
class="org.hisp.dhis.dataadmin.action.maintenance.PerformMaintenanceAction"
scope="prototype">
<property name="maintenanceService" ref="org.hisp.dhis.maintenance.MaintenanceService" />
@@ -73,12 +72,11 @@
<!-- Resource table -->
- <bean
- id="org.hisp.dhis.dataadmin.action.resourcetable.GenerateResourceTableAction"
+ <bean id="org.hisp.dhis.dataadmin.action.resourcetable.GenerateResourceTableAction"
class="org.hisp.dhis.dataadmin.action.resourcetable.GenerateResourceTableAction"
scope="prototype">
- <property name="resourceTableService"
- ref="org.hisp.dhis.resourcetable.ResourceTableService" />
+ <property name="resourceTableService" ref="org.hisp.dhis.resourcetable.ResourceTableService" />
+ <property name="sqlViewService" ref="org.hisp.dhis.sqlview.SqlViewService" />
</bean>
<!-- Cache -->
@@ -91,8 +89,7 @@
<!-- Data integrity -->
- <bean
- id="org.hisp.dhis.dataadmin.action.dataintegrity.GetDataIntegrityAction"
+ <bean id="org.hisp.dhis.dataadmin.action.dataintegrity.GetDataIntegrityAction"
class="org.hisp.dhis.dataadmin.action.dataintegrity.GetDataIntegrityAction"
scope="prototype">
<property name="dataIntegrityService"
@@ -369,18 +366,6 @@
scope="prototype">
<property name="sqlViewService" ref="org.hisp.dhis.sqlview.SqlViewService" />
</bean>
-
- <bean id="org.hisp.dhis.dataadmin.action.sqlview.DropAllSqlViewTablesAction"
- class="org.hisp.dhis.dataadmin.action.sqlview.DropAllSqlViewTablesAction"
- scope="prototype">
- <property name="sqlViewService" ref="org.hisp.dhis.sqlview.SqlViewService" />
- </bean>
-
- <bean id="org.hisp.dhis.dataadmin.action.sqlview.RegenerateAllSqlViewTablesAction"
- class="org.hisp.dhis.dataadmin.action.sqlview.RegenerateAllSqlViewTablesAction"
- scope="prototype">
- <property name="sqlViewService" ref="org.hisp.dhis.sqlview.SqlViewService" />
- </bean>
<bean id="org.hisp.dhis.dataadmin.action.sqlview.CheckViewTableExistenceAction"
class="org.hisp.dhis.dataadmin.action.sqlview.CheckViewTableExistenceAction"
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml 2010-09-15 04:42:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml 2010-09-16 10:04:16 +0000
@@ -81,7 +81,12 @@
<param name="page">
/dhis-web-maintenance-dataadmin/resourceTableForm.vm</param>
<param name="menu">/dhis-web-maintenance-dataadmin/menu.vm</param>
- <param name="javascripts">javascript/sqlView.js</param>
+ <param name="javascripts">javascript/resourceTable.js</param>
+ </action>
+
+ <action name="generateResourceTable"
+ class="org.hisp.dhis.dataadmin.action.resourcetable.GenerateResourceTableAction">
+ <result name="success" type="velocity-xml">/dhis-web-maintenance-dataadmin/responseSuccess.vm</result>
</action>
<!-- Cache -->
@@ -451,23 +456,6 @@
<param name="requiredAuthorities">F_SQLVIEW_MANAGEMENT</param>
</action>
- <action name="dropAllSqlViewTables"
- class="org.hisp.dhis.dataadmin.action.sqlview.DropAllSqlViewTablesAction">
- <result name="success" type="chain">generateResourceTables</result>
- <param name="requiredAuthorities">F_SQLVIEW_REGENERATE</param>
- </action>
-
- <action name="generateResourceTables"
- class="org.hisp.dhis.dataadmin.action.resourcetable.GenerateResourceTableAction">
- <result name="success" type="redirect">regenerateAllSqlViewTables.action</result>
- </action>
-
- <action name="regenerateAllSqlViewTables"
- class="org.hisp.dhis.dataadmin.action.sqlview.RegenerateAllSqlViewTablesAction">
- <result name="success" type="chain">displayResourceTableForm</result>
- <result name="error" type="chain">displayResourceTableForm</result>
- </action>
-
<action name="getResourceProperties" class="org.hisp.dhis.dataadmin.action.sqlview.GetResourcePropertiesAction">
<result name="success" type="velocity-json">/dhis-web-maintenance-dataadmin/jsonResourceProperties.vm</result>
</action>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/resourceTable.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/resourceTable.js 2010-09-16 09:02:40 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/resourceTable.js 2010-09-16 10:04:16 +0000
@@ -1,4 +1,6 @@
+var selected = false;
+
function generateResourceTable()
{
var organisationUnit = document.getElementById( "organisationUnit" ).checked;
@@ -37,3 +39,15 @@
{
setMessage( i18n_resource_tables_generated );
}
+
+function toggleAll()
+{
+ selected = !selected;
+
+ document.getElementById( "organisationUnit" ).checked = selected;
+ document.getElementById( "dataElementGroupSetStructure" ).checked = selected;
+ document.getElementById( "indicatorGroupSetStructure" ).checked = selected;
+ document.getElementById( "organisationUnitGroupSetStructure" ).checked = selected;
+ document.getElementById( "categoryStructure" ).checked = selected;
+ document.getElementById( "categoryOptionComboName" ).checked = selected;
+}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/sqlView.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/sqlView.js 2010-09-16 09:02:40 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/sqlView.js 2010-09-16 10:04:16 +0000
@@ -76,67 +76,6 @@
);
}
-function selectOrUnselectALL()
-{
- var listRadio = document.getElementsByName('resourceTableCheckBox');
-
- for (var i = 0 ; i < listRadio.length ; i++) {
-
- listRadio.item(i).checked = checkingStatus;
- }
-
- // If true, its means the items unselected yet
- if ( checkingStatus )
- {
- $("#selectAllButton").val( i18n_unselect_all );
- }
- else
- {
- $("#selectAllButton").val( i18n_select_all );
- }
- checkingStatus = !checkingStatus;
-}
-
-// -----------------------------------------------------------------------
-// Re-generating for the resource tables and the view ones
-// -----------------------------------------------------------------------
-
-function validateRegenerateResourceView()
-{
- var params = "";
- var organisationUnit = byId( "organisationUnit" ).checked;
- var dataElementGroupSetStructure = byId( "dataElementGroupSetStructure" ).checked;
- var indicatorGroupSetStructure = byId( "indicatorGroupSetStructure" ).checked;
- var organisationUnitGroupSetStructure = byId( "organisationUnitGroupSetStructure" ).checked;
- var categoryStructure = byId( "categoryStructure" ).checked;
- var categoryOptionComboName = byId( "categoryOptionComboName" ).checked;
-
- if ( organisationUnit || dataElementGroupSetStructure || indicatorGroupSetStructure ||
- organisationUnitGroupSetStructure || categoryStructure || categoryOptionComboName )
- {
- setWaitMessage( i18n_regenerating_resource_tables_and_views );
-
- var submitForm = byId("regenerateResourceViewForm")
-
- params += (organisationUnit == true ? "organisationUnit=true&" : "");
- params += (dataElementGroupSetStructure == true ? "dataElementGroupSetStructure=true&" : "");
- params += (indicatorGroupSetStructure == true ? "indicatorGroupSetStructure=true&" : "");
- params += (organisationUnitGroupSetStructure == true ? "organisationUnitGroupSetStructure=true&" : "");
- params += (categoryStructure == true ? "categoryStructure=true&" : "");
- params += (categoryOptionComboName == true ? "categoryOptionComboName=true&" : "");
-
- submitForm.action +="?"+params;
- submitForm.submit();
- }
- else
- {
- setMessage( i18n_select_options );
-
- return false;
- }
-
-}
-
// -----------------------------------------------------------------------
// View data from the specified view table
// -----------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/resourceTableForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/resourceTableForm.vm 2010-09-16 08:49:51 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/resourceTableForm.vm 2010-09-16 10:04:16 +0000
@@ -1,13 +1,3 @@
-<script>
-//-----------------------------------------------------------------------
-//init jQuery validation for regenerateResourceViewForm
-//-----------------------------------------------------------------------
-
- jQuery(document).ready(function() {
- validation( 'regenerateResourceViewForm', validateRegenerateResourceView )
- });
-
-</script>
<h3>$i18n.getString( "resource_table" ) #openHelp( "resourceTables" )</h3>
@@ -46,8 +36,8 @@
<table>
<tr>
<td>
- <input type="button" value='$i18n.getString( "select_all" )' id="selectAllButton" onclick="selectOrUnselectALL()" style="width:100px">
- <input type="submit" value='$i18n.getString( "generate_resource_tables" )' style="width:150px">
+ <input type="button" value='$i18n.getString( "select_all" )' id="selectAllButton" onclick="toggleAll()" style="width:100px">
+ <input type="button" value='$i18n.getString( "generate_resource_tables" )' onclick="generateResourceTable()" style="width:150px">
</td>
</tr>
@@ -57,16 +47,7 @@
<span id="message"></span>
-<div id="warningArea" style="position:fixed;right:10px;top:200px;display:none">
- <div style="float:right">
- <a href="javascript:hideWarning()" title="$i18n.getString( 'hide_warning' )"><img src="../images/close.png" alt="$i18n.getString( 'hide_warning' )"></a>
- </div>
- <p><span id="warningField"></span></p>
-</div>
-
<script type="text/javascript">
-
- checkingStatus = true;
var i18n_generating_resource_tables = '$encoder.jsEscape( $i18n.getString( "generating_resource_tables" ), "'" )';
var i18n_resource_tables_generated = '$encoder.jsEscape( $i18n.getString( "resource_tables_generated" ), "'" )';
@@ -76,8 +57,4 @@
var i18n_select_all = '$encoder.jsEscape( $i18n.getString( "select_all" ), "'" )';
var i18n_unselect_all = '$encoder.jsEscape( $i18n.getString( "unselect_all" ), "'" )';
- #if ( $message )
- setMessage( '$message' );
- #end
-
</script>