public ProjectRelationshipFilter getTypeFilter() { if ( types == null || types.isEmpty() || new HashSet<RelationshipType>( types ).containsAll( Arrays.asList( RelationshipType.values() ) ) ) { return AnyFilter.INSTANCE; } else { return new RelationshipTypeFilter( types, isManagedIncluded(), isConcreteIncluded() ); } }
@SuppressWarnings( "unchecked" ) @Override public R build() { final R recipe = (R) new ProjectGraphRelationshipsRequest(); configure( recipe ); return recipe; }
@Override public MappedProjectRelationshipsResult getDirectRelationshipsFrom( final ProjectGraphRelationshipsRequest recipe ) throws CartoDataException, CartoRequestException { MappedProjectRelationshipsResult result = new MappedProjectRelationshipsResult(); final ProjectProjector<Set<ProjectRelationship<?, ?>>> extractor = ( ref, graph ) -> { final Set<ProjectRelationship<?, ?>> rels = graph.findDirectRelationshipsFrom( ref, recipe.isManagedIncluded(), recipe.isConcreteIncluded(), recipe.toTypeArray() ); return rels == null || rels.isEmpty() ? null : new HashSet<>( rels ); }; final ProjectCollector<Set<ProjectRelationship<?, ?>>> consumer = ( ref, rels ) -> { if ( rels != null ) { result.addProject( new MappedProjectRelationships( ref, rels ) ); } }; resolver.resolveAndExtractSingleGraph( recipe.getTypeFilter(), recipe, new MatchingProjectFunction<>( recipe, extractor, consumer ) ); return result; }
@Override public MappedProjectRelationshipsResult getDirectRelationshipsTo( final ProjectGraphRelationshipsRequest recipe ) throws CartoDataException, CartoRequestException { MappedProjectRelationshipsResult result = new MappedProjectRelationshipsResult(); final ProjectProjector<Set<ProjectRelationship<?, ?>>> extractor = ( ref, graph ) -> { final Set<ProjectRelationship<?, ?>> rels = graph.findDirectRelationshipsTo( ref, recipe.isManagedIncluded(), recipe.isConcreteIncluded(), recipe.toTypeArray() ); return rels == null || rels.isEmpty() ? null : new HashSet<>( rels ); }; final ProjectCollector<Set<ProjectRelationship<?, ?>>> consumer = ( ref, rels ) -> { if ( rels != null ) { result.addProject( new MappedProjectRelationships( ref, rels ) ); } }; resolver.resolveAndExtractSingleGraph( recipe.getTypeFilter(), recipe, new MatchingProjectFunction<>( recipe, extractor, consumer ) ); return result; }
@Override public MappedProjectRelationshipsResult getDirectRelationshipsTo( final ProjectGraphRelationshipsRequest recipe ) throws CartoDataException, CartoRequestException { MappedProjectRelationshipsResult result = new MappedProjectRelationshipsResult(); final ProjectProjector<Set<ProjectRelationship<?, ?>>> extractor = ( ref, graph ) -> { final Set<ProjectRelationship<?, ?>> rels = graph.findDirectRelationshipsTo( ref, recipe.isManagedIncluded(), recipe.isConcreteIncluded(), recipe.toTypeArray() ); return rels == null || rels.isEmpty() ? null : new HashSet<>( rels ); }; final ProjectCollector<Set<ProjectRelationship<?, ?>>> consumer = ( ref, rels ) -> { if ( rels != null ) { result.addProject( new MappedProjectRelationships( ref, rels ) ); } }; resolver.resolveAndExtractSingleGraph( recipe.getTypeFilter(), recipe, new MatchingProjectFunction<>( recipe, extractor, consumer ) ); return result; }
public ProjectRelationshipFilter getTypeFilter() { if ( types == null || types.isEmpty() || new HashSet<RelationshipType>( types ).containsAll( Arrays.asList( RelationshipType.values() ) ) ) { return AnyFilter.INSTANCE; } else { return new RelationshipTypeFilter( types, isManagedIncluded(), isConcreteIncluded() ); } }
@SuppressWarnings( "unchecked" ) @Override public R build() { final R recipe = (R) new ProjectGraphRelationshipsRequest(); configure( recipe ); return recipe; }
@Override public MappedProjectRelationshipsResult getDirectRelationshipsFrom( final ProjectGraphRelationshipsRequest recipe ) throws CartoDataException, CartoRequestException { MappedProjectRelationshipsResult result = new MappedProjectRelationshipsResult(); final ProjectProjector<Set<ProjectRelationship<?, ?>>> extractor = ( ref, graph ) -> { final Set<ProjectRelationship<?, ?>> rels = graph.findDirectRelationshipsFrom( ref, recipe.isManagedIncluded(), recipe.isConcreteIncluded(), recipe.toTypeArray() ); return rels == null || rels.isEmpty() ? null : new HashSet<>( rels ); }; final ProjectCollector<Set<ProjectRelationship<?, ?>>> consumer = ( ref, rels ) -> { if ( rels != null ) { result.addProject( new MappedProjectRelationships( ref, rels ) ); } }; resolver.resolveAndExtractSingleGraph( recipe.getTypeFilter(), recipe, new MatchingProjectFunction<>( recipe, extractor, consumer ) ); return result; }