Esempio n. 1
0
 public void checkIsActiveRecordLocked() throws RecordUnlockedException {
   SessionState sessionState = getSessionState();
   CollectRecord record = sessionState.getActiveRecord();
   if (record == null) {
     throw new RecordUnlockedException();
   } else if (record.getId() != null) {
     User user = sessionState.getUser();
     String lockId = sessionState.getSessionId();
     try {
       recordManager.checkIsLocked(record.getId(), user, lockId);
       sessionState.keepActiveRecordAlive();
     } catch (RecordUnlockedException e) {
       clearActiveRecord();
       throw e;
     }
   }
 }
Esempio n. 2
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;
 }