public IItemCollection getPermissions(int typeObject, int idObject, int[] typePermissions) throws ISPACException { CollectionDAO coldao = PermissionDAO.getPermissions(mDbCnt, typeObject, idObject, typePermissions); List list = new ArrayList(); while (coldao.next()) { ObjectDAO permission = coldao.value(); String respName = permission.getString("RESP_NAME"); if (StringUtils.isBlank(respName)) { String idResp = permission.getString("ID_RESP"); IResponsible responsible = null; try { responsible = getResp(idResp); // } catch (ISPACException ie) { } catch (Exception ie) { // java.lang.NumberFormatException // si el ID_RESP no es un UID y es el nombre del responsable } /* if (responsible != null) { // Establecer el nombre del responsable permission.set("RESP_NAME", responsible.getRespName()); permission.store(mDbCnt); } else { // Eliminar el permiso asociado al responsable que ya no existe // permission.delete(mDbCnt); // No eliminar sino no incluirlo en la lista permission = null; } */ if (responsible != null) { // Establecer el nombre del responsable permission.set("RESP_NAME", responsible.getRespName()); permission.store(mDbCnt); } /*else { // Establecer el ID como nombre del responsable permission.set("RESP_NAME", idResp); } permission.store(mDbCnt); */ } if (permission != null) { list.add(permission); } } return new ListCollection(list); }
public IItemCollection getRespPermissions(int idpcd, int codePermission) throws ISPACException { CollectionDAO coldao = PermissionsDAO.getPermissions(mDbCnt, idpcd, codePermission); List list = new ArrayList(); while (coldao.next()) { ObjectDAO dao = coldao.value(); String uid = dao.getString("UID_USR"); IResponsible resp = getResp(uid); list.add(resp); } return new ListCollection(list); }