@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(); }
@Override public boolean deletePerson(int id) { Person p = Person.getPersonById(id); if (p != null) { Person.removePerson(p); return true; } else { return false; } }
@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); }
@Override public Person readPerson(int id) { return Person.getPersonById(id); }