dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #32103
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16409: bugfixes in program importer
------------------------------------------------------------
revno: 16409
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-08-14 15:39:46 +0700
message:
bugfixes in program importer
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.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-08-14 08:16:44 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java 2014-08-14 08:39:46 +0000
@@ -79,13 +79,13 @@
private String dateOfIncidentDescription;
@Scanned
- private Set<OrganisationUnit> organisationUnits = new HashSet<OrganisationUnit>();
-
- @Scanned
- private List<ProgramStage> programStages = new ArrayList<ProgramStage>();
-
- @Scanned
- private Set<ValidationCriteria> validationCriteria = new HashSet<ValidationCriteria>();
+ private Set<OrganisationUnit> organisationUnits = new HashSet<>();
+
+ @Scanned
+ private List<ProgramStage> programStages = new ArrayList<>();
+
+ @Scanned
+ private Set<ValidationCriteria> validationCriteria = new HashSet<>();
private Integer type;
@@ -93,15 +93,15 @@
private Boolean ignoreOverdueEvents = false;
- private List<ProgramTrackedEntityAttribute> programAttributes = new ArrayList<ProgramTrackedEntityAttribute>(); //TODO use List?
+ private List<ProgramTrackedEntityAttribute> programAttributes = new ArrayList<>();
@Scanned
- private Set<UserAuthorityGroup> userRoles = new HashSet<UserAuthorityGroup>();
+ private Set<UserAuthorityGroup> userRoles = new HashSet<>();
private Boolean onlyEnrollOnce = false;
@Scanned
- private Set<TrackedEntityInstanceReminder> instanceReminders = new HashSet<TrackedEntityInstanceReminder>();
+ private Set<TrackedEntityInstanceReminder> instanceReminders = new HashSet<>();
/**
* Allow enrolling tracked entity to all org units disregarding whether the
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java 2014-07-27 13:15:50 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java 2014-08-14 08:39:46 +0000
@@ -74,6 +74,7 @@
import java.lang.reflect.Field;
import java.lang.reflect.Method;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@@ -126,7 +127,7 @@
@Autowired
private SchemaService schemaService;
- @Autowired(required = false)
+ @Autowired( required = false )
private List<ObjectHandler<T>> objectHandlers;
//-------------------------------------------------------------------------------------------------------
@@ -162,7 +163,7 @@
private Set<DataElementOperand> greyedFields = Sets.newHashSet();
private Collection<ProgramStageDataElement> programStageDataElements = Lists.newArrayList();
- private Set<ProgramTrackedEntityAttribute> programTrackedEntityAttributes = Sets.newHashSet();
+ private List<ProgramTrackedEntityAttribute> programTrackedEntityAttributes = new ArrayList<>();
public void extract( T object )
{
@@ -253,7 +254,7 @@
private Expression extractExpression( T object, String fieldName )
{
Expression expression = null;
-
+
if ( ReflectionUtils.findGetterMethod( fieldName, object ) != null )
{
expression = ReflectionUtils.invokeGetterMethod( fieldName, object );
@@ -364,7 +365,7 @@
}
}
- private void saveAttributeValues( T object, Set<AttributeValue> attributeValues )
+ private void saveAttributeValues( T object, Collection<AttributeValue> attributeValues )
{
if ( attributeValues.size() > 0 )
{
@@ -411,18 +412,18 @@
}
}
- private Set<ProgramTrackedEntityAttribute> extractProgramTrackedEntityAttributes( T object )
+ private List<ProgramTrackedEntityAttribute> extractProgramTrackedEntityAttributes( T object )
{
- Set<ProgramTrackedEntityAttribute> programTrackedEntityAttributeSet = Sets.newHashSet();
+ List<ProgramTrackedEntityAttribute> programTrackedEntityAttributeSet = new ArrayList<>();
- if ( ReflectionUtils.isCollection( "attributes", object, ProgramTrackedEntityAttribute.class ) )
+ if ( ReflectionUtils.isCollection( "programAttributes", object, ProgramTrackedEntityAttribute.class ) )
{
- Set<ProgramTrackedEntityAttribute> programTrackedEntityAttributes = ReflectionUtils.invokeGetterMethod( "attributes", object );
+ List<ProgramTrackedEntityAttribute> programTrackedEntityAttributes = ReflectionUtils.invokeGetterMethod( "programAttributes", object );
if ( programTrackedEntityAttributes == null )
{
- programTrackedEntityAttributes = Sets.newHashSet();
- ReflectionUtils.invokeSetterMethod( "attributes", object, programTrackedEntityAttributes );
+ programTrackedEntityAttributes = new ArrayList<>();
+ ReflectionUtils.invokeSetterMethod( "programAttributes", object, programTrackedEntityAttributes );
}
for ( ProgramTrackedEntityAttribute trackedEntityAttribute : programTrackedEntityAttributes )
@@ -448,7 +449,7 @@
extractProgramTrackedEntityAttributes( object );
}
- private void saveProgramTrackedEntityAttributes( T object, Set<ProgramTrackedEntityAttribute> programTrackedEntityAttributes )
+ private void saveProgramTrackedEntityAttributes( T object, Collection<ProgramTrackedEntityAttribute> programTrackedEntityAttributes )
{
for ( ProgramTrackedEntityAttribute programTrackedEntityAttribute : programTrackedEntityAttributes )
{
@@ -457,7 +458,7 @@
sessionFactory.getCurrentSession().persist( programTrackedEntityAttribute );
}
- ReflectionUtils.invokeSetterMethod( "programTrackedEntityAttributes", object, programTrackedEntityAttributes );
+ ReflectionUtils.invokeSetterMethod( "programAttributes", object, programTrackedEntityAttributes );
}
private Collection<ProgramStageDataElement> extractProgramStageDataElements( T object )