dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #34848
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17878: Detailed eta-data export, including option combos when exporting category combos
------------------------------------------------------------
revno: 17878
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2015-01-03 13:11:10 +0100
message:
Detailed eta-data export, including option combos when exporting category combos
modified:
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultMetaDataDependencyService.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/DefaultMetaDataDependencyService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultMetaDataDependencyService.java 2014-10-16 06:17:19 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultMetaDataDependencyService.java 2015-01-03 12:11:10 +0000
@@ -29,6 +29,7 @@
*/
import com.fasterxml.jackson.annotation.JsonView;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.proxy.HibernateProxy;
@@ -38,6 +39,7 @@
import org.hisp.dhis.constant.Constant;
import org.hisp.dhis.constant.ConstantService;
import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryCombo;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
import org.hisp.dhis.expression.Expression;
import org.hisp.dhis.expression.ExpressionService;
@@ -71,7 +73,7 @@
{
private static final Log log = LogFactory.getLog( DefaultMetaDataDependencyService.class );
- private final Class<?>[] specialCases = new Class<?>[]{ DataElement.class, Indicator.class, OrganisationUnit.class, ValidationRule.class };
+ private final Class<?>[] SPECIAL_CASE_CLASSES = new Class<?>[]{ DataElement.class, DataElementCategoryCombo.class, Indicator.class, OrganisationUnit.class, ValidationRule.class };
//-------------------------------------------------------------------------------------------------------
// Dependencies
@@ -136,6 +138,7 @@
public Map<String, List<IdentifiableObject>> getIdentifiableObjectWithDependencyMap( Map<String, Object> identifiableObjectUidMap )
{
Map<String, List<IdentifiableObject>> identifiableObjectMap = getIdentifiableObjectMap( identifiableObjectUidMap );
+
Collection<IdentifiableObject> identifiableObjects = new HashSet<>();
for ( Map.Entry<String, List<IdentifiableObject>> identifiableObjectEntry : identifiableObjectMap.entrySet() )
@@ -297,7 +300,7 @@
private boolean isSpecialCase( IdentifiableObject identifiableObject )
{
- for ( Class<?> specialCase : specialCases )
+ for ( Class<?> specialCase : SPECIAL_CASE_CLASSES )
{
if ( identifiableObject.getClass().equals( specialCase ) )
{
@@ -363,6 +366,16 @@
return resultSet;
}
+ else if ( identifiableObject instanceof DataElementCategoryCombo )
+ {
+ Set<DataElementCategoryOptionCombo> dataElementCategoryOptionComboSet = new HashSet<>();
+ dataElementCategoryOptionComboSet.addAll( ((DataElementCategoryCombo) identifiableObject).getOptionCombos() );
+
+ resultSet.addAll( dataElementCategoryOptionComboSet );
+ resultSet.addAll( getDependencySet( dataElementCategoryOptionComboSet ) );
+
+ return resultSet;
+ }
else if ( identifiableObject instanceof DataElement )
{
Set<DataElementCategoryOptionCombo> dataElementCategoryOptionComboSet = new HashSet<>();