List of usage examples for java.util Collection remove
boolean remove(Object o);
From source file:org.apache.ode.bpel.engine.DebuggerSupport.java
public void removeGlobalBreakpoint(Breakpoint breakpoint) { Collection<Breakpoint> c = CollectionUtils.makeCollection(ArrayList.class, _globalBreakPoints); c.remove(breakpoint); _globalBreakPoints = c.toArray(new Breakpoint[c.size()]); }
From source file:info.magnolia.security.app.dialog.action.SaveUserDialogAction.java
private void storeGroupsCollection(UserManager userManager, User user, Collection<String> newGroups) { Collection<String> oldGroups = new ArrayList<String>(); for (String group : user.getGroups()) { oldGroups.add(group);/* w w w .j a v a 2 s .co m*/ } for (String newGroup : newGroups) { userManager.addGroup(user, newGroup); oldGroups.remove(newGroup); } for (String oldGroup : oldGroups) { userManager.removeGroup(user, oldGroup); } }
From source file:net.ontopia.topicmaps.impl.basic.index.ClassInstanceIndex.java
@Override public Collection<TopicIF> getTopicTypes() { // Create new collection Collection<TopicIF> result = new ArrayList<TopicIF>(topics.keySet()); result.remove(null); return Collections.unmodifiableCollection(result); }
From source file:net.ontopia.topicmaps.impl.basic.index.ClassInstanceIndex.java
@Override public Collection<TopicIF> getTopicNameTypes() { // Create new collection Collection<TopicIF> result = new ArrayList<TopicIF>(bnames.keySet()); result.remove(null); return Collections.unmodifiableCollection(result); }
From source file:net.ontopia.topicmaps.impl.basic.index.ClassInstanceIndex.java
@Override public Collection<TopicIF> getOccurrenceTypes() { // Create new collection Collection<TopicIF> result = new ArrayList<TopicIF>(occurs.keySet()); result.remove(null); return Collections.unmodifiableCollection(result); }
From source file:net.ontopia.topicmaps.impl.basic.index.ClassInstanceIndex.java
@Override public Collection<TopicIF> getAssociationTypes() { // Create new collection Collection<TopicIF> result = new ArrayList<TopicIF>(assocs.keySet()); result.remove(null); return Collections.unmodifiableCollection(result); }
From source file:ManagedBeans.TaskBean.java
public String editar(TareaScrum tarea) throws IOException { FicherosScrum fichero = new FicherosScrum(); TareaScrum tareaModificada = new TareaScrum(); if (file != null) { if (!file.getFileName().equals("")) { byte[] bytes = IOUtils.toByteArray(file.getInputstream()); fichero.setFichero(bytes);//w w w .ja v a 2s . c om fichero.setExt(file.getFileName()); ficherosScrumFacade.create(fichero); tareaModificada.setIdFichero(fichero); } } tareaModificada.setNombre(titulo); tareaModificada.setDescripcion(descripcion); tareaModificada.setTiempoEstimado(tiempo); tareaModificada.setEstado(estadoSeleccionado); tareaModificada.setIdUsuario(loginBean.user); tareaModificada.setIdTarea(tarea.getIdTarea()); tareaModificada.setIdProyecto(loginBean.selectedProject); tareaModificada.setFechaIni(tarea.getFechaIni()); tareaModificada.setFechaFin(tarea.getFechaFin()); Collection<TareaScrum> tareaScrumCollection = loginBean.selectedProject.getTareaScrumCollection(); for (TareaScrum t : tareaScrumCollection) { if (Objects.equals(t.getIdTarea(), tarea.getIdTarea())) { tareaScrumCollection.remove(t); tareaScrumCollection.add(tareaModificada); proyectoScrumFacade.edit(loginBean.selectedProject); tareaScrumFacade.edit(tareaModificada); } } return "manageProject"; }
From source file:com.surevine.alfresco.esl.impl.webscript.visibility.SharedVisibilityReport.java
private Collection<Presence> stripUsersFromPresence(final String currentUserName, final Collection<Presence> presenceCollection) { // Strip current user for (final Presence presence : presenceCollection) { if (presence.getUserName().equals(currentUserName)) { presenceCollection.remove(presence); break; // Surely we'll only hit one instance? }/*from w ww . ja v a2s . c o m*/ } // Strip superUser for (final Presence presence : presenceCollection) { if (presence.getUserName().equals("superUser")) { presenceCollection.remove(presence); break; // Surely we'll only hit one instance? } } return presenceCollection; }
From source file:es.ucm.fdi.dalgs.competence.service.CompetenceService.java
@PreAuthorize("hasRole('ROLE_ADMIN')") @Transactional(propagation = Propagation.REQUIRED) public ResultClass<Boolean> deleteCompetenceFromSubject(Long id_competence, Long id_subject, Long id_degree, Long id_topic, Long id_module) { // Subject subject = daoSubject.getSubject(id); ResultClass<Boolean> result = new ResultClass<>(); Collection<Competence> c = serviceSubject.getSubject(id_subject, id_topic, id_module, id_degree) .getSingleElement().getCompetences(); try {//from www. j a v a 2 s . co m c.remove(repositoryCompetence.getCompetence(id_competence, id_degree)); result.setSingleElement(true); } catch (Exception e) { result.setSingleElement(false); ; } return result; }
From source file:org.opendatakit.persistence.table.UserGrantedAuthority.java
/** * Asserts that the given group has exactly the list of desired members and no additional members. * /*from w w w.j av a 2 s .c o m*/ * @param group * @param desiredMembers * @param cc * @throws ODKDatastoreException */ public static final void assertGrantedAuthorityMembers(GrantedAuthority group, Collection<String> desiredMembers, CallingContext cc) throws ODKDatastoreException { Datastore ds = cc.getDatastore(); User user = cc.getCurrentUser(); boolean hasNotChanged = true; try { UserGrantedAuthority relation = UserGrantedAuthority.assertRelation(ds, user); // get the members as currently defined for this group List<? extends CommonFieldsBase> membersList; Query query = ds.createQuery(relation, "UserGrantedAuthority.assertGrantedAuthorityMembers", user); query.addFilter(UserGrantedAuthority.GRANTED_AUTHORITY, FilterOperation.EQUAL, group.getAuthority()); membersList = query.executeQuery(); // OK we have the desired and actual members lists for this groupname. // find the set of members to remove... List<EntityKey> deleted = new ArrayList<EntityKey>(); for (CommonFieldsBase b : membersList) { UserGrantedAuthority t = (UserGrantedAuthority) b; String uriUser = t.getUser(); if (desiredMembers.contains(uriUser)) { desiredMembers.remove(uriUser); } else { deleted.add(t.getEntityKey()); } } // we now have the list of desiredMembers to insert, and the list of // existing records to delete... List<UserGrantedAuthority> added = new ArrayList<UserGrantedAuthority>(); for (String uriUser : desiredMembers) { UserGrantedAuthority t = ds.createEntityUsingRelation(relation, user); t.setUser(uriUser); t.setGrantedAuthority(group); added.add(t); } // we have no changes if there are no adds and no deletes hasNotChanged = added.isEmpty() && deleted.isEmpty(); // we now have the list of EntityKeys to delete, and the list of records to add -- do it. ds.putEntities(added, user); ds.deleteEntities(deleted, user); } finally { if (!hasNotChanged) { // we've changed -- reload the permissions tree... cc.getUserService().reloadPermissions(); } } }