private void checkNeededWarnings(HttpServletRequest request, ResearchResult result)
     throws FenixServiceException {
   Person person = getLoggedPerson(request);
   if (!result.hasPersonParticipation(person) && !result.getCreator().equals(person)) {
     addActionMessage(request, "researcher.ResultParticipation.last.participation.warning");
   }
 }
  private void schemasStateAutomaton(
      HttpServletRequest request,
      ResearchResult result,
      ResultParticipationCreationBean bean,
      boolean automatonIsInUnitSelection) {

    String resultParticipationsSchema =
        result.getIsPossibleSelectPersonRole()
            ? "resultParticipation.full"
            : "resultParticipation.withoutRole";
    request.setAttribute("listSchema", resultParticipationsSchema);

    if (!automatonIsInUnitSelection) {
      String createResultParticipationSchema = "resultParticipation.creation";
      if (result.getIsPossibleSelectPersonRole()) {
        createResultParticipationSchema += "WithRole";
      }
      createResultParticipationSchema += (bean.isBeanExternal()) ? ".external" : ".internal";
      request.setAttribute("createSchema", createResultParticipationSchema);
    } else {
      bean.setUnitParticipationType(ParticipationType.EXTERNAL);
      String createResultParticipationSchema = "resultParticipation.fullCreation";
      if (result.getIsPossibleSelectPersonRole()) {
        createResultParticipationSchema += "WithRole";
      }
      createResultParticipationSchema += ".external.readOnly";
      request.setAttribute("createSchema", createResultParticipationSchema);
    }
  }
  public ActionForward prepareEdit(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws FenixServiceException {
    final ResearchResult result = getResultFromRequest(request);
    Person person = getLoggedPerson(request);
    if (result == null
        || (!result.hasPersonParticipation(person) && !result.getCreator().equals(person))) {
      return backToResultList(mapping, form, request, response);
    }

    ResultParticipationCreationBean bean = getRenderedObject("bean");

    setResParticipationRequestAttributes(
        request, result, (bean == null) ? getBeanFromRequest(request, result) : bean);
    return mapping.findForward("editParticipation");
  }
  private List<ResultParticipation> reOrderParticipations(
      String treeStructure, ResearchResult result) {
    final List<ResultParticipation> newParticipationsOrder = new ArrayList<ResultParticipation>();
    final List<ResultParticipation> oldParticipationsOrder =
        result.getOrderedResultParticipations();
    final String[] nodes = treeStructure.split(",");

    for (String node : nodes) {
      String[] parts = node.split("-");

      Integer index = getId(parts[0]) - 1;
      ResultParticipation participation = oldParticipationsOrder.get(index);
      newParticipationsOrder.add(participation);
    }
    return newParticipationsOrder;
  }
  private void checkNeededSchemas(
      HttpServletRequest request, ResearchResult result, ResultParticipationCreationBean bean) {
    String resultParticipationsSchema = "resultParticipation.withoutRole";
    String createResultParticipationSchema = "resultParticipation.creation";

    if ((bean.getParticipator() != null
            || (bean.getParticipatorName() != null && bean.getParticipatorName().length() > 0))
        && (bean.isBeanExternal() || bean.isUnitExternal())) {
      createResultParticipationSchema = "resultParticipation.fullCreation";
    }

    // Defining schemas with roles
    if (result.getIsPossibleSelectPersonRole()) {
      resultParticipationsSchema = "resultParticipation.full";
      if (!bean.isBeanExternal()) {
        createResultParticipationSchema = "resultParticipation.creationWithRole";
      } else {
        if (bean.getParticipator() == null) {
          if (bean.getParticipatorName().length() == 0) {
            createResultParticipationSchema = "resultParticipation.creationWithRole";
          } else {
            createResultParticipationSchema = "resultParticipation.fullCreationWithRole";
          }
        } else {
          bean.setOrganization(
              bean.getParticipator().getPerson().getExternalContract().getInstitutionUnit());
          createResultParticipationSchema = "resultParticipation.creationWithRole";
        }
      }
    }

    createResultParticipationSchema += (bean.isBeanExternal()) ? ".external" : ".internal";

    request.setAttribute("listSchema", resultParticipationsSchema);
    request.setAttribute("createSchema", createResultParticipationSchema);
  }
예제 #6
0
 @Atomic
 public static void run(ResultParticipation participation) throws FenixServiceException {
   ResearchResult result = participation.getResult();
   result.removeParticipation(participation);
   ResearchResultMetaDataManager.updateMetaDataInStorageFor(result);
 }