← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19279: GmlImport: added javadoc + exposed method to run import task on MetaData object directly

 

------------------------------------------------------------
revno: 19279
committer: Halvdan Hoem Grelland <halvdanhg@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-06-03 17:00:19 +0200
message:
  GmlImport: added javadoc + exposed method to run import task on MetaData object directly
modified:
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/gml/DefaultGmlImportService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/gml/GmlImportService.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/gml/DefaultGmlImportService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/gml/DefaultGmlImportService.java	2015-04-09 23:35:37 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/gml/DefaultGmlImportService.java	2015-06-03 15:00:19 +0000
@@ -143,6 +143,12 @@
         importService.importMetaData( userUid, fromGml( inputStream ), importOptions, taskId );
     }
 
+    @Override
+    public void importGml( MetaData metaData, String userUid, ImportOptions importOptions, TaskId taskId )
+    {
+        importService.importMetaData( userUid, metaData, importOptions, taskId );
+    }
+
     // -------------------------------------------------------------------------
     // Supportive methods
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/gml/GmlImportService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/gml/GmlImportService.java	2015-06-03 13:00:40 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/gml/GmlImportService.java	2015-06-03 15:00:19 +0000
@@ -37,15 +37,52 @@
 import java.io.InputStream;
 
 /**
+ * Handles the transformation, sanitation and merging of geospatial
+ * data for OrganisationUnits through processing and importing GML files.
+ *
  * @author Halvdan Hoem Grelland
  */
 public interface GmlImportService
 {
     String ID = GmlImportService.class.getName();
 
+    /**
+     * Transform a GML document to MetaData containing the relevant updates
+     * to geospatial features (e.g. coordinates, featuretypes). The process
+     * filters the input against the database and merges in essential fields
+     * needed for the meta data importer to only update the geospatial fields
+     * and not nullify any 'missing' fields.
+     *
+     * @param inputStream the GML document to import.
+     * @return a MetaData object reflecting the database content with the GML file changes merged in.
+     * @throws IOException on failure to read the InputStream.
+     * @throws TransformerException on failure to parse and transform the GML content.
+     */
     MetaData fromGml( InputStream inputStream )
         throws IOException, TransformerException;
 
+    /**
+     * Imports GML data and merges the geospatial data updates into the database.
+     * See {@link #fromGml(InputStream)} for details on the underlying process.
+     *
+     * @param inputStream the GML document to import.
+     * @param userUid the UID of the user performing the import (task owner).
+     * @param importOptions the ImportOptions for the MetaData importer.
+     * @param taskId the TaskId of the process.
+     * @throws IOException on failure to read the InputStream.
+     * @throws TransformerException on failure to parse and transform the GML content.
+     */
     void importGml( InputStream inputStream, String userUid, ImportOptions importOptions, TaskId taskId )
         throws IOException, TransformerException;
+
+    /**
+     * Imports a MetaData object containing geospatial updates.
+     * The MetaData should be retrieved using {@link #fromGml(InputStream)}.
+     *
+     * @param metaData the MetaData reflecting the geospatial updates.
+     * @param userUid the UID of the user performing the import (task owner).
+     * @param importOptions the ImportOptions for the MetaData importer.
+     * @param taskId the TaskId of the process.
+     */
+    void importGml( MetaData metaData, String userUid, ImportOptions importOptions, TaskId taskId );
 }