dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #28034
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13972: Refactored identitiy populator, placing tables in the modules they belong to
------------------------------------------------------------
revno: 13972
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-02-10 09:26:08 +0100
message:
Refactored identitiy populator, placing tables in the modules they belong to
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/IdentityPopulator.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/trackedentity/startup/TableAlteror.java
dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/pom.xml
--
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-services/dhis-service-core/src/main/java/org/hisp/dhis/common/IdentityPopulator.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/IdentityPopulator.java 2014-02-07 20:25:49 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/IdentityPopulator.java 2014-02-10 08:26:08 +0000
@@ -36,6 +36,8 @@
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.support.rowset.SqlRowSet;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Map;
import java.util.UUID;
@@ -47,19 +49,17 @@
{
private static final Log log = LogFactory.getLog( IdentityPopulator.class );
- private static final String[] tables = { "chart", "constant", "concept", "attribute", "indicatortype", "indicatorgroupset", "indicator",
- "indicatorgroup", "datadictionary", "validationrulegroup", "validationrule", "dataset", "orgunitlevel", "document",
- "organisationunit", "orgunitgroup", "orgunitgroupset", "dataelementcategoryoption", "dataelementgroup", "sqlview",
- "dataelement", "dataelementgroupset", "dataelementcategory", "categorycombo", "categoryoptioncombo", "map", "mapview",
- "reporttable", "report", "messageconversation", "message", "userinfo", "usergroup", "userrole", "maplegend",
- "maplegendset", "maplayer", "section", "optionset", "program", "programinstance", "programstage", "programstageinstance",
- "trackedentityinstance", "relationshiptype"
- };
-
private static final Map<String, String> TABLE_ID_MAP = DimensionalObjectUtils.asMap(
"dataelementcategoryoption", "categoryoptionid",
"dataelementcategory", "categoryid" );
+ private List<String> tables = new ArrayList<String>();
+
+ public void setTables( List<String> tables )
+ {
+ this.tables = tables;
+ }
+
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2014-01-31 18:08:43 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2014-02-10 08:26:08 +0000
@@ -878,6 +878,38 @@
<property name="name" value="IdentityPopulator" />
<property name="runlevel" value="3" />
<property name="skipInTests" value="true" />
+ <property name="tables">
+ <list>
+ <value>constant</value>
+ <value>concept</value>
+ <value>attribute</value>
+ <value>indicatortype</value>
+ <value>indicator</value>
+ <value>indicatorgroup</value>
+ <value>indicatorgroupset</value>
+ <value>datadictionary</value>
+ <value>validationrule</value>
+ <value>validationrulegroup</value>
+ <value>dataset</value>
+ <value>section</value>
+ <value>orgunitlevel</value>
+ <value>organisationunit</value>
+ <value>orgunitgroup</value>
+ <value>orgunitgroupset</value>
+ <value>dataelement</value>
+ <value>dataelementgroup</value>
+ <value>dataelementgroupset</value>
+ <value>sqlview</value>
+ <value>dataelementcategory</value>
+ <value>dataelementcategoryoption</value>
+ <value>categorycombo</value>
+ <value>categoryoptioncombo</value>
+ <value>userinfo</value>
+ <value>usergroup</value>
+ <value>userrole</value>
+ <value>optionset</value>
+ </list>
+ </property>
</bean>
<bean id="org.hisp.dhis.startup.TableCreator" class="org.hisp.dhis.startup.TableCreator">
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/trackedentity/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/trackedentity/startup/TableAlteror.java 2014-02-09 02:56:41 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/trackedentity/startup/TableAlteror.java 2014-02-10 08:26:08 +0000
@@ -38,7 +38,6 @@
import org.amplecode.quick.StatementManager;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.hisp.dhis.common.CodeGenerator;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.dataentryform.DataEntryForm;
@@ -184,8 +183,6 @@
executeSql( "update program set remindCompleted=false where remindCompleted is null" );
executeSql( "UPDATE programinstance SET followup=false where followup is null" );
- updateUid();
-
updateUidInDataEntryFrom();
updateProgramInstanceStatus();
@@ -269,47 +266,6 @@
log.info( "Dropped program_attributes table." );
}
- private void updateUid()
- {
- updateUidColumn( "trackedentityattribute" );
- updateUidColumn( "trackedentityattributegroup" );
- updateUidColumn( "program" );
- updateUidColumn( "trackedentityattribute" );
- updateUidColumn( "programstage" );
- updateUidColumn( "programstagesection" );
- updateUidColumn( "programvalidation" );
- updateUidColumn( "caseaggregatecondition" );
- }
-
- private void updateUidColumn( String tableName )
- {
- StatementHolder holder = statementManager.getHolder();
-
- try
- {
- Statement statement = holder.getStatement();
-
- ResultSet resultSet = statement.executeQuery( "SELECT " + tableName + "id FROM " + tableName
- + " where uid is null" );
-
- while ( resultSet.next() )
- {
- String uid = CodeGenerator.generateCode();
-
- executeSql( "UPDATE " + tableName + " SET uid='" + uid + "' WHERE " + tableName + "id="
- + resultSet.getInt( 1 ) );
- }
- }
- catch ( Exception ex )
- {
- log.debug( ex );
- }
- finally
- {
- holder.close();
- }
- }
-
private void updateUidInDataEntryFrom()
{
Collection<ProgramStage> programStages = programStageService.getAllProgramStages();
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml 2014-02-07 20:25:49 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml 2014-02-10 08:26:08 +0000
@@ -391,8 +391,26 @@
ref="org.hisp.dhis.dataentryform.DataEntryFormService" />
</bean>
- <bean
- class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
+ <bean id="org.hisp.dhis.common.TrackerIdentityPopulator" class="org.hisp.dhis.common.IdentityPopulator">
+ <property name="name" value="TrackerIdentityPopulator" />
+ <property name="runlevel" value="3" />
+ <property name="skipInTests" value="true" />
+ <property name="tables">
+ <list>
+ <value>trackedentityattribute</value>
+ <value>trackedentityattributegroup</value>
+ <value>program</value>
+ <value>programstage</value>
+ <value>programinstance</value>
+ <value>programstageinstance</value>
+ <value>relationshiptype</value>
+ <value>programstagesection</value>
+ <value>programvalidation</value>
+ </list>
+ </property>
+ </bean>
+
+ <bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetObject"
ref="org.hisp.dhis.system.startup.StartupRoutineExecutor" />
<property name="targetMethod" value="addStartupRoutines" />
@@ -400,6 +418,7 @@
<list>
<list>
<ref local="org.hisp.dhis.trackedentity.startup.TableAlteror" />
+ <ref local="org.hisp.dhis.common.TrackerIdentityPopulator" />
</list>
</list>
</property>
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml 2013-12-21 19:02:27 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml 2014-02-10 08:26:08 +0000
@@ -203,6 +203,42 @@
<property name="last6To12Months" value="true" />
</bean>
+ <bean id="org.hisp.dhis.common.ReportingIdentityPopulator" class="org.hisp.dhis.common.IdentityPopulator">
+ <property name="name" value="ReportingIdentityPopulator" />
+ <property name="runlevel" value="3" />
+ <property name="skipInTests" value="true" />
+ <property name="tables">
+ <list>
+ <value>reporttable</value>
+ <value>chart</value>
+ <value>map</value>
+ <value>mapview</value>
+ <value>maplegend</value>
+ <value>maplegendset</value>
+ <value>report</value>
+ <value>messageconversation</value>
+ <value>message</value>
+ <value>document</value>
+ <value>dashboard</value>
+ <value>dashboarditem</value>
+ <value>interpretation</value>
+ <value>interpretationcomment</value>
+ </list>
+ </property>
+ </bean>
+
+ <bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
+ <property name="targetObject" ref="org.hisp.dhis.system.startup.StartupRoutineExecutor" />
+ <property name="targetMethod" value="addStartupRoutines" />
+ <property name="arguments">
+ <list>
+ <list>
+ <ref local="org.hisp.dhis.common.ReportingIdentityPopulator" />
+ </list>
+ </list>
+ </property>
+ </bean>
+
<!-- DeletionHandler -->
<bean id="org.hisp.dhis.report.ReportDeletionHandler" class="org.hisp.dhis.report.ReportDeletionHandler">
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/pom.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/pom.xml 2014-01-09 21:56:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/pom.xml 2014-02-10 08:26:08 +0000
@@ -49,11 +49,6 @@
<artifactId>dhis-service-core</artifactId>
</dependency>
- <dependency>
- <groupId>org.hisp.dhis</groupId>
- <artifactId>dhis-service-importexport</artifactId>
- </dependency>
-
</dependencies>
<properties>