public ActionForward remove(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws FenixServiceException {
    final ResultParticipation participation = readResultParticipationFromRequest(request);
    if (participation == null) {
      return backToResultList(mapping, form, request, response);
    }

    final Person loggedPerson = getLoggedPerson(request);

    if (participation.getPerson().equals(loggedPerson)
        && getFromRequest(request, "confirm") == null
        && getFromRequest(request, "cancel") == null) {
      request.setAttribute("deleteConfirmation", participation.getExternalId());
    }

    if (getFromRequest(request, "confirm") != null
        || !participation.getPerson().equals(loggedPerson)) {

      try {

        DeleteResultParticipation.run(participation);
      } catch (Exception e) {
        final ActionForward defaultForward = backToResultList(mapping, form, request, response);
        return processException(request, mapping, defaultForward, e);
      }
    }

    return prepareEdit(mapping, form, request, response);
  }
  private ResultParticipation readResultParticipationFromRequest(HttpServletRequest request) {
    final String oid = getRequestParameterAsString(request, "participationId");
    ResultParticipation participation = null;

    try {
      participation = ResultParticipation.readByOid(oid);
    } catch (DomainException e) {
      addActionMessage(request, e.getKey(), e.getArgs());
    }

    return participation;
  }
Exemplo n.º 3
0
 @Atomic
 public static void run(ResultParticipation participation) throws FenixServiceException {
   ResearchResult result = participation.getResult();
   result.removeParticipation(participation);
   ResearchResultMetaDataManager.updateMetaDataInStorageFor(result);
 }