dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #30438
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15448: start work to have export service depend on SchemaService, and not ExchangeClasses, minor fix to ...
------------------------------------------------------------
revno: 15448
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-05-28 13:13:45 +0200
message:
start work to have export service depend on SchemaService, and not ExchangeClasses, minor fix to TEISchemaDescriptor
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/TrackedEntityInstanceSchemaDescriptor.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultExportService.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/schema/descriptors/TrackedEntityInstanceSchemaDescriptor.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/TrackedEntityInstanceSchemaDescriptor.java 2014-05-27 13:18:27 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/TrackedEntityInstanceSchemaDescriptor.java 2014-05-28 11:13:45 +0000
@@ -50,6 +50,7 @@
{
Schema schema = new Schema( TrackedEntityInstance.class, SINGULAR, PLURAL );
schema.setApiEndpoint( API_ENDPOINT );
+ schema.setMetadata( false );
return schema;
}
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultExportService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultExportService.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultExportService.java 2014-05-28 11:13:45 +0000
@@ -38,6 +38,8 @@
import org.hisp.dhis.filter.MetaDataFilter;
import org.hisp.dhis.filter.MetaDataFilterService;
import org.hisp.dhis.scheduling.TaskId;
+import org.hisp.dhis.schema.Schema;
+import org.hisp.dhis.schema.SchemaService;
import org.hisp.dhis.system.notification.NotificationLevel;
import org.hisp.dhis.system.notification.Notifier;
import org.hisp.dhis.system.util.ReflectionUtils;
@@ -80,6 +82,9 @@
@Autowired
private MetaDataFilterService metaDataFilterService;
+ @Autowired
+ private SchemaService schemaService;
+
//-------------------------------------------------------------------------------------------------------
// ExportService Implementation - MetaData
//-------------------------------------------------------------------------------------------------------
@@ -105,15 +110,14 @@
notifier.notify( taskId, "Exporting meta-data" );
}
- for ( Map.Entry<Class<? extends IdentifiableObject>, String> entry : ExchangeClasses.getExportMap().entrySet() )
+ for ( Schema schema : schemaService.getMetadataSchemas() )
{
- if ( !options.isEnabled( entry.getValue() ) )
+ if ( !options.isEnabled( schema.getPlural() ) || !schema.isIdentifiableObject() )
{
continue;
}
- Class<? extends IdentifiableObject> idObjectClass = entry.getKey();
-
+ Class<? extends IdentifiableObject> idObjectClass = (Class<? extends IdentifiableObject>) schema.getKlass();
Collection<? extends IdentifiableObject> idObjects;
if ( lastUpdated != null )
@@ -130,7 +134,7 @@
continue;
}
- String message = "Exporting " + idObjects.size() + " " + StringUtils.capitalize( entry.getValue() );
+ String message = "Exporting " + idObjects.size() + " " + StringUtils.capitalize( schema.getPlural() );
log.info( message );
@@ -139,7 +143,7 @@
notifier.notify( taskId, message );
}
- ReflectionUtils.invokeSetterMethod( entry.getValue(), metaData, new ArrayList<IdentifiableObject>( idObjects ) );
+ ReflectionUtils.invokeSetterMethod( schema.getPlural(), metaData, new ArrayList<IdentifiableObject>( idObjects ) );
}
log.info( "Export done at " + new Date() );
@@ -156,7 +160,6 @@
// ExportService Implementation - Detailed MetaData Export
//-------------------------------------------------------------------------------------------------------
- //@author Ovidiu Rosu <rosu.ovi@xxxxxxxxx>
@Override
public MetaData getFilteredMetaData( FilterOptions filterOptions ) throws IOException
{