dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #30364
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15418: Support ProgramValidation for tracker importer
------------------------------------------------------------
revno: 15418
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-05-26 16:19:42 +0200
message:
Support ProgramValidation for tracker importer
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramExpression.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidation.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/ProgramExpression.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramExpression.java 2014-05-23 15:28:46 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramExpression.java 2014-05-26 14:19:42 +0000
@@ -54,6 +54,7 @@
private static final long serialVersionUID = -2807997671779497354L;
public static String OBJECT_PROGRAM_STAGE_DATAELEMENT = "DE";
public static String OBJECT_PROGRAM_STAGE = "PS";
+
private int id;
private String expression;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidation.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidation.java 2014-05-23 15:28:46 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidation.java 2014-05-26 14:19:42 +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;
import org.hisp.dhis.expression.Operator;
@@ -51,6 +52,7 @@
* Determines if a de-serialized file is compatible with this class.
*/
private static final long serialVersionUID = 4785165717118297802L;
+
public static String OBJECT_PROGRAM_STAGE_DATAELEMENT = "DE";
// -------------------------------------------------------------------------
@@ -213,4 +215,20 @@
{
this.operator = operator;
}
+
+ @Override
+ public void mergeWith( IdentifiableObject other )
+ {
+ super.mergeWith( other );
+
+ if ( other.getClass().isInstance( this ) )
+ {
+ ProgramValidation programValidation = (ProgramValidation) other;
+
+ leftSide = programValidation.getLeftSide();
+ operator = programValidation.getOperator();
+ rightSide = programValidation.getRightSide();
+ program = programValidation.getProgram();
+ }
+ }
}
=== 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:53:11 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ExchangeClasses.java 2014-05-26 14:19:42 +0000
@@ -72,6 +72,7 @@
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramStage;
import org.hisp.dhis.program.ProgramStageSection;
+import org.hisp.dhis.program.ProgramValidation;
import org.hisp.dhis.relationship.RelationshipType;
import org.hisp.dhis.report.Report;
import org.hisp.dhis.reporttable.ReportTable;
@@ -177,6 +178,7 @@
allExportClasses.put( ValidationCriteria.class, "validationCriterias" );
allExportClasses.put( ProgramStageSection.class, "programStageSections" );
allExportClasses.put( ProgramStage.class, "programStages" );
+ allExportClasses.put( ProgramValidation.class, "programValidations" );
allExportClasses.put( Program.class, "programs" );
allExportClasses.put( TrackedEntity.class, "trackedEntities" );
allExportClasses.put( TrackedEntityAttribute.class, "trackedEntityAttributes" );
=== 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:53:11 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/MetaData.java 2014-05-26 14:19:42 +0000
@@ -78,6 +78,7 @@
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramStage;
import org.hisp.dhis.program.ProgramStageSection;
+import org.hisp.dhis.program.ProgramValidation;
import org.hisp.dhis.relationship.RelationshipType;
import org.hisp.dhis.report.Report;
import org.hisp.dhis.reporttable.ReportTable;
@@ -209,6 +210,8 @@
private List<ProgramStage> programStages = new ArrayList<ProgramStage>();
+ private List<ProgramValidation> programValidations = Lists.newArrayList();
+
private List<ProgramStageSection> programStageSections = new ArrayList<ProgramStageSection>();
private List<RelationshipType> relationshipTypes = new ArrayList<RelationshipType>();
@@ -862,6 +865,19 @@
}
@JsonProperty
+ @JacksonXmlElementWrapper( localName = "programValidations", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlProperty( localName = "programValidation", namespace = DxfNamespaces.DXF_2_0 )
+ public List<ProgramValidation> getProgramValidations()
+ {
+ return programValidations;
+ }
+
+ public void setProgramValidations( List<ProgramValidation> programValidations )
+ {
+ this.programValidations = programValidations;
+ }
+
+ @JsonProperty
@JacksonXmlElementWrapper( localName = "programStageSections", namespace = DxfNamespaces.DXF_2_0 )
@JacksonXmlProperty( localName = "programStageSection", namespace = DxfNamespaces.DXF_2_0 )
public List<ProgramStageSection> getProgramStageSections()
=== 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:53:11 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/resources/META-INF/dhis/beans.xml 2014-05-26 14:19:42 +0000
@@ -223,6 +223,10 @@
<constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.relationship.RelationshipType" />
</bean>
+ <bean id="programValidationImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
+ <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.program.ProgramValidation" />
+ </bean>
+
<bean id="validationCriteriaImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
<constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.validation.ValidationCriteria" />
</bean>