dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #27255
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13534: allow setting strategy=DELETE in /api/metaData by using HTTP DELETE
------------------------------------------------------------
revno: 13534
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-01-02 12:37:41 +0100
message:
allow setting strategy=DELETE in /api/metaData by using HTTP DELETE
modified:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MetaDataController.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-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MetaDataController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MetaDataController.java 2014-01-02 11:26:19 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MetaDataController.java 2014-01-02 11:37:41 +0000
@@ -37,6 +37,7 @@
import org.hisp.dhis.dxf2.metadata.MetaData;
import org.hisp.dhis.dxf2.metadata.tasks.ImportMetaDataTask;
import org.hisp.dhis.dxf2.utils.JacksonUtils;
+import org.hisp.dhis.importexport.ImportStrategy;
import org.hisp.dhis.scheduling.TaskCategory;
import org.hisp.dhis.scheduling.TaskId;
import org.hisp.dhis.system.scheduling.Scheduler;
@@ -245,6 +246,14 @@
}
}
+ @RequestMapping( value = MetaDataController.RESOURCE_PATH, method = RequestMethod.DELETE, consumes = { "application/xml", "text/*" } )
+ @PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_IMPORT')" )
+ public void deleteXml( ImportOptions importOptions, HttpServletResponse response, HttpServletRequest request ) throws IOException
+ {
+ importOptions.setImportStrategy( ImportStrategy.DELETE.name() );
+ importXml( importOptions, response, request );
+ }
+
@RequestMapping( value = MetaDataController.RESOURCE_PATH, method = RequestMethod.POST, consumes = "application/json" )
@PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_IMPORT')" )
public void importJson( ImportOptions importOptions, HttpServletResponse response, HttpServletRequest request ) throws IOException
@@ -261,6 +270,14 @@
}
}
+ @RequestMapping( value = MetaDataController.RESOURCE_PATH, method = RequestMethod.DELETE, consumes = "application/json" )
+ @PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_IMPORT')" )
+ public void deleteJson( ImportOptions importOptions, HttpServletResponse response, HttpServletRequest request ) throws IOException
+ {
+ importOptions.setImportStrategy( ImportStrategy.DELETE.name() );
+ importJson( importOptions, response, request );
+ }
+
@RequestMapping( value = { MetaDataController.RESOURCE_PATH + ".zip", MetaDataController.RESOURCE_PATH + ".xml.zip" }, method = RequestMethod.POST, consumes = { "application/xml", "text/*" } )
@PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_IMPORT')" )
public void importZippedXml( ImportOptions importOptions, HttpServletResponse response, HttpServletRequest request ) throws IOException
@@ -280,6 +297,14 @@
}
}
+ @RequestMapping( value = { MetaDataController.RESOURCE_PATH + ".zip", MetaDataController.RESOURCE_PATH + ".xml.zip" }, method = RequestMethod.DELETE, consumes = { "application/xml", "text/*" } )
+ @PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_IMPORT')" )
+ public void deleteZippedXml( ImportOptions importOptions, HttpServletResponse response, HttpServletRequest request ) throws IOException
+ {
+ importOptions.setImportStrategy( ImportStrategy.DELETE.name() );
+ importZippedXml( importOptions, response, request );
+ }
+
@RequestMapping( value = { MetaDataController.RESOURCE_PATH + ".zip", MetaDataController.RESOURCE_PATH + ".json.zip" }, method = RequestMethod.POST, consumes = "application/json" )
@PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_IMPORT')" )
public void importZippedJson( ImportOptions importOptions, HttpServletResponse response, HttpServletRequest request ) throws IOException
@@ -299,6 +324,14 @@
}
}
+ @RequestMapping( value = { MetaDataController.RESOURCE_PATH + ".zip", MetaDataController.RESOURCE_PATH + ".json.zip" }, method = RequestMethod.DELETE, consumes = "application/json" )
+ @PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_IMPORT')" )
+ public void deleteZippedJson( ImportOptions importOptions, HttpServletResponse response, HttpServletRequest request ) throws IOException
+ {
+ importOptions.setImportStrategy( ImportStrategy.DELETE.name() );
+ importZippedJson( importOptions, response, request );
+ }
+
@RequestMapping( value = { MetaDataController.RESOURCE_PATH + ".gz", MetaDataController.RESOURCE_PATH + ".xml.gz" }, method = RequestMethod.POST, consumes = { "application/xml", "text/*" } )
@PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_IMPORT')" )
public void importGZippedXml( ImportOptions importOptions, HttpServletResponse response, HttpServletRequest request ) throws IOException
@@ -316,6 +349,14 @@
}
}
+ @RequestMapping( value = { MetaDataController.RESOURCE_PATH + ".gz", MetaDataController.RESOURCE_PATH + ".xml.gz" }, method = RequestMethod.DELETE, consumes = { "application/xml", "text/*" } )
+ @PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_IMPORT')" )
+ public void deleteGZippedXml( ImportOptions importOptions, HttpServletResponse response, HttpServletRequest request ) throws IOException
+ {
+ importOptions.setImportStrategy( ImportStrategy.DELETE.name() );
+ importGZippedXml( importOptions, response, request );
+ }
+
@RequestMapping( value = { MetaDataController.RESOURCE_PATH + ".gz", MetaDataController.RESOURCE_PATH + ".json.gz" }, method = RequestMethod.POST, consumes = "application/json" )
@PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_IMPORT')" )
public void importGZippedJson( ImportOptions importOptions, HttpServletResponse response, HttpServletRequest request ) throws IOException
@@ -333,6 +374,14 @@
}
}
+ @RequestMapping( value = { MetaDataController.RESOURCE_PATH + ".gz", MetaDataController.RESOURCE_PATH + ".json.gz" }, method = RequestMethod.DELETE, consumes = "application/json" )
+ @PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_IMPORT')" )
+ public void deleteGZippedJson( ImportOptions importOptions, HttpServletResponse response, HttpServletRequest request ) throws IOException
+ {
+ importOptions.setImportStrategy( ImportStrategy.DELETE.name() );
+ importGZippedJson( importOptions, response, request );
+ }
+
//--------------------------------------------------------------------------
// Helpers
//--------------------------------------------------------------------------