public static void enrollImpl(PartakeConnection con, IPartakeDAOs daos, UserEx user, UUID ticketId, Event event,
ParticipationStatus status, String comment, Map<UUID, List<String>> enqueteAnswers,boolean changesOnlyComment, boolean isReservationTimeOver) throws DAOException {
String userId = user.getId();
String eventId = event.getId();
UserTicket oldEnrollment = daos.getEnrollmentAccess().findByTicketIdAndUserId(con, ticketId, userId);
UserTicket newEnrollment;
if (oldEnrollment == null) {
String id = daos.getEnrollmentAccess().getFreshId(con);
newEnrollment = new UserTicket(id, userId, ticketId, eventId,
comment, ParticipationStatus.NOT_ENROLLED, ModificationStatus.NOT_ENROLLED, AttendanceStatus.UNKNOWN, null, TimeUtil.getCurrentDateTime(), TimeUtil.getCurrentDateTime(), null);
} else {
newEnrollment = new UserTicket(oldEnrollment);
}
newEnrollment.setComment(comment);
newEnrollment.setEnqueteAnswers(enqueteAnswers);
if (oldEnrollment == null) {
newEnrollment.setStatus(status);
newEnrollment.setModificationStatus(ModificationStatus.CHANGED);
newEnrollment.setAppliedAt(TimeUtil.getCurrentDateTime());
} else if (changesOnlyComment || status.equals(oldEnrollment.getStatus())) {
// 特に変更しない
} else if (status.isEnrolled() == oldEnrollment.getStatus().isEnrolled()) {
// 参加する / しないの状況が変更されない場合は、status のみが更新される。
newEnrollment.setStatus(status);
newEnrollment.setModificationStatus(ModificationStatus.CHANGED);
} else {
newEnrollment.setStatus(status);
newEnrollment.setModificationStatus(ModificationStatus.CHANGED);
newEnrollment.setAppliedAt(TimeUtil.getCurrentDateTime());
}
if (oldEnrollment == null)
newEnrollment.setModifiedAt(TimeUtil.getCurrentDateTime());
//
if (status != null) {
IEventActivityAccess eaa = daos.getEventActivityAccess();