dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #41487
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21136: various fixes for dxf2 importer, make sure that category* defaults are matched correctly
------------------------------------------------------------
revno: 21136
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-11-20 10:36:20 +0700
message:
various fixes for dxf2 importer, make sure that category* defaults are matched correctly
modified:
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.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-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java 2015-10-11 18:48:57 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java 2015-11-20 03:36:20 +0000
@@ -38,6 +38,11 @@
import org.hisp.dhis.common.IdentifiableProperty;
import org.hisp.dhis.commons.timer.SystemTimer;
import org.hisp.dhis.commons.timer.Timer;
+import org.hisp.dhis.dataelement.DataElementCategory;
+import org.hisp.dhis.dataelement.DataElementCategoryCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryOption;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.period.PeriodStore;
@@ -97,6 +102,9 @@
@Autowired
private CurrentUserService currentUserService;
+ @Autowired
+ private DataElementCategoryService dataElementCategoryService;
+
//-------------------------------------------------------------------------------------------------------
// Internal and Semi-Public maps
//-------------------------------------------------------------------------------------------------------
@@ -453,6 +461,30 @@
{
Set<T> objects = new HashSet<>();
+ if ( DataElementCategoryOption.class.isInstance( object ) && ((DataElementCategoryOption) object).isDefault() )
+ {
+ objects.add( (T) dataElementCategoryService.getDataElementCategoryOptionByName( DataElementCategoryOption.DEFAULT_NAME ) );
+ return objects;
+ }
+
+ if ( DataElementCategory.class.isInstance( object ) && ((DataElementCategory) object).isDefault() )
+ {
+ objects.add( (T) dataElementCategoryService.getDataElementCategoryByName( DataElementCategory.DEFAULT_NAME ) );
+ return objects;
+ }
+
+ if ( DataElementCategoryCombo.class.isInstance( object ) && ((DataElementCategoryCombo) object).isDefault() )
+ {
+ objects.add( (T) dataElementCategoryService.getDefaultDataElementCategoryCombo() );
+ return objects;
+ }
+
+ if ( DataElementCategoryOptionCombo.class.isInstance( object ) && ((DataElementCategoryOptionCombo) object).isDefault() )
+ {
+ objects.add( (T) dataElementCategoryService.getDefaultDataElementCategoryOptionCombo() );
+ return objects;
+ }
+
if ( PeriodType.class.isInstance( object ) )
{
PeriodType periodType = (PeriodType) object;