Example #1
0
 @Secured("ROLE_ADMIN")
 public DataImportStateProxy startImport(List<Integer> entryIdsToImport, String surveyName)
     throws Exception {
   dataImportProcess.setEntryIdsToImport(entryIdsToImport);
   dataImportProcess.setNewSurveyName(surveyName);
   dataImportProcess.prepareToStartImport();
   ExecutorServiceUtil.executeInCachedPool(dataImportProcess);
   DataImportState state = dataImportProcess.getState();
   DataImportStateProxy proxy = new DataImportStateProxy(state);
   return proxy;
 }
Example #2
0
 @Secured("ROLE_ADMIN")
 public DataImportStateProxy getState() {
   if (dataImportProcess != null) {
     DataImportState state = dataImportProcess.getState();
     DataImportStateProxy proxy = new DataImportStateProxy(state);
     return proxy;
   } else {
     return null;
   }
 }
Example #3
0
 @Secured("ROLE_ADMIN")
 public DataImportSummaryProxy getSummary() {
   if (dataImportProcess != null) {
     DataImportSummary summary = dataImportProcess.getSummary();
     DataImportSummaryProxy proxy = new DataImportSummaryProxy(messageContextHolder, summary);
     return proxy;
   } else {
     return null;
   }
 }
Example #4
0
 @Secured("ROLE_ADMIN")
 public DataImportStateProxy startSummaryCreation(boolean overwriteAll) throws DataImportExeption {
   if (dataImportProcess == null || !dataImportProcess.isRunning()) {
     SessionState sessionState = sessionManager.getSessionState();
     File userImportFolder = new File(importDirectory, sessionState.getSessionId());
     packagedFile = new File(userImportFolder, FILE_NAME);
     List<User> usersList = userManager.loadAll();
     HashMap<String, User> users = new HashMap<String, User>();
     for (User user : usersList) {
       users.put(user.getName(), user);
     }
     dataImportProcess =
         new DataImportProcess(
             surveyManager, recordManager, recordDao, users, packagedFile, overwriteAll);
     dataImportProcess.prepareToStartSummaryCreation();
     ExecutorServiceUtil.executeInCachedPool(dataImportProcess);
   }
   DataImportState state = dataImportProcess.getState();
   DataImportStateProxy proxy = new DataImportStateProxy(state);
   return proxy;
 }
Example #5
0
 @Secured("ROLE_ADMIN")
 public void cancel() {
   if (dataImportProcess != null) {
     dataImportProcess.cancel();
   }
 }