List of usage examples for java.util Set remove
boolean remove(Object o);
From source file:com.github.jrrdev.mantisbtsync.core.jobs.projects.tasklets.ProjectsExtractorTasklet.java
/** * {@inheritDoc}/*from w w w .j av a 2s. co m*/ * @see org.springframework.batch.core.step.tasklet.Tasklet#execute(org.springframework.batch.core.StepContribution, org.springframework.batch.core.scope.context.ChunkContext) */ @Override public RepeatStatus execute(final StepContribution contribution, final ChunkContext chunkContext) throws Exception { final Set<BigInteger> projectsId = (Set<BigInteger>) chunkContext.getStepContext().getJobExecutionContext() .get("mantis.loop.projects_to_process"); if (projectsId != null && !projectsId.isEmpty()) { final BigInteger id = projectsId.iterator().next(); projectsId.remove(id); chunkContext.getStepContext().getStepExecution().getExecutionContext().put("mantis.loop.project_id", id); } else { chunkContext.getStepContext().getStepExecution().getExecutionContext().remove("mantis.loop.project_id"); } return RepeatStatus.FINISHED; }
From source file:de.hybris.platform.commercefacades.customergroups.impl.DefaultCustomerGroupFacade.java
@Override public void removeUserFromCustomerGroup(final String customerGroupId, final String userId) { Assert.notNull(customerGroupId);/*from ww w . j av a 2 s .co m*/ Assert.notNull(userId); final UserModel user = getUserById(userId); final UserGroupModel group = getCustomerGroupById(customerGroupId); final Set<PrincipalModel> members = new HashSet<PrincipalModel>(group.getMembers()); members.remove(user); group.setMembers(members); getModelService().save(group); getModelService().refresh(user); }
From source file:com.arpnetworking.metrics.proxy.models.protocol.v1.MetricMessagesProcessor.java
private void unsubscribe(final String service, final String metric, final String statistic) { if (!_subscriptions.containsKey(service)) { return;/* ww w . j a v a 2 s .c om*/ } final Map<String, Set<String>> metrics = _subscriptions.get(service); if (!metrics.containsKey(metric)) { return; } final Set<String> statistics = metrics.get(metric); if (statistics.contains(statistic)) { statistics.remove(statistic); } }
From source file:com.cimpoint.mes.server.repositories.WorkCenterRepository.java
@Transactional public EWorkCenter update(EWorkCenter workCenter, TrxInfo trxInfo) { Set<EEquipment> eqs = workCenter.getEquipments(); if (eqs != null) { for (EEquipment eq : eqs) { eq = this.entityManager.merge(eq); eq.setWorkCenter(workCenter); }/*w w w. ja v a 2s . c o m*/ } Set<EStep> steps = workCenter.getSteps(); if (steps != null) { for (EStep s : steps) { s = this.entityManager.merge(s); Set<EWorkCenter> wcs = s.getWorkCenters(); if (wcs != null) { for (EWorkCenter wc : wcs) { if (wc.getName().equals(workCenter.getName())) { wcs.remove(wc); break; } } wcs.add(workCenter); } } } workCenter = super.update(workCenter, trxInfo); return workCenter; }
From source file:com.sshdemo.common.report.manage.service.TextReportService.java
@Override public void delTextReport(Long textReportId) { TextReport textReport = textReportDAO.get(textReportId); Assert.notNull(textReport);/*from ww w . j a va 2s. c om*/ List<CategoryReport> categories = textReportDAO.findCategoryReportByTextReportId(textReportId); if (categories != null && !categories.isEmpty()) { for (CategoryReport categoryReport : categories) { Set<TextReport> textReports = categoryReport.getTexts(); if (textReports.isEmpty()) continue; textReports.remove(textReport); categoryReport.setTexts(textReports); categorReportDAO.merge(categoryReport); } } List<EwcmsJobReport> ewcmsJobReports = textReportDAO.findEwcmsJobReportByTextReportId(textReportId); if (ewcmsJobReports != null && !ewcmsJobReports.isEmpty()) { for (EwcmsJobReport ewcmsJobReport : ewcmsJobReports) { if (ewcmsJobReport.getChartReport() == null) { ewcmsJobReportDAO.remove(ewcmsJobReport); } else { ewcmsJobReport.setTextReport(null); ewcmsJobReportDAO.merge(ewcmsJobReport); } } } textReportDAO.removeByPK(textReportId); }
From source file:net.sf.jdmf.algorithms.association.AprioriAlgorithm.java
/** * Generates descendant rules. If there are k conditions and l consequences, * rules with (k - 1) conditions and (l + 1) consequences are generated, * one for each condition converted to a consequence. Rules not accurate * enough are removed./* www . j av a2 s . c om*/ */ protected List<Rule> generateDescendantRules(Set<Item> conditionItemSet, Set<Item> consequenceItemSet, List<Instance> instances) { List<Rule> descendantRules = new ArrayList<Rule>(); if (conditionItemSet.size() == 1) { return descendantRules; } for (Item conditionItem : conditionItemSet) { Set<Item> descendantConditionItemSet = new LinkedHashSet<Item>(conditionItemSet); descendantConditionItemSet.remove(conditionItem); Set<Item> descendantConsequenceItemSet = new LinkedHashSet<Item>(consequenceItemSet); descendantConsequenceItemSet.add(conditionItem); Rule descendantRule = generateRule(descendantConditionItemSet, descendantConsequenceItemSet); Double descendantRuleAccuracy = calculateAccuracy(descendantRule, instances); if (descendantRuleAccuracy >= minRuleAccuracy) { descendantRules.add(descendantRule); descendantRules.addAll(generateDescendantRules(descendantConditionItemSet, descendantConsequenceItemSet, instances)); } } return descendantRules; }
From source file:org.magnum.mobilecloud.video.VideoLikeController.java
@RequestMapping(value = VideoSvcApi.VIDEO_SVC_PATH + "/{id}/unlike", method = RequestMethod.POST) public void unlikeVideo(@PathVariable("id") long id, Principal p, HttpServletResponse resp) { Video v = videos.findOne(id);//from w w w. ja v a 2s .c om if (v == null) { resp.setStatus(HttpServletResponse.SC_NOT_FOUND); } else { Set<String> likedUsernames = v.getLikedUsernames(); String username = p.getName(); if (!likedUsernames.contains(username)) { resp.setStatus(HttpServletResponse.SC_BAD_REQUEST); } else { likedUsernames.remove(username); v.setLikedUsernames(likedUsernames); v.setLikes(likedUsernames.size()); videos.save(v); } } }
From source file:service.TagService.java
public void deleteClientTag(Long clientId, Long tagId, Long pkId) { if (pkId != null) { if (clientId != null) { Client c = clientDao.find(clientId); if (tagId != null) { Tag t = tagDao.find(tagId); Set<Tag> tags = c.getTags(); tags.remove(t); c.setTags(tags);/*from ww w . ja v a 2 s. c om*/ if (validate(c)) { clientDao.update(c); } } else { addError(" ? "); } } else { addError(" "); } } else { addError(" "); } }
From source file:de.hybris.platform.b2bacceleratorservices.company.impl.DefaultB2BCommerceUserService.java
@Override public B2BUserGroupModel deselectB2BUserGroupFromCustomer(final String user, final String usergroup) { final B2BCustomerModel customer = this.getCustomerForUid(user); final Set<PrincipalGroupModel> groups = new HashSet<PrincipalGroupModel>(customer.getGroups()); final B2BUserGroupModel userGroupModel = this.getB2BUserGroupForUid(usergroup); groups.remove(userGroupModel); customer.setGroups(groups);/*from ww w . ja v a 2s . c om*/ this.getModelService().save(customer); return userGroupModel; }
From source file:io.undertow.servlet.test.path.FilterPathMappingTestCase.java
private void requireHeaders(final HttpResponse result, final String... headers) { final Header[] resultHeaders = result.getAllHeaders(); final List<Header> realResultHeaders = new ArrayList<>(); for (Header header : resultHeaders) { if (header.getName().startsWith("filter")) { realResultHeaders.add(header); }/*from ww w. j a v a 2s . c o m*/ } final Set<String> found = new HashSet<>(Arrays.asList(headers)); for (Header header : realResultHeaders) { if (!found.remove(header.getValue())) { Assert.fail("Found unexpected header " + header.getValue()); } } if (!found.isEmpty()) { Assert.fail("header(s) not found " + found); } }