List of usage examples for java.util Set remove
boolean remove(Object o);
From source file:models.NotificationEvent.java
private static Set<User> getReceivers(AbstractPosting abstractPosting) { Set<User> receivers = abstractPosting.getWatchers(); receivers.addAll(getMentionedUsers(abstractPosting.body)); receivers.remove(UserApp.currentUser()); return receivers; }
From source file:models.NotificationEvent.java
public static void afterNewSVNCommitComment(Project project, CommitComment codeComment) throws IOException, SVNException, ServletException { Commit commit = RepositoryService.getRepository(project).getCommit(codeComment.commitId); Set<User> watchers = commit.getWatchers(project); watchers.addAll(getMentionedUsers(codeComment.contents)); watchers.remove(UserApp.currentUser()); NotificationEvent notiEvent = createFromCurrentUser(codeComment); notiEvent.title = formatReplyTitle(project, commit); notiEvent.receivers = watchers;//from ww w . j a va2s .co m notiEvent.eventType = NEW_COMMENT; notiEvent.oldValue = null; notiEvent.newValue = codeComment.contents; NotificationEvent.add(notiEvent); }
From source file:models.NotificationEvent.java
public static void afterNewCommitComment(Project project, ReviewComment comment, String commitId) throws IOException, SVNException, ServletException { Commit commit = RepositoryService.getRepository(project).getCommit(commitId); Set<User> watchers = commit.getWatchers(project); watchers.addAll(getMentionedUsers(comment.getContents())); watchers.remove(UserApp.currentUser()); NotificationEvent notiEvent = createFromCurrentUser(comment); notiEvent.title = formatReplyTitle(project, commit); notiEvent.receivers = watchers;// w w w .j a v a 2s. c om notiEvent.eventType = NEW_REVIEW_COMMENT; notiEvent.oldValue = null; notiEvent.newValue = comment.getContents(); NotificationEvent.add(notiEvent); }
From source file:models.NotificationEvent.java
/** * @see {@link controllers.PullRequestApp#newComment(String, String, Long, String)} *//*ww w .java 2 s. co m*/ public static void afterNewComment(User sender, PullRequest pullRequest, ReviewComment newComment, String urlToView) { NotificationEvent notiEvent = createFrom(sender, newComment); notiEvent.title = formatReplyTitle(pullRequest); Set<User> receivers = getMentionedUsers(newComment.getContents()); receivers.addAll(getReceivers(sender, pullRequest)); receivers.remove(User.findByLoginId(newComment.author.loginId)); notiEvent.receivers = receivers; notiEvent.eventType = NEW_REVIEW_COMMENT; notiEvent.oldValue = null; notiEvent.newValue = newComment.getContents(); NotificationEvent.add(notiEvent); }
From source file:org.commonjava.maven.atlas.graph.spi.neo4j.io.Conversions.java
public static void removeFromURISetProperty(final Collection<URI> uris, final String prop, final PropertyContainer container) { if (uris == null || uris.isEmpty() || !container.hasProperty(prop)) { return;/*www . ja v a2 s . c o m*/ } final Set<URI> existing = getURISetProperty(prop, container, null); for (final URI uri : uris) { existing.remove(uri); } if (existing.isEmpty()) { container.removeProperty(prop); } else { container.setProperty(prop, toStringArray(existing)); } }
From source file:com.centeractive.ws.builder.soap.SchemaUtils.java
/** * Extracts namespaces - used in tool integrations for mapping.. *//*from w w w .j av a 2 s .c o m*/ public static Collection<String> extractNamespaces(SchemaTypeSystem schemaTypes, boolean removeDefault) { Set<String> namespaces = new HashSet<String>(); SchemaType[] globalTypes = schemaTypes.globalTypes(); for (int c = 0; c < globalTypes.length; c++) { namespaces.add(globalTypes[c].getName().getNamespaceURI()); } if (removeDefault) { namespaces.removeAll(defaultSchemas.keySet()); namespaces.remove(Constants.SOAP11_ENVELOPE_NS); namespaces.remove(Constants.SOAP_ENCODING_NS); } return namespaces; }
From source file:net.ontopia.topicmaps.utils.TopicMapSynchronizer.java
/** * PUBLIC: Updates the target topic map from the source topic map, * synchronizing the selected topics in the target (ttopicq) with * the selected topics in the source (stopicq) using the deciders to * filter topic characteristics to synchronize. * @param target the topic map to update * @param ttopicq tolog query selecting the target topics to update * @param tchard filter for the target characteristics to update * @param source the source topic map//from w w w. jav a 2 s. c o m * @param stopicq tolog query selecting the source topics to use * @param schard filter for the source characteristics to update */ public static void update(TopicMapIF target, String ttopicq, DeciderIF<TMObjectIF> tchard, TopicMapIF source, String stopicq, DeciderIF<TMObjectIF> schard) throws InvalidQueryException { // build sets of topics Set<TopicIF> targetts = queryForSet(target, ttopicq); Set<TopicIF> sourcets = queryForSet(source, stopicq); // loop over source topics (we change targetts later, so we have to pass // a copy to the tracker) AssociationTracker tracker = new AssociationTracker(new CompactHashSet<TopicIF>(targetts), sourcets); Iterator<TopicIF> topicIterator = sourcets.iterator(); while (topicIterator.hasNext()) { TopicIF stopic = topicIterator.next(); TopicIF ttopic = getOrCreate(target, stopic); targetts.remove(ttopic); update(target, stopic, tchard, schard, tracker); } // remove extraneous associations Iterator<AssociationIF> associationIterator = tracker.getUnsupported().iterator(); while (associationIterator.hasNext()) { AssociationIF assoc = associationIterator.next(); log.debug("Tracker removing {}", assoc); assoc.remove(); } // remove extraneous topics topicIterator = targetts.iterator(); while (topicIterator.hasNext()) topicIterator.next().remove(); }
From source file:com.sishuok.chapter3.web.controller.chat.ChatController.java
@RequestMapping(params = "command=login") public String login(HttpSession session, @RequestParam("username") String username, Model model) { session.setAttribute("username", username); msgPublisher.login(username);/*from ww w .j ava 2s.c om*/ Set<String> loginUsers = (Set<String>) msgPublisher.getLoginUsers(); loginUsers.remove(username); model.addAttribute("loginUsers", loginUsers); return "chat"; }
From source file:edu.scripps.fl.pubchem.app.relations.ELinkStage.java
@Override public void preprocess() throws StageException { try {/*from w w w .j ava 2 s . co m*/ Set<String> dbs = EUtilsWebSession.getInstance().getDatabases(); dbs.remove("pccompound"); dbs.remove("pcsubstance"); databases = StringUtils.join(dbs, ","); } catch (Exception ex) { throw new StageException(this, ex); } }
From source file:net.sourceforge.fenixedu.domain.accessControl.academicAdministration.EnumArray.java
public EnumArray<T> without(T element) { Set<T> newElements = new HashSet<T>(elements); newElements.remove(element); return make(newElements); }