@Atomic
 private CareerWorkshopConfirmation retrieveThisWorskhopApplicationConfirmation(
     Student student,
     CareerWorkshopConfirmationEvent confirmationEvent,
     CareerWorkshopApplication application) {
   for (CareerWorkshopConfirmation confirmation : student.getCareerWorkshopConfirmationsSet()) {
     if (confirmation.getCareerWorkshopConfirmationEvent() == confirmationEvent) {
       return confirmation;
     }
   }
   return new CareerWorkshopConfirmation(student, confirmationEvent, application);
 }
  public ActionForward presentConfirmation(
      ActionMapping actionMapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    final Student student = getLoggedStudent(request);
    final String eventExternalId = request.getParameter("eventId");
    CareerWorkshopConfirmationEvent event = FenixFramework.getDomainObject(eventExternalId);
    CareerWorkshopApplication application =
        retrieveThisWorkshopApplication(student, event.getCareerWorkshopApplicationEvent());
    CareerWorkshopConfirmation confirmation =
        retrieveThisWorskhopApplicationConfirmation(student, event, application);

    request.setAttribute("confirmationForm", confirmation);
    request.setAttribute(
        "confirmationBean", new CareerWorkshopConfirmationBean(confirmation.getExternalId()));
    return actionMapping.findForward("careerWorkshopConfirmationForm");
  }
  public ActionForward acceptConfirmation(
      ActionMapping actionMapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    CareerWorkshopConfirmationBean bean = getRenderedObject("confirmationBean");
    CareerWorkshopConfirmation confirmation = FenixFramework.getDomainObject(bean.getExternalId());
    if (isConfirmationPeriodExpired(confirmation)) {
      addActionMessage("error", request, "error.careerWorkshops.confirmationPeriodExpired");
      return prepare(actionMapping, actionForm, request, response);
    }
    confirmation.setConfirmationCode(bean.getConfirmationCode());
    confirmation.setConfirmation(true);
    confirmation.sealConfirmation();

    addActionMessage("success", request, "message.careerWorkshops.confirmationSuccessful");

    return prepare(actionMapping, actionForm, request, response);
  }
 private boolean isConfirmationPeriodExpired(CareerWorkshopConfirmation confirmation) {
   DateTime thisInstant = new DateTime();
   return thisInstant.isAfter(confirmation.getCareerWorkshopConfirmationEvent().getEndDate());
 }