List of usage examples for com.google.common.collect ImmutableMultimap of
public static <K, V> ImmutableMultimap<K, V> of()
From source file:org.apache.calcite.plan.volcano.VolcanoRelMetadataProvider.java
public <M extends Metadata> Multimap<Method, MetadataHandler<M>> handlers(MetadataDef<M> def) { return ImmutableMultimap.of(); }
From source file:org.graylog.plugins.pipelineprocessor.PipelineProcessorMessageDecorator.java
@Override public SearchResponse apply(SearchResponse searchResponse) { final List<ResultMessageSummary> results = new ArrayList<>(); if (pipelines.isEmpty()) { return searchResponse; }//from w ww .j a v a 2s .c o m searchResponse.messages().forEach((inMessage) -> { final Message message = new Message(inMessage.message()); final List<Message> additionalCreatedMessages = pipelineInterpreter.processForPipelines(message, pipelines, new NoopInterpreterListener(), pipelineStateUpdater.getLatestState()); results.add(ResultMessageSummary.create(inMessage.highlightRanges(), message.getFields(), inMessage.index())); additionalCreatedMessages.forEach((additionalMessage) -> { // TODO: pass proper highlight ranges. Need to rebuild them for new messages. results.add(ResultMessageSummary.create(ImmutableMultimap.of(), additionalMessage.getFields(), "[created from decorator]")); }); }); return searchResponse.toBuilder().messages(results).build(); }
From source file:org.jboss.errai.idea.plugin.ui.TemplateUtil.java
/** * Finds all "data-field" tags for the specified {@link org.jboss.errai.idea.plugin.ui.model.TemplateMetaData}. * * @param templateMetaData//from w ww . j a v a 2s . c om * the {@link org.jboss.errai.idea.plugin.ui.model.TemplateMetaData} to use to find the tag. * @param project * the IntelliJ <tt>Project</tt> reference. * @param includeRoot * boolean indicating whether or not to consider the root node in the search. If set to <tt>false</tt>, * only children of the node are considered. If Set to <tt>true</tt>, the root node itself is checked * to see if it is a data-field. * * @return Map of all datafields in the template class. */ @NotNull public static Multimap<String, TemplateDataField> findAllDataFieldTags(TemplateMetaData templateMetaData, Project project, boolean includeRoot) { if (!templateMetaData.getTemplateExpression().hasRootNode()) { includeRoot = true; } VirtualFile vf = templateMetaData.getTemplateFile(); XmlTag rootTag = templateMetaData.getRootTag(); if (vf == null) { return ImmutableMultimap.of(); } final PsiManager instance = PsiManager.getInstance(project); final PsiFile file = instance.findFile(vf); if (file == null) { return ImmutableMultimap.of(); } final XmlFile xmlFile = (XmlFile) file; if (rootTag == null) { rootTag = xmlFile.getRootTag(); } return findAllDataFieldTags(file, rootTag, includeRoot); }
From source file:org.apache.james.mailbox.store.search.SimpleMessageSearchIndex.java
private Multimap<MailboxId, Long> searchMultimap(MailboxSession session, Mailbox mailbox, SearchQuery query) throws MailboxException { if (!isMatchingUser(session, mailbox)) { return ImmutableMultimap.of(); }//from w w w .jav a 2 s . c o m MessageMapper mapper = messageMapperFactory.getMessageMapper(session); final SortedSet<MailboxMessage> hitSet = new TreeSet<MailboxMessage>(); UidCriterion uidCrit = findConjugatedUidCriterion(query.getCriterias()); if (uidCrit != null) { // if there is a conjugated uid range criterion in the query tree we can optimize by // only fetching this uid range NumericRange[] ranges = uidCrit.getOperator().getRange(); for (NumericRange r : ranges) { Iterator<MailboxMessage> it = mapper.findInMailbox(mailbox, MessageRange.range(r.getLowValue(), r.getHighValue()), FetchType.Metadata, -1); while (it.hasNext()) { hitSet.add(it.next()); } } } else { // we have to fetch all messages Iterator<MailboxMessage> messages = mapper.findInMailbox(mailbox, MessageRange.all(), FetchType.Full, -1); while (messages.hasNext()) { MailboxMessage m = messages.next(); hitSet.add(m); } } // MessageSearches does the filtering for us return ImmutableMultimap.<MailboxId, Long>builder() .putAll(mailbox.getMailboxId(), ImmutableList.copyOf(new MessageSearches(hitSet.iterator(), query, session).iterator())) .build(); }
From source file:uk.ac.open.kmi.iserve.sal.manager.impl.ServiceManagerIndexRdf.java
/** * Given an operation, this method obtains the list of input URIs mapped to their annotated types (i.e., modelReferences). * Note that the same input may have several annotations indicating the type. * * @param operationUri the URI for which we want to obtain the inputs and their annotated types * @return a Multimap with the inputs and their corresponding types. *//*from w ww .j av a 2s . co m*/ @Override public Multimap<URI, URI> listTypedInputs(URI operationUri) { if (operationUri == null) { return ImmutableMultimap.of(); } ImmutableMultimap.Builder<URI, URI> result = ImmutableMultimap.builder(); for (URI input : this.opInputMap.get(operationUri)) { result.putAll(input, this.modelReferencesMap.get(input)); } return result.build(); }
From source file:com.griddynamics.jagger.storage.rdb.OneTableJdbcKeyValueStorage.java
@Override public Multimap<String, Object> fetchAll(Namespace namespace) { List<Map<String, Object>> fetch; try {/*from w w w. j av a 2 s. co m*/ fetch = jdbcTemplate.queryForList( "select key as key, value as value from " + TABLE_NAME + " where name=? ", new Object[] { namespace.toString() }); } catch (EmptyResultDataAccessException e) { return ImmutableMultimap.of(); } Multimap<String, Object> result = ArrayListMultimap.create(); for (Map<String, Object> map : fetch) { String key = (String) map.get("key"); byte[] data = (byte[]) map.get("value"); Object value = SerializationUtils.deserialize(data); result.put(key, value); } return result; }
From source file:net.hydromatic.optiq.impl.jdbc.JdbcSchema.java
protected Multimap<String, TableFunction> getTableFunctions() { // TODO: populate map from JDBC metadata return ImmutableMultimap.of(); }
From source file:com.google.idea.blaze.base.model.MockBlazeProjectDataBuilder.java
public BlazeProjectData build() { TargetMap targetMap = this.targetMap != null ? this.targetMap : new TargetMap(ImmutableMap.of()); ImmutableMap<String, String> blazeInfo = this.blazeInfo != null ? this.blazeInfo : ImmutableMap.of(); BlazeRoots blazeRoots = this.blazeRoots != null ? this.blazeRoots : new BlazeRoots(null, ImmutableList.of(workspaceRoot.directory()), new ExecutionRootPath("bin"), new ExecutionRootPath("gen"), null); BlazeVersionData blazeVersionData = this.blazeVersionData != null ? this.blazeVersionData : new BlazeVersionData(); WorkspacePathResolver workspacePathResolver = this.workspacePathResolver != null ? this.workspacePathResolver : new WorkspacePathResolverImpl(workspaceRoot, blazeRoots); ArtifactLocationDecoder artifactLocationDecoder = this.artifactLocationDecoder != null ? this.artifactLocationDecoder : new ArtifactLocationDecoderImpl(blazeRoots, workspacePathResolver); WorkspaceLanguageSettings workspaceLanguageSettings = this.workspaceLanguageSettings != null ? this.workspaceLanguageSettings : new WorkspaceLanguageSettings(WorkspaceType.JAVA, ImmutableSet.of()); SyncState syncState = this.syncState != null ? this.syncState : new SyncState(ImmutableMap.of()); ImmutableMultimap<TargetKey, TargetKey> reverseDependencies = this.reverseDependencies != null ? this.reverseDependencies : ImmutableMultimap.of(); return new BlazeProjectData(syncTime, targetMap, blazeInfo, blazeRoots, blazeVersionData, workspacePathResolver, artifactLocationDecoder, workspaceLanguageSettings, syncState, reverseDependencies, null);/*from w ww .j a v a 2 s . c o m*/ }
From source file:org.jboss.errai.idea.plugin.ui.TemplateUtil.java
private static Multimap<String, TemplateDataField> findAllDataFieldTags(VirtualFile vf, XmlTag rootTag, Project project, boolean includeRoot) { if (vf == null) { return ImmutableMultimap.of(); }/*from ww w. j a v a 2s . c o m*/ final PsiManager instance = PsiManager.getInstance(project); final PsiFile file = instance.findFile(vf); if (file == null) { return ImmutableMultimap.of(); } if (rootTag == null) { rootTag = ((XmlFile) file).getRootTag(); } else { } return findAllDataFieldTags(file, rootTag, includeRoot); }
From source file:com.facebook.buck.features.python.PythonLibraryDescription.java
@Override public <U> Optional<U> createMetadata(BuildTarget buildTarget, ActionGraphBuilder graphBuilder, CellPathResolver cellRoots, PythonLibraryDescriptionArg args, Optional<ImmutableMap<BuildTarget, Version>> selectedVersions, Class<U> metadataClass) { Optional<Map.Entry<Flavor, MetadataType>> optionalType = METADATA_TYPE.getFlavorAndValue(buildTarget); if (!optionalType.isPresent()) { return Optional.empty(); }//w w w.j a v a 2 s . c o m FlavorDomain<UnresolvedCxxPlatform> cxxPlatforms = toolchainProvider .getByName(CxxPlatformsProvider.DEFAULT_NAME, CxxPlatformsProvider.class) .getUnresolvedCxxPlatforms(); Map.Entry<Flavor, MetadataType> type = optionalType.get(); BuildTarget baseTarget = buildTarget.withoutFlavors(type.getKey()); switch (type.getValue()) { case PACKAGE_COMPONENTS: { Map.Entry<Flavor, PythonPlatform> pythonPlatform = getPythonPlatforms().getFlavorAndValue(baseTarget) .orElseThrow(IllegalArgumentException::new); Map.Entry<Flavor, UnresolvedCxxPlatform> cxxPlatform = cxxPlatforms.getFlavorAndValue(baseTarget) .orElseThrow(IllegalArgumentException::new); baseTarget = buildTarget.withoutFlavors(pythonPlatform.getKey(), cxxPlatform.getKey()); SourcePathRuleFinder ruleFinder = new SourcePathRuleFinder(graphBuilder); SourcePathResolver pathResolver = DefaultSourcePathResolver.from(ruleFinder); Path baseModule = PythonUtil.getBasePath(baseTarget, args.getBaseModule()); PythonPackageComponents components = PythonPackageComponents.of( PythonUtil.getModules(baseTarget, graphBuilder, ruleFinder, pathResolver, pythonPlatform.getValue(), cxxPlatform.getValue().resolve(graphBuilder), "srcs", baseModule, args.getSrcs(), args.getPlatformSrcs(), args.getVersionedSrcs(), selectedVersions), PythonUtil.getModules(baseTarget, graphBuilder, ruleFinder, pathResolver, pythonPlatform.getValue(), cxxPlatform.getValue().resolve(graphBuilder), "resources", baseModule, args.getResources(), args.getPlatformResources(), args.getVersionedResources(), selectedVersions), ImmutableMap.of(), ImmutableMultimap.of(), args.getZipSafe()); return Optional.of(components).map(metadataClass::cast); } case PACKAGE_DEPS: { Map.Entry<Flavor, PythonPlatform> pythonPlatform = getPythonPlatforms().getFlavorAndValue(baseTarget) .orElseThrow(IllegalArgumentException::new); Map.Entry<Flavor, UnresolvedCxxPlatform> cxxPlatform = cxxPlatforms.getFlavorAndValue(baseTarget) .orElseThrow(IllegalArgumentException::new); ImmutableList<BuildTarget> depTargets = PythonUtil.getDeps(pythonPlatform.getValue(), cxxPlatform.getValue().resolve(graphBuilder), args.getDeps(), args.getPlatformDeps()); return Optional.of(graphBuilder.getAllRules(depTargets)).map(metadataClass::cast); } } throw new IllegalStateException(); }