dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #21609
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10266: log which user started the dxf2 import job
------------------------------------------------------------
revno: 10266
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2013-03-16 18:27:06 +0700
message:
log which user started the dxf2 import job
modified:
dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultImportService.java
dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ImportService.java
dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/tasks/ImportMetaDataTask.java
dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/components/Dxf2Component.java
dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/components/Dxf2DataEndpoint.java
dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/components/Dxf2MetaDataEndpoint.java
dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/components/Dxf2MetaDataProducer.java
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-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultImportService.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultImportService.java 2013-03-15 16:33:34 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultImportService.java 2013-03-16 11:27:06 +0000
@@ -27,13 +27,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.SessionFactory;
@@ -44,10 +37,19 @@
import org.hisp.dhis.system.notification.Notifier;
import org.hisp.dhis.system.util.ReflectionUtils;
import org.hisp.dhis.user.CurrentUserService;
+import org.hisp.dhis.user.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
@@ -84,30 +86,32 @@
//-------------------------------------------------------------------------------------------------------
@Override
- public ImportSummary importMetaData( MetaData metaData, TaskId taskId )
- {
- return importMetaData( metaData, ImportOptions.getDefaultImportOptions(), taskId );
- }
-
- @Override
- public ImportSummary importMetaData( MetaData metaData )
- {
- return importMetaData( metaData, ImportOptions.getDefaultImportOptions() );
- }
-
- @Override
- public ImportSummary importMetaData( MetaData metaData, ImportOptions importOptions )
- {
- return importMetaData( metaData, importOptions, null );
- }
-
- @Override
- public ImportSummary importMetaData( MetaData metaData, ImportOptions importOptions, TaskId taskId )
- {
+ public ImportSummary importMetaData( User user, MetaData metaData, TaskId taskId )
+ {
+ return importMetaData( user, metaData, ImportOptions.getDefaultImportOptions(), taskId );
+ }
+
+ @Override
+ public ImportSummary importMetaData( User user, MetaData metaData )
+ {
+ return importMetaData( user, metaData, ImportOptions.getDefaultImportOptions() );
+ }
+
+ @Override
+ public ImportSummary importMetaData( User user, MetaData metaData, ImportOptions importOptions )
+ {
+ return importMetaData( user, metaData, importOptions, null );
+ }
+
+ @Override
+ public ImportSummary importMetaData( User user, MetaData metaData, ImportOptions importOptions, TaskId taskId )
+ {
+ log.info( "User '" + user.getUsername() + "' started import at " + new Date() );
+
notifier.clear( taskId ).notify( taskId, "Importing meta-data" );
-
+
ImportSummary importSummary = new ImportSummary();
-
+
objectBridge.init();
if ( importOptions.isDryRun() )
@@ -139,7 +143,7 @@
}
ImportTypeSummary importTypeSummary = doImport( objects, importOptions );
-
+
// TODO do we need this?
sessionFactory.getCurrentSession().flush();
=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ImportService.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ImportService.java 2012-06-27 15:59:59 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ImportService.java 2013-03-16 11:27:06 +0000
@@ -28,6 +28,7 @@
*/
import org.hisp.dhis.scheduling.TaskId;
+import org.hisp.dhis.user.User;
import org.springframework.stereotype.Service;
/**
@@ -36,11 +37,11 @@
@Service
public interface ImportService
{
- ImportSummary importMetaData( MetaData metaData );
-
- ImportSummary importMetaData( MetaData metaData, TaskId taskId );
-
- ImportSummary importMetaData( MetaData metaData, ImportOptions importOptions );
-
- ImportSummary importMetaData( MetaData metaData, ImportOptions importOptions, TaskId taskId );
+ ImportSummary importMetaData( User user, MetaData metaData );
+
+ ImportSummary importMetaData( User user, MetaData metaData, TaskId taskId );
+
+ ImportSummary importMetaData( User user, MetaData metaData, ImportOptions importOptions );
+
+ ImportSummary importMetaData( User user, MetaData metaData, ImportOptions importOptions, TaskId taskId );
}
=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/tasks/ImportMetaDataTask.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/tasks/ImportMetaDataTask.java 2012-10-25 16:44:59 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/tasks/ImportMetaDataTask.java 2013-03-16 11:27:06 +0000
@@ -31,6 +31,7 @@
import org.hisp.dhis.dxf2.metadata.ImportService;
import org.hisp.dhis.dxf2.metadata.MetaData;
import org.hisp.dhis.scheduling.TaskId;
+import org.hisp.dhis.user.User;
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -38,6 +39,8 @@
public class ImportMetaDataTask
implements Runnable
{
+ private User user;
+
private ImportService importService;
private ImportOptions importOptions;
@@ -46,8 +49,9 @@
private MetaData metaData;
- public ImportMetaDataTask( ImportService importService, ImportOptions importOptions, TaskId taskId, MetaData metaData )
+ public ImportMetaDataTask( User user, ImportService importService, ImportOptions importOptions, TaskId taskId, MetaData metaData )
{
+ this.user = user;
this.importService = importService;
this.importOptions = importOptions;
this.taskId = taskId;
@@ -57,6 +61,6 @@
@Override
public void run()
{
- importService.importMetaData( metaData, importOptions, taskId );
+ importService.importMetaData( user, metaData, importOptions, taskId );
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/components/Dxf2Component.java'
--- dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/components/Dxf2Component.java 2012-04-16 15:40:44 +0000
+++ dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/components/Dxf2Component.java 2013-03-16 11:27:06 +0000
@@ -27,49 +27,54 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.Map;
-
import org.apache.camel.Endpoint;
import org.apache.camel.impl.DefaultComponent;
import org.hisp.dhis.dxf2.datavalueset.DataValueSetService;
import org.hisp.dhis.dxf2.metadata.ImportService;
+import org.hisp.dhis.user.CurrentUserService;
import org.springframework.beans.factory.annotation.Autowired;
+import java.util.Map;
+
/**
* A DHIS 2 specific camel component for creating dhis2 endpoints
- *
+ * <p/>
* Two forms of uri are supported for the endpoints:
- * 1. uri="dhis2:metadata?<options>" creates a metadata endpoint for importing metadata
+ * 1. uri="dhis2:metadata?<options>" creates a metadata endpoint for importing metadata
* 2. uri="dhis2:data?<options>" creates a datavalueset endpoint for importing data
- *
+ * <p/>
* See the respective endpoint classes for details of the options supported on each
- *
+ *
* @author bobj
*/
-public class Dxf2Component
+public class Dxf2Component
extends DefaultComponent
{
public static final String DATA = "data";
public static final String METADATA = "metadata";
-
+
@Autowired
private ImportService importService;
-
+
@Autowired
private DataValueSetService dataValueSetService;
+ @Autowired
+ private CurrentUserService currentUserService;
+
@Override
protected Endpoint createEndpoint( String uri, String remaining, Map<String, Object> parameters ) throws Exception
{
- if ( !remaining.equals( DATA ) && !remaining.equals( METADATA ) )
+ if ( !remaining.equals( DATA ) && !remaining.equals( METADATA ) )
{
- throw new UnsupportedOperationException( "Invalid dhis2 uri part " + remaining);
+ throw new UnsupportedOperationException( "Invalid dhis2 uri part " + remaining );
}
-
- Endpoint endpoint = remaining.equals( DATA ) ?
- new Dxf2DataEndpoint( uri, this, dataValueSetService ) : new Dxf2MetaDataEndpoint( uri, this, importService );
-
+
+ Endpoint endpoint = remaining.equals( DATA ) ?
+ new Dxf2DataEndpoint( currentUserService.getCurrentUser(), uri, this, dataValueSetService ) :
+ new Dxf2MetaDataEndpoint( currentUserService.getCurrentUser(), uri, this, importService );
+
setProperties( endpoint, parameters );
return endpoint;
}
=== modified file 'dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/components/Dxf2DataEndpoint.java'
--- dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/components/Dxf2DataEndpoint.java 2012-06-01 21:56:18 +0000
+++ dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/components/Dxf2DataEndpoint.java 2013-03-16 11:27:06 +0000
@@ -34,29 +34,32 @@
import org.hisp.dhis.dxf2.datavalueset.DataValueSetService;
import org.hisp.dhis.dxf2.metadata.ImportOptions;
import org.hisp.dhis.importexport.ImportStrategy;
+import org.hisp.dhis.user.User;
/**
* dataendpoint is created using a uri of the form:
* dhis2:metadata?dryRun=true|false&importStrategy=NEW|NEW_AND_UPDATES|UPDATES
- *
+ *
* @author bobj
*/
-public class Dxf2DataEndpoint
+public class Dxf2DataEndpoint
extends DefaultEndpoint
{
protected DataValueSetService dataValueSetService;
+ protected User user;
+
public DataValueSetService getDataValueSetService()
{
return dataValueSetService;
}
-
+
// -------------------------------------------------------------------------
// Parameters supported by this endpoint
// -------------------------------------------------------------------------
-
+
protected ImportOptions importOptions;
-
+
public ImportOptions getImportOptions()
{
return importOptions;
@@ -64,9 +67,9 @@
public void setImportStrategy( ImportStrategy importStrategy )
{
- importOptions.setImportStrategy(importStrategy.toString());
+ importOptions.setImportStrategy( importStrategy.toString() );
}
-
+
public void setDryRun( Boolean dryRun )
{
importOptions.setDryRun( dryRun );
@@ -81,12 +84,13 @@
{
importOptions.setOrgUnitIdScheme( orgUnitIdScheme );
}
-
- public Dxf2DataEndpoint( String uri, Dxf2Component component, DataValueSetService dataValueSetService )
+
+ public Dxf2DataEndpoint( User user, String uri, Dxf2Component component, DataValueSetService dataValueSetService )
{
super( uri, component );
- importOptions = new ImportOptions();
+ this.importOptions = new ImportOptions();
this.dataValueSetService = dataValueSetService;
+ this.user = user;
}
@Override
=== modified file 'dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/components/Dxf2MetaDataEndpoint.java'
--- dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/components/Dxf2MetaDataEndpoint.java 2012-06-25 20:14:42 +0000
+++ dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/components/Dxf2MetaDataEndpoint.java 2013-03-16 11:27:06 +0000
@@ -33,6 +33,7 @@
import org.apache.camel.impl.DefaultEndpoint;
import org.hisp.dhis.dxf2.metadata.ImportOptions;
import org.hisp.dhis.dxf2.metadata.ImportService;
+import org.hisp.dhis.user.User;
/**
* metadataendpoint is created using a uri of the form:
@@ -45,6 +46,8 @@
{
protected ImportService importService;
+ protected User user;
+
public ImportService getImportService()
{
return importService;
@@ -71,17 +74,18 @@
options.setStrategy( strategy );
}
- public Dxf2MetaDataEndpoint( String uri, Dxf2Component component, ImportService importService )
+ public Dxf2MetaDataEndpoint( User user, String uri, Dxf2Component component, ImportService importService )
{
super( uri, component );
this.importService = importService;
- options = new ImportOptions();
+ this.options = new ImportOptions();
+ this.user = user;
}
@Override
public Producer createProducer() throws Exception
{
- return new Dxf2MetaDataProducer( this );
+ return new Dxf2MetaDataProducer( user, this );
}
@Override
=== modified file 'dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/components/Dxf2MetaDataProducer.java'
--- dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/components/Dxf2MetaDataProducer.java 2012-06-05 15:36:07 +0000
+++ dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/components/Dxf2MetaDataProducer.java 2013-03-16 11:27:06 +0000
@@ -34,6 +34,7 @@
import org.hisp.dhis.dxf2.metadata.ImportSummary;
import org.hisp.dhis.dxf2.metadata.MetaData;
import org.hisp.dhis.dxf2.utils.JacksonUtils;
+import org.hisp.dhis.user.User;
import java.io.InputStream;
@@ -45,9 +46,12 @@
{
private static final Log log = LogFactory.getLog( Dxf2MetaDataProducer.class );
- public Dxf2MetaDataProducer( Dxf2MetaDataEndpoint endpoint )
+ private User user;
+
+ public Dxf2MetaDataProducer( User user, Dxf2MetaDataEndpoint endpoint )
{
super( endpoint );
+ this.user = user;
}
@Override
@@ -58,7 +62,7 @@
Dxf2MetaDataEndpoint endpoint = (Dxf2MetaDataEndpoint) this.getEndpoint();
MetaData metadata = JacksonUtils.fromXml( (InputStream) exchange.getIn().getBody(), MetaData.class );
- ImportSummary summary = endpoint.getImportService().importMetaData( metadata, endpoint.getImportOptions() );
+ ImportSummary summary = endpoint.getImportService().importMetaData( user, metadata, endpoint.getImportOptions() );
exchange.getOut().setBody( JacksonUtils.toXmlAsString( summary ) );
}
}
=== 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 2012-10-10 18:17:25 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MetaDataController.java 2013-03-16 11:27:06 +0000
@@ -30,7 +30,10 @@
import org.hisp.dhis.api.utils.ContextUtils;
import org.hisp.dhis.api.utils.ContextUtils.CacheStrategy;
import org.hisp.dhis.common.view.ExportView;
-import org.hisp.dhis.dxf2.metadata.*;
+import org.hisp.dhis.dxf2.metadata.ExportService;
+import org.hisp.dhis.dxf2.metadata.ImportOptions;
+import org.hisp.dhis.dxf2.metadata.ImportService;
+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.scheduling.TaskCategory;
@@ -50,7 +53,11 @@
import javax.xml.bind.JAXBException;
import java.io.IOException;
import java.util.Map;
-import java.util.zip.*;
+import java.util.zip.GZIPInputStream;
+import java.util.zip.GZIPOutputStream;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+import java.util.zip.ZipOutputStream;
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -117,7 +124,7 @@
JacksonUtils.toXmlWithView( response.getOutputStream(), metaData, ExportView.class );
}
- @RequestMapping( value = {MetaDataController.RESOURCE_PATH + ".zip"}, produces = "*/*" )
+ @RequestMapping( value = { MetaDataController.RESOURCE_PATH + ".zip" }, produces = "*/*" )
@PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_EXPORT')" )
public void exportZipped( @RequestParam Map<String, String> parameters, HttpServletResponse response, HttpServletRequest request ) throws IOException
{
@@ -133,7 +140,7 @@
}
}
- @RequestMapping( value = {MetaDataController.RESOURCE_PATH + ".xml.zip"}, produces = "*/*" )
+ @RequestMapping( value = { MetaDataController.RESOURCE_PATH + ".xml.zip" }, produces = "*/*" )
@PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_EXPORT')" )
public void exportZippedXML( @RequestParam Map<String, String> parameters, HttpServletResponse response ) throws IOException
{
@@ -149,7 +156,7 @@
JacksonUtils.toXmlWithView( zip, metaData, ExportView.class );
}
- @RequestMapping( value = {MetaDataController.RESOURCE_PATH + ".json.zip"}, produces = "*/*" )
+ @RequestMapping( value = { MetaDataController.RESOURCE_PATH + ".json.zip" }, produces = "*/*" )
@PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_EXPORT')" )
public void exportZippedJSON( @RequestParam Map<String, String> parameters, HttpServletResponse response ) throws IOException
{
@@ -165,7 +172,7 @@
JacksonUtils.toJsonWithView( zip, metaData, ExportView.class );
}
- @RequestMapping( value = {MetaDataController.RESOURCE_PATH + ".gz"}, produces = "*/*" )
+ @RequestMapping( value = { MetaDataController.RESOURCE_PATH + ".gz" }, produces = "*/*" )
@PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_EXPORT')" )
public void exportGZipped( @RequestParam Map<String, String> parameters, HttpServletResponse response, HttpServletRequest request ) throws IOException
{
@@ -181,7 +188,7 @@
}
}
- @RequestMapping( value = {MetaDataController.RESOURCE_PATH + ".xml.gz"}, produces = "*/*" )
+ @RequestMapping( value = { MetaDataController.RESOURCE_PATH + ".xml.gz" }, produces = "*/*" )
@PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_EXPORT')" )
public void exportGZippedXML( @RequestParam Map<String, String> parameters, HttpServletResponse response ) throws IOException
{
@@ -195,7 +202,7 @@
JacksonUtils.toXmlWithView( gzip, metaData, ExportView.class );
}
- @RequestMapping( value = {MetaDataController.RESOURCE_PATH + ".json.gz"}, produces = "*/*" )
+ @RequestMapping( value = { MetaDataController.RESOURCE_PATH + ".json.gz" }, produces = "*/*" )
@PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_EXPORT')" )
public void exportGZippedJSON( @RequestParam Map<String, String> parameters, HttpServletResponse response ) throws IOException
{
@@ -213,7 +220,7 @@
// Import
//--------------------------------------------------------------------------
- @RequestMapping( value = MetaDataController.RESOURCE_PATH, method = RequestMethod.POST, consumes = {"application/xml", "text/*"} )
+ @RequestMapping( value = MetaDataController.RESOURCE_PATH, method = RequestMethod.POST, consumes = { "application/xml", "text/*" } )
@PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_IMPORT')" )
public void importXml( ImportOptions importOptions, HttpServletResponse response, HttpServletRequest request ) throws JAXBException, IOException
{
@@ -221,7 +228,7 @@
TaskId taskId = new TaskId( TaskCategory.METADATA_IMPORT, currentUserService.getCurrentUser() );
- scheduler.executeTask( new ImportMetaDataTask( importService, importOptions,taskId, metaData ) );
+ scheduler.executeTask( new ImportMetaDataTask( currentUserService.getCurrentUser(), importService, importOptions, taskId, metaData ) );
response.setHeader( "Location", ContextUtils.getRootPath( request ) + "/system/tasks/" + TaskCategory.METADATA_IMPORT );
response.setStatus( HttpServletResponse.SC_NO_CONTENT );
@@ -235,13 +242,13 @@
TaskId taskId = new TaskId( TaskCategory.METADATA_IMPORT, currentUserService.getCurrentUser() );
- scheduler.executeTask( new ImportMetaDataTask( importService, importOptions,taskId, metaData ) );
+ scheduler.executeTask( new ImportMetaDataTask( currentUserService.getCurrentUser(), importService, importOptions, taskId, metaData ) );
response.setHeader( "Location", ContextUtils.getRootPath( request ) + "/system/tasks/" + TaskCategory.METADATA_IMPORT );
response.setStatus( HttpServletResponse.SC_NO_CONTENT );
}
- @RequestMapping( value = {MetaDataController.RESOURCE_PATH + ".zip", MetaDataController.RESOURCE_PATH + ".xml.zip"}, method = RequestMethod.POST, consumes = {"application/xml", "text/*"} )
+ @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 JAXBException, IOException
{
@@ -252,13 +259,13 @@
TaskId taskId = new TaskId( TaskCategory.METADATA_IMPORT, currentUserService.getCurrentUser() );
- scheduler.executeTask( new ImportMetaDataTask( importService, importOptions,taskId, metaData ) );
+ scheduler.executeTask( new ImportMetaDataTask( currentUserService.getCurrentUser(), importService, importOptions, taskId, metaData ) );
response.setHeader( "Location", ContextUtils.getRootPath( request ) + "/system/tasks/" + TaskCategory.METADATA_IMPORT );
response.setStatus( HttpServletResponse.SC_NO_CONTENT );
}
- @RequestMapping( value = {MetaDataController.RESOURCE_PATH + ".zip", MetaDataController.RESOURCE_PATH + ".json.zip"}, method = RequestMethod.POST, consumes = "application/json" )
+ @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
{
@@ -269,13 +276,13 @@
TaskId taskId = new TaskId( TaskCategory.METADATA_IMPORT, currentUserService.getCurrentUser() );
- scheduler.executeTask( new ImportMetaDataTask( importService, importOptions,taskId, metaData ) );
+ scheduler.executeTask( new ImportMetaDataTask( currentUserService.getCurrentUser(), importService, importOptions, taskId, metaData ) );
response.setHeader( "Location", ContextUtils.getRootPath( request ) + "/system/tasks/" + TaskCategory.METADATA_IMPORT );
response.setStatus( HttpServletResponse.SC_NO_CONTENT );
}
- @RequestMapping( value = {MetaDataController.RESOURCE_PATH + ".gz", MetaDataController.RESOURCE_PATH + ".xml.gz"}, method = RequestMethod.POST, consumes = {"application/xml", "text/*"} )
+ @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 JAXBException, IOException
{
@@ -284,13 +291,13 @@
TaskId taskId = new TaskId( TaskCategory.METADATA_IMPORT, currentUserService.getCurrentUser() );
- scheduler.executeTask( new ImportMetaDataTask( importService, importOptions,taskId, metaData ) );
+ scheduler.executeTask( new ImportMetaDataTask( currentUserService.getCurrentUser(), importService, importOptions, taskId, metaData ) );
response.setHeader( "Location", ContextUtils.getRootPath( request ) + "/system/tasks/" + TaskCategory.METADATA_IMPORT );
response.setStatus( HttpServletResponse.SC_NO_CONTENT );
}
- @RequestMapping( value = {MetaDataController.RESOURCE_PATH + ".gz", MetaDataController.RESOURCE_PATH + ".json.gz"}, method = RequestMethod.POST, consumes = "application/json" )
+ @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
{
@@ -299,7 +306,7 @@
TaskId taskId = new TaskId( TaskCategory.METADATA_IMPORT, currentUserService.getCurrentUser() );
- scheduler.executeTask( new ImportMetaDataTask( importService, importOptions,taskId, metaData ) );
+ scheduler.executeTask( new ImportMetaDataTask( currentUserService.getCurrentUser(), importService, importOptions, taskId, metaData ) );
response.setHeader( "Location", ContextUtils.getRootPath( request ) + "/system/tasks/" + TaskCategory.METADATA_IMPORT );
response.setStatus( HttpServletResponse.SC_NO_CONTENT );