Search in sources :

Example 26 with Revision

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;
}
Also used : Project(org.finos.legend.sdlc.domain.model.project.Project) Revision(org.finos.legend.sdlc.domain.model.revision.Revision) ProjectConfiguration(org.finos.legend.sdlc.domain.model.project.configuration.ProjectConfiguration)

Aggregations

Revision (org.finos.legend.sdlc.domain.model.revision.Revision)26 Entity (org.finos.legend.sdlc.domain.model.entity.Entity)15 ProjectConfiguration (org.finos.legend.sdlc.domain.model.project.configuration.ProjectConfiguration)10 Workspace (org.finos.legend.sdlc.domain.model.project.workspace.Workspace)9 LegendSDLCServerException (org.finos.legend.sdlc.server.error.LegendSDLCServerException)7 Project (org.finos.legend.sdlc.domain.model.project.Project)6 ProjectType (org.finos.legend.sdlc.domain.model.project.ProjectType)6 Instant (java.time.Instant)5 List (java.util.List)5 Test (org.junit.Test)5 Response (javax.ws.rs.core.Response)4 HttpResponseException (org.apache.http.client.HttpResponseException)4 Collections (java.util.Collections)3 Comparator (java.util.Comparator)3 Function (java.util.function.Function)3 Collectors (java.util.stream.Collectors)3 Lists (org.eclipse.collections.api.factory.Lists)3 Iterate (org.eclipse.collections.impl.utility.Iterate)3 ArtifactGeneration (org.finos.legend.sdlc.domain.model.project.configuration.ArtifactGeneration)3 MetamodelDependency (org.finos.legend.sdlc.domain.model.project.configuration.MetamodelDependency)3