use of org.finos.legend.sdlc.domain.model.revision.Revision in project legend-sdlc by finos.
the class DependenciesApiImpl method getDownstreamProjects.
@Override
public Set<ProjectRevision> getDownstreamProjects(String projectId) {
/*
TODO : Maybe enable ElasticSearch for Gitlab https://docs.gitlab.com/ee/integration/elasticsearch.html ??
*/
List<Project> projects = // false because downstream projects might not be owned by the current user
this.projectApi.getProjects(// false because downstream projects might not be owned by the current user
false, null, null, null, null);
Set<ProjectRevision> results = Sets.mutable.empty();
for (Project otherProject : projects) {
String otherProjectId = otherProject.getProjectId();
if (!projectId.equals(otherProjectId)) {
Revision otherProjectRevision = this.revisionApi.getProjectRevisionContext(otherProjectId).getCurrentRevision();
ProjectConfiguration projectConfiguration = this.projectConfigurationApi.getProjectRevisionProjectConfiguration(otherProjectId, otherProjectRevision.getId());
if (Iterate.anySatisfy(projectConfiguration.getProjectDependencies(), d -> projectId.equals(d.getProjectId()))) {
results.add(new ProjectRevision(otherProject.getProjectId(), otherProjectRevision.getId()));
}
}
}
return results;
}
Aggregations