use of org.hisp.dhis.client.sdk.android.api.persistence.flow.TrackedEntityDataValueFlow in project pictureapp by EyeSeeTea.
the class EventExtended method removeDataValues.
public EventFlow removeDataValues() {
//Remove all dataValues
List<TrackedEntityDataValueFlow> dataValues = new Select().from(TrackedEntityDataValueFlow.class).where(TrackedEntityDataValueFlow_Table.event.eq(event.getUId())).queryList();
if (dataValues != null) {
for (int i = dataValues.size() - 1; i >= 0; i--) {
TrackedEntityDataValueFlow dataValue = dataValues.get(i);
dataValue.delete();
dataValues.remove(i);
}
}
//// TODO: 15/11/2016
//event.setDataValues(null);
event.save();
return event;
}
use of org.hisp.dhis.client.sdk.android.api.persistence.flow.TrackedEntityDataValueFlow in project pictureapp by EyeSeeTea.
the class SurveyChecker method getEvents.
public static List<EventExtended> getEvents(JsonNode jsonNode) {
TypeReference<List<Event>> typeRef = new TypeReference<List<Event>>() {
};
List<Event> events;
try {
if (jsonNode.has("events")) {
ObjectMapper objectMapper = new ObjectMapper().registerModule(new JodaModule());
events = objectMapper.readValue(jsonNode.get("events").traverse(), typeRef);
} else {
events = new ArrayList<>();
}
} catch (IOException e) {
events = new ArrayList<>();
e.printStackTrace();
}
List<EventExtended> eventExtendedList = new ArrayList<>();
for (Event event : events) {
EventFlow eventFlow = EventFlow.MAPPER.mapToDatabaseEntity(event);
EventExtended eventExtended = new EventExtended(eventFlow);
if (event.getDataValues() != null && event.getDataValues().size() > 0) {
List<TrackedEntityDataValueFlow> trackedEntityDataValueFlows = TrackedEntityDataValueFlow.MAPPER.mapToDatabaseEntities(event.getDataValues());
eventExtended.setDataValuesInMemory(trackedEntityDataValueFlows);
}
eventExtendedList.add(eventExtended);
}
return eventExtendedList;
}
Aggregations