dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #42969
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21878: metadata import/export exception crud advice handlers
------------------------------------------------------------
revno: 21878
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2016-02-04 11:08:38 +0700
message:
metadata import/export exception crud advice handlers
modified:
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/DefaultMetadataExportService.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/DefaultMetadataImportService.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/MetadataExportService.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/MetadataImportService.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/CrudControllerAdvice.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/metadata2/DefaultMetadataExportService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/DefaultMetadataExportService.java 2016-02-03 07:40:27 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/DefaultMetadataExportService.java 2016-02-04 04:08:38 +0000
@@ -135,7 +135,7 @@
}
@Override
- public void validate( MetadataExportParams params ) throws MetadataExportException
+ public void validate( MetadataExportParams params )
{
}
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/DefaultMetadataImportService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/DefaultMetadataImportService.java 2016-02-04 04:06:33 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/DefaultMetadataImportService.java 2016-02-04 04:08:38 +0000
@@ -77,7 +77,7 @@
}
@Override
- public void validate( MetadataImportParams params ) throws MetadataImportException
+ public void validate( MetadataImportParams params )
{
}
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/MetadataExportService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/MetadataExportService.java 2016-02-03 06:57:11 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/MetadataExportService.java 2016-02-04 04:08:38 +0000
@@ -43,7 +43,7 @@
RootNode getMetadataAsNode( MetadataExportParams params );
- void validate( MetadataExportParams params ) throws MetadataExportException;
+ void validate( MetadataExportParams params );
MetadataExportParams getParamsFromMap( Map<String, List<String>> parameters );
}
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/MetadataImportService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/MetadataImportService.java 2016-02-04 04:06:33 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/MetadataImportService.java 2016-02-04 04:08:38 +0000
@@ -38,7 +38,7 @@
{
void importMetadata( MetadataImportParams params );
- void validate( MetadataImportParams params ) throws MetadataImportException;
+ void validate( MetadataImportParams params );
MetadataImportParams getParamsFromMap( Map<String, List<String>> parameters );
}
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/CrudControllerAdvice.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/CrudControllerAdvice.java 2016-01-26 04:34:57 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/CrudControllerAdvice.java 2016-02-04 04:08:38 +0000
@@ -35,6 +35,8 @@
import org.hisp.dhis.common.exception.InvalidIdentifierReferenceException;
import org.hisp.dhis.dataapproval.exceptions.DataApprovalException;
import org.hisp.dhis.dxf2.common.Status;
+import org.hisp.dhis.dxf2.metadata2.MetadataExportException;
+import org.hisp.dhis.dxf2.metadata2.MetadataImportException;
import org.hisp.dhis.dxf2.webmessage.WebMessageException;
import org.hisp.dhis.query.QueryException;
import org.hisp.dhis.query.QueryParserException;
@@ -151,4 +153,10 @@
{
webMessageService.send( WebMessageUtils.createWebMessage( ex.getMessage(), Status.ERROR, ex.getStatusCode() ), response, request );
}
+
+ @ExceptionHandler( { MetadataImportException.class, MetadataExportException.class } )
+ public void metadataImportExportHandler( Exception ex, HttpServletResponse response, HttpServletRequest request )
+ {
+ webMessageService.send( WebMessageUtils.conflict( ex.getMessage() ), response, request );
+ }
}