Example #1
0
 /*
  * (non-Javadoc)
  *
  * @see org.cuny.sensors.dao.IDao#save(java.lang.Object)
  */
 @Override
 public RawFile save(RawFile obj) throws Exception {
   Map<String, Object> parameters = new HashMap<String, Object>(5);
   parameters.put(FILE_NAME, obj.getFilename());
   parameters.put(FILE_SIZE, obj.getFileSize());
   parameters.put(STATUS, obj.getStatus().toString());
   parameters.put(BUILDING, obj.getBuilding());
   parameters.put(CAMPUS, obj.getCampus());
   Number newId = insertActor.executeAndReturnKey(parameters);
   obj.setId(newId.longValue());
   return obj;
 }
Example #2
0
 /*
  * (non-Javadoc)
  *
  * @see org.cuny.sensors.dao.IDao#update(java.lang.Object)
  */
 @Override
 public RawFile update(RawFile obj) throws Exception {
   RawFile old = get(obj.getId());
   this.jdbcTemplate.update(
       "update "
           + TABLE_NAME
           + " set "
           + FILE_NAME
           + " = ?, "
           + FILE_SIZE
           + " = ?, "
           + DATASET_COUNT
           + " = ?, "
           + SENSOR_COUNT
           + " = ?, "
           + RECORD_COUNT
           + " = ?, "
           + BUILDING
           + " = ?,"
           + CAMPUS
           + " = ?,"
           + STATUS
           + " = ?,"
           + NOTES
           + "  = ? where "
           + ID
           + " = ?",
       obj.getFilename(),
       obj.getFileSize(),
       obj.getDatasetCount(),
       obj.getSensorCount(),
       obj.getRecordCount(),
       obj.getBuilding(),
       obj.getCampus(),
       obj.getStatus().toString(),
       obj.getNotes(),
       obj.getId());
   return old;
 }