dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #30363
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15417: support for ProgramStageSections in importer
------------------------------------------------------------
revno: 15417
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-05-26 15:53:11 +0200
message:
support for ProgramStageSections in importer
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageSection.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ExchangeClasses.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/MetaData.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/resources/META-INF/dhis/beans.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-api/src/main/java/org/hisp/dhis/program/ProgramStageSection.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageSection.java 2014-05-26 11:54:16 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageSection.java 2014-05-26 13:53:11 +0000
@@ -35,6 +35,7 @@
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.DxfNamespaces;
+import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.common.view.DetailedView;
import org.hisp.dhis.common.view.ExportView;
@@ -103,4 +104,18 @@
{
this.programStageDataElements = programStageDataElements;
}
+
+ @Override
+ public void mergeWith( IdentifiableObject other )
+ {
+ super.mergeWith( other );
+
+ if ( other.getClass().isInstance( this ) )
+ {
+ ProgramStageSection programStageSection = (ProgramStageSection) other;
+
+ programStageDataElements.clear();
+ programStageDataElements.addAll( programStageSection.getProgramStageDataElements() );
+ }
+ }
}
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ExchangeClasses.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ExchangeClasses.java 2014-05-26 13:32:42 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ExchangeClasses.java 2014-05-26 13:53:11 +0000
@@ -71,6 +71,7 @@
import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramStage;
+import org.hisp.dhis.program.ProgramStageSection;
import org.hisp.dhis.relationship.RelationshipType;
import org.hisp.dhis.report.Report;
import org.hisp.dhis.reporttable.ReportTable;
@@ -174,6 +175,7 @@
allExportClasses.put( RelationshipType.class, "relationshipTypes" );
allExportClasses.put( ValidationCriteria.class, "validationCriterias" );
+ allExportClasses.put( ProgramStageSection.class, "programStageSections" );
allExportClasses.put( ProgramStage.class, "programStages" );
allExportClasses.put( Program.class, "programs" );
allExportClasses.put( TrackedEntity.class, "trackedEntities" );
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/MetaData.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/MetaData.java 2014-05-26 13:35:31 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/MetaData.java 2014-05-26 13:53:11 +0000
@@ -77,6 +77,7 @@
import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramStage;
+import org.hisp.dhis.program.ProgramStageSection;
import org.hisp.dhis.relationship.RelationshipType;
import org.hisp.dhis.report.Report;
import org.hisp.dhis.reporttable.ReportTable;
@@ -208,6 +209,8 @@
private List<ProgramStage> programStages = new ArrayList<ProgramStage>();
+ private List<ProgramStageSection> programStageSections = new ArrayList<ProgramStageSection>();
+
private List<RelationshipType> relationshipTypes = new ArrayList<RelationshipType>();
private List<ValidationCriteria> validationCriterias = new ArrayList<ValidationCriteria>();
@@ -859,6 +862,19 @@
}
@JsonProperty
+ @JacksonXmlElementWrapper( localName = "programStageSections", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlProperty( localName = "programStageSection", namespace = DxfNamespaces.DXF_2_0 )
+ public List<ProgramStageSection> getProgramStageSections()
+ {
+ return programStageSections;
+ }
+
+ public void setProgramStageSections( List<ProgramStageSection> programStageSections )
+ {
+ this.programStageSections = programStageSections;
+ }
+
+ @JsonProperty
@JacksonXmlElementWrapper( localName = "relationshipTypes", namespace = DxfNamespaces.DXF_2_0 )
@JacksonXmlProperty( localName = "relationshipType", namespace = DxfNamespaces.DXF_2_0 )
public List<RelationshipType> getRelationshipTypes()
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/resources/META-INF/dhis/beans.xml 2014-05-26 13:35:31 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/resources/META-INF/dhis/beans.xml 2014-05-26 13:53:11 +0000
@@ -215,6 +215,10 @@
<constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.program.ProgramStage" />
</bean>
+ <bean id="programStageSectionImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
+ <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.program.ProgramStageSection" />
+ </bean>
+
<bean id="relationshipTypeImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
<constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.relationship.RelationshipType" />
</bean>