コード例 #1
0
 // FIXME remove this method and implement a better version handling
 private void setVersion(int experimentTaskId) {
   String version = GerbilConfiguration.getGerbilVersion();
   if (version == null) {
     LOGGER.error(
         "Couldn't get the current gerbil version. Can't add it to the experiment task #"
             + experimentTaskId
             + ". Returning.");
     return;
   }
   MapSqlParameterSource parameters = new MapSqlParameterSource();
   parameters.addValue("id", experimentTaskId);
   parameters.addValue("version", version);
   this.template.update(INSERT_VERSION_OF_EXPERIMENT_TASK, parameters);
 }
コード例 #2
0
 @Override
 public int createTask(
     String annotatorName,
     String datasetName,
     String experimentType,
     String matching,
     String experimentId) {
   MapSqlParameterSource params =
       createTaskParameters(annotatorName, datasetName, experimentType, matching);
   params.addValue("state", ExperimentDAO.TASK_STARTED_BUT_NOT_FINISHED_YET);
   java.util.Date today = new java.util.Date();
   params.addValue("lastChanged", new java.sql.Timestamp(today.getTime()));
   params.addValue("version", GerbilConfiguration.getGerbilVersion());
   KeyHolder keyHolder = new GeneratedKeyHolder();
   this.template.update(INSERT_TASK, params, keyHolder);
   Integer generatedKey = (Integer) keyHolder.getKey();
   if (experimentId != null) {
     connectToExperiment(experimentId, generatedKey);
   }
   // FIXME remove this method and implement a better version handling
   setVersion(generatedKey);
   return generatedKey;
 }