public ActionForward executeAction(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response,
      SessionAPI session)
      throws Exception {

    // Comprobar si el usuario tiene asignadas las funciones adecuadas
    FunctionHelper.checkFunctions(
        request,
        session.getClientContext(),
        new int[] {ISecurityAPI.FUNC_INV_DOCTYPES_READ, ISecurityAPI.FUNC_INV_DOCTYPES_EDIT});

    IInvesflowAPI invesFlowAPI = session.getAPI();
    ICatalogAPI catalogAPI = invesFlowAPI.getCatalogAPI();

    String scttaskId = request.getParameter("cttaskId");
    String filtro = " WHERE CTTRTD.ID_TPDOC =CTTPDOC.ID  AND CTTRTD.ID_TRAMITE = " + scttaskId;
    HashMap tablemap = new HashMap();
    tablemap.put("CTTPDOC", new Integer(ICatalogAPI.ENTITY_CT_TYPEDOC));
    tablemap.put("CTTRTD", new Integer(ICatalogAPI.ENTITY_CT_TASKTYPEDOC));

    IItemCollection itemcol = catalogAPI.queryCTEntities(tablemap, filtro);
    List cttasklist = CollectionBean.getBeanList(itemcol);

    int cttaskId = Integer.parseInt(scttaskId);

    IItem cttask = catalogAPI.getCTEntity(ICatalogAPI.ENTITY_CT_TASK, cttaskId);
    ItemBean cttaskbean = new ItemBean(cttask);
    request.setAttribute("CTTask", cttaskbean);

    CacheFormatterFactory factory = CacheFormatterFactory.getInstance();
    BeanFormatter formatter = null;

    // Establece el formateador de las fases del catálogo
    if (FunctionHelper.userHasFunction(
        request, session.getClientContext(), ISecurityAPI.FUNC_INV_TASKS_EDIT)) {
      formatter = factory.getFormatter(getISPACPath("/formatters/cttasktpdocsformatter.xml"));
    } else {
      formatter =
          factory.getFormatter(getISPACPath("/formatters/cttasktpdocsreadonlyformatter.xml"));
    }

    request.setAttribute("Formatter", formatter);
    request.setAttribute("ItemList", cttasklist);

    // Identificador para los enlaces del menu.
    request.setAttribute("KeyId", scttaskId);

    return mapping.findForward("success");
  }
Beispiel #2
0
  public ActionForward executeAction(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response,
      SessionAPI session)
      throws Exception {

    // Comprobar si el usuario tiene asignadas las funciones adecuadas
    FunctionHelper.checkFunctions(
        request, session.getClientContext(), new int[] {ISecurityAPI.FUNC_INV_PROCEDURES_EDIT});

    int intTpObj = Integer.parseInt(request.getParameter("TpObj"));
    int intIdObj = Integer.parseInt(request.getParameter("IdObj"));

    // Prepara las API's a utilizar
    IInvesflowAPI invesFlowAPI = session.getAPI();
    ICatalogAPI catalogAPI = invesFlowAPI.getCatalogAPI();

    if (request.getParameter("idRule") != null) {
      catalogAPI.addPRuleEvent(
          intTpObj,
          intIdObj,
          Integer.parseInt(request.getParameter("codEvent")),
          Integer.parseInt(request.getParameter("idRule")));

      ActionForward forward = mapping.findForward("showevents");
      String path = forward.getPath() + "?TpObj=" + intTpObj + "&IdObj=" + intIdObj;
      return new ActionForward(forward.getName(), path, forward.getRedirect());
    }

    request.setAttribute("TpObj", String.valueOf(intTpObj));
    request.setAttribute("IdObj", String.valueOf(intIdObj));

    CacheFormatterFactory factory = CacheFormatterFactory.getInstance();
    String ispacbase = (String) servlet.getServletContext().getAttribute("ispacbase");

    if (request.getParameter("codEvent") != null) {
      request.setAttribute("codEvent", request.getParameter("codEvent"));
      IItemCollection rulecol = catalogAPI.getCTRules();
      List rulelist = CollectionBean.getBeanList(rulecol);

      request.setAttribute("RulesList", rulelist);

      BeanFormatter formatter =
          factory.getFormatter(getISPACPath("/formatters/events/ruleslistformatter.xml"));

      request.setAttribute("RulesListFormatter", formatter);
      request.setAttribute(
          "application", StaticContext.rewritePage(ispacbase, "common/events/ruleslist.jsp"));
    } else {
      List eventlist = DescriptionsPEvents.getDescEventsList(intTpObj, intIdObj);
      request.setAttribute("EventsList", eventlist);

      BeanFormatter formatter =
          factory.getFormatter(getISPACPath("/formatters/events/eventslistformatter.xml"));

      request.setAttribute("EventsListFormatter", formatter);
      request.setAttribute(
          "application", StaticContext.rewritePage(ispacbase, "common/events/eventslist.jsp"));
    }

    return mapping.findForward("success");
  }