public ActionForward executeAction( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ISicresServicioRPAdmin oServicio = new ISicresServicioRPAdminAdapter(); // Se obtiene la entidad Entidad entidad = new Entidad(); entidad.setIdentificador(MultiEntityContextHolder.getEntity()); String id = request.getParameter("idSelect"); String isNodoSelected = request.getParameter("nodoSelected"); String idUnidadSeleccionada = (String) request.getSession(false).getAttribute("idUnidad"); try { // Tipo departamento if (isLdapMethod(entidad.getIdentificador())) { String nodeDn = null; ServiceTree serviceTree = (ServiceTree) request.getSession(false).getAttribute(Constantes.LDAP_SERVICE_GROUP_TREE); if (serviceTree != null) { boolean enc = serviceTree.searchNode(serviceTree.getTree(), Integer.parseInt(id)); if (enc) { NodeImplLDAP nodo = (NodeImplLDAP) serviceTree.fin.getRoot(); nodeDn = nodo.getCodigo(); // Sacar el dn a partir del id del árbol } else { // TODO OMAR Cambiar esta excepción throw new ISicresRPAdminException("No se ha encontrado el nodo en el árbol"); } } else { // TODO OMAR Cambiar esta excepción throw new ISicresRPAdminException("No se ha encontrado el árbol en sesión"); } int maxChildrenLdap = ((Integer) request .getSession() .getServletContext() .getAttribute(Constantes.MAX_CHILDREN_LDAP)) .intValue(); oServicio.importarGruposLdap( nodeDn, maxChildrenLdap, LdapConstants.LDAP_TYPE_TREE_GROUP, Boolean.valueOf(isNodoSelected).booleanValue(), idUnidadSeleccionada, entidad); } else oServicio.importarDepartamentos( Integer.parseInt(id), Boolean.valueOf(isNodoSelected).booleanValue(), idUnidadSeleccionada, entidad); } catch (ISicresRPAdminException e) { logger.error("Error en la aplicación", e); ActionErrors errores = new ActionErrors(); ActionError error = new ActionError("ieci.tecdoc.sgm.rpadmin.error.mensaje", e.getMessage()); errores.add("Error interno", error); saveErrors(request, errores); return mapping.findForward("error"); } return mapping.findForward("success"); }