コード例 #1
0
 @Override
 public int updatePersonMeasure(int id, Measure measure) {
   Person person = Person.getPersonById(id);
   // Set person and healthProfile for measure
   measure.setPerson(person);
   measure.setHealthProfile(person.getHealthProfile());
   Measure.updateMeasure(measure);
   return measure.getMid();
 }
コード例 #2
0
 @Override
 public Measure readPersonMeasure(int id, String measureType, int mid) {
   Measure m = Measure.getMeasureById(mid);
   // Check that measure equals the given measure type and person id
   if (m.getMeasure().equals(measureType) && m.getPerson().getIdPerson() == id) {
     return m;
   } else {
     System.out.println(
         "Could not find measure " + measureType + " with id " + mid + " from person " + id);
     return null;
   }
 }
コード例 #3
0
 @Override
 public Measure savePersonMeasure(int id, Measure measure) {
   Person person = Person.getPersonById(id);
   // Set person and healthProfile for measure
   measure.setPerson(person);
   measure.setHealthProfile(person.getHealthProfile());
   // If no created date, set the current date as measure created date
   if (measure.getCreated() == null) {
     measure.setCreated(new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
   }
   return Measure.saveMeasure(measure);
 }
コード例 #4
0
 @Override
 public List<Measure> readPersonHistory(int id, String measureType) {
   List<Measure> measures = Measure.getMeasureHistory(id, measureType, null, null);
   return measures;
 }