Java Code Examples for com.google.common.collect.BiMap#putAll()
The following examples show how to use
com.google.common.collect.BiMap#putAll() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SubjectUtils.java From usergrid with Apache License 2.0 | 6 votes |
@SuppressWarnings( "unchecked" ) public static BiMap<UUID, String> getApplications() { Subject currentUser = getSubject(); if ( currentUser == null ) { return null; } if ( !currentUser.hasRole( ROLE_APPLICATION_ADMIN ) && !currentUser.hasRole( ROLE_APPLICATION_USER ) ) { return null; } Session session = currentUser.getSession(); BiMap<UUID, String> applications = HashBiMap.create(); Map map = (Map)session.getAttribute( "applications" ); applications.putAll(map); return applications; }
Example 2
Source File: ProtoRegistry.java From rejoiner with Apache License 2.0 | 5 votes |
ProtoRegistry build() { ImmutableListMultimap<String, TypeModification> modificationsMap = ImmutableListMultimap.copyOf( this.typeModifications.stream() .map( modification -> new SimpleImmutableEntry<>(modification.getTypeName(), modification)) .collect(Collectors.toList())); final BiMap<String, GraphQLType> mapping = HashBiMap.create(); GraphQLInterfaceType nodeInterface = new Relay() .nodeInterface( env -> { Relay.ResolvedGlobalId resolvedGlobalId = new Relay().fromGlobalId(env.getArguments().get("id").toString()); return (GraphQLObjectType) mapping.get(resolvedGlobalId.getType()); }); mapping.putAll( modifyTypes( getMap(fileDescriptors, descriptors, enumDescriptors, nodeInterface, schemaOptions), modificationsMap)); return new ProtoRegistry(mapping, nodeInterface); }
Example 3
Source File: SubjectUtils.java From usergrid with Apache License 2.0 | 5 votes |
public static BiMap<UUID, String> getOrganizations() { Subject currentUser = getSubject(); if ( !isOrganizationAdmin() ) { return null; } Session session = currentUser.getSession(); BiMap<UUID, String> organizations = HashBiMap.create(); Map map = (Map)session.getAttribute( "organizations" ); organizations.putAll(map); return organizations; }
Example 4
Source File: ManagementServiceImpl.java From usergrid with Apache License 2.0 | 5 votes |
@Override public BiMap<UUID, String> getApplicationsForOrganizations( Set<UUID> organizationIds ) throws Exception { if ( organizationIds == null ) { return null; } BiMap<UUID, String> applications = HashBiMap.create(); for ( UUID organizationId : organizationIds ) { BiMap<UUID, String> organizationApplications = getApplicationsForOrganization( organizationId ); applications.putAll( organizationApplications ); } return applications; }
Example 5
Source File: SwtScatterChart.java From tracecompass with Eclipse Public License 2.0 | 2 votes |
/** * Util method used to reset a bimap from a reference. * * @param reference * Reference map * @param map * Map to modify */ public static <K, V> void resetBiMap(BiMap<K, V> reference, BiMap<K, V> map) { map.clear(); map.putAll(reference); }