public ActionForward deleteHolyday( 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; IItem item = (IItem) request.getSession().getAttribute("CALENDAR"); String calendarioXML = (String) item.getString("CALENDARIO"); CalendarDef calendarDef = new CalendarDef(calendarioXML); String[] datesSelected = defaultForm.getMultibox(); if (datesSelected != null) { for (int i = 0; i < datesSelected.length; i++) { calendarDef.removeHolyday(datesSelected[i]); } item.set("CALENDARIO", calendarDef.getXmlValues()); item.store(session.getClientContext()); } return getActionForwardShowDelete( request.getParameter("entityId"), request.getParameter("regId"), request.getParameter("nombre"), request.getParameter("weekDaysSelect")); // return getActionForwardShow(request.getParameter("entityId"),request.getParameter("regId")); }
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"); }