use of org.hisp.dhis.util.DateUtils.parseDate in project dhis2-core by dhis2.
the class ProgramStageInstanceUpdatePreProcessor method setStatus.
private void setStatus(ProgramStageInstance programStageInstance, final Event event, WorkContext ctx) {
if (event.getStatus() == ACTIVE) {
programStageInstance.setStatus(ACTIVE);
programStageInstance.setCompletedBy(null);
programStageInstance.setCompletedDate(null);
} else if (programStageInstance.getStatus() != event.getStatus() && event.getStatus() == COMPLETED) {
final String completedBy = EventUtils.getValidUsername(event.getCompletedBy(), ctx.getImportOptions());
programStageInstance.setCompletedBy(completedBy);
Date completedDate = new Date();
if (event.getCompletedDate() != null) {
completedDate = DateUtils.parseDate(event.getCompletedDate());
}
programStageInstance.setCompletedDate(completedDate);
programStageInstance.setStatus(COMPLETED);
} else if (event.getStatus() == SKIPPED) {
programStageInstance.setStatus(SKIPPED);
} else if (event.getStatus() == SCHEDULE) {
programStageInstance.setStatus(SCHEDULE);
}
}
Aggregations