dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #30360
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15414: fixes to tracker classes, adding merging
------------------------------------------------------------
revno: 15414
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-05-26 15:29:12 +0200
message:
fixes to tracker classes, adding merging
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceReminder.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationCriteria.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ExchangeClasses.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
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java 2014-05-23 15:28:46 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java 2014-05-26 13:29:12 +0000
@@ -36,6 +36,8 @@
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.annotation.Scanned;
import org.hisp.dhis.common.view.DetailedView;
import org.hisp.dhis.common.view.ExportView;
import org.hisp.dhis.common.view.WithoutOrganisationUnitsView;
@@ -90,8 +92,10 @@
private Set<ProgramInstance> programInstances = new HashSet<ProgramInstance>();
+ @Scanned
private Set<ProgramStage> programStages = new HashSet<ProgramStage>();
+ @Scanned
private Set<ValidationCriteria> validationCriteria = new HashSet<ValidationCriteria>();
private Integer type;
@@ -102,10 +106,12 @@
private Set<ProgramTrackedEntityAttribute> attributes = new HashSet<ProgramTrackedEntityAttribute>();
+ @Scanned
private Set<UserAuthorityGroup> userRoles = new HashSet<UserAuthorityGroup>();
private Boolean onlyEnrollOnce = false;
+ @Scanned
private Set<TrackedEntityInstanceReminder> instanceReminders = new HashSet<TrackedEntityInstanceReminder>();
/**
@@ -561,4 +567,51 @@
{
this.trackedEntity = trackedEntity;
}
+
+ @Override
+ public void mergeWith( IdentifiableObject other )
+ {
+ super.mergeWith( other );
+
+ if ( other.getClass().isInstance( this ) )
+ {
+ Program program = (Program) other;
+
+ description = program.getDescription();
+ version = program.getVersion();
+ dateOfEnrollmentDescription = program.getDateOfEnrollmentDescription();
+ dateOfIncidentDescription = program.getDateOfIncidentDescription();
+ type = program.getType();
+ displayIncidentDate = program.getDisplayIncidentDate();
+ ignoreOverdueEvents = program.getIgnoreOverdueEvents();
+ onlyEnrollOnce = program.getOnlyEnrollOnce();
+ displayOnAllOrgunit = program.getDisplayOnAllOrgunit();
+ selectEnrollmentDatesInFuture = program.getSelectEnrollmentDatesInFuture();
+ selectIncidentDatesInFuture = program.getSelectIncidentDatesInFuture();
+ relationshipText = program.getRelationshipText();
+ relationshipType = program.getRelationshipType();
+ relationshipFromA = program.getRelationshipFromA();
+ relatedProgram = program.getRelatedProgram();
+ dataEntryMethod = program.getDataEntryMethod();
+ trackedEntity = program.getTrackedEntity();
+
+ organisationUnits.clear();
+ organisationUnits.addAll( program.getOrganisationUnits() );
+
+ programStages.clear();
+ programStages.addAll( program.getProgramStages() );
+
+ validationCriteria.clear();
+ validationCriteria.addAll( program.getValidationCriteria() );
+
+ attributes.clear();
+ attributes.addAll( program.getAttributes() );
+
+ userRoles.clear();
+ userRoles.addAll( program.getUserRoles() );
+
+ instanceReminders.clear();
+ instanceReminders.addAll( program.getInstanceReminders() );
+ }
+ }
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceReminder.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceReminder.java 2014-05-23 11:48:56 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceReminder.java 2014-05-26 13:29:12 +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.common.view.WithoutOrganisationUnitsView;
@@ -231,4 +232,23 @@
{
this.messageType = messageType;
}
+
+ @Override
+ public void mergeWith( IdentifiableObject other )
+ {
+ super.mergeWith( other );
+
+ if ( other.getClass().isInstance( this ) )
+ {
+ TrackedEntityInstanceReminder trackedEntityInstanceReminder = (TrackedEntityInstanceReminder) other;
+
+ daysAllowedSendMessage = trackedEntityInstanceReminder.getDaysAllowedSendMessage();
+ templateMessage = trackedEntityInstanceReminder.getTemplateMessage();
+ dateToCompare = trackedEntityInstanceReminder.getDateToCompare();
+ sendTo = trackedEntityInstanceReminder.getSendTo();
+ whenToSend = trackedEntityInstanceReminder.getWhenToSend();
+ messageType = trackedEntityInstanceReminder.getMessageType();
+ userGroup = trackedEntityInstanceReminder.getUserGroup();
+ }
+ }
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationCriteria.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationCriteria.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationCriteria.java 2014-05-26 13:29:12 +0000
@@ -40,7 +40,6 @@
/**
* @author Lars Helge Overland
- * @version $Id$
*/
@JacksonXmlRootElement( localName = "validationCriteria", namespace = DxfNamespaces.DXF_2_0 )
public class ValidationCriteria
=== 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 12:06:17 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ExchangeClasses.java 2014-05-26 13:29:12 +0000
@@ -85,6 +85,7 @@
import org.hisp.dhis.user.User;
import org.hisp.dhis.user.UserAuthorityGroup;
import org.hisp.dhis.user.UserGroup;
+import org.hisp.dhis.validation.ValidationCriteria;
import org.hisp.dhis.validation.ValidationRule;
import org.hisp.dhis.validation.ValidationRuleGroup;
@@ -171,10 +172,10 @@
allExportClasses.put( MessageConversation.class, "messageConversations" );
allExportClasses.put( Interpretation.class, "interpretations" );
- // allExportClasses.put( ValidationCriteria.class, "validationCriterias" );
+ allExportClasses.put( RelationshipType.class, "relationshipTypes" );
+ allExportClasses.put( ValidationCriteria.class, "validationCriterias" );
+ allExportClasses.put( ProgramStage.class, "programStages" );
allExportClasses.put( Program.class, "programs" );
- allExportClasses.put( ProgramStage.class, "programStages" );
- allExportClasses.put( RelationshipType.class, "relationshipTypes" );
allExportClasses.put( TrackedEntity.class, "trackedEntities" );
allExportClasses.put( TrackedEntityAttribute.class, "trackedEntityAttributes" );
allExportClasses.put( TrackedEntityAttributeGroup.class, "trackedEntityAttributeGroups" );