dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #31173
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15859: bugfix for null complexNodes
------------------------------------------------------------
revno: 15859
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-06-26 14:46:13 +0700
message:
bugfix for null complexNodes
modified:
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/fieldfilter/DefaultFieldFilterService.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/fieldfilter/DefaultFieldFilterService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/fieldfilter/DefaultFieldFilterService.java 2014-06-25 13:32:36 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/fieldfilter/DefaultFieldFilterService.java 2014-06-26 07:46:13 +0000
@@ -38,6 +38,7 @@
import org.hisp.dhis.common.PresetProvider;
import org.hisp.dhis.dxf2.parser.ParserService;
import org.hisp.dhis.node.AbstractNode;
+import org.hisp.dhis.node.Node;
import org.hisp.dhis.node.NodePropertyConverter;
import org.hisp.dhis.node.NodeTransformer;
import org.hisp.dhis.node.types.CollectionNode;
@@ -69,13 +70,13 @@
@Autowired
private SchemaService schemaService;
- @Autowired( required = false )
+ @Autowired(required = false)
private Set<PresetProvider> presetProviders = Sets.newHashSet();
- @Autowired( required = false )
+ @Autowired(required = false)
private Set<NodePropertyConverter> nodePropertyConverters = Sets.newHashSet();
- @Autowired( required = false )
+ @Autowired(required = false)
private Set<NodeTransformer> nodeTransformers = Sets.newHashSet();
private ImmutableMap<String, PresetProvider> presets = ImmutableMap.of();
@@ -147,14 +148,14 @@
for ( Object object : objects )
{
- collectionNode.addChild( buildComplexNode( fieldMap, klass, object ) );
+ collectionNode.addChild( buildNode( fieldMap, klass, object ) );
}
return collectionNode;
}
- @SuppressWarnings( "unchecked" )
- private ComplexNode buildComplexNode( FieldMap fieldMap, Class<?> klass, Object object )
+ @SuppressWarnings("unchecked")
+ private AbstractNode buildNode( FieldMap fieldMap, Class<?> klass, Object object )
{
Schema schema = schemaService.getDynamicSchema( klass );
@@ -163,7 +164,7 @@
if ( object == null )
{
- return complexNode;
+ return new SimpleNode( schema.getName(), null );
}
updateFields( fieldMap, schema.getKlass() );
@@ -226,7 +227,7 @@
for ( Object collectionObject : collection )
{
- ComplexNode node = buildComplexNode( map, property.getItemKlass(), collectionObject );
+ Node node = buildNode( map, property.getItemKlass(), collectionObject );
if ( !node.getChildren().isEmpty() )
{
@@ -258,7 +259,7 @@
}
else
{
- child = buildComplexNode( getFullFieldMap( propertySchema ), property.getKlass(), returnValue );
+ child = buildNode( getFullFieldMap( propertySchema ), property.getKlass(), returnValue );
}
}
}
@@ -271,7 +272,7 @@
for ( Object collectionObject : (Collection<?>) returnValue )
{
- ComplexNode node = buildComplexNode( fieldValue, property.getItemKlass(), collectionObject );
+ Node node = buildNode( fieldValue, property.getItemKlass(), collectionObject );
if ( !node.getChildren().isEmpty() )
{
@@ -281,7 +282,7 @@
}
else
{
- child = buildComplexNode( fieldValue, property.getKlass(), returnValue );
+ child = buildNode( fieldValue, property.getKlass(), returnValue );
}
}