// there are solutions. yippie!
Weight solution = solutions.get(0);
if (activityInterval == null ||
!solution.getInterval().equals(activityInterval)) {
// interval is changed, save new interval
Status status = activity.withStatus();
status.setStart(solution.getStart().toString());
status.setEnd(solution.getEnd().toString());
status.setActivityStatus(Status.ACTIVITY_STATUS.planned);
status.setUpdated(DateTime.now().toString());
state.put("activity", activity);
logger.info("Activity replanned at " + solution.toString()); // TODO: cleanup logging
try {
// TODO: cleanup
logger.info("Replanned activity: " + JOM.getInstance().writeValueAsString(activity));
} catch (Exception e) {}
return true;
}
else {
// planning did not change. nothing to do.
}
}
else {
if (activityStart != null || activityEnd != null) {
// no solution
Issue issue = new Issue();
issue.setCode(Issue.NO_PLANNING);
issue.setType(Issue.TYPE.error);
issue.setMessage("No free interval found for the meeting");
issue.setTimestamp(DateTime.now().toString());
// TODO: generate hints
addIssue(issue);
Status status = activity.withStatus();
status.setStart(null);
status.setEnd(null);
status.setActivityStatus(Status.ACTIVITY_STATUS.error);
status.setUpdated(DateTime.now().toString());
state.put("activity", activity);
logger.info(issue.getMessage()); // TODO: cleanup logging
return true;
}
else {