Package ch.tatool.data

Examples of ch.tatool.data.ModuleSession


       long sessionCount = dataService.getSessionCount(module, false);
       return String.valueOf(sessionCount);
    }
   
    public String getSchedulerLastSessionDate(Module module) {
      ModuleSession lastSession = dataService.getLastSession(module, false);
      String lastSessionString = "";
      if (lastSession != null) {
            DateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
            Date d = lastSession.getStartTime();
            lastSessionString = dateFormat.format(d);
        } else {
           lastSessionString = "-";
        }
      return lastSessionString;
View Full Code Here


        todayDate.set(Calendar.SECOND, 0);
        todayDate.set(Calendar.MILLISECOND, 0);
        Calendar lastSessionDate = new GregorianCalendar();

        long numSessions = getDataService().getSessionCount(module, false);
        ModuleSession lastSession = getDataService().getLastSession(module, false);
        if (lastSession != null) {
            lastSessionDate.setTime(lastSession.getStartTime());
        } else {
            lastSessionDate.set(Calendar.YEAR, 1900);
        }
        ModuleSchedulerMessage message = new ModuleSchedulerMessageImpl();
View Full Code Here

   * Creates a new module session. The module start date is set immediately
   */
  @SuppressWarnings("unchecked")
  public ModuleSession createSession(Module module) {
    final ModuleImpl moduleImpl = (ModuleImpl) module;
    ModuleSession moduleSession = (ModuleSession) moduleImpl
        .getTransactionTemplate().execute(new TransactionCallback() {
          public Object doInTransaction(TransactionStatus status) {
            ModuleSession moduleSession = new ModuleSessionImpl();
            moduleSession.setStartTime(new Date());
            moduleSession.setCompleted(0);
            moduleImpl.getSessionDAO().saveSession(moduleImpl, moduleSession);
            return moduleSession;
          }
        });
    return moduleSession;
View Full Code Here

        if (!exportConfigured(module, exporterKey)) {
            return false;
        }
       
        // nothing to export if there are no sessions
        ModuleSession session = dataService.getLastSession(module, true);
        if (session == null) {
            return false;
        }

        // check last exported session id with what's stored in the module
        String lastExportSessionId = module.getModuleProperties().get(exporterKey + "." + DataExportService.PROPERTY_LAST_EXPORTED_SESSION);

        if (lastExportSessionId != null && lastExportSessionId.equals(String.valueOf(session.getIndex()))) {
            return false;
        }
       
        return true;
    }
View Full Code Here

            dataService.saveModule(module);
            return exporterError.getErrorMessage();
          }
            // update the export information
            module.getModuleProperties().put(exporterKey + "." + DataExportService.PROPERTY_LAST_EXPORT_TIMESTAMP, String.valueOf(System.currentTimeMillis()));
            ModuleSession session = dataService.getLastSession(module, true);
            if (session != null) {
                // should always be the case
                module.getModuleProperties().put(exporterKey + "." + DataExportService.PROPERTY_LAST_EXPORTED_SESSION, String.valueOf(session.getIndex()));
            }
            dataService.saveModule(module);
        } catch (RuntimeException ioe) {
          logger.error(ioe.getMessage(), ioe);
        }
View Full Code Here

      // read the last level state from the module
      Integer level = Level.getLevelProperty().ensureValue(module, this);
      Level.getLevelProperty().setValue(this, level);
     
      // initialize the total points of the session to zero
      ModuleSession session = context.getExecutionData().getModuleSession();
      Points.getTotalMinPointsProperty().setValue(session, this, 0);
      Points.getTotalPointsProperty().setValue(session, this, 0);
      Points.getTotalMaxPointsProperty().setValue(session, this, 0);
     
      // do the same for the module
View Full Code Here

        curr += Points.getPointsProperty().getValue(trial, this, ZERO_POINTS);
        max += Points.getMaxPointsProperty().getValue(trial, this, ZERO_POINTS);
      }
     
      // update the session data with the current execution totals
      ModuleSession session = context.getExecutionData().getModuleSession();
      IntegerProperty totalMinPointsProperty = Points.getTotalMinPointsProperty();
      IntegerProperty totalPointsProperty = Points.getTotalPointsProperty();
      IntegerProperty totalMaxPointsProperty = Points.getTotalMaxPointsProperty();
     
      // fetch the session total - we are sure it is initialized as we used ensureValue in session start
View Full Code Here

      IntegerProperty totalMinPointsProperty = Points.getTotalMinPointsProperty();
      IntegerProperty totalPointsProperty = Points.getTotalPointsProperty();
      IntegerProperty totalMaxPointsProperty = Points.getTotalMaxPointsProperty();
     
      // Set the current level onto the session
      ModuleSession session = context.getExecutionData().getModuleSession();
      Level.getLevelProperty().setValue(session, this);
     
      // roll up the  the total points to zero
      Module module = context.getExecutionData().getModule();
     
View Full Code Here

        todayDate.set(Calendar.SECOND, 0);
        todayDate.set(Calendar.MILLISECOND, 0);
        Calendar lastSessionDate = new GregorianCalendar();

        long numSessions = getDataService().getSessionCount(module, false);
        ModuleSession lastSession = getDataService()
                .getLastSession(module);
        if (lastSession != null && lastSession.getEndTime() != null) {
            lastSessionDate.setTime(lastSession.getStartTime());
        } else {
            lastSessionDate.set(Calendar.YEAR, 1900);
        }
       
       
View Full Code Here

       long sessionCount = dataService.getSessionCount(module, false);
       return String.valueOf(sessionCount);
    }
   
    public String getSchedulerLastSessionDate(Module module) {
      ModuleSession lastSession = dataService.getLastSession(module);
      String lastSessionString = "";
      if (lastSession != null) {
            DateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
            Date d = lastSession.getStartTime();
            lastSessionString = dateFormat.format(d);
        } else {
           lastSessionString = "-";
        }
      return lastSessionString;
View Full Code Here

TOP

Related Classes of ch.tatool.data.ModuleSession

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.