use of org.jboss.pnc.facade.util.GraphDtoBuilder in project pnc by project-ncl.
the class BuildProviderImpl method getDependencyGraph.
@Override
public Graph<Build> getDependencyGraph(String buildId) {
Build specific = getSpecific(buildId);
if (specific == null) {
throw new EmptyEntityException("there is no record for given buildId.");
}
org.jboss.util.graph.Graph<BuildWithDependencies> buildGraph = createBuildDependencyGraph(buildId);
GraphDtoBuilder<BuildWithDependencies, Build> graphBuilder = new GraphDtoBuilder();
return graphBuilder.from(buildGraph, Build.class, vertex -> vertex.getData().getBuild());
}
use of org.jboss.pnc.facade.util.GraphDtoBuilder in project pnc by project-ncl.
the class BuildProviderImpl method getBuildGraphForGroupBuild.
@Override
public Graph<Build> getBuildGraphForGroupBuild(String groupBuildId) {
BuildConfigSetRecord buildConfigSetRecord = buildConfigSetRecordRepository.queryById(Integer.valueOf(groupBuildId));
if (buildConfigSetRecord == null) {
throw new EmptyEntityException("Build group " + groupBuildId + " does not exists.");
}
List<String> runningAndStoredIds = getBuildIdsInTheGroup(buildConfigSetRecord);
org.jboss.util.graph.Graph<BuildWithDependencies> buildGraph = new org.jboss.util.graph.Graph<>();
for (String buildId : runningAndStoredIds) {
org.jboss.util.graph.Graph<BuildWithDependencies> dependencyGraph = createBuildDependencyGraph(buildId);
GraphUtils.merge(buildGraph, dependencyGraph);
logger.trace("Merged graph from buildRecordId {} to BuildConfigSetRecordGraph {}; Edges {},", buildId, buildGraph, buildGraph.getEdges());
}
GraphDtoBuilder<BuildWithDependencies, Build> graphBuilder = new GraphDtoBuilder();
Graph<Build> graphDto = graphBuilder.from(buildGraph, Build.class, vertex -> vertex.getData().getBuild());
return graphDto;
}
Aggregations