@JsonIgnore public boolean isValid() { return getWorkspaceId() != null && getSourceLocation() != null && getGraphComposition() != null && getGraphComposition().valid(); }
public void normalize() { getGraphComposition().normalize(); normalize( patcherIds ); }
protected void configure( final R recipe ) { recipe.setExcludedSubgraphs( excludedSubgraphs ); recipe.setInjectedBOMs( injectedBOMs ); recipe.setPatcherIds( patcherIds ); recipe.setResolve( resolve ); recipe.setSource( source ); recipe.setSourceLocation( sourceLocation ); recipe.setTimeoutSecs( timeoutSecs ); recipe.setVersionSelections( versionSelections ); recipe.setWorkspaceId( workspaceId ); }
private void resolveDiscoveryConfig( final AbstractGraphRequest recipe ) throws CartoRequestException { if ( recipe.getDiscoveryConfig() == null ) { final Location sourceLocation = recipe.getSourceLocation(); if ( sourceLocation == null ) { throw new CartoRequestException( "Source Location appears not to have been set on RepositoryContentRequest: {}. Cannot create DiscoveryConfig.", this ); } final String uri = sourceLocation.getUri(); DiscoveryConfig ddc; try { ddc = new DiscoveryConfig( uri ); } catch ( final URISyntaxException e ) { throw new CartoRequestException( "Invalid Source Location URI: {}. Cannot create DiscoveryConfig.", uri ); } ddc.setEnabled( recipe.isResolve() ); ddc.setEnabledPatchers( recipe.getPatcherIds() ); ddc.setTimeoutMillis( 1000 * recipe.getTimeoutSecs() ); resolveDiscoveryLocations( ddc, recipe ); recipe.setDiscoveryConfig( ddc ); } }
throws CartoDataException, CartoRequestException logger.info( "Initial source location: '{}'", recipe.getSourceLocation() ); final URI sourceUri = sourceManager.createSourceURI( recipe.getSourceLocation().getUri() ); recipe.getSourceLocation(), sourceManager.getFormatHint() ); if ( !recipe.isResolve() ) final ViewParams params = new ViewParams.Builder( recipe.getWorkspaceId(), desc.rootsArray() ) .withFilter( desc.filter() ) .withMutator( desc.getMutatorInstance() ) .withSelections( recipe.getVersionSelections() ) .build(); final DiscoveryConfig discoveryConfig = recipe.getDiscoveryConfig(); final ViewParams params = new ViewParams.Builder( recipe.getWorkspaceId(), specifics ) .withFilter( aggOptions.getFilter() ) .withMutator( desc.getMutatorInstance() ) .withSelections( recipe.getVersionSelections() ) .build();
for ( final GraphDescription desc : recipe.getGraphComposition() ) if ( recipe.isResolve() ) final ViewParams params = new ViewParams.Builder( recipe.getWorkspaceId(), desc.rootsArray() ) .withFilter( desc.filter() ) .withMutator( desc.getMutatorInstance() ) .withSelections( recipe.getVersionSelections() ) .build();
private void resolveVersionSelections( final AbstractGraphRequest recipe ) throws CartoRequestException { final List<ProjectVersionRef> injectedBOMs = recipe.getInjectedBOMs(); if ( injectedBOMs != null ) { final List<? extends Location> locations = recipe.getDiscoveryConfig() .getLocations(); final Map<ProjectRef, ProjectVersionRef> injectedDepMgmt = recipe.getVersionSelections(); readDepMgmtToVersionMap( injectedBOMs, locations, injectedDepMgmt ); recipe.setVersionSelections( injectedDepMgmt ); } }
public void resolvePresets( final AbstractGraphRequest recipe ) { if ( recipe == null ) { return; } final GraphComposition comp = recipe.getGraphComposition(); resolvePresets( comp ); }
private AggregationOptions createAggregationOptions( final AbstractGraphRequest recipe, final ProjectRelationshipFilter baseFilter ) throws CartoDataException, CartoRequestException { final AggregationOptions options = new AggregationOptions(); options.setDiscoveryEnabled( recipe.isResolve() ); options.setFilter( recipe.buildFilter( baseFilter ) ); options.setDiscoveryConfig( recipe.getDiscoveryConfig() ); options.setProcessIncompleteSubgraphs( true ); options.setProcessVariableSubgraphs( true ); return options; }
public void resolve( final AbstractGraphRequest recipe ) throws CartoRequestException { if ( recipe == null ) { return; } resolveSourceLocations( recipe ); resolveDiscoveryConfig( recipe ); resolvePresets( recipe ); resolveMutators( recipe ); resolveVersionSelections( recipe ); if ( recipe instanceof RepositoryContentRequest ) { final RepositoryContentRequest rcr = (RepositoryContentRequest) recipe; final Set<String> excludedSources = rcr.getExcludedSources(); final Set<Location> excludedLocations = resolveSourceLocationSet( excludedSources ); rcr.setExcludedSourceLocations( excludedLocations ); } recipe.normalize(); if ( !recipe.isValid() ) { throw new CartoRequestException( "Invalid repository request: {}", recipe ); } }
public void resolveSourceLocations( final AbstractGraphRequest recipe ) throws CartoRequestException { if ( recipe == null ) { return; } final String spec = recipe.getSource(); if ( spec == null ) { return; } Location location; try { location = resolver.resolve( spec ); } catch ( final TransferException e ) { throw new CartoRequestException( "Failed to graph location from spec: '%s'. Reason: %s", e, spec, e.getMessage() ); } if ( location != null ) { recipe.setSourceLocation( location ); } }
final Location location = recipe.getSourceLocation(); try
public ProjectRelationshipFilter buildFilter( final ProjectRelationshipFilter filter ) { final List<ProjectVersionRef> excludedSubgraphs = getExcludedSubgraphs(); if ( excludedSubgraphs == null || excludedSubgraphs.isEmpty() ) { return filter; } else { return new ExcludingFilter( excludedSubgraphs, filter ); } }
private void resolveDiscoveryConfig( final AbstractGraphRequest recipe ) throws CartoRequestException { if ( recipe.getDiscoveryConfig() == null ) { final Location sourceLocation = recipe.getSourceLocation(); if ( sourceLocation == null ) { throw new CartoRequestException( "Source Location appears not to have been set on RepositoryContentRequest: {}. Cannot create DiscoveryConfig.", this ); } final String uri = sourceLocation.getUri(); DiscoveryConfig ddc; try { ddc = new DiscoveryConfig( uri ); } catch ( final URISyntaxException e ) { throw new CartoRequestException( "Invalid Source Location URI: {}. Cannot create DiscoveryConfig.", uri ); } ddc.setEnabled( recipe.isResolve() ); ddc.setEnabledPatchers( recipe.getPatcherIds() ); ddc.setTimeoutMillis( 1000 * recipe.getTimeoutSecs() ); resolveDiscoveryLocations( ddc, recipe ); recipe.setDiscoveryConfig( ddc ); } }
throws CartoDataException, CartoRequestException logger.info( "Initial source location: '{}'", recipe.getSourceLocation() ); final URI sourceUri = sourceManager.createSourceURI( recipe.getSourceLocation().getUri() ); recipe.getSourceLocation(), sourceManager.getFormatHint() ); if ( !recipe.isResolve() ) final ViewParams params = new ViewParams.Builder( recipe.getWorkspaceId(), desc.rootsArray() ) .withFilter( desc.filter() ) .withMutator( desc.getMutatorInstance() ) .withSelections( recipe.getVersionSelections() ) .build(); final DiscoveryConfig discoveryConfig = recipe.getDiscoveryConfig(); final ViewParams params = new ViewParams.Builder( recipe.getWorkspaceId(), specifics ) .withFilter( aggOptions.getFilter() ) .withMutator( desc.getMutatorInstance() ) .withSelections( recipe.getVersionSelections() ) .build();
for ( final GraphDescription desc : recipe.getGraphComposition() ) if ( recipe.isResolve() ) final ViewParams params = new ViewParams.Builder( recipe.getWorkspaceId(), desc.rootsArray() ) .withFilter( desc.filter() ) .withMutator( desc.getMutatorInstance() ) .withSelections( recipe.getVersionSelections() ) .build();
private void resolveVersionSelections( final AbstractGraphRequest recipe ) throws CartoRequestException { final List<ProjectVersionRef> injectedBOMs = recipe.getInjectedBOMs(); if ( injectedBOMs != null ) { final List<? extends Location> locations = recipe.getDiscoveryConfig() .getLocations(); final Map<ProjectRef, ProjectVersionRef> injectedDepMgmt = recipe.getVersionSelections(); readDepMgmtToVersionMap( injectedBOMs, locations, injectedDepMgmt ); recipe.setVersionSelections( injectedDepMgmt ); } }
@JsonIgnore public void setDefaultPreset( final String defaultPreset ) { getGraphComposition().setDefaultPreset( defaultPreset ); }
private AggregationOptions createAggregationOptions( final AbstractGraphRequest recipe, final ProjectRelationshipFilter baseFilter ) throws CartoDataException, CartoRequestException { final AggregationOptions options = new AggregationOptions(); options.setDiscoveryEnabled( recipe.isResolve() ); options.setFilter( recipe.buildFilter( baseFilter ) ); options.setDiscoveryConfig( recipe.getDiscoveryConfig() ); options.setProcessIncompleteSubgraphs( true ); options.setProcessVariableSubgraphs( true ); return options; }
public void resolve( final AbstractGraphRequest recipe ) throws CartoRequestException { if ( recipe == null ) { return; } resolveSourceLocations( recipe ); resolveDiscoveryConfig( recipe ); resolvePresets( recipe ); resolveMutators( recipe ); resolveVersionSelections( recipe ); if ( recipe instanceof RepositoryContentRequest ) { final RepositoryContentRequest rcr = (RepositoryContentRequest) recipe; final Set<String> excludedSources = rcr.getExcludedSources(); final Set<Location> excludedLocations = resolveSourceLocationSet( excludedSources ); rcr.setExcludedSourceLocations( excludedLocations ); } recipe.normalize(); if ( !recipe.isValid() ) { throw new CartoRequestException( "Invalid repository request: {}", recipe ); } }