コード例 #1
0
  public ActionForward executeAction(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response,
      SessionAPI session)
      throws Exception {

    ClientContext cct = session.getClientContext();

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

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

    int itemId = Integer.parseInt(request.getParameter("idfstd"));

    IItem item = catalogAPI.getCTEntity(ICatalogAPI.ENTITY_P_FSTD, itemId);
    item.delete(cct);

    TreeView tree =
        (TreeView)
            request
                .getSession()
                .getAttribute(ManageVistaCuadroProcedimientoAction.CUADRO_PROCEDIMIENTO);
    if (tree != null) {
      TreeNode actualnode = tree.getSelectedNode().getParent();
      tree.setSelectedNode(actualnode);
      actualnode.refresh();
    }

    request.setAttribute("Refresh", "true");

    return mapping.findForward("success");
  }
コード例 #2
0
  public ActionForward deleteCalendar(
      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_COMP_CALENDARS_EDIT});

    CalendarForm defaultForm = (CalendarForm) form;
    ICatalogAPI catalogAPI = session.getAPI().getCatalogAPI();
    String[] multibox = defaultForm.getMultibox();
    for (int i = 0; i < multibox.length; i++) {
      String idCalendar = multibox[i];
      IItem item =
          catalogAPI.getCTEntity(
              ICatalogAPI.ENTITY_SPAC_CALENDARIOS, new Integer(idCalendar).intValue());
      item.delete(session.getClientContext());
    }
    return mapping.findForward("success_deleteCalendar");
  }