public String deleteSelectedRepoSubscriptions() { Subject subject = EnterpriseFacesContextUtility.getSubject(); String[] selected = getSelectedRepoSubscriptions(); int repoId = Integer.valueOf(FacesContextUtility.getRequiredRequestParameter("id")); int[] resourceIds = getIntegerArray(selected); if ((resourceIds != null) && (resourceIds.length > 0)) { try { RepoManagerLocal manager = LookupUtil.getRepoManagerLocal(); // TODO: we should have a SLSB method that takes a list of resources for (int resourceId : resourceIds) { manager.unsubscribeResourceFromRepos(subject, resourceId, new int[] {repoId}); } FacesContextUtility.addMessage( FacesMessage.SEVERITY_INFO, "Unsubscribed [" + resourceIds.length + "] resources from repository"); } catch (Exception e) { FacesContextUtility.addMessage( FacesMessage.SEVERITY_ERROR, "Failed to unsubscribe one or more resources from repository", e); } } return "success"; }
public String associateSelectedContentSourcesWithRepo() { Subject subject = EnterpriseFacesContextUtility.getSubject(); String[] selected = getSelectedRepoUnsubscriptions(); int repoId = Integer.valueOf(FacesContextUtility.getRequiredRequestParameter("id")); int[] resourceIds = getIntegerArray(selected); if ((resourceIds != null) && (resourceIds.length > 0)) { try { RepoManagerLocal manager = LookupUtil.getRepoManagerLocal(); for (int resourceId : resourceIds) { manager.subscribeResourceToRepos(subject, resourceId, new int[] {repoId}); } FacesContextUtility.addMessage( FacesMessage.SEVERITY_INFO, "Subscribed [" + resourceIds.length + "] resources with repository"); } catch (Exception e) { FacesContextUtility.addMessage( FacesMessage.SEVERITY_ERROR, "Failed to subscribe one or more resources with repository", e); } } return "success"; }