List of usage examples for com.google.common.collect Multimap get
Collection<V> get(@Nullable K key);
From source file:org.jclouds.aws.ec2.compute.strategy.AWSEC2ListNodesStrategy.java
protected Function<String, Set<SpotInstanceRequest>> spotInstancesByIdInRegion( final Multimap<String, String> idsByRegions) { return new Function<String, Set<SpotInstanceRequest>>() { @Override//from w ww. j a v a2 s . c o m public Set<SpotInstanceRequest> apply(String from) { return client.getSpotInstanceApi().get().describeSpotInstanceRequestsInRegion(from, toArray(idsByRegions.get(from), String.class)); } }; }
From source file:org.apache.aurora.scheduler.http.Maintenance.java
@GET @Produces(MediaType.APPLICATION_JSON)//from w w w . j a va 2 s. c o m public Response getHosts() { return storage.read(storeProvider -> { Multimap<MaintenanceMode, String> hostsByMode = Multimaps.transformValues(Multimaps .index(storeProvider.getAttributeStore().getHostAttributes(), IHostAttributes::getMode), IHostAttributes::getHost); Map<MaintenanceMode, Object> hosts = ImmutableMap.of(DRAINED, ImmutableSet.copyOf(hostsByMode.get(DRAINED)), SCHEDULED, ImmutableSet.copyOf(hostsByMode.get(SCHEDULED)), DRAINING, getTasksByHosts(storeProvider, hostsByMode.get(DRAINING)).asMap()); return Response.ok(hosts).build(); }); }
From source file:eu.esdihumboldt.hale.common.core.service.cleanup.impl.CleanupServiceImpl.java
private <T> Collection<T> take(CleanupContext context, Multimap<CleanupContext, T> elements) { switch (context) { case APPLICATION: // all elements Collection<T> res1 = new ArrayList<T>(elements.values()); elements.clear();// w w w.j a v a2s . c o m return res1; default: Collection<T> res2 = new ArrayList<T>(elements.get(context)); elements.removeAll(context); return res2; } }
From source file:fr.putnami.pwt.doc.client.page.sample.SamplePage.java
protected void addSources(Multimap<String, String> sources) { Panel panelToOpen = null;/*from w w w . jav a 2s. c o m*/ String sourceToOpen = null; for (String panelName : sources.keySet()) { List sourceList = new List(); sourceList.setType(Type.LIST); for (String source : sources.get(panelName)) { if (sourceToOpen == null) { sourceToOpen = source; } sourceList.add(new SourceItem(source)); } Panel sourcePanel = new Panel(); if (panelToOpen == null) { panelToOpen = sourcePanel; } sourcePanel.add(new Header(panelName)); sourcePanel.add(sourceList); this.samplePageLayout.sourceAccordion.add(sourcePanel); } this.requestFile(sourceToOpen); }
From source file:org.robotframework.ide.eclipse.main.plugin.navigator.handlers.ChangeExclusionHandler.java
public void changeExclusion(final IEventBroker eventBroker, final IStructuredSelection selection) { final List<IResource> resourcesToChange = Selections.getAdaptableElements(selection, IResource.class); final Map<IProject, Collection<RobotSuiteFile>> grouped = RobotSuiteFileCollector .collectGroupedByProject(resourcesToChange); final Multimap<IProject, IPath> groupedPaths = groupByProject(resourcesToChange); for (IResource res : resourcesToChange) { removeMarkers(res);//from ww w .j a va 2 s .c om } for (final IProject groupingProject : groupedPaths.keySet()) { changeExclusion(groupingProject, groupedPaths.get(groupingProject)); final RedProjectConfigEventData<Collection<IPath>> eventData = new RedProjectConfigEventData<>( groupingProject.getFile(RobotProjectConfig.FILENAME), groupedPaths.get(groupingProject)); eventBroker.send(RobotProjectConfigEvents.ROBOT_CONFIG_VALIDATION_EXCLUSIONS_STRUCTURE_CHANGED, eventData); final Collection<RobotSuiteFile> suiteModels = grouped.get(groupingProject); if (suiteModels != null) { final ModelUnitValidatorConfig validatorConfig = ModelUnitValidatorConfigFactory .create(suiteModels); final Job validationJob = RobotArtifactsValidator.createValidationJob(groupingProject, validatorConfig); validationJob.schedule(REVALIDATE_JOB_DELAY); } } SwtThread.asyncExec(new Runnable() { @Override public void run() { final IDecoratorManager manager = PlatformUI.getWorkbench().getDecoratorManager(); manager.update(RobotValidationExcludedDecorator.ID); } }); }
From source file:eu.tomylobo.routes.sign.TrackedSign.java
public TrackedSign(Multimap<String, String> section) { location = Ini.loadLocation(section, "%s", false); entries = new String[4]; int entryCount = 0; for (int i = 0; i < 4; ++i) { final Collection<String> values = section.get("line" + i); if (values.size() != 1) continue; entries[i] = Ini.getOnlyValue(values); ++entryCount;//w w w. ja v a 2 s. c o m } this.entryCount = entryCount; if (entryCount == 0) throw new IllegalArgumentException("A sign with no entries was parsed."); }
From source file:fr.putnami.pwt.doc.client.page.sample.SampleView.java
protected void addSources(Multimap<String, String> sources) { Panel panelToOpen = null;/* w w w. ja v a2s.c o m*/ String sourceToOpen = null; for (String panelName : sources.keySet()) { List sourceList = new List(); sourceList.setType(Type.LIST); for (String source : sources.get(panelName)) { if (sourceToOpen == null) { sourceToOpen = source; } sourceList.add(new SourceItem(source)); } Panel sourcePanel = new Panel(); if (panelToOpen == null) { panelToOpen = sourcePanel; } sourcePanel.add(new Header(panelName)); sourcePanel.add(sourceList); samplePageLayout.sourceAccordion.add(sourcePanel); } requestFile(sourceToOpen); }
From source file:org.xacml4j.v30.pdp.DefaultPolicyDecisionPoint.java
/** * Gets all attributes from an {@link EvaluationContext} which were resolved * and not present in the original access decision request * * @param context an evaluation context//from w ww .j a va 2 s .c o m * @return a collection of {@link Attribute} instances */ private Collection<Category> getResolvedAttributes(EvaluationContext context) { Map<AttributeDesignatorKey, BagOfAttributeExp> desig = context.getResolvedDesignators(); Multimap<CategoryId, Attribute> attributes = HashMultimap.create(); for (AttributeDesignatorKey k : desig.keySet()) { BagOfAttributeExp v = desig.get(k); Collection<Attribute> values = attributes.get(k.getCategory()); values.add(Attribute.builder(k.getAttributeId()).issuer(k.getIssuer()).values(v.values()).build()); } Collection<Category> result = new LinkedList<Category>(); for (CategoryId c : attributes.keySet()) { result.add(Category.builder(c).entity(Entity.builder().attributes(attributes.get(c)).build()).build()); } return result; }
From source file:com.b2international.snowowl.snomed.datastore.converter.SnomedReferenceSetMemberConverter.java
private void expandComponentCategory(Options expandOptions, Multimap<String, SnomedReferenceSetMember> referencedComponentIdToMemberMap, Multimap<ComponentCategory, String> componentCategoryToIdMap, ComponentCategory category) { final Collection<String> componentIds = componentCategoryToIdMap.get(category); final SearchResourceRequestBuilder<?, BranchContext, ? extends CollectionResource<? extends SnomedCoreComponent>> search; switch (category) { case CONCEPT: search = SnomedRequests.prepareSearchConcept(); break;/*www . ja v a 2s .c o m*/ case DESCRIPTION: search = SnomedRequests.prepareSearchDescription(); break; case RELATIONSHIP: search = SnomedRequests.prepareSearchRelationship(); break; default: throw new UnsupportedOperationException("Category is not supported in referenced component expansion"); } search.filterByIds(componentIds).setLimit(componentIds.size()).setLocales(locales()) .setExpand(expandOptions.get("expand", Options.class)); CollectionResource<? extends SnomedCoreComponent> components = search.build().execute(context()); for (SnomedCoreComponent component : components) { for (SnomedReferenceSetMember member : referencedComponentIdToMemberMap.get(component.getId())) { ((SnomedReferenceSetMember) member).setReferencedComponent(component); } } }
From source file:com.zimbra.client.ZGetInfoResult.java
/*** * * @return Set of all lowercased email addresses for this account, including primary name and any aliases. *///from w w w .j a v a2 s . c om public Set<String> getEmailAddresses() { Multimap<String, String> attrs = data.getAttrsMultimap(); Set<String> addresses = new HashSet<String>(); addresses.add(getName().toLowerCase()); for (String alias : attrs.get(ZAttrProvisioning.A_zimbraMailAlias)) { addresses.add(alias.toLowerCase()); } for (String allowFrom : attrs.get(ZAttrProvisioning.A_zimbraAllowFromAddress)) { addresses.add(allowFrom.toLowerCase()); } return addresses; }