From c55a3392585d269acdbbae32b3018b572c097544 Mon Sep 17 00:00:00 2001 From: Gayathri Rallapalle Date: Thu, 24 Aug 2023 06:52:52 -0400 Subject: [PATCH] Clean SourceSpecification part II --- .../legend/sdlc/domain/model/patch/Patch.java | 58 ++++++++- .../model/project/DevelopmentStream.java | 37 ++++-- .../project/DevelopmentStreamConsumer.java | 17 ++- .../model/project/DevelopmentStreamType.java | 20 +++ .../project/DevelopmentStreamVisitor.java | 17 ++- .../project/ProjectDevelopmentStream.java | 18 +-- .../model/project/workspace/Workspace.java | 4 + .../sdlc/domain/model/review/Review.java | 5 + .../comparison/FileSystemComparisonApi.java | 2 +- .../server/api/patch/FileSystemPatchApi.java | 6 + .../api/review/FileSystemReviewApi.java | 8 +- .../api/workspace/FileSystemWorkspaceApi.java | 22 ++-- .../domain/api/comparison/ComparisonApi.java | 10 +- .../server/domain/api/entity/EntityApi.java | 4 +- .../server/domain/api/patch/PatchApi.java | 8 ++ .../api/project/ProjectConfigurationApi.java | 6 +- .../project/source/SourceSpecification.java | 36 +++--- .../server/domain/api/review/ReviewApi.java | 24 +++- .../domain/api/workflow/WorkflowApi.java | 2 +- .../domain/api/workflow/WorkflowJobApi.java | 2 +- .../api/workspace/PatchWorkspaceSource.java | 66 ---------- .../domain/api/workspace/WorkspaceApi.java | 23 ++-- .../api/workspace/WorkspaceSpecification.java | 28 ++-- .../sdlc/server/gitlab/api/BaseGitLabApi.java | 83 +++++------- .../gitlab/api/GitLabApiWithFileAccess.java | 12 +- .../gitlab/api/GitLabComparisonApi.java | 18 +-- .../api/GitLabConflictResolutionApi.java | 2 +- .../server/gitlab/api/GitLabEntityApi.java | 4 +- .../server/gitlab/api/GitLabPatchApi.java | 28 ++++ .../api/GitLabProjectConfigurationApi.java | 4 +- .../server/gitlab/api/GitLabReviewApi.java | 77 +++++++---- .../server/gitlab/api/GitLabRevisionApi.java | 2 +- .../server/gitlab/api/GitLabWorkspaceApi.java | 52 ++++---- .../server/gitlab/api/GitlabWorkflowApi.java | 2 +- .../project/ProjectFileAccessProvider.java | 6 +- .../sdlc/server/project/ProjectStructure.java | 2 +- ...PatchesGroupWorkspaceEntitiesResource.java | 4 +- ...chesGroupWorkspaceEntityPathsResource.java | 2 +- ...WorkspaceProjectConfigurationResource.java | 2 +- .../BackupPatchesGroupWorkspaceResource.java | 8 +- ...roupWorkspaceRevisionEntitiesResource.java | 4 +- ...pWorkspaceRevisionEntityPathsResource.java | 2 +- ...eRevisionProjectConfigurationResource.java | 2 +- ...atchesGroupWorkspaceRevisionsResource.java | 4 +- ...ackupPatchesWorkspaceEntitiesResource.java | 4 +- ...upPatchesWorkspaceEntityPathsResource.java | 2 +- ...WorkspaceProjectConfigurationResource.java | 2 +- .../user/BackupPatchesWorkspaceResource.java | 8 +- ...chesWorkspaceRevisionEntitiesResource.java | 4 +- ...sWorkspaceRevisionEntityPathsResource.java | 2 +- ...eRevisionProjectConfigurationResource.java | 2 +- ...ckupPatchesWorkspaceRevisionsResource.java | 4 +- ...tchesGroupComparisonWorkspaceResource.java | 4 +- .../ComparisonPatchesWorkspaceResource.java | 4 +- ...PatchesGroupWorkspaceEntitiesResource.java | 4 +- ...chesGroupWorkspaceEntityPathsResource.java | 2 +- ...WorkspaceProjectConfigurationResource.java | 2 +- ...solutionPatchesGroupWorkspaceResource.java | 10 +- ...roupWorkspaceRevisionEntitiesResource.java | 4 +- ...pWorkspaceRevisionEntityPathsResource.java | 2 +- ...eRevisionProjectConfigurationResource.java | 2 +- ...atchesGroupWorkspaceRevisionsResource.java | 4 +- ...utionPatchesWorkspaceEntitiesResource.java | 4 +- ...onPatchesWorkspaceEntityPathsResource.java | 2 +- ...WorkspaceProjectConfigurationResource.java | 2 +- ...ictResolutionPatchesWorkspaceResource.java | 10 +- ...chesWorkspaceRevisionEntitiesResource.java | 4 +- ...sWorkspaceRevisionEntityPathsResource.java | 2 +- ...eRevisionProjectConfigurationResource.java | 2 +- ...tionPatchesWorkspaceRevisionsResource.java | 4 +- ...WorkspaceRevisionDependenciesResource.java | 2 +- ...WorkspaceRevisionDependenciesResource.java | 2 +- ...PatchesGroupWorkspaceEntitiesResource.java | 14 +- ...esGroupWorkspaceEntityChangesResource.java | 2 +- ...chesGroupWorkspaceEntityPathsResource.java | 2 +- ...roupWorkspaceRevisionEntitiesResource.java | 4 +- ...pWorkspaceRevisionEntityPathsResource.java | 2 +- .../PatchesWorkspaceEntitiesResource.java | 14 +- ...PatchesWorkspaceEntityChangesResource.java | 2 +- .../PatchesWorkspaceEntityPathsResource.java | 2 +- ...chesWorkspaceRevisionEntitiesResource.java | 4 +- ...sWorkspaceRevisionEntityPathsResource.java | 2 +- .../resources/patch/PatchesResource.java | 20 +++ ...WorkspacePureModelContextDataResource.java | 4 +- ...eRevisionPureModelContextDataResource.java | 2 +- ...WorkspacePureModelContextDataResource.java | 4 +- ...eRevisionPureModelContextDataResource.java | 2 +- ...WorkspaceProjectConfigurationResource.java | 6 +- ...eRevisionProjectConfigurationResource.java | 4 +- ...WorkspaceProjectConfigurationResource.java | 6 +- ...eRevisionProjectConfigurationResource.java | 4 +- .../review/patch/PatchReviewsResource.java | 2 +- ...GroupWorkspaceEntityRevisionsResource.java | 4 +- ...roupWorkspacePackageRevisionsResource.java | 4 +- ...atchesGroupWorkspaceRevisionsResource.java | 4 +- ...tchesWorkspaceEntityRevisionsResource.java | 4 +- ...chesWorkspacePackageRevisionsResource.java | 4 +- .../PatchesWorkspaceRevisionsResource.java | 4 +- ...hesGroupWorkspaceWorkflowJobsResource.java | 12 +- ...atchesGroupWorkspaceWorkflowsResource.java | 4 +- .../PatchesWorkspaceWorkflowJobsResource.java | 12 +- .../PatchesWorkspaceWorkflowsResource.java | 4 +- .../group/PatchesGroupWorkspacesResource.java | 12 +- .../patch/user/PatchesWorkspacesResource.java | 12 +- .../api/GitLabComparisonApiTestResource.java | 28 ++-- .../api/GitLabEntityApiTestResource.java | 4 +- .../api/GitLabPatchApiTestResource.java | 30 +++++ ...abProjectConfigurationApiTestResource.java | 8 +- .../api/GitLabRevisionApiTestResource.java | 4 +- .../api/GitLabWorkspaceApiTestResource.java | 62 ++++----- .../server/gitlab/api/TestBaseGitLabApi.java | 122 +++++++++--------- .../IntegrationTestGitLabPatchApis.java | 6 + .../api/server/TestGitLabServerPatchApis.java | 6 + .../backend/api/InMemoryComparisonApi.java | 2 +- .../backend/api/InMemoryEntityApi.java | 22 ++-- .../backend/api/InMemoryPatchApi.java | 7 + .../api/InMemoryProjectConfigurationApi.java | 14 +- .../backend/api/InMemoryReviewApi.java | 7 +- .../backend/api/InMemoryRevisionApi.java | 22 ++-- .../backend/api/InMemoryWorkspaceApi.java | 40 +++--- .../inmemory/domain/api/InMemoryPatch.java | 21 +-- .../inmemory/domain/api/InMemoryReview.java | 72 +++++++++-- .../domain/api/InMemoryWorkspace.java | 10 ++ .../resources/TestDependenciesResource.java | 2 +- .../server/resources/TestPatchesResource.java | 19 +++ 125 files changed, 897 insertions(+), 636 deletions(-) rename legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/workspace/WorkspaceSource.java => legend-sdlc-model/src/main/java/org/finos/legend/sdlc/domain/model/project/DevelopmentStream.java (51%) rename legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/workspace/WorkspaceSourceConsumer.java => legend-sdlc-model/src/main/java/org/finos/legend/sdlc/domain/model/project/DevelopmentStreamConsumer.java (65%) create mode 100644 legend-sdlc-model/src/main/java/org/finos/legend/sdlc/domain/model/project/DevelopmentStreamType.java rename legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/workspace/WorkspaceSourceVisitor.java => legend-sdlc-model/src/main/java/org/finos/legend/sdlc/domain/model/project/DevelopmentStreamVisitor.java (57%) rename legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/workspace/ProjectWorkspaceSource.java => legend-sdlc-model/src/main/java/org/finos/legend/sdlc/domain/model/project/ProjectDevelopmentStream.java (60%) delete mode 100644 legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/workspace/PatchWorkspaceSource.java diff --git a/legend-sdlc-model/src/main/java/org/finos/legend/sdlc/domain/model/patch/Patch.java b/legend-sdlc-model/src/main/java/org/finos/legend/sdlc/domain/model/patch/Patch.java index bee6e04e27..b27d2abe95 100644 --- a/legend-sdlc-model/src/main/java/org/finos/legend/sdlc/domain/model/patch/Patch.java +++ b/legend-sdlc-model/src/main/java/org/finos/legend/sdlc/domain/model/patch/Patch.java @@ -15,11 +15,63 @@ package org.finos.legend.sdlc.domain.model.patch; +import org.finos.legend.sdlc.domain.model.project.DevelopmentStream; +import org.finos.legend.sdlc.domain.model.project.DevelopmentStreamType; +import org.finos.legend.sdlc.domain.model.project.DevelopmentStreamVisitor; import org.finos.legend.sdlc.domain.model.version.VersionId; -public interface Patch +import java.util.Objects; + +public class Patch extends DevelopmentStream { - String getProjectId(); + private String projectId; + private VersionId patchReleaseVersionId; + + public Patch(String projectId, VersionId patchReleaseVersionId) + { + super(DevelopmentStreamType.PATCH.toString()); + this.projectId = Objects.requireNonNull(projectId, "projectId may not be null"); + this.patchReleaseVersionId = Objects.requireNonNull(patchReleaseVersionId, "patchReleaseVersionId is not null"); + } + + public Patch() + { + super(DevelopmentStreamType.PATCH.toString()); + } + + public String getProjectId() + { + return this.projectId; + } + + public VersionId getPatchReleaseVersionId() + { + return this.patchReleaseVersionId; + } + + @Override + public T visit(DevelopmentStreamVisitor visitor) + { + return visitor.visit(this); + } + + @Override + public boolean equals(Object other) + { + return (this == other) || + ((other instanceof Patch) && this.patchReleaseVersionId.equals(((Patch) other).patchReleaseVersionId)); + } + + @Override + public int hashCode() + { + return this.patchReleaseVersionId.hashCode(); + } + + @Override + protected StringBuilder appendAdditionalInfo(StringBuilder builder) + { + return this.patchReleaseVersionId.appendVersionIdString(builder.append(" patchVersion=")); + } - VersionId getPatchReleaseVersionId(); } \ No newline at end of file diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/workspace/WorkspaceSource.java b/legend-sdlc-model/src/main/java/org/finos/legend/sdlc/domain/model/project/DevelopmentStream.java similarity index 51% rename from legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/workspace/WorkspaceSource.java rename to legend-sdlc-model/src/main/java/org/finos/legend/sdlc/domain/model/project/DevelopmentStream.java index 2b558706c9..7fa18fba40 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/workspace/WorkspaceSource.java +++ b/legend-sdlc-model/src/main/java/org/finos/legend/sdlc/domain/model/project/DevelopmentStream.java @@ -12,20 +12,24 @@ // See the License for the specific language governing permissions and // limitations under the License. -package org.finos.legend.sdlc.server.domain.api.workspace; +package org.finos.legend.sdlc.domain.model.project; + +import org.finos.legend.sdlc.domain.model.patch.Patch; import org.finos.legend.sdlc.domain.model.version.VersionId; -import org.finos.legend.sdlc.server.domain.api.project.source.SourceSpecification; -public abstract class WorkspaceSource +import java.util.Objects; + +public abstract class DevelopmentStream { - WorkspaceSource() + private static String type; + + public DevelopmentStream(String type) { + this.type = Objects.requireNonNull(type, "developemnt stream type amy not be null"); } - public abstract SourceSpecification getSourceSpecification(); - - public abstract T visit(WorkspaceSourceVisitor visitor); + public abstract T visit(DevelopmentStreamVisitor visitor); @Override public String toString() @@ -33,25 +37,30 @@ public String toString() return appendString(new StringBuilder()).toString(); } - StringBuilder appendString(StringBuilder builder) + public StringBuilder appendString(StringBuilder builder) { return appendAdditionalInfo(builder.append("<").append(getClass().getSimpleName())).append('>'); } protected abstract StringBuilder appendAdditionalInfo(StringBuilder builder); - public static ProjectWorkspaceSource projectWorkspaceSource() + public String getType() + { + return this.type; + } + + public static ProjectDevelopmentStream projectDevelopmentStream() { - return ProjectWorkspaceSource.INSTANCE; + return ProjectDevelopmentStream.INSTANCE; } - public static PatchWorkspaceSource patchWorkspaceSource(String patch) + public static Patch patch(String projectId, VersionId patchReleaseVersionId) { - return patchWorkspaceSource(VersionId.parseVersionId(patch)); + return new Patch(projectId, patchReleaseVersionId); } - public static PatchWorkspaceSource patchWorkspaceSource(VersionId patch) + public static Patch patch(String projectId, String patchReleaseVersionId) { - return new PatchWorkspaceSource(patch); + return new Patch(projectId, VersionId.parseVersionId(patchReleaseVersionId)); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/workspace/WorkspaceSourceConsumer.java b/legend-sdlc-model/src/main/java/org/finos/legend/sdlc/domain/model/project/DevelopmentStreamConsumer.java similarity index 65% rename from legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/workspace/WorkspaceSourceConsumer.java rename to legend-sdlc-model/src/main/java/org/finos/legend/sdlc/domain/model/project/DevelopmentStreamConsumer.java index d6024c95ce..fb93e6ab7e 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/workspace/WorkspaceSourceConsumer.java +++ b/legend-sdlc-model/src/main/java/org/finos/legend/sdlc/domain/model/project/DevelopmentStreamConsumer.java @@ -12,39 +12,42 @@ // See the License for the specific language governing permissions and // limitations under the License. -package org.finos.legend.sdlc.server.domain.api.workspace; +package org.finos.legend.sdlc.domain.model.project; + +import org.finos.legend.sdlc.domain.model.patch.Patch; import java.util.function.Consumer; -public abstract class WorkspaceSourceConsumer implements WorkspaceSourceVisitor, Consumer +public abstract class DevelopmentStreamConsumer implements DevelopmentStreamVisitor, Consumer { @Override - public final Void visit(ProjectWorkspaceSource source) + public final Void visit(ProjectDevelopmentStream source) { accept(source); return null; } @Override - public final Void visit(PatchWorkspaceSource source) + public final Void visit(Patch source) { accept(source); return null; } @Override - public final void accept(WorkspaceSource source) + public final void accept(DevelopmentStream source) { source.visit(this); } - protected void accept(ProjectWorkspaceSource source) + protected void accept(ProjectDevelopmentStream source) { // nothing by default } - protected void accept(PatchWorkspaceSource source) + protected void accept(Patch source) { // nothing by default } } + diff --git a/legend-sdlc-model/src/main/java/org/finos/legend/sdlc/domain/model/project/DevelopmentStreamType.java b/legend-sdlc-model/src/main/java/org/finos/legend/sdlc/domain/model/project/DevelopmentStreamType.java new file mode 100644 index 0000000000..832211bd5a --- /dev/null +++ b/legend-sdlc-model/src/main/java/org/finos/legend/sdlc/domain/model/project/DevelopmentStreamType.java @@ -0,0 +1,20 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.sdlc.domain.model.project; + +public enum DevelopmentStreamType +{ + PROJECT_MAIN, PATCH +} diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/workspace/WorkspaceSourceVisitor.java b/legend-sdlc-model/src/main/java/org/finos/legend/sdlc/domain/model/project/DevelopmentStreamVisitor.java similarity index 57% rename from legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/workspace/WorkspaceSourceVisitor.java rename to legend-sdlc-model/src/main/java/org/finos/legend/sdlc/domain/model/project/DevelopmentStreamVisitor.java index d1014c3bc3..d9ffbc5eab 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/workspace/WorkspaceSourceVisitor.java +++ b/legend-sdlc-model/src/main/java/org/finos/legend/sdlc/domain/model/project/DevelopmentStreamVisitor.java @@ -12,25 +12,28 @@ // See the License for the specific language governing permissions and // limitations under the License. -package org.finos.legend.sdlc.server.domain.api.workspace; +package org.finos.legend.sdlc.domain.model.project; + +import org.finos.legend.sdlc.domain.model.patch.Patch; import java.util.function.Function; -public interface WorkspaceSourceVisitor extends Function +public interface DevelopmentStreamVisitor extends Function { - default T visit(ProjectWorkspaceSource source) + default T visit(ProjectDevelopmentStream source) { - throw new UnsupportedOperationException("Unsupported workspace source specification: " + source); + throw new UnsupportedOperationException("Unsupported development stream specification: " + source); } - default T visit(PatchWorkspaceSource source) + default T visit(Patch source) { - throw new UnsupportedOperationException("Unsupported workspace source specification: " + source); + throw new UnsupportedOperationException("Unsupported development stream specification: " + source); } @Override - default T apply(WorkspaceSource source) + default T apply(DevelopmentStream source) { return source.visit(this); } + } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/workspace/ProjectWorkspaceSource.java b/legend-sdlc-model/src/main/java/org/finos/legend/sdlc/domain/model/project/ProjectDevelopmentStream.java similarity index 60% rename from legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/workspace/ProjectWorkspaceSource.java rename to legend-sdlc-model/src/main/java/org/finos/legend/sdlc/domain/model/project/ProjectDevelopmentStream.java index 9f6e48ffd2..a3c0079281 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/workspace/ProjectWorkspaceSource.java +++ b/legend-sdlc-model/src/main/java/org/finos/legend/sdlc/domain/model/project/ProjectDevelopmentStream.java @@ -12,26 +12,20 @@ // See the License for the specific language governing permissions and // limitations under the License. -package org.finos.legend.sdlc.server.domain.api.workspace; -import org.finos.legend.sdlc.server.domain.api.project.source.SourceSpecification; +package org.finos.legend.sdlc.domain.model.project; -public class ProjectWorkspaceSource extends WorkspaceSource +public class ProjectDevelopmentStream extends DevelopmentStream { - static final ProjectWorkspaceSource INSTANCE = new ProjectWorkspaceSource(); + static final ProjectDevelopmentStream INSTANCE = new ProjectDevelopmentStream(); - private ProjectWorkspaceSource() + private ProjectDevelopmentStream() { + super(DevelopmentStreamType.PROJECT_MAIN.toString()); } @Override - public SourceSpecification getSourceSpecification() - { - return SourceSpecification.projectSourceSpecification(); - } - - @Override - public T visit(WorkspaceSourceVisitor visitor) + public T visit(DevelopmentStreamVisitor visitor) { return visitor.visit(this); } diff --git a/legend-sdlc-model/src/main/java/org/finos/legend/sdlc/domain/model/project/workspace/Workspace.java b/legend-sdlc-model/src/main/java/org/finos/legend/sdlc/domain/model/project/workspace/Workspace.java index 50a5fad060..27cf05f25b 100644 --- a/legend-sdlc-model/src/main/java/org/finos/legend/sdlc/domain/model/project/workspace/Workspace.java +++ b/legend-sdlc-model/src/main/java/org/finos/legend/sdlc/domain/model/project/workspace/Workspace.java @@ -14,6 +14,8 @@ package org.finos.legend.sdlc.domain.model.project.workspace; +import org.finos.legend.sdlc.domain.model.project.DevelopmentStream; + public interface Workspace { String getProjectId(); @@ -21,4 +23,6 @@ public interface Workspace String getUserId(); String getWorkspaceId(); + + DevelopmentStream getSource(); } diff --git a/legend-sdlc-model/src/main/java/org/finos/legend/sdlc/domain/model/review/Review.java b/legend-sdlc-model/src/main/java/org/finos/legend/sdlc/domain/model/review/Review.java index 0aca36c515..0d76bd7712 100644 --- a/legend-sdlc-model/src/main/java/org/finos/legend/sdlc/domain/model/review/Review.java +++ b/legend-sdlc-model/src/main/java/org/finos/legend/sdlc/domain/model/review/Review.java @@ -14,6 +14,7 @@ package org.finos.legend.sdlc.domain.model.review; +import org.finos.legend.sdlc.domain.model.project.workspace.Workspace; import org.finos.legend.sdlc.domain.model.user.User; import org.finos.legend.sdlc.domain.model.project.workspace.WorkspaceType; @@ -26,8 +27,12 @@ public interface Review String getProjectId(); + Workspace getWorkspace(); + + @Deprecated String getWorkspaceId(); + @Deprecated WorkspaceType getWorkspaceType(); String getTitle(); diff --git a/legend-sdlc-server-fs/src/main/java/org/finos/legend/sdlc/server/api/comparison/FileSystemComparisonApi.java b/legend-sdlc-server-fs/src/main/java/org/finos/legend/sdlc/server/api/comparison/FileSystemComparisonApi.java index 1611896666..2a6c20c595 100644 --- a/legend-sdlc-server-fs/src/main/java/org/finos/legend/sdlc/server/api/comparison/FileSystemComparisonApi.java +++ b/legend-sdlc-server-fs/src/main/java/org/finos/legend/sdlc/server/api/comparison/FileSystemComparisonApi.java @@ -35,7 +35,7 @@ public Comparison getWorkspaceCreationComparison(String projectId, WorkspaceSpec } @Override - public Comparison getWorkspaceSourceComparison(String projectId, WorkspaceSpecification workspaceSpecification) + public Comparison getDevelopmentStreamComparison(String projectId, WorkspaceSpecification workspaceSpecification) { throw FSException.unavailableFeature(); } diff --git a/legend-sdlc-server-fs/src/main/java/org/finos/legend/sdlc/server/api/patch/FileSystemPatchApi.java b/legend-sdlc-server-fs/src/main/java/org/finos/legend/sdlc/server/api/patch/FileSystemPatchApi.java index 612afc6015..298538c736 100644 --- a/legend-sdlc-server-fs/src/main/java/org/finos/legend/sdlc/server/api/patch/FileSystemPatchApi.java +++ b/legend-sdlc-server-fs/src/main/java/org/finos/legend/sdlc/server/api/patch/FileSystemPatchApi.java @@ -42,6 +42,12 @@ public List getPatches(String projectId, Integer minMajorVersion, Integer throw FSException.unavailableFeature(); } + @Override + public Patch getPatch(String projectId, VersionId patchReleaseVersionId) + { + throw FSException.unavailableFeature(); + } + @Override public void deletePatch(String projectId, VersionId patchReleaseVersionId) { diff --git a/legend-sdlc-server-fs/src/main/java/org/finos/legend/sdlc/server/api/review/FileSystemReviewApi.java b/legend-sdlc-server-fs/src/main/java/org/finos/legend/sdlc/server/api/review/FileSystemReviewApi.java index ff7bf2d246..ba6b318d5f 100644 --- a/legend-sdlc-server-fs/src/main/java/org/finos/legend/sdlc/server/api/review/FileSystemReviewApi.java +++ b/legend-sdlc-server-fs/src/main/java/org/finos/legend/sdlc/server/api/review/FileSystemReviewApi.java @@ -14,7 +14,7 @@ package org.finos.legend.sdlc.server.api.review; -import org.finos.legend.sdlc.domain.model.project.workspace.WorkspaceType; +import org.finos.legend.sdlc.domain.model.project.DevelopmentStream; import org.finos.legend.sdlc.domain.model.review.Approval; import org.finos.legend.sdlc.domain.model.review.Review; import org.finos.legend.sdlc.domain.model.review.ReviewState; @@ -26,7 +26,7 @@ import java.time.Instant; import java.util.Collections; import java.util.List; -import java.util.function.BiPredicate; +import java.util.Set; public class FileSystemReviewApi implements ReviewApi { @@ -42,13 +42,13 @@ public Review getReview(String projectId, String reviewId) } @Override - public List getReviews(String projectId, ReviewState state, Iterable revisionIds, BiPredicate workspaceIdAndTypePredicate, Instant since, Instant until, Integer limit) + public List getReviews(String projectId, Set workspaceSources, ReviewState state, Iterable revisionIds, Instant since, Instant until, Integer limit) { return Collections.emptyList(); } @Override - public List getReviews(boolean assignedToMe, boolean authoredByMe, List labels, BiPredicate workspaceIdAndTypePredicate, ReviewState state, Instant since, Instant until, Integer limit) + public List getReviews(boolean assignedToMe, boolean authoredByMe, Set workspaceSources, List labels, ReviewState state, Instant since, Instant until, Integer limit) { return Collections.emptyList(); } diff --git a/legend-sdlc-server-fs/src/main/java/org/finos/legend/sdlc/server/api/workspace/FileSystemWorkspaceApi.java b/legend-sdlc-server-fs/src/main/java/org/finos/legend/sdlc/server/api/workspace/FileSystemWorkspaceApi.java index da6353fcf9..64dec4b6b2 100644 --- a/legend-sdlc-server-fs/src/main/java/org/finos/legend/sdlc/server/api/workspace/FileSystemWorkspaceApi.java +++ b/legend-sdlc-server-fs/src/main/java/org/finos/legend/sdlc/server/api/workspace/FileSystemWorkspaceApi.java @@ -21,13 +21,13 @@ import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.Ref; import org.eclipse.jgit.lib.Repository; +import org.finos.legend.sdlc.domain.model.patch.Patch; +import org.finos.legend.sdlc.domain.model.project.DevelopmentStream; import org.finos.legend.sdlc.domain.model.project.workspace.Workspace; import org.finos.legend.sdlc.domain.model.project.workspace.WorkspaceType; import org.finos.legend.sdlc.server.api.entity.FileSystemApiWithFileAccess; import org.finos.legend.sdlc.server.api.user.FileSystemUserApi; -import org.finos.legend.sdlc.server.domain.api.workspace.PatchWorkspaceSource; import org.finos.legend.sdlc.server.domain.api.workspace.WorkspaceApi; -import org.finos.legend.sdlc.server.domain.api.workspace.WorkspaceSource; import org.finos.legend.sdlc.server.domain.api.workspace.WorkspaceSpecification; import org.finos.legend.sdlc.server.error.LegendSDLCServerException; import org.finos.legend.sdlc.server.exception.FSException; @@ -71,7 +71,7 @@ public Workspace getWorkspace(String projectId, WorkspaceSpecification workspace } @Override - public List getWorkspaces(String projectId, Set types, Set accessTypes, Set sources) + public List getWorkspaces(String projectId, Set types, Set accessTypes, Set sources) { if (sources == null) { @@ -101,13 +101,13 @@ public List getWorkspaces(String projectId, Set types, } @Override - public List getAllWorkspaces(String projectId, Set types, Set accessTypes, Set sources) + public List getAllWorkspaces(String projectId, Set types, Set accessTypes, Set sources) { return this.getWorkspaces(projectId, types, accessTypes, sources); } @Override - public Workspace newWorkspace(String projectId, String workspaceId, WorkspaceType type, WorkspaceSource source) + public Workspace newWorkspace(String projectId, String workspaceId, WorkspaceType type, DevelopmentStream source) { LegendSDLCServerException.validateNonNull(projectId, "projectId may not be null"); LegendSDLCServerException.validateNonNull(workspaceId, "workspaceId may not be null"); @@ -186,11 +186,11 @@ public static String getWorkspaceBranchName(WorkspaceSpecification workspaceSpec protected static String getWorkspaceBranchName(WorkspaceSpecification workspaceSpec, String currentUser) { StringBuilder builder = new StringBuilder(); - WorkspaceSource source = workspaceSpec.getSource(); - if (source instanceof PatchWorkspaceSource) + DevelopmentStream source = workspaceSpec.getSource(); + if (source instanceof Patch) { builder.append(PATCH_WORKSPACE_BRANCH_PREFIX).append(BRANCH_DELIMITER); - ((PatchWorkspaceSource) source).getPatchVersionId().appendVersionIdString(builder).append(BRANCH_DELIMITER); + ((Patch) source).getPatchReleaseVersionId().appendVersionIdString(builder).append(BRANCH_DELIMITER); } builder.append(getWorkspaceBranchNamePrefix(workspaceSpec.getType(), workspaceSpec.getAccessType())).append(BRANCH_DELIMITER); if (workspaceSpec.getType() == WorkspaceType.USER) @@ -337,6 +337,12 @@ public String getWorkspaceId() { return workspaceId; } + + @Override + public DevelopmentStream getSource() + { + return workspaceSpecification.getSource(); + } }; } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/comparison/ComparisonApi.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/comparison/ComparisonApi.java index 3fc97e794a..d521fdfb3e 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/comparison/ComparisonApi.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/comparison/ComparisonApi.java @@ -15,11 +15,11 @@ package org.finos.legend.sdlc.server.domain.api.comparison; import org.finos.legend.sdlc.domain.model.comparison.Comparison; +import org.finos.legend.sdlc.domain.model.project.DevelopmentStream; import org.finos.legend.sdlc.domain.model.project.workspace.WorkspaceType; import org.finos.legend.sdlc.domain.model.version.VersionId; import org.finos.legend.sdlc.server.domain.api.project.source.SourceSpecification; import org.finos.legend.sdlc.server.domain.api.project.source.WorkspaceSourceSpecification; -import org.finos.legend.sdlc.server.domain.api.workspace.WorkspaceSource; import org.finos.legend.sdlc.server.domain.api.workspace.WorkspaceSpecification; import org.finos.legend.sdlc.server.project.ProjectFileAccessProvider; @@ -41,11 +41,11 @@ public interface ComparisonApi * @param workspaceSpecification workspace specification * @return comparison between user workspace HEAD and workspace source HEAD */ - Comparison getWorkspaceSourceComparison(String projectId, WorkspaceSpecification workspaceSpecification); + Comparison getDevelopmentStreamComparison(String projectId, WorkspaceSpecification workspaceSpecification); /** * Get the comparison for a given review between the HEAD (current revision) of its source (workspace) and target. - * This is equivalent to calling {@link #getWorkspaceSourceComparison} for the source workspace of the review. + * This is equivalent to calling {@link #getDevelopmentStreamComparison} for the source workspace of the review. * * @param projectId project id * @param reviewId review id @@ -114,13 +114,13 @@ default Comparison getWorkspaceProjectComparison(String projectId, SourceSpecifi { throw new IllegalArgumentException("Not a workspace source specification: " + sourceSpecification); } - return getWorkspaceSourceComparison(projectId, ((WorkspaceSourceSpecification) sourceSpecification).getWorkspaceSpecification()); + return getDevelopmentStreamComparison(projectId, ((WorkspaceSourceSpecification) sourceSpecification).getWorkspaceSpecification()); } @Deprecated default Comparison getWorkspaceProjectComparison(String projectId, String workspaceId, WorkspaceType workspaceType) { - return getWorkspaceSourceComparison(projectId, WorkspaceSpecification.newWorkspaceSpecification(workspaceId, workspaceType, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, WorkspaceSource.projectWorkspaceSource())); + return getDevelopmentStreamComparison(projectId, WorkspaceSpecification.newWorkspaceSpecification(workspaceId, workspaceType, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, DevelopmentStream.projectDevelopmentStream())); } @Deprecated diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/entity/EntityApi.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/entity/EntityApi.java index c65996ec53..bad62c5960 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/entity/EntityApi.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/entity/EntityApi.java @@ -45,7 +45,7 @@ default EntityAccessContext getEntityAccessContext(String projectId, SourceSpeci @Deprecated default EntityAccessContext getProjectEntityAccessContext(String projectId, VersionId patchReleaseVersionId) { - return getEntityAccessContext(projectId, SourceSpecification.newSourceSpecification(patchReleaseVersionId)); + return getEntityAccessContext(projectId, SourceSpecification.newSourceSpecification(projectId, patchReleaseVersionId)); } @Deprecated @@ -57,7 +57,7 @@ default EntityAccessContext getProjectEntityAccessContext(String projectId) @Deprecated default EntityAccessContext getProjectRevisionEntityAccessContext(String projectId, VersionId patchReleaseVersionId, String revisionId) { - return getEntityAccessContext(projectId, SourceSpecification.newSourceSpecification(patchReleaseVersionId), revisionId); + return getEntityAccessContext(projectId, SourceSpecification.newSourceSpecification(projectId, patchReleaseVersionId), revisionId); } @Deprecated diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/patch/PatchApi.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/patch/PatchApi.java index 119d04c2b8..571d36da59 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/patch/PatchApi.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/patch/PatchApi.java @@ -45,6 +45,14 @@ public interface PatchApi */ List getPatches(String projectId, Integer minMajorVersion, Integer maxMajorVersion, Integer minMinorVersion, Integer maxMinorVersion, Integer minPatchVersion, Integer maxPatchVersion); + /** + * Get a specific patch release branch for the given project. + * + * @param projectId project id + * @param patchReleaseVersionId patch release branch you want to delete + */ + Patch getPatch(String projectId, VersionId patchReleaseVersionId); + /** * Deleted the given patch release branch for the given project. * diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/project/ProjectConfigurationApi.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/project/ProjectConfigurationApi.java index eb6c6bf3cf..fadc2fd389 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/project/ProjectConfigurationApi.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/project/ProjectConfigurationApi.java @@ -60,7 +60,7 @@ default List getAvailableArtifactGeneration @Deprecated default ProjectConfiguration getProjectProjectConfiguration(String projectId, VersionId patchReleaseVersionId) { - return getProjectConfiguration(projectId, SourceSpecification.newSourceSpecification(patchReleaseVersionId)); + return getProjectConfiguration(projectId, SourceSpecification.newSourceSpecification(projectId, patchReleaseVersionId)); } @Deprecated @@ -78,7 +78,7 @@ default ProjectConfiguration getProjectRevisionProjectConfiguration(String proje @Deprecated default ProjectConfiguration getProjectRevisionProjectConfiguration(String projectId, VersionId patchReleaseVersionId, String revisionId) { - return getProjectConfiguration(projectId, SourceSpecification.newSourceSpecification(patchReleaseVersionId), revisionId); + return getProjectConfiguration(projectId, SourceSpecification.newSourceSpecification(projectId, patchReleaseVersionId), revisionId); } @Deprecated @@ -252,7 +252,7 @@ default Revision updateProjectConfigurationForWorkspaceWithConflictResolution(St @Deprecated default List getProjectAvailableArtifactGenerations(String projectId, VersionId patchReleaseVersionId) { - return getAvailableArtifactGenerations(projectId, SourceSpecification.newSourceSpecification(patchReleaseVersionId)); + return getAvailableArtifactGenerations(projectId, SourceSpecification.newSourceSpecification(projectId, patchReleaseVersionId)); } @Deprecated diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/project/source/SourceSpecification.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/project/source/SourceSpecification.java index bc21f3dd6a..b36288f8b4 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/project/source/SourceSpecification.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/project/source/SourceSpecification.java @@ -14,9 +14,9 @@ package org.finos.legend.sdlc.server.domain.api.project.source; +import org.finos.legend.sdlc.domain.model.project.DevelopmentStream; import org.finos.legend.sdlc.domain.model.project.workspace.WorkspaceType; import org.finos.legend.sdlc.domain.model.version.VersionId; -import org.finos.legend.sdlc.server.domain.api.workspace.WorkspaceSource; import org.finos.legend.sdlc.server.domain.api.workspace.WorkspaceSpecification; import org.finos.legend.sdlc.server.project.ProjectFileAccessProvider; @@ -102,12 +102,12 @@ public static WorkspaceSourceSpecification workspaceSourceSpecification(Workspac } @Deprecated - public static SourceSpecification newSourceSpecification(String workspaceId, WorkspaceType workspaceType, ProjectFileAccessProvider.WorkspaceAccessType workspaceAccessType, VersionId patchReleaseVersionId) + public static SourceSpecification newSourceSpecification(String projectId, String workspaceId, WorkspaceType workspaceType, ProjectFileAccessProvider.WorkspaceAccessType workspaceAccessType, VersionId patchReleaseVersionId) { if (workspaceId != null) { - WorkspaceSource workspaceSource = (patchReleaseVersionId == null) ? WorkspaceSource.projectWorkspaceSource() : WorkspaceSource.patchWorkspaceSource(patchReleaseVersionId); - WorkspaceSpecification workspaceSpec = WorkspaceSpecification.newWorkspaceSpecification(workspaceId, workspaceType, workspaceAccessType, workspaceSource); + DevelopmentStream devlopmentStream = (patchReleaseVersionId == null) ? DevelopmentStream.projectDevelopmentStream() : DevelopmentStream.patch(projectId, patchReleaseVersionId); + WorkspaceSpecification workspaceSpec = WorkspaceSpecification.newWorkspaceSpecification(workspaceId, workspaceType, workspaceAccessType, devlopmentStream); return workspaceSourceSpecification(workspaceSpec); } if (patchReleaseVersionId != null) @@ -120,54 +120,54 @@ public static SourceSpecification newSourceSpecification(String workspaceId, Wor @Deprecated public static SourceSpecification newSourceSpecification(String workspaceId, WorkspaceType workspaceType, ProjectFileAccessProvider.WorkspaceAccessType workspaceAccessType) { - return newSourceSpecification(workspaceId, workspaceType, workspaceAccessType, null); + return newSourceSpecification(null, workspaceId, workspaceType, workspaceAccessType, null); } @Deprecated public static SourceSpecification newSourceSpecification(String workspaceId, WorkspaceType workspaceType) { - return newSourceSpecification(workspaceId, workspaceType, null, null); + return newSourceSpecification(null, workspaceId, workspaceType, null, null); } @Deprecated - public static SourceSpecification newSourceSpecification(VersionId patchReleaseVersionId) + public static SourceSpecification newSourceSpecification(String projectId, VersionId patchReleaseVersionId) { - return newSourceSpecification(null, null, null, patchReleaseVersionId); + return newSourceSpecification(projectId, null, null, null, patchReleaseVersionId); } @Deprecated - public static SourceSpecification newGroupWorkspaceSourceSpecification(String workspaceId, ProjectFileAccessProvider.WorkspaceAccessType workspaceAccessType, VersionId patchReleaseVersionId) + public static SourceSpecification newGroupWorkspaceSourceSpecification(String projectId, String workspaceId, ProjectFileAccessProvider.WorkspaceAccessType workspaceAccessType, VersionId patchReleaseVersionId) { - return newSourceSpecification(workspaceId, WorkspaceType.GROUP, workspaceAccessType, patchReleaseVersionId); + return newSourceSpecification(projectId, workspaceId, WorkspaceType.GROUP, workspaceAccessType, patchReleaseVersionId); } @Deprecated - public static SourceSpecification newGroupWorkspaceSourceSpecification(String workspaceId, VersionId patchReleaseVersionId) + public static SourceSpecification newGroupWorkspaceSourceSpecification(String projectId, String workspaceId, VersionId patchReleaseVersionId) { - return newGroupWorkspaceSourceSpecification(workspaceId, null, patchReleaseVersionId); + return newGroupWorkspaceSourceSpecification(projectId, workspaceId, null, patchReleaseVersionId); } @Deprecated public static SourceSpecification newGroupWorkspaceSourceSpecification(String workspaceId) { - return newGroupWorkspaceSourceSpecification(workspaceId, null); + return newGroupWorkspaceSourceSpecification(null, workspaceId, null); } @Deprecated - public static SourceSpecification newUserWorkspaceSourceSpecification(String workspaceId, ProjectFileAccessProvider.WorkspaceAccessType workspaceAccessType, VersionId patchReleaseVersionId) + public static SourceSpecification newUserWorkspaceSourceSpecification(String projectId, String workspaceId, ProjectFileAccessProvider.WorkspaceAccessType workspaceAccessType, VersionId patchReleaseVersionId) { - return newSourceSpecification(workspaceId, WorkspaceType.USER, workspaceAccessType, patchReleaseVersionId); + return newSourceSpecification(projectId, workspaceId, WorkspaceType.USER, workspaceAccessType, patchReleaseVersionId); } @Deprecated - public static SourceSpecification newUserWorkspaceSourceSpecification(String workspaceId, VersionId patchReleaseVersionId) + public static SourceSpecification newUserWorkspaceSourceSpecification(String projectId, String workspaceId, VersionId patchReleaseVersionId) { - return newUserWorkspaceSourceSpecification(workspaceId, null, patchReleaseVersionId); + return newUserWorkspaceSourceSpecification(projectId, workspaceId, null, patchReleaseVersionId); } @Deprecated public static SourceSpecification newUserWorkspaceSourceSpecification(String workspaceId) { - return newUserWorkspaceSourceSpecification(workspaceId, null); + return newUserWorkspaceSourceSpecification(null, workspaceId, null); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/review/ReviewApi.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/review/ReviewApi.java index 46d547b9f2..a2922bdd7c 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/review/ReviewApi.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/review/ReviewApi.java @@ -14,6 +14,7 @@ package org.finos.legend.sdlc.server.domain.api.review; +import org.finos.legend.sdlc.domain.model.project.DevelopmentStream; import org.finos.legend.sdlc.domain.model.project.ProjectType; import org.finos.legend.sdlc.domain.model.project.workspace.WorkspaceType; import org.finos.legend.sdlc.domain.model.review.Approval; @@ -25,6 +26,7 @@ import org.finos.legend.sdlc.server.domain.api.workspace.WorkspaceSpecification; import java.time.Instant; +import java.util.Collections; import java.util.List; import java.util.Set; import java.util.function.BiPredicate; @@ -51,13 +53,13 @@ public interface ReviewApi * @param projectId project id * @param state review state * @param revisionIds a set of revision IDs, with each we will get the reviews are associated - * @param workspaceIdAndTypePredicate workspace Id and type predicate with which review is associated + * @param workspaceSources workspaces with which review is associated * @param since this time limit is interpreted based on the chosen state, for example: if only committed reviews are fetched, 'since' will concern the committed time * @param until this time limit is interpreted based on the chosen state, for example: if only committed reviews are fetched, 'since' will concern the committed time * @param limit maximum number of reviews to get * @return reviews */ - List getReviews(String projectId, ReviewState state, Iterable revisionIds, BiPredicate workspaceIdAndTypePredicate, Instant since, Instant until, Integer limit); + List getReviews(String projectId, Set workspaceSources, ReviewState state, Iterable revisionIds, Instant since, Instant until, Integer limit); /** * Get reviews across all projects with the given state and labels. @@ -72,14 +74,14 @@ public interface ReviewApi * @param assignedToMe whether to return only reviews assigned to me * @param authoredByMe whether to return only reviews authored by me * @param labels labels to apply, return only reviews that match all the labels - * @param workspaceIdAndTypePredicate workspace Id and type predicate with which review is associated + * @param workspaceSources workspace sources with which review is associated * @param state review state * @param since this time limit is interpreted based on the chosen state, for example: if only committed reviews are fetched, 'since' will concern the committed time * @param until this time limit is interpreted based on the chosen state, for example: if only committed reviews are fetched, 'since' will concern the committed time * @param limit maximum number of reviews to get * @return reviews */ - List getReviews(boolean assignedToMe, boolean authoredByMe, List labels, BiPredicate workspaceIdAndTypePredicate, ReviewState state, Instant since, Instant until, Integer limit); + List getReviews(boolean assignedToMe, boolean authoredByMe, Set workspaceSources, List labels, ReviewState state, Instant since, Instant until, Integer limit); /** * Create a review for changes from the given workspace. @@ -233,10 +235,16 @@ default Review getReview(String projectId, VersionId patchReleaseVersionId, Stri return getReview(projectId, reviewId); } + @Deprecated + default List getReviews(String projectId, ReviewState state, Iterable revisionIds, BiPredicate workspaceIdAndTypePredicate, Instant since, Instant until, Integer limit) + { + return getReviews(projectId, Collections.singleton(DevelopmentStream.projectDevelopmentStream()), state, revisionIds, since, until, limit); + } + @Deprecated default List getReviews(String projectId, VersionId patchReleaseVersionId, ReviewState state, Iterable revisionIds, BiPredicate workspaceIdAndTypePredicate, Instant since, Instant until, Integer limit) { - return getReviews(projectId, state, revisionIds, workspaceIdAndTypePredicate, since, until, limit); + return getReviews(projectId, Collections.singleton(DevelopmentStream.patch(projectId, patchReleaseVersionId)), state, revisionIds, since, until, limit); } @Deprecated @@ -245,6 +253,12 @@ default List getReviews(String projectId, ReviewState state, Iterable getReviews(boolean assignedToMe, boolean authoredByMe, List labels, BiPredicate workspaceIdAndTypePredicate, ReviewState state, Instant since, Instant until, Integer limit) + { + return getReviews(assignedToMe, authoredByMe, null, labels, state, since, until, limit); + } + @Deprecated default List getReviews(Set projectTypes, boolean assignedToMe, boolean authoredByMe, List labels, ReviewState state, Instant since, Instant until, Integer limit) { diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/workflow/WorkflowApi.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/workflow/WorkflowApi.java index b55e3dcc53..d959dd4865 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/workflow/WorkflowApi.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/workflow/WorkflowApi.java @@ -32,7 +32,7 @@ public interface WorkflowApi @Deprecated default WorkflowAccessContext getProjectWorkflowAccessContext(String projectId, VersionId patchReleaseVersionId) { - return getWorkflowAccessContext(projectId, SourceSpecification.newSourceSpecification(patchReleaseVersionId)); + return getWorkflowAccessContext(projectId, SourceSpecification.newSourceSpecification(projectId, patchReleaseVersionId)); } @Deprecated diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/workflow/WorkflowJobApi.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/workflow/WorkflowJobApi.java index ce50990445..cbb364811a 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/workflow/WorkflowJobApi.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/workflow/WorkflowJobApi.java @@ -32,7 +32,7 @@ public interface WorkflowJobApi @Deprecated default WorkflowJobAccessContext getProjectWorkflowJobAccessContext(String projectId, VersionId patchReleaseVersionId) { - return getWorkflowJobAccessContext(projectId, SourceSpecification.newSourceSpecification(patchReleaseVersionId)); + return getWorkflowJobAccessContext(projectId, SourceSpecification.newSourceSpecification(projectId, patchReleaseVersionId)); } @Deprecated diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/workspace/PatchWorkspaceSource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/workspace/PatchWorkspaceSource.java deleted file mode 100644 index 49887fdeef..0000000000 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/workspace/PatchWorkspaceSource.java +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2023 Goldman Sachs -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package org.finos.legend.sdlc.server.domain.api.workspace; - -import org.finos.legend.sdlc.domain.model.version.VersionId; -import org.finos.legend.sdlc.server.domain.api.project.source.SourceSpecification; - -import java.util.Objects; - -public class PatchWorkspaceSource extends WorkspaceSource -{ - private final VersionId patchVersion; - - PatchWorkspaceSource(VersionId patchVersion) - { - this.patchVersion = Objects.requireNonNull(patchVersion, "patch version may not be null"); - } - - public VersionId getPatchVersionId() - { - return this.patchVersion; - } - - @Override - public SourceSpecification getSourceSpecification() - { - return SourceSpecification.patchSourceSpecification(this.patchVersion); - } - - @Override - public T visit(WorkspaceSourceVisitor visitor) - { - return visitor.visit(this); - } - - @Override - public boolean equals(Object other) - { - return (this == other) || - ((other instanceof PatchWorkspaceSource) && this.patchVersion.equals(((PatchWorkspaceSource) other).patchVersion)); - } - - @Override - public int hashCode() - { - return this.patchVersion.hashCode(); - } - - @Override - protected StringBuilder appendAdditionalInfo(StringBuilder builder) - { - return this.patchVersion.appendVersionIdString(builder.append(" patchVersion=")); - } -} diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/workspace/WorkspaceApi.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/workspace/WorkspaceApi.java index 1b6306c9cd..e46f348026 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/workspace/WorkspaceApi.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/workspace/WorkspaceApi.java @@ -14,6 +14,7 @@ package org.finos.legend.sdlc.server.domain.api.workspace; +import org.finos.legend.sdlc.domain.model.project.DevelopmentStream; import org.finos.legend.sdlc.domain.model.project.workspace.Workspace; import org.finos.legend.sdlc.domain.model.project.workspace.WorkspaceType; import org.finos.legend.sdlc.domain.model.version.VersionId; @@ -45,7 +46,7 @@ public interface WorkspaceApi * @param sources set of workspace sources in scope; null means all sources * @return workspaces */ - List getWorkspaces(String projectId, Set types, Set accessTypes, Set sources); + List getWorkspaces(String projectId, Set types, Set accessTypes, Set sources); /** * Get all workspaces in the given project for all users subject to the given filters. @@ -56,7 +57,7 @@ public interface WorkspaceApi * @param sources set of workspace sources in scope * @return workspaces */ - List getAllWorkspaces(String projectId, Set types, Set accessTypes, Set sources); + List getAllWorkspaces(String projectId, Set types, Set accessTypes, Set sources); /** * Create a new workspace in the given project. If the workspace is a user workspace, then it will be for the @@ -68,7 +69,7 @@ public interface WorkspaceApi * @param source workspace source * @return new workspace */ - Workspace newWorkspace(String projectId, String workspaceId, WorkspaceType type, WorkspaceSource source); + Workspace newWorkspace(String projectId, String workspaceId, WorkspaceType type, DevelopmentStream source); /** * Delete the given workspace. @@ -166,13 +167,13 @@ default List getGroupWorkspaces(String projectId) @Deprecated default List getWorkspaces(String projectId, VersionId patchReleaseVersionId, Set workspaceTypes) { - return getWorkspaces(projectId, workspaceTypes, Collections.singleton(WorkspaceAccessType.WORKSPACE), Collections.singleton((patchReleaseVersionId == null) ? WorkspaceSource.projectWorkspaceSource() : WorkspaceSource.patchWorkspaceSource(patchReleaseVersionId))); + return getWorkspaces(projectId, workspaceTypes, Collections.singleton(WorkspaceAccessType.WORKSPACE), Collections.singleton((patchReleaseVersionId == null) ? DevelopmentStream.projectDevelopmentStream() : DevelopmentStream.patch(projectId, patchReleaseVersionId))); } @Deprecated default List getWorkspacesWithConflictResolution(String projectId, VersionId patchReleaseVersionId) { - return getWorkspaces(projectId, Collections.singleton(WorkspaceType.USER), Collections.singleton(WorkspaceAccessType.CONFLICT_RESOLUTION), Collections.singleton((patchReleaseVersionId == null) ? WorkspaceSource.projectWorkspaceSource() : WorkspaceSource.patchWorkspaceSource(patchReleaseVersionId))); + return getWorkspaces(projectId, Collections.singleton(WorkspaceType.USER), Collections.singleton(WorkspaceAccessType.CONFLICT_RESOLUTION), Collections.singleton((patchReleaseVersionId == null) ? DevelopmentStream.projectDevelopmentStream() : DevelopmentStream.patch(projectId, patchReleaseVersionId))); } @Deprecated @@ -184,7 +185,7 @@ default List getWorkspacesWithConflictResolution(String projectId) @Deprecated default List getBackupWorkspaces(String projectId, VersionId patchReleaseVersionId) { - return getWorkspaces(projectId, Collections.singleton(WorkspaceType.USER), Collections.singleton(WorkspaceAccessType.BACKUP), Collections.singleton((patchReleaseVersionId == null) ? WorkspaceSource.projectWorkspaceSource() : WorkspaceSource.patchWorkspaceSource(patchReleaseVersionId))); + return getWorkspaces(projectId, Collections.singleton(WorkspaceType.USER), Collections.singleton(WorkspaceAccessType.BACKUP), Collections.singleton((patchReleaseVersionId == null) ? DevelopmentStream.projectDevelopmentStream() : DevelopmentStream.patch(projectId, patchReleaseVersionId))); } @Deprecated @@ -202,7 +203,7 @@ default List getBackupWorkspaces(String projectId) @Deprecated default List getAllUserWorkspaces(String projectId) { - return getAllWorkspaces(projectId, Collections.singleton(WorkspaceType.USER), null, Collections.singleton(WorkspaceSource.projectWorkspaceSource())); + return getAllWorkspaces(projectId, Collections.singleton(WorkspaceType.USER), null, Collections.singleton(DevelopmentStream.projectDevelopmentStream())); } /** @@ -214,7 +215,7 @@ default List getAllUserWorkspaces(String projectId) @Deprecated default List getAllWorkspaces(String projectId) { - return getAllWorkspaces(projectId, null, null, Collections.singleton(WorkspaceSource.projectWorkspaceSource())); + return getAllWorkspaces(projectId, null, null, Collections.singleton(DevelopmentStream.projectDevelopmentStream())); } /** @@ -228,7 +229,7 @@ default List getAllWorkspaces(String projectId) @Deprecated default List getAllWorkspaces(String projectId, VersionId patchReleaseVersionId, Set workspaceTypes) { - return getAllWorkspaces(projectId, workspaceTypes, Collections.singleton(WorkspaceAccessType.WORKSPACE), Collections.singleton((patchReleaseVersionId == null) ? WorkspaceSource.projectWorkspaceSource() : WorkspaceSource.patchWorkspaceSource(patchReleaseVersionId))); + return getAllWorkspaces(projectId, workspaceTypes, Collections.singleton(WorkspaceAccessType.WORKSPACE), Collections.singleton((patchReleaseVersionId == null) ? DevelopmentStream.projectDevelopmentStream() : DevelopmentStream.patch(projectId, patchReleaseVersionId))); } /** @@ -458,7 +459,7 @@ default boolean isWorkspaceInConflictResolutionMode(String projectId, SourceSpec @Deprecated default Workspace newUserWorkspace(String projectId, String workspaceId) { - return newWorkspace(projectId, workspaceId, WorkspaceType.USER, WorkspaceSource.projectWorkspaceSource()); + return newWorkspace(projectId, workspaceId, WorkspaceType.USER, DevelopmentStream.projectDevelopmentStream()); } /** @@ -471,7 +472,7 @@ default Workspace newUserWorkspace(String projectId, String workspaceId) @Deprecated default Workspace newGroupWorkspace(String projectId, String workspaceId) { - return newWorkspace(projectId, workspaceId, WorkspaceType.GROUP, WorkspaceSource.projectWorkspaceSource()); + return newWorkspace(projectId, workspaceId, WorkspaceType.GROUP, DevelopmentStream.projectDevelopmentStream()); } /** diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/workspace/WorkspaceSpecification.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/workspace/WorkspaceSpecification.java index 5bfe1959f9..ed0bb79ee9 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/workspace/WorkspaceSpecification.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/domain/api/workspace/WorkspaceSpecification.java @@ -14,6 +14,9 @@ package org.finos.legend.sdlc.server.domain.api.workspace; +import org.finos.legend.sdlc.domain.model.patch.Patch; +import org.finos.legend.sdlc.domain.model.project.DevelopmentStream; +import org.finos.legend.sdlc.domain.model.project.ProjectDevelopmentStream; import org.finos.legend.sdlc.domain.model.project.workspace.WorkspaceType; import org.finos.legend.sdlc.server.domain.api.project.source.SourceSpecification; import org.finos.legend.sdlc.server.domain.api.project.source.WorkspaceSourceSpecification; @@ -26,10 +29,10 @@ public class WorkspaceSpecification private final String id; private final WorkspaceType type; private final WorkspaceAccessType accessType; - private final WorkspaceSource source; + private final DevelopmentStream source; private final String userId; - private WorkspaceSpecification(String id, WorkspaceType type, WorkspaceAccessType accessType, WorkspaceSource source, String userId) + private WorkspaceSpecification(String id, WorkspaceType type, WorkspaceAccessType accessType, DevelopmentStream source, String userId) { if ((userId != null) && (type != WorkspaceType.USER)) { @@ -77,7 +80,7 @@ public String toString() { builder.append(" accessType=").append(this.accessType.getLabel()); } - if (!(this.source instanceof ProjectWorkspaceSource)) + if (!(this.source instanceof ProjectDevelopmentStream)) { this.source.appendString(builder.append(" source=")); } @@ -103,11 +106,20 @@ public WorkspaceAccessType getAccessType() return this.accessType; } - public WorkspaceSource getSource() + public DevelopmentStream getSource() { return this.source; } + public SourceSpecification getWorkspaceSourceSpecification() + { + if (this.source instanceof Patch) + { + return SourceSpecification.patchSourceSpecification(((Patch) this.source).getPatchReleaseVersionId()); + } + return SourceSpecification.projectSourceSpecification(); + } + /** * The user id, if specified; otherwise, null. The user id may only be specified if the workspace type is * {@link WorkspaceType#USER}. Even then, it is optional. @@ -135,12 +147,12 @@ public WorkspaceSourceSpecification getSourceSpecification() * @param userId optional user id * @return workspace specification */ - public static WorkspaceSpecification newWorkspaceSpecification(String id, WorkspaceType type, WorkspaceAccessType accessType, WorkspaceSource source, String userId) + public static WorkspaceSpecification newWorkspaceSpecification(String id, WorkspaceType type, WorkspaceAccessType accessType, DevelopmentStream source, String userId) { - return new WorkspaceSpecification(id, type, (accessType == null) ? WorkspaceAccessType.WORKSPACE : accessType, (source == null) ? WorkspaceSource.projectWorkspaceSource() : source, userId); + return new WorkspaceSpecification(id, type, (accessType == null) ? WorkspaceAccessType.WORKSPACE : accessType, (source == null) ? DevelopmentStream.projectDevelopmentStream() : source, userId); } - public static WorkspaceSpecification newWorkspaceSpecification(String id, WorkspaceType type, WorkspaceAccessType accessType, WorkspaceSource source) + public static WorkspaceSpecification newWorkspaceSpecification(String id, WorkspaceType type, WorkspaceAccessType accessType, DevelopmentStream source) { return newWorkspaceSpecification(id, type, accessType, source, null); } @@ -150,7 +162,7 @@ public static WorkspaceSpecification newWorkspaceSpecification(String id, Worksp return newWorkspaceSpecification(id, type, accessType, null); } - public static WorkspaceSpecification newWorkspaceSpecification(String id, WorkspaceType type, WorkspaceSource source) + public static WorkspaceSpecification newWorkspaceSpecification(String id, WorkspaceType type, DevelopmentStream source) { return newWorkspaceSpecification(id, type, null, source); } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/BaseGitLabApi.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/BaseGitLabApi.java index 1989674d88..dd0aa37652 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/BaseGitLabApi.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/BaseGitLabApi.java @@ -15,6 +15,10 @@ package org.finos.legend.sdlc.server.gitlab.api; import org.finos.legend.sdlc.domain.model.patch.Patch; +import org.finos.legend.sdlc.domain.model.project.DevelopmentStream; +import org.finos.legend.sdlc.domain.model.project.DevelopmentStreamConsumer; +import org.finos.legend.sdlc.domain.model.project.DevelopmentStreamVisitor; +import org.finos.legend.sdlc.domain.model.project.ProjectDevelopmentStream; import org.finos.legend.sdlc.domain.model.project.workspace.Workspace; import org.finos.legend.sdlc.domain.model.project.workspace.WorkspaceType; import org.finos.legend.sdlc.domain.model.review.ReviewState; @@ -30,11 +34,6 @@ import org.finos.legend.sdlc.server.domain.api.project.source.SourceSpecificationVisitor; import org.finos.legend.sdlc.server.domain.api.project.source.VersionSourceSpecification; import org.finos.legend.sdlc.server.domain.api.project.source.WorkspaceSourceSpecification; -import org.finos.legend.sdlc.server.domain.api.workspace.PatchWorkspaceSource; -import org.finos.legend.sdlc.server.domain.api.workspace.ProjectWorkspaceSource; -import org.finos.legend.sdlc.server.domain.api.workspace.WorkspaceSource; -import org.finos.legend.sdlc.server.domain.api.workspace.WorkspaceSourceConsumer; -import org.finos.legend.sdlc.server.domain.api.workspace.WorkspaceSourceVisitor; import org.finos.legend.sdlc.server.domain.api.workspace.WorkspaceSpecification; import org.finos.legend.sdlc.server.error.LegendSDLCServerException; import org.finos.legend.sdlc.server.gitlab.GitLabConfiguration; @@ -212,19 +211,19 @@ protected static boolean isValidPackageableElementPath(String string) protected static String getWorkspaceBranchNamePrefix(WorkspaceSpecification workspaceSpec) { String basePrefix = getWorkspaceBranchNamePrefix(workspaceSpec.getType(), workspaceSpec.getAccessType()); - return workspaceSpec.getSource().visit(new WorkspaceSourceVisitor() + return workspaceSpec.getSource().visit(new DevelopmentStreamVisitor() { @Override - public String visit(ProjectWorkspaceSource source) + public String visit(ProjectDevelopmentStream source) { return basePrefix; } @Override - public String visit(PatchWorkspaceSource source) + public String visit(Patch source) { StringBuilder builder = new StringBuilder(getPatchWorkspaceBranchPrefix()).append(BRANCH_DELIMITER); - source.getPatchVersionId().appendVersionIdString(builder).append(BRANCH_DELIMITER); + source.getPatchReleaseVersionId().appendVersionIdString(builder).append(BRANCH_DELIMITER); return builder.append(basePrefix).toString(); } }); @@ -292,7 +291,7 @@ protected static String getPatchWorkspaceBranchPrefix() return PATCH_WORKSPACE_BRANCH_PREFIX; } - protected static WorkspaceSpecification parseWorkspaceBranchName(String branchName) + protected static WorkspaceSpecification parseWorkspaceBranchName(String projectId, String branchName) { if (branchName == null) { @@ -310,10 +309,10 @@ protected static WorkspaceSpecification parseWorkspaceBranchName(String branchNa String userId = matcher.group("user"); String workspaceId = matcher.group("id"); - WorkspaceSource source; + DevelopmentStream source; if (patchVersionString == null) { - source = WorkspaceSource.projectWorkspaceSource(); + source = DevelopmentStream.projectDevelopmentStream(); } else { @@ -327,7 +326,7 @@ protected static WorkspaceSpecification parseWorkspaceBranchName(String branchNa // not a valid version string return null; } - source = WorkspaceSource.patchWorkspaceSource(versionId); + source = new Patch(projectId, versionId); } WorkspaceType type; @@ -494,7 +493,7 @@ protected String getSourceBranch(GitLabProjectId projectId, WorkspaceSpecificati return getSourceBranch(projectId, workspaceSpec.getSource()); } - protected String getSourceBranch(GitLabProjectId projectId, WorkspaceSource workspaceSource) + protected String getSourceBranch(GitLabProjectId projectId, DevelopmentStream workspaceSource) { return getSourceBranch(workspaceSource, () -> getDefaultBranch(projectId)); } @@ -509,20 +508,20 @@ protected static String getSourceBranch(WorkspaceSpecification workspaceSpec, Su return getSourceBranch(workspaceSpec.getSource(), defaultBranchSupplier); } - protected static String getSourceBranch(WorkspaceSource workspaceSource, Supplier defaultBranchSupplier) + protected static String getSourceBranch(DevelopmentStream workspaceSource, Supplier defaultBranchSupplier) { - return workspaceSource.visit(new WorkspaceSourceVisitor() + return workspaceSource.visit(new DevelopmentStreamVisitor() { @Override - public String visit(ProjectWorkspaceSource source) + public String visit(ProjectDevelopmentStream source) { return defaultBranchSupplier.get(); } @Override - public String visit(PatchWorkspaceSource source) + public String visit(Patch source) { - return getPatchReleaseBranchName(source.getPatchVersionId()); + return getPatchReleaseBranchName(source.getPatchReleaseVersionId()); } }); } @@ -540,11 +539,11 @@ protected String getWorkspaceBranchName(WorkspaceSpecification workspaceSpec) protected static String getWorkspaceBranchName(WorkspaceSpecification workspaceSpec, Supplier currentUser) { StringBuilder builder = new StringBuilder(); - WorkspaceSource source = workspaceSpec.getSource(); - if (source instanceof PatchWorkspaceSource) + DevelopmentStream source = workspaceSpec.getSource(); + if (source instanceof Patch) { builder.append(PATCH_WORKSPACE_BRANCH_PREFIX).append(BRANCH_DELIMITER); - ((PatchWorkspaceSource) source).getPatchVersionId().appendVersionIdString(builder).append(BRANCH_DELIMITER); + ((Patch) source).getPatchReleaseVersionId().appendVersionIdString(builder).append(BRANCH_DELIMITER); } builder.append(getWorkspaceBranchNamePrefix(workspaceSpec.getType(), workspaceSpec.getAccessType())).append(BRANCH_DELIMITER); if (workspaceSpec.getType() == WorkspaceType.USER) @@ -737,11 +736,6 @@ protected static String getReferenceInfo(String projectId, WorkspaceSpecificatio return getReferenceInfo(projectId, workspaceSpec.getSourceSpecification()); } - protected static String getReferenceInfo(String projectId, WorkspaceSource workspaceSource) - { - return getReferenceInfo(projectId, workspaceSource.getSourceSpecification()); - } - protected static String getReferenceInfo(String projectId, SourceSpecification sourceSpec) { return getReferenceInfo(projectId, sourceSpec, null); @@ -784,12 +778,12 @@ protected void accept(WorkspaceSourceSpecification sourceSpec) builder.append(workspaceSpec.getType().getLabel()).append(" ") .append(workspaceSpec.getAccessType().getLabel()).append(" ") .append(workspaceSpec.getId()).append(" of "); - workspaceSpec.getSource().visit(new WorkspaceSourceConsumer() + workspaceSpec.getSource().visit(new DevelopmentStreamConsumer() { @Override - protected void accept(PatchWorkspaceSource source) + protected void accept(Patch source) { - source.getPatchVersionId().appendVersionIdString(builder.append("patch ")).append(" of "); + source.getPatchReleaseVersionId().appendVersionIdString(builder.append("patch ")).append(" of "); } }); } @@ -1056,7 +1050,7 @@ public String getName() protected static Workspace fromWorkspaceBranchName(String projectId, String branchName) { - WorkspaceSpecification workspaceSpec = parseWorkspaceBranchName(branchName); + WorkspaceSpecification workspaceSpec = parseWorkspaceBranchName(projectId, branchName); return (workspaceSpec == null) ? null : fromWorkspaceSpecification(projectId, workspaceSpec); } @@ -1087,6 +1081,12 @@ public String getWorkspaceId() { return workspaceId; } + + @Override + public DevelopmentStream getSource() + { + return workspaceSpec.getSource(); + } }; } @@ -1094,20 +1094,7 @@ protected static Patch fromPatchBranchName(String projectId, String branchName) { int index = branchName.lastIndexOf(BRANCH_DELIMITER); VersionId patchReleaseVersionId = parseVersionIdString(branchName.substring(index + 1)); - return new Patch() - { - @Override - public String getProjectId() - { - return projectId; - } - - @Override - public VersionId getPatchReleaseVersionId() - { - return patchReleaseVersionId; - } - }; + return new Patch(projectId, patchReleaseVersionId); } protected MergeRequest getReviewMergeRequest(MergeRequestApi mergeRequestApi, GitLabProjectId projectId, String reviewId) @@ -1141,18 +1128,18 @@ protected MergeRequest getReviewMergeRequest(MergeRequestApi mergeRequestApi, Gi () -> "Error accessing review " + reviewId + " in project " + projectId); } - if (!isReviewMergeRequest(mergeRequest, defaultBranchSupplier)) + if (!isReviewMergeRequest(mergeRequest, projectId.toString(), defaultBranchSupplier)) { throw new LegendSDLCServerException("Unknown review in project " + projectId + ": " + reviewId, Status.NOT_FOUND); } return mergeRequest; } - protected static boolean isReviewMergeRequest(MergeRequest mergeRequest, Supplier defaultBranchSupplier) + protected static boolean isReviewMergeRequest(MergeRequest mergeRequest, String projectId, Supplier defaultBranchSupplier) { if (mergeRequest != null) { - WorkspaceSpecification workspaceSpec = parseWorkspaceBranchName(mergeRequest.getSourceBranch()); + WorkspaceSpecification workspaceSpec = parseWorkspaceBranchName(projectId, mergeRequest.getSourceBranch()); if ((workspaceSpec != null) && (workspaceSpec.getAccessType() == WorkspaceAccessType.WORKSPACE)) { String expectedTargetBranch = getSourceBranch(workspaceSpec, defaultBranchSupplier); diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitLabApiWithFileAccess.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitLabApiWithFileAccess.java index 89e282c7fa..fb6900c2be 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitLabApiWithFileAccess.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitLabApiWithFileAccess.java @@ -23,6 +23,8 @@ import org.eclipse.collections.api.factory.Sets; import org.eclipse.collections.api.list.MutableList; import org.eclipse.collections.api.set.MutableSet; +import org.finos.legend.sdlc.domain.model.patch.Patch; +import org.finos.legend.sdlc.domain.model.project.DevelopmentStreamConsumer; import org.finos.legend.sdlc.domain.model.project.configuration.ProjectConfiguration; import org.finos.legend.sdlc.domain.model.revision.Revision; import org.finos.legend.sdlc.domain.model.revision.RevisionAlias; @@ -33,8 +35,6 @@ import org.finos.legend.sdlc.server.domain.api.project.source.SourceSpecificationConsumer; import org.finos.legend.sdlc.server.domain.api.project.source.VersionSourceSpecification; import org.finos.legend.sdlc.server.domain.api.project.source.WorkspaceSourceSpecification; -import org.finos.legend.sdlc.server.domain.api.workspace.PatchWorkspaceSource; -import org.finos.legend.sdlc.server.domain.api.workspace.WorkspaceSourceConsumer; import org.finos.legend.sdlc.server.domain.api.workspace.WorkspaceSpecification; import org.finos.legend.sdlc.server.error.LegendSDLCServerException; import org.finos.legend.sdlc.server.gitlab.GitLabConfiguration; @@ -112,7 +112,7 @@ protected GitLabApiWithFileAccess(GitLabConfiguration gitLabConfiguration, GitLa @Deprecated protected ProjectConfiguration getProjectConfiguration(String projectId, VersionId patchReleaseVersionId) { - return getProjectConfiguration(projectId, SourceSpecification.newSourceSpecification(patchReleaseVersionId)); + return getProjectConfiguration(projectId, SourceSpecification.newSourceSpecification(projectId, patchReleaseVersionId)); } protected ProjectConfiguration getProjectConfiguration(String projectId, SourceSpecification sourceSpecification) @@ -852,12 +852,12 @@ protected void accept(WorkspaceSourceSpecification sourceSpec) { WorkspaceSpecification workspaceSpec = sourceSpec.getWorkspaceSpecification(); builder.append(workspaceSpec.getType().getLabel()).append(" ").append(workspaceSpec.getAccessType().getLabel()).append(" ").append(workspaceSpec.getId()); - workspaceSpec.getSource().visit(new WorkspaceSourceConsumer() + workspaceSpec.getSource().visit(new DevelopmentStreamConsumer() { @Override - protected void accept(PatchWorkspaceSource source) + protected void accept(Patch source) { - source.getPatchVersionId().appendVersionIdString(builder.append(" of patch ")); + source.getPatchReleaseVersionId().appendVersionIdString(builder.append(" of patch ")); } }); } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitLabComparisonApi.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitLabComparisonApi.java index a662513f52..ca31ec45cd 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitLabComparisonApi.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitLabComparisonApi.java @@ -102,7 +102,7 @@ public Comparison getWorkspaceCreationComparison(String projectId, WorkspaceSpec } @Override - public Comparison getWorkspaceSourceComparison(String projectId, WorkspaceSpecification workspaceSpecification) + public Comparison getDevelopmentStreamComparison(String projectId, WorkspaceSpecification workspaceSpecification) { LegendSDLCServerException.validateNonNull(projectId, "projectId may not be null"); LegendSDLCServerException.validateNonNull(workspaceSpecification, "workspace specification may not be null"); @@ -139,17 +139,17 @@ public Comparison getWorkspaceSourceComparison(String projectId, WorkspaceSpecif catch (Exception e) { throw buildException(e, - () -> "User " + getCurrentUser() + " is not allowed to access the current revision for " + getReferenceInfo(projectId, workspaceSpecification.getSource()), - () -> "Could not find current revision for " + getReferenceInfo(projectId, workspaceSpecification.getSource()), - () -> "Failed to find current revision for " + getReferenceInfo(projectId, workspaceSpecification.getSource())); + () -> "User " + getCurrentUser() + " is not allowed to access the current revision for " + getReferenceInfo(projectId, workspaceSpecification.getWorkspaceSourceSpecification()), + () -> "Could not find current revision for " + getReferenceInfo(projectId, workspaceSpecification.getWorkspaceSourceSpecification()), + () -> "Failed to find current revision for " + getReferenceInfo(projectId, workspaceSpecification.getWorkspaceSourceSpecification())); } if (sourceCommit == null) { - throw new LegendSDLCServerException("Could not access current revision for " + getReferenceInfo(projectId, workspaceSpecification.getSource())); + throw new LegendSDLCServerException("Could not access current revision for " + getReferenceInfo(projectId, workspaceSpecification.getWorkspaceSourceSpecification())); } ProjectStructure workspaceProjectStructure = getProjectStructure(projectId, workspaceSpecification.getSourceSpecification(), workspaceCommit.getId()); - ProjectStructure sourceProjectStructure = getProjectStructure(projectId, workspaceSpecification.getSource().getSourceSpecification(), sourceCommit.getId()); + ProjectStructure sourceProjectStructure = getProjectStructure(projectId, workspaceSpecification.getWorkspaceSourceSpecification(), sourceCommit.getId()); return getComparisonResult(gitLabProjectId, repositoryApi, sourceCommit.getId(), workspaceCommit.getId(), sourceProjectStructure, workspaceProjectStructure); } @@ -165,7 +165,7 @@ public Comparison getReviewComparison(String projectId, String reviewId) MergeRequest mergeRequest = getReviewMergeRequest(gitLabApi.getMergeRequestApi(), gitLabProjectId, reviewId); - WorkspaceSpecification workspaceSpec = parseWorkspaceBranchName(mergeRequest.getSourceBranch()); + WorkspaceSpecification workspaceSpec = parseWorkspaceBranchName(projectId, mergeRequest.getSourceBranch()); if (workspaceSpec == null) { throw new LegendSDLCServerException("Unknown review in project " + projectId + ": " + reviewId, Response.Status.NOT_FOUND); @@ -180,7 +180,7 @@ public Comparison getReviewComparison(String projectId, String reviewId) String fromRevisionId = diffRef.getStartSha(); String toRevisionId = diffRef.getHeadSha(); ProjectStructure fromProjectStructure = getProjectStructure(projectId, workspaceSpec.getSourceSpecification(), fromRevisionId); - ProjectStructure toProjectStructure = getProjectStructure(projectId, workspaceSpec.getSource().getSourceSpecification(), toRevisionId); + ProjectStructure toProjectStructure = getProjectStructure(projectId, workspaceSpec.getWorkspaceSourceSpecification(), toRevisionId); return getComparisonResult(gitLabProjectId, repositoryApi, fromRevisionId, toRevisionId, fromProjectStructure, toProjectStructure); } @@ -195,7 +195,7 @@ public Comparison getReviewWorkspaceCreationComparison(String projectId, String RepositoryApi repositoryApi = gitLabApi.getRepositoryApi(); MergeRequest mergeRequest = getReviewMergeRequest(gitLabApi.getMergeRequestApi(), gitLabProjectId, reviewId); - WorkspaceSpecification workspaceSpec = parseWorkspaceBranchName(mergeRequest.getSourceBranch()); + WorkspaceSpecification workspaceSpec = parseWorkspaceBranchName(projectId, mergeRequest.getSourceBranch()); if (workspaceSpec == null) { throw new LegendSDLCServerException("Unknown review in project " + projectId + ": " + reviewId, Response.Status.NOT_FOUND); diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitLabConflictResolutionApi.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitLabConflictResolutionApi.java index 62c1cc175b..8773a2780f 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitLabConflictResolutionApi.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitLabConflictResolutionApi.java @@ -179,7 +179,7 @@ public void discardChangesConflictResolution(String projectId, WorkspaceSpecific { throw buildException(e, () -> "User " + getCurrentUser() + " is not allowed to create " + getReferenceInfo(projectId, workspaceWorkspaceSpec), - () -> "Unknown " + getReferenceInfo(projectId, workspaceWorkspaceSpec.getSource()), + () -> "Unknown " + getReferenceInfo(projectId, workspaceWorkspaceSpec.getWorkspaceSourceSpecification()), () -> "Error creating " + getReferenceInfo(projectId, workspaceWorkspaceSpec)); } if (newWorkspaceBranch == null) diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitLabEntityApi.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitLabEntityApi.java index b0f3161164..135f294445 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitLabEntityApi.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitLabEntityApi.java @@ -89,7 +89,7 @@ public EntityAccessContext getReviewFromEntityAccessContext(String projectId, St throw new LegendSDLCServerException("Unable to get [from] revision info in project " + projectId + " for review " + reviewId); } - WorkspaceSpecification workspaceSpec = parseWorkspaceBranchName(mergeRequest.getSourceBranch()); + WorkspaceSpecification workspaceSpec = parseWorkspaceBranchName(projectId, mergeRequest.getSourceBranch()); return new GitLabEntityAccessContext(projectId, workspaceSpec.getSourceSpecification(), diffRef.getStartSha()) { @Override @@ -115,7 +115,7 @@ public EntityAccessContext getReviewToEntityAccessContext(String projectId, Stri throw new LegendSDLCServerException("Unable to get [from] revision info in project " + projectId + " for review " + reviewId); } - WorkspaceSpecification workspaceSpec = parseWorkspaceBranchName(mergeRequest.getSourceBranch()); + WorkspaceSpecification workspaceSpec = parseWorkspaceBranchName(projectId, mergeRequest.getSourceBranch()); return new GitLabEntityAccessContext(projectId, workspaceSpec.getSourceSpecification(), diffRef.getHeadSha()) { @Override diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitLabPatchApi.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitLabPatchApi.java index 61b616d3bc..17a56ba0ca 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitLabPatchApi.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitLabPatchApi.java @@ -224,6 +224,34 @@ else if (maxPatchVersion != null) } } + @Override + public Patch getPatch(String projectId, VersionId patchReleaseVersionId) + { + LegendSDLCServerException.validateNonNull(projectId, "projectId may not be null"); + LegendSDLCServerException.validateNonNull(patchReleaseVersionId, "patchReleaseVersionId may not be null"); + + GitLabProjectId gitLabProjectId = parseProjectId(projectId); + String branchName = getPatchReleaseBranchName(patchReleaseVersionId); + + // Get patch branch + try + { + Pager pager = getGitLabApi().getRepositoryApi().getBranches(gitLabProjectId.getGitLabId(), "^" + branchName, ITEMS_PER_PAGE); + Stream stream = PagerTools.stream(pager) + .filter(branch -> (branch != null) && (branch.getName() != null) && branch.getName().equals(branchName)) + .map(branch -> fromPatchBranchName(projectId, branch.getName())); + Patch currentPatch = stream.collect(Collectors.toList()).get(0); + return currentPatch; + } + catch (Exception e) + { + throw buildException(e, + () -> "User " + getCurrentUser() + " is not allowed to delete patch " + patchReleaseVersionId.toVersionIdString() + " in project " + projectId, + () -> "Unknown patch " + patchReleaseVersionId.toVersionIdString() + " or project (" + projectId + ")", + () -> "Error getting patch " + patchReleaseVersionId.toVersionIdString() + " in project " + projectId); + } + } + @Override public void deletePatch(String projectId, VersionId patchReleaseVersionId) { diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitLabProjectConfigurationApi.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitLabProjectConfigurationApi.java index f494b8db3e..002dcd189c 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitLabProjectConfigurationApi.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitLabProjectConfigurationApi.java @@ -100,7 +100,7 @@ public ProjectConfiguration getReviewFromProjectConfiguration(String projectId, throw new LegendSDLCServerException("Unable to get [from] revision info in project " + projectId + " for review " + reviewId); } - WorkspaceSpecification workspaceSpec = parseWorkspaceBranchName(mergeRequest.getSourceBranch()); + WorkspaceSpecification workspaceSpec = parseWorkspaceBranchName(projectId, mergeRequest.getSourceBranch()); return super.getProjectConfiguration(projectId, workspaceSpec.getSourceSpecification(), diffRef.getStartSha()); } @@ -119,7 +119,7 @@ public ProjectConfiguration getReviewToProjectConfiguration(String projectId, St throw new LegendSDLCServerException("Unable to get [to] revision info in project " + projectId + " for review " + reviewId); } - WorkspaceSpecification workspaceSpec = parseWorkspaceBranchName(mergeRequest.getSourceBranch()); + WorkspaceSpecification workspaceSpec = parseWorkspaceBranchName(projectId, mergeRequest.getSourceBranch()); return super.getProjectConfiguration(projectId, workspaceSpec.getSourceSpecification(), diffRef.getHeadSha()); } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitLabReviewApi.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitLabReviewApi.java index d0d83eae23..2affeadbd4 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitLabReviewApi.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitLabReviewApi.java @@ -22,8 +22,10 @@ import org.eclipse.collections.impl.factory.primitive.IntObjectMaps; import org.eclipse.collections.impl.factory.primitive.IntSets; import org.eclipse.collections.impl.utility.Iterate; +import org.finos.legend.sdlc.domain.model.project.DevelopmentStream; import org.finos.legend.sdlc.domain.model.project.configuration.ProjectConfiguration; import org.finos.legend.sdlc.domain.model.project.configuration.ProjectDependency; +import org.finos.legend.sdlc.domain.model.project.workspace.Workspace; import org.finos.legend.sdlc.domain.model.project.workspace.WorkspaceType; import org.finos.legend.sdlc.domain.model.review.Approval; import org.finos.legend.sdlc.domain.model.review.Review; @@ -66,7 +68,6 @@ import java.util.Date; import java.util.List; import java.util.Set; -import java.util.function.BiPredicate; import java.util.function.Function; import java.util.function.Predicate; import java.util.function.Supplier; @@ -86,7 +87,7 @@ public GitLabReviewApi(GitLabConfiguration gitLabConfiguration, GitLabUserContex } @Override - public List getReviews(String projectId, ReviewState state, Iterable revisionIds, BiPredicate workspaceIdAndTypePredicate, Instant since, Instant until, Integer limit) + public List getReviews(String projectId, Set workspaceSources, ReviewState state, Iterable revisionIds, Instant since, Instant until, Integer limit) { LegendSDLCServerException.validateNonNull(projectId, "projectId may not be null"); Set revisionIdSet; @@ -143,8 +144,8 @@ else if (revisionIds instanceof Set) } String defaultBranch = getDefaultBranch(gitLabProjectId); Supplier defaultBranchSupplier = () -> defaultBranch; - Stream stream = mergeRequestStream.filter(mr -> isReviewMergeRequest(mr, defaultBranchSupplier)).map(mr -> fromGitLabMergeRequest(projectId, mr)); - return addReviewFilters(stream, state, workspaceIdAndTypePredicate, since, until, limit).collect(Collectors.toList()); + Stream stream = mergeRequestStream.filter(mr -> isReviewMergeRequest(mr, projectId, defaultBranchSupplier)).map(mr -> fromGitLabMergeRequest(projectId, mr)); + return addReviewFilters(stream, state, workspaceSources, since, until, limit).collect(Collectors.toList()); } catch (Exception e) { @@ -157,7 +158,7 @@ else if (revisionIds instanceof Set) } @Override - public List getReviews(boolean assignedToMe, boolean authoredByMe, List labels, BiPredicate workspaceIdAndTypePredicate, ReviewState state, Instant since, Instant until, Integer limit) + public List getReviews(boolean assignedToMe, boolean authoredByMe, Set workspaceSources, List labels, ReviewState state, Instant since, Instant until, Integer limit) { if (assignedToMe && authoredByMe) { @@ -165,7 +166,7 @@ public List getReviews(boolean assignedToMe, boolean authoredByMe, List< } MergeRequestFilter mergeRequestFilter = withMergeRequestLabels(withMergeRequestFilters(new MergeRequestFilter(), state, since, until).withScope(assignedToMe ? MergeRequestScope.ASSIGNED_TO_ME : (authoredByMe ? MergeRequestScope.CREATED_BY_ME : MergeRequestScope.ALL)), labels); - return addReviewFilters(getReviewStream(mergeRequestFilter), state, workspaceIdAndTypePredicate, since, until, limit).collect(Collectors.toList()); + return addReviewFilters(getReviewStream(mergeRequestFilter), state, workspaceSources, since, until, limit).collect(Collectors.toList()); } private Stream getReviewStream(MergeRequestFilter mergeRequestFilter) @@ -175,7 +176,11 @@ private Stream getReviewStream(MergeRequestFilter mergeRequestFilter) try { return PagerTools.stream(withRetries(() -> getGitLabApi().getMergeRequestApi().getMergeRequests(mergeRequestFilter, ITEMS_PER_PAGE))) - .filter(mr -> isReviewMergeRequest(mr, () -> defaultBranchByProject.getIfAbsentPut(mr.getProjectId(), () -> getDefaultBranch(GitLabProjectId.newProjectId(idPrefix, mr.getProjectId()))))) + .filter(mr -> + { + GitLabProjectId gitLabProjectId = GitLabProjectId.newProjectId(idPrefix, mr.getProjectId()); + return isReviewMergeRequest(mr, gitLabProjectId.toString(), () -> defaultBranchByProject.getIfAbsentPut(mr.getProjectId(), () -> getDefaultBranch(gitLabProjectId))); + }) .map(mr -> fromGitLabMergeRequest(GitLabProjectId.newProjectId(idPrefix, mr.getProjectId()).toString(), mr)); } catch (Exception e) @@ -229,14 +234,14 @@ private MergeRequestFilter withMergeRequestLabels(MergeRequestFilter mergeReques return mergeRequestFilter; } - private Stream addReviewFilters(Stream stream, ReviewState state, BiPredicate workspaceIdAndTypePredicate, Instant since, Instant until, Integer limit) + private Stream addReviewFilters(Stream stream, ReviewState state, Set workspaceSources, Instant since, Instant until, Integer limit) { - return addWorkspaceIdAndTypeFilter(addLimitFilter(addTimeFilter(addStateFilter(stream, state), state, since, until), limit), workspaceIdAndTypePredicate); + return addDevelopmentStreamFilter(addLimitFilter(addTimeFilter(addStateFilter(stream, state), state, since, until), limit), workspaceSources); } - public Stream addWorkspaceIdAndTypeFilter(Stream stream, BiPredicate workspaceIdAndTypePredicate) + public Stream addDevelopmentStreamFilter(Stream stream, Set workspaceSources) { - return workspaceIdAndTypePredicate == null ? stream : stream.filter(r -> workspaceIdAndTypePredicate.test(r.getWorkspaceId(), r.getWorkspaceType())); + return (workspaceSources == null || workspaceSources.isEmpty()) ? stream : stream.filter(r -> workspaceSources.contains(r.getWorkspace().getSource())); } private Stream addStateFilter(Stream stream, ReviewState state) @@ -354,7 +359,7 @@ public Review createReview(String projectId, WorkspaceSpecification workspaceSpe boolean sourceBranchExists = withRetries(() -> GitLabApiTools.branchExists(gitLabApi, gitLabProjectId.getGitLabId(), sourceBranchName)); if (!sourceBranchExists) { - throw new LegendSDLCServerException("Review target does not exist: " + getReferenceInfo(projectId, workspaceSpecification.getSource()), Status.CONFLICT); + throw new LegendSDLCServerException("Review target does not exist: " + getReferenceInfo(projectId, workspaceSpecification.getWorkspaceSourceSpecification()), Status.CONFLICT); } MergeRequest mergeRequest = gitLabApi.getMergeRequestApi().createMergeRequest(gitLabProjectId.getGitLabId(), workspaceBranchName, sourceBranchName, title, description, null, null, (labels == null || labels.isEmpty()) ? null : labels.toArray(new String[0]), null, true); @@ -573,7 +578,7 @@ public Review commitReview(String projectId, String reviewId, String message) } // Validate the project configuration - WorkspaceSpecification workspaceSpec = parseWorkspaceBranchName(mergeRequest.getSourceBranch()); + WorkspaceSpecification workspaceSpec = parseWorkspaceBranchName(projectId, mergeRequest.getSourceBranch()); if (workspaceSpec == null) { throw new LegendSDLCServerException("Error committing review " + reviewId + " in project " + projectId + ": could not find workspace information"); @@ -953,7 +958,7 @@ protected static Review fromGitLabMergeRequest(String projectId, MergeRequest me } String sourceBranchName = mergeRequest.getSourceBranch(); - WorkspaceSpecification workspaceInfo = parseWorkspaceBranchName(sourceBranchName); + WorkspaceSpecification workspaceInfo = parseWorkspaceBranchName(projectId, sourceBranchName); if ((workspaceInfo == null) || (workspaceInfo.getAccessType() != ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE)) { return null; @@ -964,15 +969,10 @@ protected static Review fromGitLabMergeRequest(String projectId, MergeRequest me private static Review newReview(Integer reviewId, String projectId, WorkspaceSpecification workspaceSpec, String title, String description, Date createdAt, Date lastUpdatedAt, Date closedAt, Date committedAt, String reviewState, AbstractUser author, String commitRevisionId, String webURL, List labels) { - return newReview(reviewId, projectId, workspaceSpec.getId(), workspaceSpec.getType(), title, description, createdAt, lastUpdatedAt, closedAt, committedAt, reviewState, author, commitRevisionId, webURL, labels); - } - - private static Review newReview(Integer reviewId, String projectId, String workspaceId, WorkspaceType workspaceType, String title, String description, Date createdAt, Date lastUpdatedAt, Date closedAt, Date committedAt, String reviewState, AbstractUser author, String commitRevisionId, String webURL, List labels) - { - return newReview(toStringIfNotNull(reviewId), projectId, workspaceId, workspaceType, title, description, toInstantIfNotNull(createdAt), toInstantIfNotNull(lastUpdatedAt), toInstantIfNotNull(closedAt), toInstantIfNotNull(committedAt), getReviewState(reviewState), fromGitLabAbstractUser(author), commitRevisionId, webURL, labels); + return newReview(toStringIfNotNull(reviewId), projectId, workspaceSpec, title, description, toInstantIfNotNull(createdAt), toInstantIfNotNull(lastUpdatedAt), toInstantIfNotNull(closedAt), toInstantIfNotNull(committedAt), getReviewState(reviewState), fromGitLabAbstractUser(author), commitRevisionId, webURL, labels); } - private static Review newReview(String reviewId, String projectId, String workspaceId, WorkspaceType workspaceType, String title, String description, Instant createdAt, Instant lastUpdatedAt, Instant closedAt, Instant committedAt, ReviewState reviewState, User author, String commitRevisionId, String webURL, List labels) + private static Review newReview(String reviewId, String projectId, WorkspaceSpecification workspaceSpecification, String title, String description, Instant createdAt, Instant lastUpdatedAt, Instant closedAt, Instant committedAt, ReviewState reviewState, User author, String commitRevisionId, String webURL, List labels) { return new Review() { @@ -988,16 +988,47 @@ public String getProjectId() return projectId; } + @Override + public Workspace getWorkspace() + { + return new Workspace() + { + @Override + public String getProjectId() + { + return projectId; + } + + @Override + public String getUserId() + { + return workspaceSpecification.getUserId(); + } + + @Override + public String getWorkspaceId() + { + return workspaceSpecification.getId(); + } + + @Override + public DevelopmentStream getSource() + { + return workspaceSpecification.getSource(); + } + }; + } + @Override public String getWorkspaceId() { - return workspaceId; + return workspaceSpecification.getId(); } @Override public WorkspaceType getWorkspaceType() { - return workspaceType; + return workspaceSpecification.getType(); } @Override diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitLabRevisionApi.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitLabRevisionApi.java index 83063e8fa6..a2194a1164 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitLabRevisionApi.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitLabRevisionApi.java @@ -168,7 +168,7 @@ public RevisionStatus getRevisionStatus(String projectId, String revisionId) } // workspace branch - WorkspaceSpecification workspaceSpec = parseWorkspaceBranchName(cr.getName()); + WorkspaceSpecification workspaceSpec = parseWorkspaceBranchName(projectId, cr.getName()); if ((workspaceSpec != null) && (workspaceSpec.getAccessType() == ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE)) { workspaces.add(fromWorkspaceSpecification(projectId, workspaceSpec)); diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitLabWorkspaceApi.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitLabWorkspaceApi.java index f5af934b2f..02bf439243 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitLabWorkspaceApi.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitLabWorkspaceApi.java @@ -15,14 +15,14 @@ package org.finos.legend.sdlc.server.gitlab.api; import org.eclipse.collections.api.factory.Lists; +import org.finos.legend.sdlc.domain.model.patch.Patch; +import org.finos.legend.sdlc.domain.model.project.DevelopmentStream; +import org.finos.legend.sdlc.domain.model.project.DevelopmentStreamConsumer; import org.finos.legend.sdlc.domain.model.project.workspace.Workspace; import org.finos.legend.sdlc.domain.model.project.workspace.WorkspaceType; import org.finos.legend.sdlc.domain.model.revision.Revision; import org.finos.legend.sdlc.server.domain.api.revision.RevisionApi; -import org.finos.legend.sdlc.server.domain.api.workspace.PatchWorkspaceSource; import org.finos.legend.sdlc.server.domain.api.workspace.WorkspaceApi; -import org.finos.legend.sdlc.server.domain.api.workspace.WorkspaceSource; -import org.finos.legend.sdlc.server.domain.api.workspace.WorkspaceSourceConsumer; import org.finos.legend.sdlc.server.domain.api.workspace.WorkspaceSpecification; import org.finos.legend.sdlc.server.error.LegendSDLCServerException; import org.finos.legend.sdlc.server.gitlab.GitLabConfiguration; @@ -102,18 +102,18 @@ public Workspace getWorkspace(String projectId, WorkspaceSpecification workspace } @Override - public List getWorkspaces(String projectId, Set types, Set accessTypes, Set sources) + public List getWorkspaces(String projectId, Set types, Set accessTypes, Set sources) { return getWorkspaces(projectId, types, accessTypes, sources, getCurrentUser()); } @Override - public List getAllWorkspaces(String projectId, Set types, Set accessTypes, Set sources) + public List getAllWorkspaces(String projectId, Set types, Set accessTypes, Set sources) { return getWorkspaces(projectId, types, accessTypes, sources, null); } - private List getWorkspaces(String projectId, Set types, Set accessTypes, Set sources, String userId) + private List getWorkspaces(String projectId, Set types, Set accessTypes, Set sources, String userId) { LegendSDLCServerException.validateNonNull(projectId, "projectId may not be null"); GitLabProjectId gitLabProjectId = parseProjectId(projectId); @@ -134,7 +134,7 @@ private List getWorkspaces(String projectId, Set types { for (WorkspaceAccessType accessType : resolvedAccessTypes) { - for (WorkspaceSource source : sources) + for (DevelopmentStream source : sources) { Stream localStream = getWorkspaces(gitLabProjectId, type, accessType, source, userId); stream = (stream == null) ? localStream : Stream.concat(stream, localStream); @@ -171,7 +171,7 @@ private Stream getAllPatchWorkspaces(GitLabProjectId pro Stream stream = PagerTools.stream(pager) .map(Branch::getName) .filter(n -> (n != null) && n.startsWith(branchPrefix)) - .map(GitLabWorkspaceApi::parseWorkspaceBranchName) + .map(branchName -> parseWorkspaceBranchName(projectId.toString(), branchName)) .filter(Objects::nonNull); if (types != null) { @@ -188,7 +188,7 @@ private Stream getAllPatchWorkspaces(GitLabProjectId pro return stream; } - private Stream getWorkspaces(GitLabProjectId projectId, WorkspaceType type, WorkspaceAccessType accessType, WorkspaceSource source, String userId) throws GitLabApiException + private Stream getWorkspaces(GitLabProjectId projectId, WorkspaceType type, WorkspaceAccessType accessType, DevelopmentStream source, String userId) throws GitLabApiException { String branchPrefix = getBranchSearchPrefix(type, accessType, source, userId); @@ -197,12 +197,12 @@ private Stream getWorkspaces(GitLabProjectId projectId, return PagerTools.stream(pager) .map(Branch::getName) .filter(n -> (n != null) && n.startsWith(branchPrefix)) - .map(GitLabWorkspaceApi::parseWorkspaceBranchName) + .map(branchName -> parseWorkspaceBranchName(projectId.toString(), branchName)) .filter(Objects::nonNull) .filter(spec -> (spec.getType() == type) && (spec.getAccessType() == accessType) && source.equals(spec.getSource())); } - private String getBranchSearchPrefix(WorkspaceType type, WorkspaceAccessType accessType, WorkspaceSource source, String userId) + private String getBranchSearchPrefix(WorkspaceType type, WorkspaceAccessType accessType, DevelopmentStream source, String userId) { if (type == WorkspaceType.USER) { @@ -249,9 +249,9 @@ public boolean isWorkspaceOutdated(String projectId, WorkspaceSpecification work catch (Exception e) { throw buildException(e, - () -> "User " + getCurrentUser() + " is not allowed to access the latest revision in " + getReferenceInfo(projectId, workspaceSpecification.getSource()), - () -> "Unknown: " + getReferenceInfo(projectId, workspaceSpecification.getSource()), - () -> "Error accessing latest revision for " + getReferenceInfo(projectId, workspaceSpecification.getSource())); + () -> "User " + getCurrentUser() + " is not allowed to access the latest revision in " + getReferenceInfo(projectId, workspaceSpecification.getWorkspaceSourceSpecification()), + () -> "Unknown: " + getReferenceInfo(projectId, workspaceSpecification.getWorkspaceSourceSpecification()), + () -> "Error accessing latest revision for " + getReferenceInfo(projectId, workspaceSpecification.getWorkspaceSourceSpecification())); } String sourceBranchRevisionId = sourceBranch.getCommit().getId(); @@ -321,7 +321,7 @@ public boolean isWorkspaceInConflictResolutionMode(String projectId, WorkspaceSp } @Override - public Workspace newWorkspace(String projectId, String workspaceId, WorkspaceType type, WorkspaceSource source) + public Workspace newWorkspace(String projectId, String workspaceId, WorkspaceType type, DevelopmentStream source) { LegendSDLCServerException.validateNonNull(projectId, "projectId may not be null"); LegendSDLCServerException.validateNonNull(workspaceId, "workspace id may not be null"); @@ -339,14 +339,14 @@ public Workspace newWorkspace(String projectId, String workspaceId, WorkspaceTyp RepositoryApi repositoryApi = getGitLabApi().getRepositoryApi(); // check if the source branch exists or not - workspaceSpecification.getSource().visit(new WorkspaceSourceConsumer() + workspaceSpecification.getSource().visit(new DevelopmentStreamConsumer() { @Override - protected void accept(PatchWorkspaceSource source) + protected void accept(Patch source) { - if (!isPatchReleaseBranchPresent(gitLabProjectId, source.getPatchVersionId())) + if (!isPatchReleaseBranchPresent(gitLabProjectId, source.getPatchReleaseVersionId())) { - throw new LegendSDLCServerException("Patch release branch for " + source.getPatchVersionId() + " doesn't exist", Response.Status.BAD_REQUEST); + throw new LegendSDLCServerException("Patch release branch for " + source.getPatchReleaseVersionId() + " doesn't exist", Response.Status.BAD_REQUEST); } } }); @@ -531,9 +531,9 @@ public WorkspaceUpdateReport updateWorkspace(String projectId, WorkspaceSpecific catch (Exception e) { throw buildException(e, - () -> "User " + getCurrentUser() + " is not allowed to access the latest revision in " + getReferenceInfo(projectId, workspaceSpecification.getSource()), - () -> "Unknown : " + getReferenceInfo(projectId, workspaceSpecification.getSource()), - () -> "Error accessing latest revision for " + getReferenceInfo(projectId, workspaceSpecification.getSource())); + () -> "User " + getCurrentUser() + " is not allowed to access the latest revision in " + getReferenceInfo(projectId, workspaceSpecification.getWorkspaceSourceSpecification()), + () -> "Unknown : " + getReferenceInfo(projectId, workspaceSpecification.getWorkspaceSourceSpecification()), + () -> "Error accessing latest revision for " + getReferenceInfo(projectId, workspaceSpecification.getWorkspaceSourceSpecification())); } String sourceRevisionId = sourceBranch.getCommit().getId(); @@ -563,9 +563,9 @@ public WorkspaceUpdateReport updateWorkspace(String projectId, WorkspaceSpecific catch (Exception e) { throw buildException(e, - () -> "User " + getCurrentUser() + " is not allowed to access revision " + sourceRevisionId + " in " + getReferenceInfo(projectId, workspaceSpecification.getSource()), - () -> "Unknown revision in " + getReferenceInfo(projectId, workspaceSpecification.getSource()) + ": " + sourceRevisionId, - () -> "Error accessing revision " + sourceRevisionId + " of " + getReferenceInfo(projectId, workspaceSpecification.getSource())); + () -> "User " + getCurrentUser() + " is not allowed to access revision " + sourceRevisionId + " in " + getReferenceInfo(projectId, workspaceSpecification.getWorkspaceSourceSpecification()), + () -> "Unknown revision in " + getReferenceInfo(projectId, workspaceSpecification.getWorkspaceSourceSpecification()) + ": " + sourceRevisionId, + () -> "Error accessing revision " + sourceRevisionId + " of " + getReferenceInfo(projectId, workspaceSpecification.getWorkspaceSourceSpecification())); } // Temp branch for checking for merge conflicts @@ -1016,7 +1016,7 @@ private WorkspaceUpdateReport createConflictResolution(String projectId, Workspa // Create a new commit on conflict resolution branch CommitsApi commitsApi = getGitLabApi().getCommitsApi(); - ProjectFileAccessProvider.FileAccessContext projectFileAccessContext = getProjectFileAccessProvider().getFileAccessContext(projectId, workspaceSpec.getSource().getSourceSpecification()); + ProjectFileAccessProvider.FileAccessContext projectFileAccessContext = getProjectFileAccessProvider().getFileAccessContext(projectId, workspaceSpec.getWorkspaceSourceSpecification()); ProjectFileAccessProvider.FileAccessContext workspaceFileAccessContext = getProjectFileAccessProvider().getFileAccessContext(projectId, workspaceSpec.getSourceSpecification()); try { diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitlabWorkflowApi.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitlabWorkflowApi.java index 12e9a1b1fa..53c488a5bb 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitlabWorkflowApi.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/gitlab/api/GitlabWorkflowApi.java @@ -87,7 +87,7 @@ public WorkflowAccessContext getReviewWorkflowAccessContext(String projectId, St GitLabProjectId gitLabProjectId = parseProjectId(projectId); MergeRequest mergeRequest = getReviewMergeRequest(getGitLabApi().getMergeRequestApi(), gitLabProjectId, reviewId, true); - WorkspaceSpecification workspaceSpec = parseWorkspaceBranchName(mergeRequest.getSourceBranch()); + WorkspaceSpecification workspaceSpec = parseWorkspaceBranchName(projectId, mergeRequest.getSourceBranch()); if (workspaceSpec == null) { throw new LegendSDLCServerException("Unknown review in project " + projectId + ": " + reviewId, Response.Status.NOT_FOUND); diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/project/ProjectFileAccessProvider.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/project/ProjectFileAccessProvider.java index ad7df03079..ffd56189b7 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/project/ProjectFileAccessProvider.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/project/ProjectFileAccessProvider.java @@ -14,12 +14,12 @@ package org.finos.legend.sdlc.server.project; +import org.finos.legend.sdlc.domain.model.project.DevelopmentStream; import org.finos.legend.sdlc.domain.model.project.workspace.WorkspaceType; import org.finos.legend.sdlc.domain.model.revision.Revision; import org.finos.legend.sdlc.domain.model.version.VersionId; import org.finos.legend.sdlc.server.domain.api.project.source.SourceSpecification; import org.finos.legend.sdlc.server.domain.api.project.source.WorkspaceSourceSpecification; -import org.finos.legend.sdlc.server.domain.api.workspace.WorkspaceSource; import org.finos.legend.sdlc.server.domain.api.workspace.WorkspaceSpecification; import org.finos.legend.sdlc.server.error.LegendSDLCServerException; import org.finos.legend.sdlc.server.tools.IOTools; @@ -231,7 +231,7 @@ default FileAccessContext getWorkspaceFileAccessContext(String projectId, String LegendSDLCServerException.validateNonNull(workspaceId, "workspaceId may not be null"); LegendSDLCServerException.validateNonNull(workspaceType, "workspaceType may not be null"); LegendSDLCServerException.validateNonNull(workspaceAccessType, "workspaceAccessType may not be null"); - return getFileAccessContext(projectId, SourceSpecification.workspaceSourceSpecification(WorkspaceSpecification.newWorkspaceSpecification(workspaceId, workspaceType, workspaceAccessType, WorkspaceSource.projectWorkspaceSource()))); + return getFileAccessContext(projectId, SourceSpecification.workspaceSourceSpecification(WorkspaceSpecification.newWorkspaceSpecification(workspaceId, workspaceType, workspaceAccessType, DevelopmentStream.projectDevelopmentStream()))); } @Deprecated @@ -241,7 +241,7 @@ default FileAccessContext getWorkspaceRevisionFileAccessContext(String projectId LegendSDLCServerException.validateNonNull(workspaceType, "workspaceType may not be null"); LegendSDLCServerException.validateNonNull(workspaceAccessType, "workspaceAccessType may not be null"); LegendSDLCServerException.validateNonNull(revisionId, "revisionId may not be null"); - return getFileAccessContext(projectId, SourceSpecification.workspaceSourceSpecification(WorkspaceSpecification.newWorkspaceSpecification(workspaceId, workspaceType, workspaceAccessType, WorkspaceSource.projectWorkspaceSource())), revisionId); + return getFileAccessContext(projectId, SourceSpecification.workspaceSourceSpecification(WorkspaceSpecification.newWorkspaceSpecification(workspaceId, workspaceType, workspaceAccessType, DevelopmentStream.projectDevelopmentStream())), revisionId); } @Deprecated diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/project/ProjectStructure.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/project/ProjectStructure.java index fe605be9ac..ce37288a10 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/project/ProjectStructure.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/project/ProjectStructure.java @@ -434,7 +434,7 @@ else if (requireRevisionId) revisionId = updateBuilder.getRevisionId(); } - FileAccessContext fileAccessContext = CachingFileAccessContext.wrap(projectFileAccessProvider.getFileAccessContext(projectId, SourceSpecification.newSourceSpecification(workspaceId, workspaceType, workspaceAccessType, patchReleaseVersionId), revisionId)); + FileAccessContext fileAccessContext = CachingFileAccessContext.wrap(projectFileAccessProvider.getFileAccessContext(projectId, SourceSpecification.newSourceSpecification(projectId, workspaceId, workspaceType, workspaceAccessType, patchReleaseVersionId), revisionId)); ProjectFile configFile = getProjectConfigurationFile(fileAccessContext); ProjectConfiguration currentConfig = (configFile == null) ? getDefaultProjectConfiguration(projectId) : readProjectConfiguration(configFile); diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/group/BackupPatchesGroupWorkspaceEntitiesResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/group/BackupPatchesGroupWorkspaceEntitiesResource.java index aa5c3320f4..0f6c3ef29d 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/group/BackupPatchesGroupWorkspaceEntitiesResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/group/BackupPatchesGroupWorkspaceEntitiesResource.java @@ -85,7 +85,7 @@ public List getAllEntities(@PathParam("projectId") String projectId, } return executeWithLogging( "getting entities in backup group workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> getEntities(this.entityApi.getBackupWorkspaceEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes, excludeInvalid) + () -> getEntities(this.entityApi.getBackupWorkspaceEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes, excludeInvalid) ); } @@ -106,7 +106,7 @@ public Entity getEntityByPath(@PathParam("projectId") String projectId, @PathPar } return executeWithLogging( "getting entity " + path + " in backup group workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.entityApi.getBackupWorkspaceEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)).getEntity(path) + () -> this.entityApi.getBackupWorkspaceEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)).getEntity(path) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/group/BackupPatchesGroupWorkspaceEntityPathsResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/group/BackupPatchesGroupWorkspaceEntityPathsResource.java index 6fca143091..50908feddc 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/group/BackupPatchesGroupWorkspaceEntityPathsResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/group/BackupPatchesGroupWorkspaceEntityPathsResource.java @@ -81,7 +81,7 @@ public List getEntitiesPaths(@PathParam("projectId") String projectId, } return executeWithLogging( "getting entity paths in group workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> getEntityPaths(this.entityApi.getBackupWorkspaceEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes) + () -> getEntityPaths(this.entityApi.getBackupWorkspaceEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/group/BackupPatchesGroupWorkspaceProjectConfigurationResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/group/BackupPatchesGroupWorkspaceProjectConfigurationResource.java index c30d3e90ac..d865d5fa82 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/group/BackupPatchesGroupWorkspaceProjectConfigurationResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/group/BackupPatchesGroupWorkspaceProjectConfigurationResource.java @@ -62,7 +62,7 @@ public ProjectConfiguration getWorkspaceProjectConfiguration(@PathParam("project } return executeWithLogging( "getting project " + projectId + " configuration in backup group workspace " + workspaceId + " for patch release version " + patchReleaseVersionId, - () -> this.projectConfigurationApi.getBackupWorkspaceProjectConfiguration(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)) + () -> this.projectConfigurationApi.getBackupWorkspaceProjectConfiguration(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/group/BackupPatchesGroupWorkspaceResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/group/BackupPatchesGroupWorkspaceResource.java index 8507b9af40..9ac85156b0 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/group/BackupPatchesGroupWorkspaceResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/group/BackupPatchesGroupWorkspaceResource.java @@ -69,7 +69,7 @@ public Workspace getGroupWorkspace(@PathParam("projectId") String projectId, @Pa } return executeWithLogging( "getting backup group workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.workspaceApi.getBackupWorkspace(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)) + () -> this.workspaceApi.getBackupWorkspace(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)) ); } @@ -90,7 +90,7 @@ public boolean isWorkspaceOutdated(@PathParam("projectId") String projectId, @Pa } return executeWithLogging( "checking if backup group workspace " + workspaceId + " of project " + projectId + " for patch release version " + patchReleaseVersionId + " is outdated", - () -> this.workspaceApi.isBackupWorkspaceOutdated(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)) + () -> this.workspaceApi.isBackupWorkspaceOutdated(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)) ); } @@ -110,7 +110,7 @@ public void discardBackup(@PathParam("projectId") String projectId, @PathParam(" } executeWithLogging( "discarding backup group workspace " + workspaceId + " in project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.backupApi.discardBackupWorkspace(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)) + () -> this.backupApi.discardBackupWorkspace(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)) ); } @@ -134,7 +134,7 @@ public void recoverBackup(@PathParam("projectId") String projectId, } executeWithLogging( forceRecovery ? "force " : "" + "recovering group workspace " + workspaceId + " from backup in project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.backupApi.recoverBackupWorkspace(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId), forceRecovery) + () -> this.backupApi.recoverBackupWorkspace(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId), forceRecovery) ); } } \ No newline at end of file diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/group/BackupPatchesGroupWorkspaceRevisionEntitiesResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/group/BackupPatchesGroupWorkspaceRevisionEntitiesResource.java index 6c967b1976..d940ebf1cf 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/group/BackupPatchesGroupWorkspaceRevisionEntitiesResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/group/BackupPatchesGroupWorkspaceRevisionEntitiesResource.java @@ -87,7 +87,7 @@ public List getAllEntities(@PathParam("projectId") String projectId, } return executeWithLogging( "getting entities in revision " + revisionId + " of backup group workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> getEntities(this.entityApi.getBackupWorkspaceRevisionEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId), revisionId), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes, excludeInvalid) + () -> getEntities(this.entityApi.getBackupWorkspaceRevisionEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId), revisionId), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes, excludeInvalid) ); } @@ -108,7 +108,7 @@ public Entity getEntityByPath(@PathParam("projectId") String projectId, @PathPar } return executeWithLogging( "getting entity " + path + " in revision " + revisionId + " of backup group workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.entityApi.getBackupWorkspaceRevisionEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId), revisionId).getEntity(path) + () -> this.entityApi.getBackupWorkspaceRevisionEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId), revisionId).getEntity(path) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/group/BackupPatchesGroupWorkspaceRevisionEntityPathsResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/group/BackupPatchesGroupWorkspaceRevisionEntityPathsResource.java index 1279007112..3d80eb4124 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/group/BackupPatchesGroupWorkspaceRevisionEntityPathsResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/group/BackupPatchesGroupWorkspaceRevisionEntityPathsResource.java @@ -82,7 +82,7 @@ public List getAllEntities(@PathParam("projectId") String projectId, } return executeWithLogging( "getting entity paths in revision " + revisionId + " of backup group workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> getEntityPaths(this.entityApi.getBackupWorkspaceRevisionEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId), revisionId), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes) + () -> getEntityPaths(this.entityApi.getBackupWorkspaceRevisionEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId), revisionId), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/group/BackupPatchesGroupWorkspaceRevisionProjectConfigurationResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/group/BackupPatchesGroupWorkspaceRevisionProjectConfigurationResource.java index 89e78514f1..1f6f3b0854 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/group/BackupPatchesGroupWorkspaceRevisionProjectConfigurationResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/group/BackupPatchesGroupWorkspaceRevisionProjectConfigurationResource.java @@ -66,7 +66,7 @@ public ProjectConfiguration getWorkspaceRevisionProjectConfiguration(@PathParam( } return executeWithLogging( "getting project " + projectId + " configuration in backup group workspace " + workspaceId + " at revision " + revisionId + " for patch release version " + patchReleaseVersionId, - () -> this.projectConfigurationApi.getBackupWorkspaceRevisionProjectConfiguration(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId), revisionId) + () -> this.projectConfigurationApi.getBackupWorkspaceRevisionProjectConfiguration(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId), revisionId) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/group/BackupPatchesGroupWorkspaceRevisionsResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/group/BackupPatchesGroupWorkspaceRevisionsResource.java index e6d6712c83..a79128cfaf 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/group/BackupPatchesGroupWorkspaceRevisionsResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/group/BackupPatchesGroupWorkspaceRevisionsResource.java @@ -73,7 +73,7 @@ public List getRevisions(@PathParam("projectId") String projectId, } return executeWithLogging( "getting revision for group backup workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.revisionApi.getBackupWorkspaceRevisionContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)).getRevisions(null, ResolvedInstant.getResolvedInstantIfNonNull(since), ResolvedInstant.getResolvedInstantIfNonNull(until), limit) + () -> this.revisionApi.getBackupWorkspaceRevisionContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)).getRevisions(null, ResolvedInstant.getResolvedInstantIfNonNull(since), ResolvedInstant.getResolvedInstantIfNonNull(until), limit) ); } @@ -97,7 +97,7 @@ public Revision getRevision(@PathParam("projectId") String projectId, } return executeWithLogging( "getting revision " + revisionId + " for backup group workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.revisionApi.getBackupWorkspaceRevisionContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)).getRevision(revisionId) + () -> this.revisionApi.getBackupWorkspaceRevisionContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)).getRevision(revisionId) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/user/BackupPatchesWorkspaceEntitiesResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/user/BackupPatchesWorkspaceEntitiesResource.java index fb1d22d2f7..b7abe749c8 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/user/BackupPatchesWorkspaceEntitiesResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/user/BackupPatchesWorkspaceEntitiesResource.java @@ -85,7 +85,7 @@ public List getAllEntities(@PathParam("projectId") String projectId, } return executeWithLogging( "getting entities in backup user workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> getEntities(this.entityApi.getBackupWorkspaceEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes, excludeInvalid) + () -> getEntities(this.entityApi.getBackupWorkspaceEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes, excludeInvalid) ); } @@ -106,7 +106,7 @@ public Entity getEntityByPath(@PathParam("projectId") String projectId, @PathPar } return executeWithLogging( "getting entity " + path + " in backup user workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.entityApi.getBackupWorkspaceEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)).getEntity(path) + () -> this.entityApi.getBackupWorkspaceEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)).getEntity(path) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/user/BackupPatchesWorkspaceEntityPathsResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/user/BackupPatchesWorkspaceEntityPathsResource.java index 9c5cb2468f..609229c4f2 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/user/BackupPatchesWorkspaceEntityPathsResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/user/BackupPatchesWorkspaceEntityPathsResource.java @@ -81,7 +81,7 @@ public List getEntitiesPaths(@PathParam("projectId") String projectId, } return executeWithLogging( "getting entity paths in user workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> getEntityPaths(this.entityApi.getBackupWorkspaceEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes) + () -> getEntityPaths(this.entityApi.getBackupWorkspaceEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/user/BackupPatchesWorkspaceProjectConfigurationResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/user/BackupPatchesWorkspaceProjectConfigurationResource.java index b922abcf99..d58f35c104 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/user/BackupPatchesWorkspaceProjectConfigurationResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/user/BackupPatchesWorkspaceProjectConfigurationResource.java @@ -62,7 +62,7 @@ public ProjectConfiguration getWorkspaceProjectConfiguration(@PathParam("project } return executeWithLogging( "getting project " + projectId + " configuration in backup user workspace " + workspaceId, - () -> this.projectConfigurationApi.getBackupWorkspaceProjectConfiguration(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)) + () -> this.projectConfigurationApi.getBackupWorkspaceProjectConfiguration(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/user/BackupPatchesWorkspaceResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/user/BackupPatchesWorkspaceResource.java index 5dd252a000..0cab444bf1 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/user/BackupPatchesWorkspaceResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/user/BackupPatchesWorkspaceResource.java @@ -69,7 +69,7 @@ public Workspace getUserWorkspace(@PathParam("projectId") String projectId, @Pat } return executeWithLogging( "getting backup user workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.workspaceApi.getBackupWorkspace(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)) + () -> this.workspaceApi.getBackupWorkspace(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)) ); } @@ -90,7 +90,7 @@ public boolean isWorkspaceOutdated(@PathParam("projectId") String projectId, @Pa } return executeWithLogging( "checking if backup user workspace " + workspaceId + " of project " + projectId + " for patch release version " + patchReleaseVersionId + " is outdated", - () -> this.workspaceApi.isBackupWorkspaceOutdated(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)) + () -> this.workspaceApi.isBackupWorkspaceOutdated(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)) ); } @@ -110,7 +110,7 @@ public void discardBackup(@PathParam("projectId") String projectId, @PathParam(" } executeWithLogging( "discarding backup user workspace " + workspaceId + " in project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.backupApi.discardBackupWorkspace(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)) + () -> this.backupApi.discardBackupWorkspace(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)) ); } @@ -134,7 +134,7 @@ public void recoverBackup(@PathParam("projectId") String projectId, } executeWithLogging( forceRecovery ? "force " : "" + "recovering user workspace " + workspaceId + " from backup in project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.backupApi.recoverBackupWorkspace(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId), forceRecovery) + () -> this.backupApi.recoverBackupWorkspace(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId), forceRecovery) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/user/BackupPatchesWorkspaceRevisionEntitiesResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/user/BackupPatchesWorkspaceRevisionEntitiesResource.java index fd296622c7..962439ca7c 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/user/BackupPatchesWorkspaceRevisionEntitiesResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/user/BackupPatchesWorkspaceRevisionEntitiesResource.java @@ -86,7 +86,7 @@ public List getAllEntities(@PathParam("projectId") String projectId, } return executeWithLogging( "getting entities in revision " + revisionId + " of backup user workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> getEntities(this.entityApi.getBackupWorkspaceRevisionEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId), revisionId), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes, excludeInvalid) + () -> getEntities(this.entityApi.getBackupWorkspaceRevisionEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId), revisionId), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes, excludeInvalid) ); } @@ -107,7 +107,7 @@ public Entity getEntityByPath(@PathParam("projectId") String projectId, @PathPar } return executeWithLogging( "getting entity " + path + " in revision " + revisionId + " of backup user workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.entityApi.getBackupWorkspaceRevisionEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId), revisionId).getEntity(path) + () -> this.entityApi.getBackupWorkspaceRevisionEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId), revisionId).getEntity(path) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/user/BackupPatchesWorkspaceRevisionEntityPathsResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/user/BackupPatchesWorkspaceRevisionEntityPathsResource.java index 5b4471eabc..a4e9867946 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/user/BackupPatchesWorkspaceRevisionEntityPathsResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/user/BackupPatchesWorkspaceRevisionEntityPathsResource.java @@ -82,7 +82,7 @@ public List getAllEntities(@PathParam("projectId") String projectId, } return executeWithLogging( "getting entity paths in revision " + revisionId + " of backup user workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> getEntityPaths(this.entityApi.getBackupWorkspaceRevisionEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId), revisionId), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes) + () -> getEntityPaths(this.entityApi.getBackupWorkspaceRevisionEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId), revisionId), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/user/BackupPatchesWorkspaceRevisionProjectConfigurationResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/user/BackupPatchesWorkspaceRevisionProjectConfigurationResource.java index a096e34ac8..a01572cabc 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/user/BackupPatchesWorkspaceRevisionProjectConfigurationResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/user/BackupPatchesWorkspaceRevisionProjectConfigurationResource.java @@ -66,7 +66,7 @@ public ProjectConfiguration getWorkspaceRevisionProjectConfiguration(@PathParam( } return executeWithLogging( "getting project " + projectId + " configuration in backup user workspace " + workspaceId + " at revision " + revisionId + " for patch release version " + patchReleaseVersionId, - () -> this.projectConfigurationApi.getBackupWorkspaceRevisionProjectConfiguration(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId), revisionId) + () -> this.projectConfigurationApi.getBackupWorkspaceRevisionProjectConfiguration(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId), revisionId) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/user/BackupPatchesWorkspaceRevisionsResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/user/BackupPatchesWorkspaceRevisionsResource.java index 1a464138e2..77960d1f6f 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/user/BackupPatchesWorkspaceRevisionsResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/backup/patch/user/BackupPatchesWorkspaceRevisionsResource.java @@ -73,7 +73,7 @@ public List getRevisions(@PathParam("projectId") String projectId, } return executeWithLogging( "getting revision for user backup workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.revisionApi.getBackupWorkspaceRevisionContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)).getRevisions(null, ResolvedInstant.getResolvedInstantIfNonNull(since), ResolvedInstant.getResolvedInstantIfNonNull(until), limit) + () -> this.revisionApi.getBackupWorkspaceRevisionContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)).getRevisions(null, ResolvedInstant.getResolvedInstantIfNonNull(since), ResolvedInstant.getResolvedInstantIfNonNull(until), limit) ); } @@ -97,7 +97,7 @@ public Revision getRevision(@PathParam("projectId") String projectId, } return executeWithLogging( "getting revision " + revisionId + " for backup user workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.revisionApi.getBackupWorkspaceRevisionContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)).getRevision(revisionId) + () -> this.revisionApi.getBackupWorkspaceRevisionContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)).getRevision(revisionId) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/comparison/patch/group/PatchesGroupComparisonWorkspaceResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/comparison/patch/group/PatchesGroupComparisonWorkspaceResource.java index 77f5c01208..19d3e9e71a 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/comparison/patch/group/PatchesGroupComparisonWorkspaceResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/comparison/patch/group/PatchesGroupComparisonWorkspaceResource.java @@ -63,7 +63,7 @@ public Comparison getWorkspaceCreationComparison(@PathParam("projectId") String } return executeWithLogging( "getting comparison between current group workspace revision and project revision at workspace creation, for group workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.comparisonApi.getWorkspaceCreationComparison(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)) + () -> this.comparisonApi.getWorkspaceCreationComparison(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)) ); } @@ -84,7 +84,7 @@ public Comparison getWorkspaceProjectComparison(@PathParam("projectId") String p } return executeWithLogging( "getting comparison between current group workspace revision and current project revision, for group workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.comparisonApi.getWorkspaceProjectComparison(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)) + () -> this.comparisonApi.getWorkspaceProjectComparison(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/comparison/patch/user/ComparisonPatchesWorkspaceResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/comparison/patch/user/ComparisonPatchesWorkspaceResource.java index aa5c329f80..5962510d6a 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/comparison/patch/user/ComparisonPatchesWorkspaceResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/comparison/patch/user/ComparisonPatchesWorkspaceResource.java @@ -63,7 +63,7 @@ public Comparison getWorkspaceCreationComparison(@PathParam("projectId") String } return executeWithLogging( "getting comparison between current user workspace revision and project revision at workspace creation, for user workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.comparisonApi.getWorkspaceCreationComparison(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)) + () -> this.comparisonApi.getWorkspaceCreationComparison(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)) ); } @@ -84,7 +84,7 @@ public Comparison getWorkspaceProjectComparison(@PathParam("projectId") String p } return executeWithLogging( "getting comparison between current user workspace revision and current project revision, for user workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.comparisonApi.getWorkspaceProjectComparison(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)) + () -> this.comparisonApi.getWorkspaceProjectComparison(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/group/ConflictResolutionPatchesGroupWorkspaceEntitiesResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/group/ConflictResolutionPatchesGroupWorkspaceEntitiesResource.java index eb3316e6df..650722fa51 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/group/ConflictResolutionPatchesGroupWorkspaceEntitiesResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/group/ConflictResolutionPatchesGroupWorkspaceEntitiesResource.java @@ -85,7 +85,7 @@ public List getAllEntities(@PathParam("projectId") String projectId, } return executeWithLogging( "getting entities in group workspace with conflict resolution " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> getEntities(this.entityApi.getWorkspaceWithConflictResolutionEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes, excludeInvalid) + () -> getEntities(this.entityApi.getWorkspaceWithConflictResolutionEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes, excludeInvalid) ); } @@ -106,7 +106,7 @@ public Entity getEntityByPath(@PathParam("projectId") String projectId, @PathPar } return executeWithLogging( "getting entity " + path + " in group workspace with conflict resolution " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.entityApi.getWorkspaceWithConflictResolutionEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)).getEntity(path) + () -> this.entityApi.getWorkspaceWithConflictResolutionEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)).getEntity(path) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/group/ConflictResolutionPatchesGroupWorkspaceEntityPathsResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/group/ConflictResolutionPatchesGroupWorkspaceEntityPathsResource.java index 9acf052aaf..d166a0a5ca 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/group/ConflictResolutionPatchesGroupWorkspaceEntityPathsResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/group/ConflictResolutionPatchesGroupWorkspaceEntityPathsResource.java @@ -81,7 +81,7 @@ public List getEntitiesPaths(@PathParam("projectId") String projectId, } return executeWithLogging( "getting entity paths in group workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> getEntityPaths(this.entityApi.getWorkspaceWithConflictResolutionEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes) + () -> getEntityPaths(this.entityApi.getWorkspaceWithConflictResolutionEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/group/ConflictResolutionPatchesGroupWorkspaceProjectConfigurationResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/group/ConflictResolutionPatchesGroupWorkspaceProjectConfigurationResource.java index d978d0100f..d913702337 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/group/ConflictResolutionPatchesGroupWorkspaceProjectConfigurationResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/group/ConflictResolutionPatchesGroupWorkspaceProjectConfigurationResource.java @@ -62,7 +62,7 @@ public ProjectConfiguration getWorkspaceProjectConfiguration(@PathParam("project } return executeWithLogging( "getting project " + projectId + " configuration in group workspace with conflict resolution " + workspaceId + " for patch release version " + patchReleaseVersionId, - () -> this.projectConfigurationApi.getWorkspaceWithConflictResolutionProjectConfiguration(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)) + () -> this.projectConfigurationApi.getWorkspaceWithConflictResolutionProjectConfiguration(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/group/ConflictResolutionPatchesGroupWorkspaceResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/group/ConflictResolutionPatchesGroupWorkspaceResource.java index a32f6bf1a6..c88864db67 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/group/ConflictResolutionPatchesGroupWorkspaceResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/group/ConflictResolutionPatchesGroupWorkspaceResource.java @@ -68,7 +68,7 @@ public Workspace getGroupWorkspace(@PathParam("projectId") String projectId, @Pa } return executeWithLogging( "getting group workspace with conflict resolution " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.workspaceApi.getWorkspaceWithConflictResolution(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)) + () -> this.workspaceApi.getWorkspaceWithConflictResolution(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)) ); } @@ -89,7 +89,7 @@ public boolean isWorkspaceOutdated(@PathParam("projectId") String projectId, @Pa } return executeWithLogging( "checking if group workspace with conflict resolution " + workspaceId + " of project " + projectId + " for patch release version " + patchReleaseVersionId + " is outdated", - () -> this.workspaceApi.isWorkspaceWithConflictResolutionOutdated(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)) + () -> this.workspaceApi.isWorkspaceWithConflictResolutionOutdated(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)) ); } @@ -109,7 +109,7 @@ public void discardConflictResolution(@PathParam("projectId") String projectId, } executeWithLogging( "discarding conflict resolution for group workspace " + workspaceId + " in project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.conflictResolutionApi.discardConflictResolution(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)) + () -> this.conflictResolutionApi.discardConflictResolution(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)) ); } @@ -130,7 +130,7 @@ public void discardChangesConflictResolution(@PathParam("projectId") String proj } executeWithLogging( "discarding all conflict resolution changes for group workspace " + workspaceId + " in project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.conflictResolutionApi.discardConflictResolution(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)) + () -> this.conflictResolutionApi.discardConflictResolution(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)) ); } @@ -152,7 +152,7 @@ public void acceptConflictResolution(@PathParam("projectId") String projectId, @ } executeWithLogging( "accept conflict resolution for group workspace " + workspaceId + " in project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.conflictResolutionApi.acceptConflictResolution(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId), command) + () -> this.conflictResolutionApi.acceptConflictResolution(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId), command) ); } } \ No newline at end of file diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/group/ConflictResolutionPatchesGroupWorkspaceRevisionEntitiesResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/group/ConflictResolutionPatchesGroupWorkspaceRevisionEntitiesResource.java index 8e3e7a8a2e..184e8299a7 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/group/ConflictResolutionPatchesGroupWorkspaceRevisionEntitiesResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/group/ConflictResolutionPatchesGroupWorkspaceRevisionEntitiesResource.java @@ -87,7 +87,7 @@ public List getAllEntities(@PathParam("projectId") String projectId, } return executeWithLogging( "getting entities in revision " + revisionId + " of group workspace with conflict resolution " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> getEntities(this.entityApi.getWorkspaceWithConflictResolutionRevisionEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId), revisionId), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes, excludeInvalid) + () -> getEntities(this.entityApi.getWorkspaceWithConflictResolutionRevisionEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId), revisionId), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes, excludeInvalid) ); } @@ -113,7 +113,7 @@ public Entity getEntityByPath(@PathParam("projectId") String projectId, } return executeWithLogging( "getting entity " + path + " in revision " + revisionId + " of group workspace with conflict resolution " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.entityApi.getWorkspaceWithConflictResolutionRevisionEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId), revisionId).getEntity(path) + () -> this.entityApi.getWorkspaceWithConflictResolutionRevisionEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId), revisionId).getEntity(path) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/group/ConflictResolutionPatchesGroupWorkspaceRevisionEntityPathsResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/group/ConflictResolutionPatchesGroupWorkspaceRevisionEntityPathsResource.java index a20b648623..db59ae5b9a 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/group/ConflictResolutionPatchesGroupWorkspaceRevisionEntityPathsResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/group/ConflictResolutionPatchesGroupWorkspaceRevisionEntityPathsResource.java @@ -82,7 +82,7 @@ public List getAllEntities(@PathParam("projectId") String projectId, } return executeWithLogging( "getting entity paths in revision " + revisionId + " of group workspace with conflict resolution " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> getEntityPaths(this.entityApi.getWorkspaceWithConflictResolutionRevisionEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId), revisionId), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes) + () -> getEntityPaths(this.entityApi.getWorkspaceWithConflictResolutionRevisionEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId), revisionId), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/group/ConflictResolutionPatchesGroupWorkspaceRevisionProjectConfigurationResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/group/ConflictResolutionPatchesGroupWorkspaceRevisionProjectConfigurationResource.java index 77b2dfa68c..5a3990fdfd 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/group/ConflictResolutionPatchesGroupWorkspaceRevisionProjectConfigurationResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/group/ConflictResolutionPatchesGroupWorkspaceRevisionProjectConfigurationResource.java @@ -66,7 +66,7 @@ public ProjectConfiguration getWorkspaceRevisionProjectConfiguration(@PathParam( } return executeWithLogging( "getting project " + projectId + " configuration in group workspace with conflict resolution " + workspaceId + " at revision " + revisionId + " for patch release version " + patchReleaseVersionId, - () -> this.projectConfigurationApi.getWorkspaceWithConflictResolutionRevisionProjectConfiguration(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId), revisionId) + () -> this.projectConfigurationApi.getWorkspaceWithConflictResolutionRevisionProjectConfiguration(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId), revisionId) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/group/ConflictResolutionPatchesGroupWorkspaceRevisionsResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/group/ConflictResolutionPatchesGroupWorkspaceRevisionsResource.java index dd32900acc..b19ca53c57 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/group/ConflictResolutionPatchesGroupWorkspaceRevisionsResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/group/ConflictResolutionPatchesGroupWorkspaceRevisionsResource.java @@ -73,7 +73,7 @@ public List getRevisions(@PathParam("projectId") String projectId, } return executeWithLogging( "getting revision for group workspace with conflict resolution " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.revisionApi.getWorkspaceWithConflictResolutionRevisionContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)).getRevisions(null, ResolvedInstant.getResolvedInstantIfNonNull(since), ResolvedInstant.getResolvedInstantIfNonNull(until), limit) + () -> this.revisionApi.getWorkspaceWithConflictResolutionRevisionContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)).getRevisions(null, ResolvedInstant.getResolvedInstantIfNonNull(since), ResolvedInstant.getResolvedInstantIfNonNull(until), limit) ); } @@ -97,7 +97,7 @@ public Revision getRevision(@PathParam("projectId") String projectId, } return executeWithLogging( "getting revision " + revisionId + " for group workspace with conflict resolution " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.revisionApi.getWorkspaceWithConflictResolutionRevisionContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)).getRevision(revisionId) + () -> this.revisionApi.getWorkspaceWithConflictResolutionRevisionContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)).getRevision(revisionId) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/user/ConflictResolutionPatchesWorkspaceEntitiesResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/user/ConflictResolutionPatchesWorkspaceEntitiesResource.java index a1c5680763..febb386985 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/user/ConflictResolutionPatchesWorkspaceEntitiesResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/user/ConflictResolutionPatchesWorkspaceEntitiesResource.java @@ -85,7 +85,7 @@ public List getAllEntities(@PathParam("projectId") String projectId, } return executeWithLogging( "getting entities in user workspace with conflict resolution " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> getEntities(this.entityApi.getWorkspaceWithConflictResolutionEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes, excludeInvalid) + () -> getEntities(this.entityApi.getWorkspaceWithConflictResolutionEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes, excludeInvalid) ); } @@ -106,7 +106,7 @@ public Entity getEntityByPath(@PathParam("projectId") String projectId, @PathPar } return executeWithLogging( "getting entity " + path + " in user workspace with conflict resolution " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.entityApi.getWorkspaceWithConflictResolutionEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)).getEntity(path) + () -> this.entityApi.getWorkspaceWithConflictResolutionEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)).getEntity(path) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/user/ConflictResolutionPatchesWorkspaceEntityPathsResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/user/ConflictResolutionPatchesWorkspaceEntityPathsResource.java index 2e15951e18..dc32e64efa 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/user/ConflictResolutionPatchesWorkspaceEntityPathsResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/user/ConflictResolutionPatchesWorkspaceEntityPathsResource.java @@ -81,7 +81,7 @@ public List getEntitiesPaths(@PathParam("projectId") String projectId, } return executeWithLogging( "getting entity paths in user workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> getEntityPaths(this.entityApi.getWorkspaceWithConflictResolutionEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes) + () -> getEntityPaths(this.entityApi.getWorkspaceWithConflictResolutionEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/user/ConflictResolutionPatchesWorkspaceProjectConfigurationResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/user/ConflictResolutionPatchesWorkspaceProjectConfigurationResource.java index 6fdeab8556..539085ef92 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/user/ConflictResolutionPatchesWorkspaceProjectConfigurationResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/user/ConflictResolutionPatchesWorkspaceProjectConfigurationResource.java @@ -62,7 +62,7 @@ public ProjectConfiguration getWorkspaceProjectConfiguration(@PathParam("project } return executeWithLogging( "getting project " + projectId + " configuration in user workspace with conflict resolution " + workspaceId + " for patch release version " + patchReleaseVersionId, - () -> this.projectConfigurationApi.getWorkspaceWithConflictResolutionProjectConfiguration(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)) + () -> this.projectConfigurationApi.getWorkspaceWithConflictResolutionProjectConfiguration(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/user/ConflictResolutionPatchesWorkspaceResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/user/ConflictResolutionPatchesWorkspaceResource.java index 4cdbf7d8dd..8400742f57 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/user/ConflictResolutionPatchesWorkspaceResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/user/ConflictResolutionPatchesWorkspaceResource.java @@ -68,7 +68,7 @@ public Workspace getUserWorkspace(@PathParam("projectId") String projectId, @Pat } return executeWithLogging( "getting user workspace with conflict resolution " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.workspaceApi.getWorkspaceWithConflictResolution(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)) + () -> this.workspaceApi.getWorkspaceWithConflictResolution(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)) ); } @@ -89,7 +89,7 @@ public boolean isWorkspaceOutdated(@PathParam("projectId") String projectId, @Pa } return executeWithLogging( "checking if user workspace with conflict resolution " + workspaceId + " of project " + projectId + " for patch release version " + patchReleaseVersionId + " is outdated", - () -> this.workspaceApi.isWorkspaceWithConflictResolutionOutdated(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)) + () -> this.workspaceApi.isWorkspaceWithConflictResolutionOutdated(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)) ); } @@ -109,7 +109,7 @@ public void discardConflictResolution(@PathParam("projectId") String projectId, } executeWithLogging( "discarding conflict resolution for user workspace " + workspaceId + " in project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.conflictResolutionApi.discardConflictResolution(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)) + () -> this.conflictResolutionApi.discardConflictResolution(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)) ); } @@ -130,7 +130,7 @@ public void discardChangesConflictResolution(@PathParam("projectId") String proj } executeWithLogging( "discarding all conflict resolution changes for user workspace " + workspaceId + " in project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.conflictResolutionApi.discardConflictResolution(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)) + () -> this.conflictResolutionApi.discardConflictResolution(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)) ); } @@ -152,7 +152,7 @@ public void acceptConflictResolution(@PathParam("projectId") String projectId, @ } executeWithLogging( "accept conflict resolution for user workspace " + workspaceId + " in project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.conflictResolutionApi.acceptConflictResolution(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId), command) + () -> this.conflictResolutionApi.acceptConflictResolution(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId), command) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/user/ConflictResolutionPatchesWorkspaceRevisionEntitiesResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/user/ConflictResolutionPatchesWorkspaceRevisionEntitiesResource.java index 259de14c05..a710179b07 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/user/ConflictResolutionPatchesWorkspaceRevisionEntitiesResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/user/ConflictResolutionPatchesWorkspaceRevisionEntitiesResource.java @@ -87,7 +87,7 @@ public List getAllEntities(@PathParam("projectId") String projectId, } return executeWithLogging( "getting entities in revision " + revisionId + " of user workspace with conflict resolution " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> getEntities(this.entityApi.getWorkspaceWithConflictResolutionRevisionEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId), revisionId), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes, excludeInvalid) + () -> getEntities(this.entityApi.getWorkspaceWithConflictResolutionRevisionEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId), revisionId), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes, excludeInvalid) ); } @@ -113,7 +113,7 @@ public Entity getEntityByPath(@PathParam("projectId") String projectId, } return executeWithLogging( "getting entity " + path + " in revision " + revisionId + " of user workspace with conflict resolution " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.entityApi.getWorkspaceWithConflictResolutionRevisionEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId), revisionId).getEntity(path) + () -> this.entityApi.getWorkspaceWithConflictResolutionRevisionEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId), revisionId).getEntity(path) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/user/ConflictResolutionPatchesWorkspaceRevisionEntityPathsResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/user/ConflictResolutionPatchesWorkspaceRevisionEntityPathsResource.java index e80830ce6b..dfc5dee199 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/user/ConflictResolutionPatchesWorkspaceRevisionEntityPathsResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/user/ConflictResolutionPatchesWorkspaceRevisionEntityPathsResource.java @@ -82,7 +82,7 @@ public List getAllEntities(@PathParam("projectId") String projectId, } return executeWithLogging( "getting entity paths in revision " + revisionId + " of user workspace with conflict resolution " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> getEntityPaths(this.entityApi.getWorkspaceWithConflictResolutionRevisionEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId), revisionId), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes) + () -> getEntityPaths(this.entityApi.getWorkspaceWithConflictResolutionRevisionEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId), revisionId), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/user/ConflictResolutionPatchesWorkspaceRevisionProjectConfigurationResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/user/ConflictResolutionPatchesWorkspaceRevisionProjectConfigurationResource.java index 0da89b119c..298593d820 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/user/ConflictResolutionPatchesWorkspaceRevisionProjectConfigurationResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/user/ConflictResolutionPatchesWorkspaceRevisionProjectConfigurationResource.java @@ -66,7 +66,7 @@ public ProjectConfiguration getWorkspaceRevisionProjectConfiguration(@PathParam( } return executeWithLogging( "getting project " + projectId + " configuration in user workspace with conflict resolution " + workspaceId + " at revision " + revisionId + " for patch release version " + patchReleaseVersionId, - () -> this.projectConfigurationApi.getWorkspaceWithConflictResolutionRevisionProjectConfiguration(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId), revisionId) + () -> this.projectConfigurationApi.getWorkspaceWithConflictResolutionRevisionProjectConfiguration(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId), revisionId) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/user/ConflictResolutionPatchesWorkspaceRevisionsResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/user/ConflictResolutionPatchesWorkspaceRevisionsResource.java index 85d70ce255..bce368cb3c 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/user/ConflictResolutionPatchesWorkspaceRevisionsResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/conflictResolution/patch/user/ConflictResolutionPatchesWorkspaceRevisionsResource.java @@ -73,7 +73,7 @@ public List getRevisions(@PathParam("projectId") String projectId, } return executeWithLogging( "getting revision for user workspace with conflict resolution " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.revisionApi.getWorkspaceWithConflictResolutionRevisionContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)).getRevisions(null, ResolvedInstant.getResolvedInstantIfNonNull(since), ResolvedInstant.getResolvedInstantIfNonNull(until), limit) + () -> this.revisionApi.getWorkspaceWithConflictResolutionRevisionContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)).getRevisions(null, ResolvedInstant.getResolvedInstantIfNonNull(since), ResolvedInstant.getResolvedInstantIfNonNull(until), limit) ); } @@ -97,7 +97,7 @@ public Revision getRevision(@PathParam("projectId") String projectId, } return executeWithLogging( "getting revision " + revisionId + " for user workspace with conflict resolution " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.revisionApi.getWorkspaceWithConflictResolutionRevisionContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)).getRevision(revisionId) + () -> this.revisionApi.getWorkspaceWithConflictResolutionRevisionContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)).getRevision(revisionId) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/dependency/patch/group/PatchesGroupWorkspaceRevisionDependenciesResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/dependency/patch/group/PatchesGroupWorkspaceRevisionDependenciesResource.java index 2f85476e76..839d1fdfec 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/dependency/patch/group/PatchesGroupWorkspaceRevisionDependenciesResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/dependency/patch/group/PatchesGroupWorkspaceRevisionDependenciesResource.java @@ -69,7 +69,7 @@ public Set getUpstreamDependencies(@PathParam("projectId") St } return executeWithLogging( "getting upstream dependencies of project " + projectId + " for patch release version " + patchReleaseVersionId + ", group workspace " + workspaceId + ", revision " + revisionId + " (fetch transitively = " + transitive + ")", - () -> this.dependenciesApi.getWorkspaceRevisionUpstreamProjects(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId), revisionId, transitive) + () -> this.dependenciesApi.getWorkspaceRevisionUpstreamProjects(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId), revisionId, transitive) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/dependency/patch/user/PatchesWorkspaceRevisionDependenciesResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/dependency/patch/user/PatchesWorkspaceRevisionDependenciesResource.java index c9fa0adc7c..4d8040d267 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/dependency/patch/user/PatchesWorkspaceRevisionDependenciesResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/dependency/patch/user/PatchesWorkspaceRevisionDependenciesResource.java @@ -69,7 +69,7 @@ public Set getUpstreamDependencies(@PathParam("projectId") St } return executeWithLogging( "getting upstream dependencies of project " + projectId + " for patch release version " + patchReleaseVersionId + ", user workspace " + workspaceId + ", revision " + revisionId + " (fetch transitively = " + transitive + ")", - () -> this.dependenciesApi.getWorkspaceRevisionUpstreamProjects(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId), revisionId, transitive) + () -> this.dependenciesApi.getWorkspaceRevisionUpstreamProjects(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId), revisionId, transitive) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/group/PatchesGroupWorkspaceEntitiesResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/group/PatchesGroupWorkspaceEntitiesResource.java index 8eebf9a09a..550cf9e41e 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/group/PatchesGroupWorkspaceEntitiesResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/group/PatchesGroupWorkspaceEntitiesResource.java @@ -94,7 +94,7 @@ public List getAllEntities(@PathParam("projectId") String projectId, return execute( "getting entities in group workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, "get entities of the group workspace", - () -> getEntities(this.entityApi.getWorkspaceEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes, excludeInvalid) + () -> getEntities(this.entityApi.getWorkspaceEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes, excludeInvalid) ); } @@ -116,11 +116,11 @@ public Revision deleteEntities(@PathParam("projectId") String projectId, @PathP return (entityPathsToDelete == null) ? executeWithLogging( "deleting all entities in group workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.entityApi.getWorkspaceEntityModificationContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)).deleteAllEntities(command.getMessage()) + () -> this.entityApi.getWorkspaceEntityModificationContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)).deleteAllEntities(command.getMessage()) ) : executeWithLogging( "deleting " + entityPathsToDelete.size() + " entities in group workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.entityApi.getWorkspaceEntityModificationContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)).deleteEntities(entityPathsToDelete, command.getMessage()) + () -> this.entityApi.getWorkspaceEntityModificationContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)).deleteEntities(entityPathsToDelete, command.getMessage()) ); } @@ -142,7 +142,7 @@ public Revision updateEntities(@PathParam("projectId") String projectId, @PathP return execute( "updating entities in group workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, "update entities", - () -> this.entityApi.getWorkspaceEntityModificationContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)).updateEntities(command.getEntities(), command.isReplace(), command.getMessage()) + () -> this.entityApi.getWorkspaceEntityModificationContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)).updateEntities(command.getEntities(), command.isReplace(), command.getMessage()) ); } @@ -163,7 +163,7 @@ public Entity getEntityByPath(@PathParam("projectId") String projectId, @PathPar } return executeWithLogging( "getting entity " + path + " in group workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.entityApi.getWorkspaceEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)).getEntity(path) + () -> this.entityApi.getWorkspaceEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)).getEntity(path) ); } @@ -185,7 +185,7 @@ public Revision createOrUpdateEntity(@PathParam("projectId") String projectId, @ } return executeWithLogging( "Creating or updating entity " + path + " in group workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.entityApi.getWorkspaceEntityModificationContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)).createOrUpdateEntity(path, command.getClassifierPath(), command.getContent(), command.getMessage()) + () -> this.entityApi.getWorkspaceEntityModificationContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)).createOrUpdateEntity(path, command.getClassifierPath(), command.getContent(), command.getMessage()) ); } @@ -207,7 +207,7 @@ public Revision deleteEntity(@PathParam("projectId") String projectId, @PathPara } return executeWithLogging( "deleting entity " + path + " in group workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.entityApi.getWorkspaceEntityModificationContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)).deleteEntity(path, command.getMessage()) + () -> this.entityApi.getWorkspaceEntityModificationContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)).deleteEntity(path, command.getMessage()) ); } } \ No newline at end of file diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/group/PatchesGroupWorkspaceEntityChangesResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/group/PatchesGroupWorkspaceEntityChangesResource.java index 1ee4c87b58..e021057405 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/group/PatchesGroupWorkspaceEntityChangesResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/group/PatchesGroupWorkspaceEntityChangesResource.java @@ -64,7 +64,7 @@ public Revision performEntityChanges(@PathParam("projectId") String projectId, @ } return executeWithLogging( "performing changes in group workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.entityApi.getWorkspaceEntityModificationContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)).performChanges(command.getEntityChanges(), command.getRevisionId(), command.getMessage()) + () -> this.entityApi.getWorkspaceEntityModificationContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)).performChanges(command.getEntityChanges(), command.getRevisionId(), command.getMessage()) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/group/PatchesGroupWorkspaceEntityPathsResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/group/PatchesGroupWorkspaceEntityPathsResource.java index ebfab73ad9..945fc4c589 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/group/PatchesGroupWorkspaceEntityPathsResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/group/PatchesGroupWorkspaceEntityPathsResource.java @@ -81,7 +81,7 @@ public List getAllEntities(@PathParam("projectId") String projectId, } return executeWithLogging( "getting entity paths in group workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> getEntityPaths(this.entityApi.getWorkspaceEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes) + () -> getEntityPaths(this.entityApi.getWorkspaceEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/group/PatchesGroupWorkspaceRevisionEntitiesResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/group/PatchesGroupWorkspaceRevisionEntitiesResource.java index 53030bbb14..1c839147f2 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/group/PatchesGroupWorkspaceRevisionEntitiesResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/group/PatchesGroupWorkspaceRevisionEntitiesResource.java @@ -87,7 +87,7 @@ public List getAllEntities(@PathParam("projectId") String projectId, } return executeWithLogging( "getting entities in revision " + revisionId + " of group workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> getEntities(this.entityApi.getWorkspaceRevisionEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId), revisionId), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes, excludeInvalid) + () -> getEntities(this.entityApi.getWorkspaceRevisionEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId), revisionId), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes, excludeInvalid) ); } @@ -113,7 +113,7 @@ public Entity getEntityByPath(@PathParam("projectId") String projectId, } return executeWithLogging( "getting entity " + path + " in revision " + revisionId + " of group workspace " + workspaceId + " for project " + projectId, - () -> this.entityApi.getWorkspaceRevisionEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId), revisionId).getEntity(path) + () -> this.entityApi.getWorkspaceRevisionEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId), revisionId).getEntity(path) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/group/PatchesGroupWorkspaceRevisionEntityPathsResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/group/PatchesGroupWorkspaceRevisionEntityPathsResource.java index 46059d77eb..f2ccdd5b63 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/group/PatchesGroupWorkspaceRevisionEntityPathsResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/group/PatchesGroupWorkspaceRevisionEntityPathsResource.java @@ -82,7 +82,7 @@ public List getAllEntities(@PathParam("projectId") String projectId, } return executeWithLogging( "getting entity paths in revision " + revisionId + " of group workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> getEntityPaths(this.entityApi.getWorkspaceRevisionEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId), revisionId), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes) + () -> getEntityPaths(this.entityApi.getWorkspaceRevisionEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId), revisionId), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/user/PatchesWorkspaceEntitiesResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/user/PatchesWorkspaceEntitiesResource.java index 75a693c556..25e0094eef 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/user/PatchesWorkspaceEntitiesResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/user/PatchesWorkspaceEntitiesResource.java @@ -93,7 +93,7 @@ public List getAllEntities(@PathParam("projectId") String projectId, return execute( "getting entities in user workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, "get entities of the user workspace", - () -> getEntities(this.entityApi.getWorkspaceEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes, excludeInvalid) + () -> getEntities(this.entityApi.getWorkspaceEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes, excludeInvalid) ); } @@ -115,11 +115,11 @@ public Revision deleteEntities(@PathParam("projectId") String projectId, @PathPa return (entityPathsToDelete == null) ? executeWithLogging( "deleting all entities in user workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.entityApi.getWorkspaceEntityModificationContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)).deleteAllEntities(command.getMessage()) + () -> this.entityApi.getWorkspaceEntityModificationContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)).deleteAllEntities(command.getMessage()) ) : executeWithLogging( "deleting " + entityPathsToDelete.size() + " entities in user workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.entityApi.getWorkspaceEntityModificationContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)).deleteEntities(entityPathsToDelete, command.getMessage()) + () -> this.entityApi.getWorkspaceEntityModificationContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)).deleteEntities(entityPathsToDelete, command.getMessage()) ); } @@ -141,7 +141,7 @@ public Revision updateEntities(@PathParam("projectId") String projectId, @PathPa return execute( "updating entities in user workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, "update entities", - () -> this.entityApi.getWorkspaceEntityModificationContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)).updateEntities(command.getEntities(), command.isReplace(), command.getMessage()) + () -> this.entityApi.getWorkspaceEntityModificationContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)).updateEntities(command.getEntities(), command.isReplace(), command.getMessage()) ); } @@ -162,7 +162,7 @@ public Entity getEntityByPath(@PathParam("projectId") String projectId, @PathPar } return executeWithLogging( "getting entity " + path + " in user workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.entityApi.getWorkspaceEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)).getEntity(path) + () -> this.entityApi.getWorkspaceEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)).getEntity(path) ); } @@ -184,7 +184,7 @@ public Revision createOrUpdateEntity(@PathParam("projectId") String projectId, @ } return executeWithLogging( "Creating or updating entity " + path + " in user workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.entityApi.getWorkspaceEntityModificationContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)).createOrUpdateEntity(path, command.getClassifierPath(), command.getContent(), command.getMessage()) + () -> this.entityApi.getWorkspaceEntityModificationContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)).createOrUpdateEntity(path, command.getClassifierPath(), command.getContent(), command.getMessage()) ); } @@ -206,7 +206,7 @@ public Revision deleteEntity(@PathParam("projectId") String projectId, @PathPara } return executeWithLogging( "deleting entity " + path + " in user workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.entityApi.getWorkspaceEntityModificationContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)).deleteEntity(path, command.getMessage()) + () -> this.entityApi.getWorkspaceEntityModificationContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)).deleteEntity(path, command.getMessage()) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/user/PatchesWorkspaceEntityChangesResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/user/PatchesWorkspaceEntityChangesResource.java index 8f87cb52cf..cf4797473e 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/user/PatchesWorkspaceEntityChangesResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/user/PatchesWorkspaceEntityChangesResource.java @@ -64,7 +64,7 @@ public Revision performEntityChanges(@PathParam("projectId") String projectId, @ } return executeWithLogging( "performing changes in workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.entityApi.getWorkspaceEntityModificationContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)).performChanges(command.getEntityChanges(), command.getRevisionId(), command.getMessage()) + () -> this.entityApi.getWorkspaceEntityModificationContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)).performChanges(command.getEntityChanges(), command.getRevisionId(), command.getMessage()) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/user/PatchesWorkspaceEntityPathsResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/user/PatchesWorkspaceEntityPathsResource.java index 887a629b2c..4686be7512 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/user/PatchesWorkspaceEntityPathsResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/user/PatchesWorkspaceEntityPathsResource.java @@ -81,7 +81,7 @@ public List getAllEntities(@PathParam("projectId") String projectId, } return executeWithLogging( "getting entity paths in workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> getEntityPaths(this.entityApi.getWorkspaceEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes) + () -> getEntityPaths(this.entityApi.getWorkspaceEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/user/PatchesWorkspaceRevisionEntitiesResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/user/PatchesWorkspaceRevisionEntitiesResource.java index 6fa3399cfc..c11d1e454b 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/user/PatchesWorkspaceRevisionEntitiesResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/user/PatchesWorkspaceRevisionEntitiesResource.java @@ -87,7 +87,7 @@ public List getAllEntities(@PathParam("projectId") String projectId, } return executeWithLogging( "getting entities in revision " + revisionId + " of workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> getEntities(this.entityApi.getWorkspaceRevisionEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId), revisionId), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes, excludeInvalid) + () -> getEntities(this.entityApi.getWorkspaceRevisionEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId), revisionId), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes, excludeInvalid) ); } @@ -113,7 +113,7 @@ public Entity getEntityByPath(@PathParam("projectId") String projectId, } return executeWithLogging( "getting entity " + path + " in revision " + revisionId + " of workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.entityApi.getWorkspaceRevisionEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId), revisionId).getEntity(path) + () -> this.entityApi.getWorkspaceRevisionEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId), revisionId).getEntity(path) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/user/PatchesWorkspaceRevisionEntityPathsResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/user/PatchesWorkspaceRevisionEntityPathsResource.java index 00fb075544..62c543b1a2 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/user/PatchesWorkspaceRevisionEntityPathsResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/entity/patch/user/PatchesWorkspaceRevisionEntityPathsResource.java @@ -82,7 +82,7 @@ public List getAllEntities(@PathParam("projectId") String projectId, } return executeWithLogging( "getting entity paths in revision " + revisionId + " of workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> getEntityPaths(this.entityApi.getWorkspaceRevisionEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId), revisionId), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes) + () -> getEntityPaths(this.entityApi.getWorkspaceRevisionEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId), revisionId), classifierPaths, packages, includeSubPackages, nameRegex, stereotypes, taggedValueRegexes) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/patch/PatchesResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/patch/PatchesResource.java index 5e928a0280..80883896fb 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/patch/PatchesResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/patch/PatchesResource.java @@ -104,6 +104,26 @@ public List getpatchReleaseBranches(@PathParam("projectId") String projec ); } + @GET + @Path("{patchReleaseVersionId}") + @ApiOperation("Get a specific patch release branch") + public Patch getPatchReleaseBranch(@PathParam("projectId") String projectId, @PathParam("patchReleaseVersionId") String patchReleaseVersionId) + { + VersionId versionId; + try + { + versionId = VersionId.parseVersionId(patchReleaseVersionId); + } + catch (IllegalArgumentException e) + { + throw new LegendSDLCServerException(e.getMessage(), Response.Status.BAD_REQUEST, e); + } + return executeWithLogging( + "getting patch release branch " + patchReleaseVersionId + " for project " + projectId, + () -> this.patchApi.getPatch(projectId, versionId) + ); + } + @DELETE @Path("{patchReleaseVersionId}") @ApiOperation("Delete a patch release branch") diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/pmcd/patch/group/PatchesGroupWorkspacePureModelContextDataResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/pmcd/patch/group/PatchesGroupWorkspacePureModelContextDataResource.java index fa486b02c3..e7ff54644c 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/pmcd/patch/group/PatchesGroupWorkspacePureModelContextDataResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/pmcd/patch/group/PatchesGroupWorkspacePureModelContextDataResource.java @@ -68,12 +68,12 @@ public PureModelContextData getPureModelContextData(@PathParam("projectId") Stri "getting Pure model context data for group workspace " + workspaceId + " in project " + projectId + " for patch release version " + patchReleaseVersionId, () -> { - Revision revision = this.revisionApi.getWorkspaceRevisionContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)).getCurrentRevision(); + Revision revision = this.revisionApi.getWorkspaceRevisionContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)).getCurrentRevision(); if (revision == null) { throw new LegendSDLCServerException("Could not find latest revision for group workspace " + workspaceId + " in project " + projectId + "; project may be corrupt"); } - return getPureModelContextData(projectId, revision.getId(), this.entityApi.getWorkspaceEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId))); + return getPureModelContextData(projectId, revision.getId(), this.entityApi.getWorkspaceEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId))); }); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/pmcd/patch/group/PatchesGroupWorkspaceRevisionPureModelContextDataResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/pmcd/patch/group/PatchesGroupWorkspaceRevisionPureModelContextDataResource.java index cd682ad9a9..d7a0231038 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/pmcd/patch/group/PatchesGroupWorkspaceRevisionPureModelContextDataResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/pmcd/patch/group/PatchesGroupWorkspaceRevisionPureModelContextDataResource.java @@ -66,7 +66,7 @@ public PureModelContextData getPureModelContextData(@PathParam("projectId") Stri } return executeWithLogging( "getting Pure model context data for group workspace " + workspaceId + " in project " + projectId + " at revision " + revisionId + " for patch release version " + patchReleaseVersionId, - () -> getPureModelContextData(projectId, revisionId, this.entityApi.getWorkspaceRevisionEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId), revisionId)) + () -> getPureModelContextData(projectId, revisionId, this.entityApi.getWorkspaceRevisionEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId), revisionId)) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/pmcd/patch/user/PatchesWorkspacePureModelContextDataResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/pmcd/patch/user/PatchesWorkspacePureModelContextDataResource.java index 2f1b7feaf0..ef8b694f10 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/pmcd/patch/user/PatchesWorkspacePureModelContextDataResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/pmcd/patch/user/PatchesWorkspacePureModelContextDataResource.java @@ -68,12 +68,12 @@ public PureModelContextData getPureModelContextData(@PathParam("projectId") Stri "getting Pure model context data for user workspace " + workspaceId + " in project " + projectId + " for patch release version " + patchReleaseVersionId, () -> { - Revision revision = this.revisionApi.getWorkspaceRevisionContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)).getCurrentRevision(); + Revision revision = this.revisionApi.getWorkspaceRevisionContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)).getCurrentRevision(); if (revision == null) { throw new LegendSDLCServerException("Could not find latest revision for user workspace " + workspaceId + " in project " + projectId + "; project may be corrupt" + " for patch release version " + patchReleaseVersionId); } - return getPureModelContextData(projectId, revision.getId(), this.entityApi.getWorkspaceEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId))); + return getPureModelContextData(projectId, revision.getId(), this.entityApi.getWorkspaceEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId))); }); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/pmcd/patch/user/PatchesWorkspaceRevisionPureModelContextDataResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/pmcd/patch/user/PatchesWorkspaceRevisionPureModelContextDataResource.java index add51101b5..8a5ab7b5df 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/pmcd/patch/user/PatchesWorkspaceRevisionPureModelContextDataResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/pmcd/patch/user/PatchesWorkspaceRevisionPureModelContextDataResource.java @@ -66,7 +66,7 @@ public PureModelContextData getPureModelContextData(@PathParam("projectId") Stri } return executeWithLogging( "getting Pure model context data for user workspace " + workspaceId + " in project " + projectId + " at revision " + revisionId + " for patch release version " + patchReleaseVersionId, - () -> getPureModelContextData(projectId, revisionId, this.entityApi.getWorkspaceRevisionEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId), revisionId)) + () -> getPureModelContextData(projectId, revisionId, this.entityApi.getWorkspaceRevisionEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId), revisionId)) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/project/patch/group/PatchesGroupWorkspaceProjectConfigurationResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/project/patch/group/PatchesGroupWorkspaceProjectConfigurationResource.java index 5a0e2ad156..f3454c0a4b 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/project/patch/group/PatchesGroupWorkspaceProjectConfigurationResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/project/patch/group/PatchesGroupWorkspaceProjectConfigurationResource.java @@ -67,7 +67,7 @@ public ProjectConfiguration getWorkspaceProjectConfiguration(@PathParam("project } return executeWithLogging( "getting project " + projectId + " configuration in group workspace " + workspaceId + " for patch release version " + patchReleaseVersionId, - () -> this.projectConfigurationApi.getWorkspaceProjectConfiguration(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)) + () -> this.projectConfigurationApi.getWorkspaceProjectConfiguration(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)) ); } @@ -88,7 +88,7 @@ public Revision updateProjectStructureVersion(@PathParam("projectId") String pro } return executeWithLogging( "updating configuration for project " + projectId + " in group workspace " + workspaceId + " for patch release version " + patchReleaseVersionId, - () -> this.projectConfigurationApi.updateProjectConfiguration(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId), command.getMessage(), command.getProjectConfigurationUpdater()) + () -> this.projectConfigurationApi.updateProjectConfiguration(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId), command.getMessage(), command.getProjectConfigurationUpdater()) ); } @@ -109,7 +109,7 @@ public List getWorkspaceAvailableGeneration } return executeWithLogging( "getting project " + projectId + " configuration in group workspace " + workspaceId + " for patch release version " + patchReleaseVersionId, - () -> this.projectConfigurationApi.getWorkspaceAvailableArtifactGenerations(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)) + () -> this.projectConfigurationApi.getWorkspaceAvailableArtifactGenerations(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/project/patch/group/PatchesGroupWorkspaceRevisionProjectConfigurationResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/project/patch/group/PatchesGroupWorkspaceRevisionProjectConfigurationResource.java index 4418405ea4..f8cb595157 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/project/patch/group/PatchesGroupWorkspaceRevisionProjectConfigurationResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/project/patch/group/PatchesGroupWorkspaceRevisionProjectConfigurationResource.java @@ -68,7 +68,7 @@ public ProjectConfiguration getWorkspaceRevisionProjectConfiguration(@PathParam( } return executeWithLogging( "getting project " + projectId + " configuration in group workspace " + workspaceId + " at revision " + revisionId + " for patch release version " + patchReleaseVersionId, - () -> this.projectConfigurationApi.getWorkspaceRevisionProjectConfiguration(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId), revisionId) + () -> this.projectConfigurationApi.getWorkspaceRevisionProjectConfiguration(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId), revisionId) ); } @@ -92,7 +92,7 @@ public List getProjectAvailableArtifactGene } return executeWithLogging( "getting project " + projectId + " available generations in group workspace " + workspaceId + " at revision " + revisionId + " for patch release version " + patchReleaseVersionId, - () -> this.projectConfigurationApi.getWorkspaceRevisionAvailableArtifactGenerations(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId), revisionId) + () -> this.projectConfigurationApi.getWorkspaceRevisionAvailableArtifactGenerations(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId), revisionId) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/project/patch/user/PatchesWorkspaceProjectConfigurationResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/project/patch/user/PatchesWorkspaceProjectConfigurationResource.java index 0bcb2a27ad..7aeeef6e29 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/project/patch/user/PatchesWorkspaceProjectConfigurationResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/project/patch/user/PatchesWorkspaceProjectConfigurationResource.java @@ -67,7 +67,7 @@ public ProjectConfiguration getWorkspaceProjectConfiguration(@PathParam("project } return executeWithLogging( "getting project " + projectId + " configuration in workspace " + workspaceId + " for patch release version " + patchReleaseVersionId, - () -> this.projectConfigurationApi.getWorkspaceProjectConfiguration(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)) + () -> this.projectConfigurationApi.getWorkspaceProjectConfiguration(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)) ); } @@ -88,7 +88,7 @@ public Revision updateProjectStructureVersion(@PathParam("projectId") String pro } return executeWithLogging( "updating configuration for project " + projectId + " in workspace " + workspaceId + " for patch release version " + patchReleaseVersionId, - () -> this.projectConfigurationApi.updateProjectConfiguration(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId), command.getMessage(), command.getProjectConfigurationUpdater()) + () -> this.projectConfigurationApi.updateProjectConfiguration(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId), command.getMessage(), command.getProjectConfigurationUpdater()) ); } @@ -109,7 +109,7 @@ public List getWorkspaceAvailableGeneration } return executeWithLogging( "getting project " + projectId + " configuration in workspace " + workspaceId + " for patch release version " + patchReleaseVersionId, - () -> this.projectConfigurationApi.getWorkspaceAvailableArtifactGenerations(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)) + () -> this.projectConfigurationApi.getWorkspaceAvailableArtifactGenerations(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/project/patch/user/PatchesWorkspaceRevisionProjectConfigurationResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/project/patch/user/PatchesWorkspaceRevisionProjectConfigurationResource.java index f182bf808a..88c2991d75 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/project/patch/user/PatchesWorkspaceRevisionProjectConfigurationResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/project/patch/user/PatchesWorkspaceRevisionProjectConfigurationResource.java @@ -68,7 +68,7 @@ public ProjectConfiguration getWorkspaceRevisionProjectConfiguration(@PathParam( } return executeWithLogging( "getting project " + projectId + " configuration in workspace " + workspaceId + " at revision " + revisionId + " for patch release version " + patchReleaseVersionId, - () -> this.projectConfigurationApi.getWorkspaceRevisionProjectConfiguration(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId), revisionId) + () -> this.projectConfigurationApi.getWorkspaceRevisionProjectConfiguration(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId), revisionId) ); } @@ -92,7 +92,7 @@ public List getProjectAvailableArtifactGene } return executeWithLogging( "getting project " + projectId + " available generations in workspace " + workspaceId + " at revision " + revisionId + " for patch release version " + patchReleaseVersionId, - () -> this.projectConfigurationApi.getWorkspaceRevisionAvailableArtifactGenerations(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId), revisionId) + () -> this.projectConfigurationApi.getWorkspaceRevisionAvailableArtifactGenerations(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId), revisionId) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/review/patch/PatchReviewsResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/review/patch/PatchReviewsResource.java index 55074db422..40da6a2adb 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/review/patch/PatchReviewsResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/review/patch/PatchReviewsResource.java @@ -161,7 +161,7 @@ public Review createReview(@PathParam("projectId") String projectId, @PathParam( return execute( "creating review \"" + command.getTitle() + "\" in project " + projectId + " for patch release version " + patchReleaseVersionId, "create a review", - () -> this.reviewApi.createReview(projectId, SourceSpecification.newSourceSpecification(command.getWorkspaceId(), Optional.ofNullable(command.getWorkspaceType()).orElse(WorkspaceType.USER), null, versionId), command.getTitle(), command.getDescription(), command.getLabels()) + () -> this.reviewApi.createReview(projectId, SourceSpecification.newSourceSpecification(projectId, command.getWorkspaceId(), Optional.ofNullable(command.getWorkspaceType()).orElse(WorkspaceType.USER), null, versionId), command.getTitle(), command.getDescription(), command.getLabels()) ); } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/revision/patch/group/PatchesGroupWorkspaceEntityRevisionsResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/revision/patch/group/PatchesGroupWorkspaceEntityRevisionsResource.java index aa3dd37d57..81ed20e211 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/revision/patch/group/PatchesGroupWorkspaceEntityRevisionsResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/revision/patch/group/PatchesGroupWorkspaceEntityRevisionsResource.java @@ -74,7 +74,7 @@ public List getRevisions(@PathParam("projectId") String projectId, } return executeWithLogging( "getting revisions for entity " + path + " in group workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.revisionApi.getWorkspaceEntityRevisionContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId), path).getRevisions(null, ResolvedInstant.getResolvedInstantIfNonNull(since), ResolvedInstant.getResolvedInstantIfNonNull(until), limit) + () -> this.revisionApi.getWorkspaceEntityRevisionContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId), path).getRevisions(null, ResolvedInstant.getResolvedInstantIfNonNull(since), ResolvedInstant.getResolvedInstantIfNonNull(until), limit) ); } @@ -99,7 +99,7 @@ public Revision getRevision(@PathParam("projectId") String projectId, } return executeWithLogging( "getting revision " + revisionId + " for entity " + path + " in group workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.revisionApi.getWorkspaceEntityRevisionContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId), path).getRevision(revisionId) + () -> this.revisionApi.getWorkspaceEntityRevisionContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId), path).getRevision(revisionId) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/revision/patch/group/PatchesGroupWorkspacePackageRevisionsResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/revision/patch/group/PatchesGroupWorkspacePackageRevisionsResource.java index 6861be2693..d8986af95d 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/revision/patch/group/PatchesGroupWorkspacePackageRevisionsResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/revision/patch/group/PatchesGroupWorkspacePackageRevisionsResource.java @@ -74,7 +74,7 @@ public List getRevisions(@PathParam("projectId") String projectId, } return executeWithLogging( "getting revisions for package " + path + " in group workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.revisionApi.getWorkspacePackageRevisionContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId), path).getRevisions(null, ResolvedInstant.getResolvedInstantIfNonNull(since), ResolvedInstant.getResolvedInstantIfNonNull(until), limit) + () -> this.revisionApi.getWorkspacePackageRevisionContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId), path).getRevisions(null, ResolvedInstant.getResolvedInstantIfNonNull(since), ResolvedInstant.getResolvedInstantIfNonNull(until), limit) ); } @@ -99,7 +99,7 @@ public Revision getRevision(@PathParam("projectId") String projectId, } return executeWithLogging( "getting revision " + revisionId + " for package " + path + " in group workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.revisionApi.getWorkspacePackageRevisionContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId), path).getRevision(revisionId) + () -> this.revisionApi.getWorkspacePackageRevisionContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId), path).getRevision(revisionId) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/revision/patch/group/PatchesGroupWorkspaceRevisionsResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/revision/patch/group/PatchesGroupWorkspaceRevisionsResource.java index f8b19e49bb..b1cd6ec2df 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/revision/patch/group/PatchesGroupWorkspaceRevisionsResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/revision/patch/group/PatchesGroupWorkspaceRevisionsResource.java @@ -73,7 +73,7 @@ public List getRevisions(@PathParam("projectId") String projectId, } return executeWithLogging( "getting revision for group workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.revisionApi.getWorkspaceRevisionContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)).getRevisions(null, ResolvedInstant.getResolvedInstantIfNonNull(since), ResolvedInstant.getResolvedInstantIfNonNull(until), limit) + () -> this.revisionApi.getWorkspaceRevisionContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)).getRevisions(null, ResolvedInstant.getResolvedInstantIfNonNull(since), ResolvedInstant.getResolvedInstantIfNonNull(until), limit) ); } @@ -97,7 +97,7 @@ public Revision getRevision(@PathParam("projectId") String projectId, } return executeWithLogging( "getting revision " + revisionId + " for group workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.revisionApi.getWorkspaceRevisionContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)).getRevision(revisionId) + () -> this.revisionApi.getWorkspaceRevisionContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)).getRevision(revisionId) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/revision/patch/user/PatchesWorkspaceEntityRevisionsResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/revision/patch/user/PatchesWorkspaceEntityRevisionsResource.java index e77fddf5f3..5921e1d839 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/revision/patch/user/PatchesWorkspaceEntityRevisionsResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/revision/patch/user/PatchesWorkspaceEntityRevisionsResource.java @@ -74,7 +74,7 @@ public List getRevisions(@PathParam("projectId") String projectId, } return executeWithLogging( "getting revisions for entity " + path + " in user workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.revisionApi.getWorkspaceEntityRevisionContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId), path).getRevisions(null, ResolvedInstant.getResolvedInstantIfNonNull(since), ResolvedInstant.getResolvedInstantIfNonNull(until), limit) + () -> this.revisionApi.getWorkspaceEntityRevisionContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId), path).getRevisions(null, ResolvedInstant.getResolvedInstantIfNonNull(since), ResolvedInstant.getResolvedInstantIfNonNull(until), limit) ); } @@ -99,7 +99,7 @@ public Revision getRevision(@PathParam("projectId") String projectId, } return executeWithLogging( "getting revision " + revisionId + " for entity " + path + " in user workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.revisionApi.getWorkspaceEntityRevisionContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId), path).getRevision(revisionId) + () -> this.revisionApi.getWorkspaceEntityRevisionContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId), path).getRevision(revisionId) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/revision/patch/user/PatchesWorkspacePackageRevisionsResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/revision/patch/user/PatchesWorkspacePackageRevisionsResource.java index 7039cd8efc..4605b1193a 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/revision/patch/user/PatchesWorkspacePackageRevisionsResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/revision/patch/user/PatchesWorkspacePackageRevisionsResource.java @@ -74,7 +74,7 @@ public List getRevisions(@PathParam("projectId") String projectId, } return executeWithLogging( "getting revisions for package " + path + " in user workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.revisionApi.getWorkspacePackageRevisionContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId), path).getRevisions(null, ResolvedInstant.getResolvedInstantIfNonNull(since), ResolvedInstant.getResolvedInstantIfNonNull(until), limit) + () -> this.revisionApi.getWorkspacePackageRevisionContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId), path).getRevisions(null, ResolvedInstant.getResolvedInstantIfNonNull(since), ResolvedInstant.getResolvedInstantIfNonNull(until), limit) ); } @@ -99,7 +99,7 @@ public Revision getRevision(@PathParam("projectId") String projectId, } return executeWithLogging( "getting revision " + revisionId + " for package " + path + " in user workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.revisionApi.getWorkspacePackageRevisionContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId), path).getRevision(revisionId) + () -> this.revisionApi.getWorkspacePackageRevisionContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId), path).getRevision(revisionId) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/revision/patch/user/PatchesWorkspaceRevisionsResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/revision/patch/user/PatchesWorkspaceRevisionsResource.java index 8fbaf1e58c..de8a32b057 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/revision/patch/user/PatchesWorkspaceRevisionsResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/revision/patch/user/PatchesWorkspaceRevisionsResource.java @@ -73,7 +73,7 @@ public List getRevisions(@PathParam("projectId") String projectId, } return executeWithLogging( "getting revision for user workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.revisionApi.getWorkspaceRevisionContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)).getRevisions(null, ResolvedInstant.getResolvedInstantIfNonNull(since), ResolvedInstant.getResolvedInstantIfNonNull(until), limit) + () -> this.revisionApi.getWorkspaceRevisionContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)).getRevisions(null, ResolvedInstant.getResolvedInstantIfNonNull(since), ResolvedInstant.getResolvedInstantIfNonNull(until), limit) ); } @@ -97,7 +97,7 @@ public Revision getRevision(@PathParam("projectId") String projectId, } return executeWithLogging( "getting revision " + revisionId + " for user workspace " + workspaceId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.revisionApi.getWorkspaceRevisionContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)).getRevision(revisionId) + () -> this.revisionApi.getWorkspaceRevisionContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)).getRevision(revisionId) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/workflow/patch/group/PatchesGroupWorkspaceWorkflowJobsResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/workflow/patch/group/PatchesGroupWorkspaceWorkflowJobsResource.java index 32e8ef231e..a2a0da6c01 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/workflow/patch/group/PatchesGroupWorkspaceWorkflowJobsResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/workflow/patch/group/PatchesGroupWorkspaceWorkflowJobsResource.java @@ -75,7 +75,7 @@ public List getWorkflowJobs(@PathParam("projectId") String projectI } return executeWithLogging( "getting workflow jobs for group workspace " + workspaceId + " in project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.workflowJobApi.getWorkspaceWorkflowJobAccessContext(projectId, SourceSpecification.newSourceSpecification(workspaceId, WorkspaceType.GROUP, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, versionId)).getWorkflowJobs(workflowId, statuses) + () -> this.workflowJobApi.getWorkspaceWorkflowJobAccessContext(projectId, SourceSpecification.newSourceSpecification(projectId, workspaceId, WorkspaceType.GROUP, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, versionId)).getWorkflowJobs(workflowId, statuses) ); } @@ -100,7 +100,7 @@ public WorkflowJob getWorkflowJob(@PathParam("projectId") String projectId, } return executeWithLogging( "getting workflow job " + workflowJobId + " for group workspace " + workspaceId + " in project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.workflowJobApi.getWorkspaceWorkflowJobAccessContext(projectId, SourceSpecification.newSourceSpecification(workspaceId, WorkspaceType.GROUP, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, versionId)).getWorkflowJob(workflowId, workflowJobId) + () -> this.workflowJobApi.getWorkspaceWorkflowJobAccessContext(projectId, SourceSpecification.newSourceSpecification(projectId, workspaceId, WorkspaceType.GROUP, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, versionId)).getWorkflowJob(workflowId, workflowJobId) ); } @@ -128,7 +128,7 @@ public Response getWorkflowJobLogs(@PathParam("projectId") String projectId, "getting workflow job logs " + workflowJobId + " for group workspace " + workspaceId + " in project " + projectId + " for patch release version " + patchReleaseVersionId, () -> { - String logs = this.workflowJobApi.getWorkspaceWorkflowJobAccessContext(projectId, SourceSpecification.newSourceSpecification(workspaceId, WorkspaceType.GROUP, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, versionId)).getWorkflowJobLog(workflowId, workflowJobId); + String logs = this.workflowJobApi.getWorkspaceWorkflowJobAccessContext(projectId, SourceSpecification.newSourceSpecification(projectId, workspaceId, WorkspaceType.GROUP, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, versionId)).getWorkflowJobLog(workflowId, workflowJobId); return Response.ok(logs) .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + workflowJobId + ".log\"") .build(); @@ -157,7 +157,7 @@ public WorkflowJob runWorkflowJob(@PathParam("projectId") String projectId, } return executeWithLogging( "running workflow job " + workflowJobId + " for group workspace " + workspaceId + " in project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.workflowJobApi.getWorkspaceWorkflowJobAccessContext(projectId, SourceSpecification.newSourceSpecification(workspaceId, WorkspaceType.GROUP, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, versionId)).runWorkflowJob(workflowId, workflowJobId) + () -> this.workflowJobApi.getWorkspaceWorkflowJobAccessContext(projectId, SourceSpecification.newSourceSpecification(projectId, workspaceId, WorkspaceType.GROUP, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, versionId)).runWorkflowJob(workflowId, workflowJobId) ); } @@ -182,7 +182,7 @@ public WorkflowJob retryWorkflowJob(@PathParam("projectId") String projectId, } return executeWithLogging( "retrying workflow job " + workflowJobId + " for group workspace " + workspaceId + " in project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.workflowJobApi.getWorkspaceWorkflowJobAccessContext(projectId, SourceSpecification.newSourceSpecification(workspaceId, WorkspaceType.GROUP, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, versionId)).retryWorkflowJob(workflowId, workflowJobId) + () -> this.workflowJobApi.getWorkspaceWorkflowJobAccessContext(projectId, SourceSpecification.newSourceSpecification(projectId, workspaceId, WorkspaceType.GROUP, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, versionId)).retryWorkflowJob(workflowId, workflowJobId) ); } @@ -208,7 +208,7 @@ public WorkflowJob cancelWorkflowJob(@PathParam("projectId") String projectId, } return executeWithLogging( "canceling workflow job " + workflowJobId + " for group workspace " + workspaceId + " in project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.workflowJobApi.getWorkspaceWorkflowJobAccessContext(projectId, SourceSpecification.newSourceSpecification(workspaceId, WorkspaceType.GROUP, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, versionId)).cancelWorkflowJob(workflowId, workflowJobId) + () -> this.workflowJobApi.getWorkspaceWorkflowJobAccessContext(projectId, SourceSpecification.newSourceSpecification(projectId, workspaceId, WorkspaceType.GROUP, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, versionId)).cancelWorkflowJob(workflowId, workflowJobId) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/workflow/patch/group/PatchesGroupWorkspaceWorkflowsResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/workflow/patch/group/PatchesGroupWorkspaceWorkflowsResource.java index 2c4414819c..e54a149f40 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/workflow/patch/group/PatchesGroupWorkspaceWorkflowsResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/workflow/patch/group/PatchesGroupWorkspaceWorkflowsResource.java @@ -77,7 +77,7 @@ public List getWorkflows(@PathParam("projectId") String projectId, } return executeWithLogging( "getting workflows for group workspace " + workspaceId + " in project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.workflowApi.getWorkspaceWorkflowAccessContext(projectId, SourceSpecification.newSourceSpecification(workspaceId, WorkspaceType.GROUP, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, versionId)).getWorkflows(revisionIds, statuses, limit) + () -> this.workflowApi.getWorkspaceWorkflowAccessContext(projectId, SourceSpecification.newSourceSpecification(projectId, workspaceId, WorkspaceType.GROUP, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, versionId)).getWorkflows(revisionIds, statuses, limit) ); } @@ -98,7 +98,7 @@ public Workflow getWorkflow(@PathParam("projectId") String projectId, @PathParam } return executeWithLogging( "getting workflow " + workflowId + " for group workspace " + workspaceId + " in project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.workflowApi.getWorkspaceWorkflowAccessContext(projectId, SourceSpecification.newSourceSpecification(workspaceId, WorkspaceType.GROUP, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, versionId)).getWorkflow(workflowId) + () -> this.workflowApi.getWorkspaceWorkflowAccessContext(projectId, SourceSpecification.newSourceSpecification(projectId, workspaceId, WorkspaceType.GROUP, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, versionId)).getWorkflow(workflowId) ); } } \ No newline at end of file diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/workflow/patch/user/PatchesWorkspaceWorkflowJobsResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/workflow/patch/user/PatchesWorkspaceWorkflowJobsResource.java index 390809f8fb..e21e797e63 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/workflow/patch/user/PatchesWorkspaceWorkflowJobsResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/workflow/patch/user/PatchesWorkspaceWorkflowJobsResource.java @@ -75,7 +75,7 @@ public List getWorkflowJobs(@PathParam("projectId") String projectI } return executeWithLogging( "getting workflow jobs for user workspace " + workspaceId + " in project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.workflowJobApi.getWorkspaceWorkflowJobAccessContext(projectId, SourceSpecification.newSourceSpecification(workspaceId, WorkspaceType.USER, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, versionId)).getWorkflowJobs(workflowId, statuses) + () -> this.workflowJobApi.getWorkspaceWorkflowJobAccessContext(projectId, SourceSpecification.newSourceSpecification(projectId, workspaceId, WorkspaceType.USER, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, versionId)).getWorkflowJobs(workflowId, statuses) ); } @@ -100,7 +100,7 @@ public WorkflowJob getWorkflowJob(@PathParam("projectId") String projectId, } return executeWithLogging( "getting workflow job " + workflowJobId + " for user workspace " + workspaceId + " in project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.workflowJobApi.getWorkspaceWorkflowJobAccessContext(projectId, SourceSpecification.newSourceSpecification(workspaceId, WorkspaceType.USER, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, versionId)).getWorkflowJob(workflowId, workflowJobId) + () -> this.workflowJobApi.getWorkspaceWorkflowJobAccessContext(projectId, SourceSpecification.newSourceSpecification(projectId, workspaceId, WorkspaceType.USER, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, versionId)).getWorkflowJob(workflowId, workflowJobId) ); } @@ -128,7 +128,7 @@ public Response getWorkflowJobLogs(@PathParam("projectId") String projectId, "getting workflow job logs " + workflowJobId + " for user workspace " + workspaceId + " in project " + projectId + " for patch release version " + patchReleaseVersionId, () -> { - String logs = this.workflowJobApi.getWorkspaceWorkflowJobAccessContext(projectId, SourceSpecification.newSourceSpecification(workspaceId, WorkspaceType.USER, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, versionId)).getWorkflowJobLog(workflowId, workflowJobId); + String logs = this.workflowJobApi.getWorkspaceWorkflowJobAccessContext(projectId, SourceSpecification.newSourceSpecification(projectId, workspaceId, WorkspaceType.USER, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, versionId)).getWorkflowJobLog(workflowId, workflowJobId); return Response.ok(logs) .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + workflowJobId + ".log\"") .build(); @@ -157,7 +157,7 @@ public WorkflowJob runWorkflowJob(@PathParam("projectId") String projectId, } return executeWithLogging( "running workflow job " + workflowJobId + " for user workspace " + workspaceId + " in project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.workflowJobApi.getWorkspaceWorkflowJobAccessContext(projectId, SourceSpecification.newSourceSpecification(workspaceId, WorkspaceType.USER, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, versionId)).runWorkflowJob(workflowId, workflowJobId) + () -> this.workflowJobApi.getWorkspaceWorkflowJobAccessContext(projectId, SourceSpecification.newSourceSpecification(projectId, workspaceId, WorkspaceType.USER, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, versionId)).runWorkflowJob(workflowId, workflowJobId) ); } @@ -182,7 +182,7 @@ public WorkflowJob retryWorkflowJob(@PathParam("projectId") String projectId, } return executeWithLogging( "retrying workflow job " + workflowJobId + " for user workspace " + workspaceId + " in project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.workflowJobApi.getWorkspaceWorkflowJobAccessContext(projectId, SourceSpecification.newSourceSpecification(workspaceId, WorkspaceType.USER, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, versionId)).retryWorkflowJob(workflowId, workflowJobId) + () -> this.workflowJobApi.getWorkspaceWorkflowJobAccessContext(projectId, SourceSpecification.newSourceSpecification(projectId, workspaceId, WorkspaceType.USER, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, versionId)).retryWorkflowJob(workflowId, workflowJobId) ); } @@ -208,7 +208,7 @@ public WorkflowJob cancelWorkflowJob(@PathParam("projectId") String projectId, } return executeWithLogging( "canceling workflow job " + workflowJobId + " for user workspace " + workspaceId + " in project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.workflowJobApi.getWorkspaceWorkflowJobAccessContext(projectId, SourceSpecification.newSourceSpecification(workspaceId, WorkspaceType.USER, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, versionId)).cancelWorkflowJob(workflowId, workflowJobId) + () -> this.workflowJobApi.getWorkspaceWorkflowJobAccessContext(projectId, SourceSpecification.newSourceSpecification(projectId, workspaceId, WorkspaceType.USER, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, versionId)).cancelWorkflowJob(workflowId, workflowJobId) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/workflow/patch/user/PatchesWorkspaceWorkflowsResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/workflow/patch/user/PatchesWorkspaceWorkflowsResource.java index f21d4d2d70..18905a87d1 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/workflow/patch/user/PatchesWorkspaceWorkflowsResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/workflow/patch/user/PatchesWorkspaceWorkflowsResource.java @@ -77,7 +77,7 @@ public List getWorkflows(@PathParam("projectId") String projectId, } return executeWithLogging( "getting workflows for user workspace " + workspaceId + " in project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.workflowApi.getWorkspaceWorkflowAccessContext(projectId, SourceSpecification.newSourceSpecification(workspaceId, WorkspaceType.USER, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, versionId)).getWorkflows(revisionIds, statuses, limit) + () -> this.workflowApi.getWorkspaceWorkflowAccessContext(projectId, SourceSpecification.newSourceSpecification(projectId, workspaceId, WorkspaceType.USER, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, versionId)).getWorkflows(revisionIds, statuses, limit) ); } @@ -98,7 +98,7 @@ public Workflow getWorkflow(@PathParam("projectId") String projectId, @PathParam } return executeWithLogging( "getting workflow " + workflowId + " for user workspace " + workspaceId + " in project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.workflowApi.getWorkspaceWorkflowAccessContext(projectId, SourceSpecification.newSourceSpecification(workspaceId, WorkspaceType.USER, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, versionId)).getWorkflow(workflowId) + () -> this.workflowApi.getWorkspaceWorkflowAccessContext(projectId, SourceSpecification.newSourceSpecification(projectId, workspaceId, WorkspaceType.USER, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, versionId)).getWorkflow(workflowId) ); } } diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/workspace/patch/group/PatchesGroupWorkspacesResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/workspace/patch/group/PatchesGroupWorkspacesResource.java index 25e3318eb7..12678d9271 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/workspace/patch/group/PatchesGroupWorkspacesResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/workspace/patch/group/PatchesGroupWorkspacesResource.java @@ -95,7 +95,7 @@ public Workspace getGroupWorkspace(@PathParam("projectId") String projectId, @Pa } return executeWithLogging( "getting group workspace " + workspaceId + " for patch release " + patchReleaseVersionId + " for project " + projectId + " for patch release version " + patchReleaseVersionId, - () -> this.workspaceApi.getWorkspace(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)) + () -> this.workspaceApi.getWorkspace(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)) ); } @@ -116,7 +116,7 @@ public boolean isGroupWorkspaceOutdated(@PathParam("projectId") String projectId } return executeWithLogging( "checking if group workspace " + workspaceId + " for patch release " + patchReleaseVersionId + " of project " + projectId + " for patch release version " + patchReleaseVersionId + " is outdated", - () -> this.workspaceApi.isWorkspaceOutdated(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)) + () -> this.workspaceApi.isWorkspaceOutdated(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)) ); } @@ -137,7 +137,7 @@ public boolean isGroupWorkspaceInConflictResolutionMode(@PathParam("projectId") } return executeWithLogging( "checking if group workspace " + workspaceId + " for patch release " + patchReleaseVersionId + " of project " + projectId + " for patch release version " + patchReleaseVersionId + " is in conflict resolution mode", - () -> this.workspaceApi.isWorkspaceInConflictResolutionMode(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)) + () -> this.workspaceApi.isWorkspaceInConflictResolutionMode(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)) ); } @@ -158,7 +158,7 @@ public Workspace createGroupWorkspace(@PathParam("projectId") String projectId, } return executeWithLogging( "creating new group workspace " + workspaceId + " for patch release " + patchReleaseVersionId + " for project " + projectId, - () -> this.workspaceApi.newWorkspace(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)) + () -> this.workspaceApi.newWorkspace(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)) ); } @@ -180,7 +180,7 @@ public void deleteGroupWorkspace(@PathParam("projectId") String projectId, @Path } executeWithLogging( "deleting group workspace " + workspaceId + " for patch release " + patchReleaseVersionId + " for project " + projectId, - () -> this.workspaceApi.deleteWorkspace(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)) + () -> this.workspaceApi.deleteWorkspace(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)) ); } @@ -201,7 +201,7 @@ public WorkspaceApi.WorkspaceUpdateReport updateGroupWorkspace(@PathParam("proje } return executeWithLogging( "updating user workspace " + workspaceId + " in project " + projectId + " for patch release version " + patchReleaseVersionId + " to latest revision", - () -> this.workspaceApi.updateWorkspace(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, versionId)) + () -> this.workspaceApi.updateWorkspace(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, versionId)) ); } } \ No newline at end of file diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/workspace/patch/user/PatchesWorkspacesResource.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/workspace/patch/user/PatchesWorkspacesResource.java index 659408e065..6a2a2b9158 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/workspace/patch/user/PatchesWorkspacesResource.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/resources/workspace/patch/user/PatchesWorkspacesResource.java @@ -96,7 +96,7 @@ public Workspace getUserWorkspace(@PathParam("projectId") String projectId, @Pat } return executeWithLogging( "getting user workspace " + workspaceId + " for patch release " + patchReleaseVersionId + " for project " + projectId, - () -> this.workspaceApi.getWorkspace(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)) + () -> this.workspaceApi.getWorkspace(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)) ); } @@ -117,7 +117,7 @@ public boolean isUserWorkspaceOutdated(@PathParam("projectId") String projectId, } return executeWithLogging( "checking if user workspace " + workspaceId + " for patch release " + patchReleaseVersionId + " of project " + projectId + " is outdated", - () -> this.workspaceApi.isWorkspaceOutdated(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)) + () -> this.workspaceApi.isWorkspaceOutdated(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)) ); } @@ -138,7 +138,7 @@ public boolean isUserWorkspaceInConflictResolutionMode(@PathParam("projectId") S } return executeWithLogging( "checking if user workspace " + workspaceId + " for patch release " + patchReleaseVersionId + " of project " + projectId + " is in conflict resolution mode", - () -> this.workspaceApi.isWorkspaceInConflictResolutionMode(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)) + () -> this.workspaceApi.isWorkspaceInConflictResolutionMode(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)) ); } @@ -159,7 +159,7 @@ public Workspace createUserWorkspace(@PathParam("projectId") String projectId, @ } return executeWithLogging( "creating new user workspace " + workspaceId + " for patch release " + patchReleaseVersionId + " for project " + projectId, - () -> this.workspaceApi.newWorkspace(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)) + () -> this.workspaceApi.newWorkspace(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)) ); } @@ -181,7 +181,7 @@ public void deleteUserWorkspace(@PathParam("projectId") String projectId, @PathP } executeWithLogging( "deleting user workspace " + workspaceId + " for patch release " + patchReleaseVersionId + " for project " + projectId, - () -> this.workspaceApi.deleteWorkspace(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)) + () -> this.workspaceApi.deleteWorkspace(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)) ); } @@ -202,7 +202,7 @@ public WorkspaceApi.WorkspaceUpdateReport updateUserWorkspace(@PathParam("projec } return executeWithLogging( "updating user workspace " + workspaceId + " in project " + projectId + " to latest revision", - () -> this.workspaceApi.updateWorkspace(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, versionId)) + () -> this.workspaceApi.updateWorkspace(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, versionId)) ); } } diff --git a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/gitlab/api/GitLabComparisonApiTestResource.java b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/gitlab/api/GitLabComparisonApiTestResource.java index 2fe287bca1..7999c8e275 100644 --- a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/gitlab/api/GitLabComparisonApiTestResource.java +++ b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/gitlab/api/GitLabComparisonApiTestResource.java @@ -221,7 +221,7 @@ public void runUserWorkspaceComparisonTestForPatchReleaseVersion() Version version = gitlabVersionApi.newVersion(projectId, NewVersionType.PATCH, gitLabRevisionApi.getProjectRevisionContext(projectId).getCurrentRevision().getId(), ""); Patch patch = gitlabPatchApi.newPatch(projectId, version.getId()); VersionId patchReleaseVersionId = patch.getPatchReleaseVersionId(); - SourceSpecification sourceSpecification = SourceSpecification.newUserWorkspaceSourceSpecification(workspaceOneId, patchReleaseVersionId); + SourceSpecification sourceSpecification = SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceOneId, patchReleaseVersionId); Workspace createdWorkspaceOne = gitLabWorkspaceApi.newWorkspace(projectId, sourceSpecification); Revision fromRevision = gitLabRevisionApi.getWorkspaceRevisionContext(projectId, sourceSpecification).getCurrentRevision(); @@ -249,9 +249,9 @@ public void runUserWorkspaceComparisonTestForPatchReleaseVersion() Assert.assertEquals(initalEntity.getContent(), entityContentMap); Revision toRevision = gitLabRevisionApi.getWorkspaceRevisionContext(projectId, sourceSpecification).getCurrentRevision(); - List entityDiffs = gitLabComparisonApi.getWorkspaceCreationComparison(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceOneId, patchReleaseVersionId)).getEntityDiffs(); - String fromRevisionId = gitLabComparisonApi.getWorkspaceCreationComparison(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceOneId, patchReleaseVersionId)).getFromRevisionId(); - String toRevisionId = gitLabComparisonApi.getWorkspaceCreationComparison(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceOneId, patchReleaseVersionId)).getToRevisionId(); + List entityDiffs = gitLabComparisonApi.getWorkspaceCreationComparison(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceOneId, patchReleaseVersionId)).getEntityDiffs(); + String fromRevisionId = gitLabComparisonApi.getWorkspaceCreationComparison(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceOneId, patchReleaseVersionId)).getFromRevisionId(); + String toRevisionId = gitLabComparisonApi.getWorkspaceCreationComparison(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceOneId, patchReleaseVersionId)).getToRevisionId(); Assert.assertNotNull(fromRevision); Assert.assertNotNull(toRevision); @@ -263,9 +263,9 @@ public void runUserWorkspaceComparisonTestForPatchReleaseVersion() Revision projectFromRevision = gitLabRevisionApi.getProjectRevisionContext(projectId, patchReleaseVersionId).getCurrentRevision(); Revision projectToRevision = gitLabRevisionApi.getWorkspaceRevisionContext(projectId, sourceSpecification).getCurrentRevision(); - List projectEntityDiffs = gitLabComparisonApi.getWorkspaceProjectComparison(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceOneId, patchReleaseVersionId)).getEntityDiffs(); - String projectFromRevisionId = gitLabComparisonApi.getWorkspaceProjectComparison(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceOneId, patchReleaseVersionId)).getFromRevisionId(); - String projectToRevisionId = gitLabComparisonApi.getWorkspaceProjectComparison(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceOneId, patchReleaseVersionId)).getToRevisionId(); + List projectEntityDiffs = gitLabComparisonApi.getWorkspaceProjectComparison(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceOneId, patchReleaseVersionId)).getEntityDiffs(); + String projectFromRevisionId = gitLabComparisonApi.getWorkspaceProjectComparison(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceOneId, patchReleaseVersionId)).getFromRevisionId(); + String projectToRevisionId = gitLabComparisonApi.getWorkspaceProjectComparison(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceOneId, patchReleaseVersionId)).getToRevisionId(); Assert.assertNotNull(projectFromRevision); Assert.assertEquals(projectFromRevision.getId(), projectFromRevisionId); @@ -295,7 +295,7 @@ public void runGroupWorkspaceComparisonTestForPatchReleaseVersion() Version version = gitlabVersionApi.newVersion(projectId, NewVersionType.PATCH, gitLabRevisionApi.getProjectRevisionContext(projectId).getCurrentRevision().getId(), ""); Patch patch = gitlabPatchApi.newPatch(projectId, version.getId()); VersionId patchReleaseVersionId = patch.getPatchReleaseVersionId(); - SourceSpecification sourceSpecification = SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceOneId, patchReleaseVersionId); + SourceSpecification sourceSpecification = SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceOneId, patchReleaseVersionId); Workspace createdWorkspaceOne = gitLabWorkspaceApi.newWorkspace(projectId, sourceSpecification); Revision fromRevision = gitLabRevisionApi.getWorkspaceRevisionContext(projectId, sourceSpecification).getCurrentRevision(); @@ -323,9 +323,9 @@ public void runGroupWorkspaceComparisonTestForPatchReleaseVersion() Assert.assertEquals(initalEntity.getContent(), entityContentMap); Revision toRevision = gitLabRevisionApi.getWorkspaceRevisionContext(projectId, sourceSpecification).getCurrentRevision(); - List entityDiffs = gitLabComparisonApi.getWorkspaceCreationComparison(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceOneId, patchReleaseVersionId)).getEntityDiffs(); - String fromRevisionId = gitLabComparisonApi.getWorkspaceCreationComparison(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceOneId, patchReleaseVersionId)).getFromRevisionId(); - String toRevisionId = gitLabComparisonApi.getWorkspaceCreationComparison(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceOneId, patchReleaseVersionId)).getToRevisionId(); + List entityDiffs = gitLabComparisonApi.getWorkspaceCreationComparison(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceOneId, patchReleaseVersionId)).getEntityDiffs(); + String fromRevisionId = gitLabComparisonApi.getWorkspaceCreationComparison(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceOneId, patchReleaseVersionId)).getFromRevisionId(); + String toRevisionId = gitLabComparisonApi.getWorkspaceCreationComparison(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceOneId, patchReleaseVersionId)).getToRevisionId(); Assert.assertNotNull(fromRevision); Assert.assertNotNull(toRevision); @@ -337,9 +337,9 @@ public void runGroupWorkspaceComparisonTestForPatchReleaseVersion() Revision projectFromRevision = gitLabRevisionApi.getProjectRevisionContext(projectId, patchReleaseVersionId).getCurrentRevision(); Revision projectToRevision = gitLabRevisionApi.getWorkspaceRevisionContext(projectId, sourceSpecification).getCurrentRevision(); - List projectEntityDiffs = gitLabComparisonApi.getWorkspaceProjectComparison(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceOneId, patchReleaseVersionId)).getEntityDiffs(); - String projectFromRevisionId = gitLabComparisonApi.getWorkspaceProjectComparison(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceOneId, patchReleaseVersionId)).getFromRevisionId(); - String projectToRevisionId = gitLabComparisonApi.getWorkspaceProjectComparison(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceOneId, patchReleaseVersionId)).getToRevisionId(); + List projectEntityDiffs = gitLabComparisonApi.getWorkspaceProjectComparison(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceOneId, patchReleaseVersionId)).getEntityDiffs(); + String projectFromRevisionId = gitLabComparisonApi.getWorkspaceProjectComparison(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceOneId, patchReleaseVersionId)).getFromRevisionId(); + String projectToRevisionId = gitLabComparisonApi.getWorkspaceProjectComparison(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceOneId, patchReleaseVersionId)).getToRevisionId(); Assert.assertNotNull(projectFromRevision); Assert.assertEquals(projectFromRevision.getId(), projectFromRevisionId); diff --git a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/gitlab/api/GitLabEntityApiTestResource.java b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/gitlab/api/GitLabEntityApiTestResource.java index 9053a18256..a13afe616a 100644 --- a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/gitlab/api/GitLabEntityApiTestResource.java +++ b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/gitlab/api/GitLabEntityApiTestResource.java @@ -387,7 +387,7 @@ public void runEntitiesInNormalUserWorkspaceWorkflowTestForPatchRelaseVersion() Version version = this.gitLabVersionApi.newVersion(projectId, NewVersionType.MINOR, this.gitLabRevisionApi.getProjectRevisionContext(projectId).getCurrentRevision().getId(), ""); Patch patch = this.gitLabPatchApi.newPatch(projectId, version.getId()); VersionId patchReleaseVersionId = patch.getPatchReleaseVersionId(); - SourceSpecification sourceSpecification = SourceSpecification.newUserWorkspaceSourceSpecification(workspaceName, patchReleaseVersionId); + SourceSpecification sourceSpecification = SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceName, patchReleaseVersionId); Workspace createdWorkspace = this.gitLabWorkspaceApi.newWorkspace(projectId, sourceSpecification); @@ -540,7 +540,7 @@ public void runEntitiesInNormalGroupWorkspaceWorkflowTestForPatchRelaseVersion() Version version = this.gitLabVersionApi.newVersion(projectId, NewVersionType.PATCH, this.gitLabRevisionApi.getProjectRevisionContext(projectId).getCurrentRevision().getId(), ""); Patch patch = this.gitLabPatchApi.newPatch(projectId, version.getId()); VersionId patchReleaseVersionId = patch.getPatchReleaseVersionId(); - SourceSpecification sourceSpecification = SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceName, patchReleaseVersionId); + SourceSpecification sourceSpecification = SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceName, patchReleaseVersionId); Workspace createdWorkspace = this.gitLabWorkspaceApi.newWorkspace(projectId, sourceSpecification); diff --git a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/gitlab/api/GitLabPatchApiTestResource.java b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/gitlab/api/GitLabPatchApiTestResource.java index 814e7efe5e..e8e1eb04d4 100644 --- a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/gitlab/api/GitLabPatchApiTestResource.java +++ b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/gitlab/api/GitLabPatchApiTestResource.java @@ -70,6 +70,36 @@ public void runCreatePatchTest() throws LegendSDLCServerException Assert.assertEquals("0.0.2", patch.getPatchReleaseVersionId().toVersionIdString()); } + public void runGetPatchTest() throws LegendSDLCServerException + { + String projectName = "PatchTestProjectOne"; + String description = "A test project."; + String groupId = "org.finos.sdlc.test"; + String artifactId = "testpatchprojone"; + List tags = Lists.mutable.with("doe", "moffitt", AbstractGitLabServerApiTest.INTEGRATION_TEST_PROJECT_TAG); + + Project createdProject = gitLabProjectApi.createProject(projectName, description, ProjectType.MANAGED, groupId, artifactId, tags); + + Assert.assertNotNull(createdProject); + Assert.assertEquals(projectName, createdProject.getName()); + Assert.assertEquals(description, createdProject.getDescription()); + Assert.assertNull(createdProject.getProjectType()); + Assert.assertEquals(Sets.mutable.withAll(tags), Sets.mutable.withAll(createdProject.getTags())); + + String projectId = createdProject.getProjectId(); + Version version = gitLabVersionApi.newVersion(projectId, NewVersionType.PATCH, gitLabRevisionApi.getProjectRevisionContext(projectId).getCurrentRevision().getId(), ""); + Patch patch = gitLabPatchApi.newPatch(projectId, version.getId()); + + Assert.assertNotNull(patch); + Assert.assertEquals(projectId, patch.getProjectId()); + Assert.assertEquals("0.0.2", patch.getPatchReleaseVersionId().toVersionIdString()); + + Patch returnedPatch = gitLabPatchApi.getPatch(projectId, version.getId()); + Assert.assertNotNull(returnedPatch); + Assert.assertEquals(projectId, returnedPatch.getProjectId()); + Assert.assertEquals("0.0.2", returnedPatch.getPatchReleaseVersionId().toVersionIdString()); + } + public void runGetPatchesTest() throws LegendSDLCServerException { String projectName = "PatchTestProjectTwo"; diff --git a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/gitlab/api/GitLabProjectConfigurationApiTestResource.java b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/gitlab/api/GitLabProjectConfigurationApiTestResource.java index 91d2b8504c..92b728ba15 100644 --- a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/gitlab/api/GitLabProjectConfigurationApiTestResource.java +++ b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/gitlab/api/GitLabProjectConfigurationApiTestResource.java @@ -122,27 +122,27 @@ public void runUserAndGroupWorkspaceProjectConfigurationTestForPatchReleaseVersi Patch patch = this.gitlabPatchApi.newPatch(projectId, version.getId()); VersionId patchReleaseVersionId = patch.getPatchReleaseVersionId(); - Workspace createdWorkspaceOne = this.gitLabWorkspaceApi.newWorkspace(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceOneId, patchReleaseVersionId)); + Workspace createdWorkspaceOne = this.gitLabWorkspaceApi.newWorkspace(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceOneId, patchReleaseVersionId)); Assert.assertNotNull(createdWorkspaceOne); Assert.assertEquals(workspaceOneId, createdWorkspaceOne.getWorkspaceId()); Assert.assertEquals(projectId, createdWorkspaceOne.getProjectId()); Assert.assertNotNull(createdWorkspaceOne.getUserId()); - ProjectConfiguration projectConfiguration = this.gitLabProjectConfigurationApi.getWorkspaceProjectConfiguration(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceOneId, patchReleaseVersionId)); + ProjectConfiguration projectConfiguration = this.gitLabProjectConfigurationApi.getWorkspaceProjectConfiguration(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceOneId, patchReleaseVersionId)); Assert.assertNotNull(projectConfiguration); Assert.assertEquals(artifactId, projectConfiguration.getArtifactId()); Assert.assertEquals(groupId, projectConfiguration.getGroupId()); - Workspace createdWorkspaceTwo = this.gitLabWorkspaceApi.newWorkspace(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceTwoId, patchReleaseVersionId)); + Workspace createdWorkspaceTwo = this.gitLabWorkspaceApi.newWorkspace(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceTwoId, patchReleaseVersionId)); Assert.assertNotNull(createdWorkspaceTwo); Assert.assertEquals(workspaceTwoId, createdWorkspaceTwo.getWorkspaceId()); Assert.assertEquals(projectId, createdWorkspaceTwo.getProjectId()); Assert.assertNull(createdWorkspaceTwo.getUserId()); - ProjectConfiguration projectConfigurationTwo = this.gitLabProjectConfigurationApi.getWorkspaceProjectConfiguration(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceTwoId, patchReleaseVersionId)); + ProjectConfiguration projectConfigurationTwo = this.gitLabProjectConfigurationApi.getWorkspaceProjectConfiguration(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceTwoId, patchReleaseVersionId)); Assert.assertNotNull(projectConfigurationTwo); Assert.assertEquals(artifactId, projectConfigurationTwo.getArtifactId()); diff --git a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/gitlab/api/GitLabRevisionApiTestResource.java b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/gitlab/api/GitLabRevisionApiTestResource.java index ca13c9bd52..22b5a48389 100644 --- a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/gitlab/api/GitLabRevisionApiTestResource.java +++ b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/gitlab/api/GitLabRevisionApiTestResource.java @@ -261,7 +261,7 @@ public void runUserWorkspaceRevisionTestForPatchReleaseVersion() Version version = gitlabVersionApi.newVersion(projectId, NewVersionType.PATCH, gitLabRevisionApi.getProjectRevisionContext(projectId).getCurrentRevision().getId(), ""); Patch patch = gitlabPatchApi.newPatch(projectId, version.getId()); VersionId patchReleaseVersionId = patch.getPatchReleaseVersionId(); - SourceSpecification sourceSpecification = SourceSpecification.newUserWorkspaceSourceSpecification(workspaceOneId, patchReleaseVersionId); + SourceSpecification sourceSpecification = SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceOneId, patchReleaseVersionId); Workspace createdWorkspaceOne = gitLabWorkspaceApi.newWorkspace(projectId, sourceSpecification); @@ -357,7 +357,7 @@ public void runGroupWorkspaceRevisionTestForPatchReleaseVersion() Version version = gitlabVersionApi.newVersion(projectId, NewVersionType.PATCH, gitLabRevisionApi.getProjectRevisionContext(projectId).getCurrentRevision().getId(), ""); Patch patch = gitlabPatchApi.newPatch(projectId, version.getId()); VersionId patchReleaseVersionId = patch.getPatchReleaseVersionId(); - SourceSpecification sourceSpecification = SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceOneId, patchReleaseVersionId); + SourceSpecification sourceSpecification = SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceOneId, patchReleaseVersionId); Workspace createdWorkspaceOne = gitLabWorkspaceApi.newWorkspace(projectId, sourceSpecification); diff --git a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/gitlab/api/GitLabWorkspaceApiTestResource.java b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/gitlab/api/GitLabWorkspaceApiTestResource.java index 127ab2cfe6..34514f1087 100644 --- a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/gitlab/api/GitLabWorkspaceApiTestResource.java +++ b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/gitlab/api/GitLabWorkspaceApiTestResource.java @@ -456,21 +456,21 @@ public void runUserAndGroupWorkspaceNormalWorkflowTestForPatchReleaseVersion() Patch patch = gitlabPatchApi.newPatch(projectId, version.getId()); VersionId patchReleaseVersionId = patch.getPatchReleaseVersionId(); - Workspace createdWorkspaceOne = gitLabWorkspaceApi.newWorkspace(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceOneId, patchReleaseVersionId)); + Workspace createdWorkspaceOne = gitLabWorkspaceApi.newWorkspace(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceOneId, patchReleaseVersionId)); Assert.assertNotNull(createdWorkspaceOne); Assert.assertEquals(workspaceOneId, createdWorkspaceOne.getWorkspaceId()); Assert.assertEquals(projectId, createdWorkspaceOne.getProjectId()); Assert.assertNotNull(createdWorkspaceOne.getUserId()); - Workspace createdWorkspaceTwo = gitLabWorkspaceApi.newWorkspace(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceTwoId, patchReleaseVersionId)); + Workspace createdWorkspaceTwo = gitLabWorkspaceApi.newWorkspace(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceTwoId, patchReleaseVersionId)); Assert.assertNotNull(createdWorkspaceTwo); Assert.assertEquals(workspaceTwoId, createdWorkspaceTwo.getWorkspaceId()); Assert.assertEquals(projectId, createdWorkspaceTwo.getProjectId()); Assert.assertNotNull(createdWorkspaceTwo.getUserId()); - Workspace createdWorkspaceThree = gitLabWorkspaceApi.newWorkspace(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceThreeId, patchReleaseVersionId)); + Workspace createdWorkspaceThree = gitLabWorkspaceApi.newWorkspace(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceThreeId, patchReleaseVersionId)); Assert.assertNotNull(createdWorkspaceThree); Assert.assertEquals(workspaceThreeId, createdWorkspaceThree.getWorkspaceId()); @@ -488,28 +488,28 @@ public void runUserAndGroupWorkspaceNormalWorkflowTestForPatchReleaseVersion() Assert.assertEquals(2, allUserWorkspaces.size()); Assert.assertEquals(1, allGroupWorkspaces.size()); - Workspace retriedUserWorkspace = gitLabWorkspaceApi.getWorkspace(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceOneId, patchReleaseVersionId)); + Workspace retriedUserWorkspace = gitLabWorkspaceApi.getWorkspace(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceOneId, patchReleaseVersionId)); Assert.assertNotNull(retriedUserWorkspace); Assert.assertEquals(workspaceOneId, retriedUserWorkspace.getWorkspaceId()); Assert.assertEquals(projectId, retriedUserWorkspace.getProjectId()); Assert.assertNotNull(retriedUserWorkspace.getUserId()); - Workspace retriedGroupWorkspace = gitLabWorkspaceApi.getWorkspace(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceThreeId, patchReleaseVersionId)); + Workspace retriedGroupWorkspace = gitLabWorkspaceApi.getWorkspace(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceThreeId, patchReleaseVersionId)); Assert.assertNotNull(retriedGroupWorkspace); Assert.assertEquals(workspaceThreeId, retriedGroupWorkspace.getWorkspaceId()); Assert.assertEquals(projectId, retriedGroupWorkspace.getProjectId()); Assert.assertNull(retriedGroupWorkspace.getUserId()); - boolean isUserWorkspaceInConflictResolution = gitLabWorkspaceApi.isWorkspaceInConflictResolutionMode(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceOneId, patchReleaseVersionId)); - boolean isGroupWorkspaceInConflictResolution = gitLabWorkspaceApi.isWorkspaceInConflictResolutionMode(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceThreeId, patchReleaseVersionId)); + boolean isUserWorkspaceInConflictResolution = gitLabWorkspaceApi.isWorkspaceInConflictResolutionMode(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceOneId, patchReleaseVersionId)); + boolean isGroupWorkspaceInConflictResolution = gitLabWorkspaceApi.isWorkspaceInConflictResolutionMode(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceThreeId, patchReleaseVersionId)); Assert.assertFalse(isUserWorkspaceInConflictResolution); Assert.assertFalse(isGroupWorkspaceInConflictResolution); - boolean isUserWorkspaceOutdated = gitLabWorkspaceApi.isWorkspaceOutdated(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceOneId, patchReleaseVersionId)); - boolean isGroupWorkspaceOutdated = gitLabWorkspaceApi.isWorkspaceOutdated(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceThreeId, patchReleaseVersionId)); + boolean isUserWorkspaceOutdated = gitLabWorkspaceApi.isWorkspaceOutdated(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceOneId, patchReleaseVersionId)); + boolean isGroupWorkspaceOutdated = gitLabWorkspaceApi.isWorkspaceOutdated(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceThreeId, patchReleaseVersionId)); Assert.assertFalse(isUserWorkspaceOutdated); Assert.assertFalse(isGroupWorkspaceOutdated); @@ -532,10 +532,10 @@ public void runUpdateUserWorkspaceWithRebaseNoConflictTestForPatchReleaseVersion Patch patch = gitlabPatchApi.newPatch(projectId, version.getId()); VersionId patchReleaseVersionId = patch.getPatchReleaseVersionId(); - Workspace createdWorkspace = gitLabWorkspaceApi.newWorkspace(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceName, patchReleaseVersionId)); + Workspace createdWorkspace = gitLabWorkspaceApi.newWorkspace(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceName, patchReleaseVersionId)); String workspaceId = createdWorkspace.getWorkspaceId(); - List initialWorkspaceEntities = gitLabEntityApi.getWorkspaceEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, patchReleaseVersionId)).getEntities(null, null, null); + List initialWorkspaceEntities = gitLabEntityApi.getWorkspaceEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, patchReleaseVersionId)).getEntities(null, null, null); List initialProjectEntities = gitLabEntityApi.getProjectEntityAccessContext(projectId, patchReleaseVersionId).getEntities(null, null, null); Assert.assertEquals(Collections.emptyList(), initialWorkspaceEntities); @@ -543,9 +543,9 @@ public void runUpdateUserWorkspaceWithRebaseNoConflictTestForPatchReleaseVersion // Create another workspace, commit, review, merge to move project HEAD forward -- use workspace two String workspaceTwoName = "workspacetwo"; - Workspace createdWorkspaceTwo = gitLabWorkspaceApi.newWorkspace(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceTwoName, patchReleaseVersionId)); + Workspace createdWorkspaceTwo = gitLabWorkspaceApi.newWorkspace(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceTwoName, patchReleaseVersionId)); String workspaceTwoId = createdWorkspaceTwo.getWorkspaceId(); - List initialWorkspaceTwoEntities = gitLabEntityApi.getWorkspaceEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceTwoId, patchReleaseVersionId)).getEntities(null, null, null); + List initialWorkspaceTwoEntities = gitLabEntityApi.getWorkspaceEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceTwoId, patchReleaseVersionId)).getEntities(null, null, null); Assert.assertEquals(Collections.emptyList(), initialWorkspaceTwoEntities); @@ -556,8 +556,8 @@ public void runUpdateUserWorkspaceWithRebaseNoConflictTestForPatchReleaseVersion "name", "entity", "math-113", "abstract-algebra", "math-185", "complex-analysis"); - gitLabEntityApi.getWorkspaceEntityModificationContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceTwoId, patchReleaseVersionId)).createEntity(entityPath, classifierPath, entityContentMap, "initial entity"); - List modifiedWorkspaceEntities = gitLabEntityApi.getWorkspaceEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceTwoId, patchReleaseVersionId)).getEntities(null, null, null); + gitLabEntityApi.getWorkspaceEntityModificationContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceTwoId, patchReleaseVersionId)).createEntity(entityPath, classifierPath, entityContentMap, "initial entity"); + List modifiedWorkspaceEntities = gitLabEntityApi.getWorkspaceEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceTwoId, patchReleaseVersionId)).getEntities(null, null, null); Assert.assertNotNull(modifiedWorkspaceEntities); Assert.assertEquals(1, modifiedWorkspaceEntities.size()); @@ -567,7 +567,7 @@ public void runUpdateUserWorkspaceWithRebaseNoConflictTestForPatchReleaseVersion Assert.assertEquals(initalEntity.getContent(), entityContentMap); List labels = Collections.singletonList("default"); - Review testReview = gitLabCommitterReviewApi.createReview(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceTwoId, patchReleaseVersionId), "Add Courses.", "add two math courses", labels); + Review testReview = gitLabCommitterReviewApi.createReview(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceTwoId, patchReleaseVersionId), "Add Courses.", "add two math courses", labels); String reviewId = testReview.getId(); Review approvedReview = gitLabApproverReviewApi.approveReview(projectId, patchReleaseVersionId, reviewId); @@ -634,8 +634,8 @@ public void runUpdateUserWorkspaceWithRebaseNoConflictTestForPatchReleaseVersion "name", "entity", "math-113", "abstract-algebra", "math-185", "complex-analysis"); - gitLabEntityApi.getWorkspaceEntityModificationContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, patchReleaseVersionId)).createEntity(entityPath, classifierPath, currentEntityContentMap, "initial entity"); - List modifiedWorkspaceEntitiesNew = gitLabEntityApi.getWorkspaceEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, patchReleaseVersionId)).getEntities(null, null, null); + gitLabEntityApi.getWorkspaceEntityModificationContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, patchReleaseVersionId)).createEntity(entityPath, classifierPath, currentEntityContentMap, "initial entity"); + List modifiedWorkspaceEntitiesNew = gitLabEntityApi.getWorkspaceEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, patchReleaseVersionId)).getEntities(null, null, null); Assert.assertNotNull(modifiedWorkspaceEntitiesNew); Assert.assertEquals(1, modifiedWorkspaceEntities.size()); @@ -645,8 +645,8 @@ public void runUpdateUserWorkspaceWithRebaseNoConflictTestForPatchReleaseVersion Assert.assertEquals(initalEntityNew.getContent(), currentEntityContentMap); // Update workspace branch and trigger rebase - gitLabWorkspaceApi.updateWorkspace(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, patchReleaseVersionId)); - List updatedWorkspaceEntities = gitLabEntityApi.getWorkspaceEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(workspaceId, patchReleaseVersionId)).getEntities(null, null, null); + gitLabWorkspaceApi.updateWorkspace(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, patchReleaseVersionId)); + List updatedWorkspaceEntities = gitLabEntityApi.getWorkspaceEntityAccessContext(projectId, SourceSpecification.newUserWorkspaceSourceSpecification(projectId, workspaceId, patchReleaseVersionId)).getEntities(null, null, null); Assert.assertNotNull(updatedWorkspaceEntities); Assert.assertEquals(1, updatedWorkspaceEntities.size()); @@ -673,10 +673,10 @@ public void runUpdateGroupWorkspaceWithRebaseNoConflictTestForPatchReleaseVersio Patch patch = gitlabPatchApi.newPatch(projectId, version.getId()); VersionId patchReleaseVersionId = patch.getPatchReleaseVersionId(); - Workspace createdWorkspace = gitLabWorkspaceApi.newWorkspace(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceName, patchReleaseVersionId)); + Workspace createdWorkspace = gitLabWorkspaceApi.newWorkspace(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceName, patchReleaseVersionId)); String workspaceId = createdWorkspace.getWorkspaceId(); - List initialWorkspaceEntities = gitLabEntityApi.getWorkspaceEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, patchReleaseVersionId)).getEntities(null, null, null); + List initialWorkspaceEntities = gitLabEntityApi.getWorkspaceEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, patchReleaseVersionId)).getEntities(null, null, null); List initialProjectEntities = gitLabEntityApi.getProjectEntityAccessContext(projectId, patchReleaseVersionId).getEntities(null, null, null); Assert.assertEquals(Collections.emptyList(), initialWorkspaceEntities); @@ -684,9 +684,9 @@ public void runUpdateGroupWorkspaceWithRebaseNoConflictTestForPatchReleaseVersio // Create another workspace, commit, review, merge to move project HEAD forward -- use workspace two String workspaceTwoName = "workspacetwo"; - Workspace createdWorkspaceTwo = gitLabWorkspaceApi.newWorkspace(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceTwoName, patchReleaseVersionId)); + Workspace createdWorkspaceTwo = gitLabWorkspaceApi.newWorkspace(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceTwoName, patchReleaseVersionId)); String workspaceTwoId = createdWorkspaceTwo.getWorkspaceId(); - List initialWorkspaceTwoEntities = gitLabEntityApi.getWorkspaceEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceTwoId, patchReleaseVersionId)).getEntities(null, null, null); + List initialWorkspaceTwoEntities = gitLabEntityApi.getWorkspaceEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceTwoId, patchReleaseVersionId)).getEntities(null, null, null); Assert.assertEquals(Collections.emptyList(), initialWorkspaceTwoEntities); @@ -697,8 +697,8 @@ public void runUpdateGroupWorkspaceWithRebaseNoConflictTestForPatchReleaseVersio "name", "entity", "math-113", "abstract-algebra", "math-185", "complex-analysis"); - gitLabEntityApi.getWorkspaceEntityModificationContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceTwoId, patchReleaseVersionId)).createEntity(entityPath, classifierPath, entityContentMap, "initial entity"); - List modifiedWorkspaceEntities = gitLabEntityApi.getWorkspaceEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceTwoId, patchReleaseVersionId)).getEntities(null, null, null); + gitLabEntityApi.getWorkspaceEntityModificationContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceTwoId, patchReleaseVersionId)).createEntity(entityPath, classifierPath, entityContentMap, "initial entity"); + List modifiedWorkspaceEntities = gitLabEntityApi.getWorkspaceEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceTwoId, patchReleaseVersionId)).getEntities(null, null, null); Assert.assertNotNull(modifiedWorkspaceEntities); Assert.assertEquals(1, modifiedWorkspaceEntities.size()); @@ -708,7 +708,7 @@ public void runUpdateGroupWorkspaceWithRebaseNoConflictTestForPatchReleaseVersio Assert.assertEquals(initalEntity.getContent(), entityContentMap); List labels = Collections.singletonList("default"); - Review testReview = gitLabCommitterReviewApi.createReview(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceTwoId, patchReleaseVersionId), "Add Courses.", "add two math courses", labels); + Review testReview = gitLabCommitterReviewApi.createReview(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceTwoId, patchReleaseVersionId), "Add Courses.", "add two math courses", labels); String reviewId = testReview.getId(); Review approvedReview = gitLabApproverReviewApi.approveReview(projectId, patchReleaseVersionId, reviewId); @@ -775,8 +775,8 @@ public void runUpdateGroupWorkspaceWithRebaseNoConflictTestForPatchReleaseVersio "name", "entity", "math-113", "abstract-algebra", "math-185", "complex-analysis"); - gitLabEntityApi.getWorkspaceEntityModificationContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, patchReleaseVersionId)).createEntity(entityPath, classifierPath, currentEntityContentMap, "initial entity"); - List modifiedWorkspaceEntitiesNew = gitLabEntityApi.getWorkspaceEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, patchReleaseVersionId)).getEntities(null, null, null); + gitLabEntityApi.getWorkspaceEntityModificationContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, patchReleaseVersionId)).createEntity(entityPath, classifierPath, currentEntityContentMap, "initial entity"); + List modifiedWorkspaceEntitiesNew = gitLabEntityApi.getWorkspaceEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, patchReleaseVersionId)).getEntities(null, null, null); Assert.assertNotNull(modifiedWorkspaceEntitiesNew); Assert.assertEquals(1, modifiedWorkspaceEntities.size()); @@ -786,8 +786,8 @@ public void runUpdateGroupWorkspaceWithRebaseNoConflictTestForPatchReleaseVersio Assert.assertEquals(initalEntityNew.getContent(), currentEntityContentMap); // Update workspace branch and trigger rebase - gitLabWorkspaceApi.updateWorkspace(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, patchReleaseVersionId)); - List updatedWorkspaceEntities = gitLabEntityApi.getWorkspaceEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(workspaceId, patchReleaseVersionId)).getEntities(null, null, null); + gitLabWorkspaceApi.updateWorkspace(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, patchReleaseVersionId)); + List updatedWorkspaceEntities = gitLabEntityApi.getWorkspaceEntityAccessContext(projectId, SourceSpecification.newGroupWorkspaceSourceSpecification(projectId, workspaceId, patchReleaseVersionId)).getEntities(null, null, null); Assert.assertNotNull(updatedWorkspaceEntities); Assert.assertEquals(1, updatedWorkspaceEntities.size()); diff --git a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/gitlab/api/TestBaseGitLabApi.java b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/gitlab/api/TestBaseGitLabApi.java index c0afd3e5bf..0119db9100 100644 --- a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/gitlab/api/TestBaseGitLabApi.java +++ b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/gitlab/api/TestBaseGitLabApi.java @@ -14,8 +14,8 @@ package org.finos.legend.sdlc.server.gitlab.api; +import org.finos.legend.sdlc.domain.model.project.DevelopmentStream; import org.finos.legend.sdlc.domain.model.project.workspace.WorkspaceType; -import org.finos.legend.sdlc.server.domain.api.workspace.WorkspaceSource; import org.finos.legend.sdlc.server.domain.api.workspace.WorkspaceSpecification; import org.finos.legend.sdlc.server.project.ProjectFileAccessProvider; import org.junit.Assert; @@ -131,6 +131,7 @@ public void testIsVersionTagName() @Test public void testGetWorkspaceBranchName() { + String projectId = "testProject"; Supplier userNameSupplier = () -> "userName"; Assert.assertEquals( "workspace/userName/wid1", @@ -154,99 +155,100 @@ public void testGetWorkspaceBranchName() Assert.assertEquals( "patch/3.5.7/workspace/userName/wid1", - BaseGitLabApi.getWorkspaceBranchName(WorkspaceSpecification.newWorkspaceSpecification("wid1", WorkspaceType.USER, WorkspaceSource.patchWorkspaceSource("3.5.7")), userNameSupplier)); + BaseGitLabApi.getWorkspaceBranchName(WorkspaceSpecification.newWorkspaceSpecification("wid1", WorkspaceType.USER, DevelopmentStream.patch(projectId, "3.5.7")), userNameSupplier)); Assert.assertEquals( "patch/0.0.1/backup/userName/wid2", - BaseGitLabApi.getWorkspaceBranchName(WorkspaceSpecification.newWorkspaceSpecification("wid2", WorkspaceType.USER, ProjectFileAccessProvider.WorkspaceAccessType.BACKUP, WorkspaceSource.patchWorkspaceSource("0.0.1")), userNameSupplier)); + BaseGitLabApi.getWorkspaceBranchName(WorkspaceSpecification.newWorkspaceSpecification("wid2", WorkspaceType.USER, ProjectFileAccessProvider.WorkspaceAccessType.BACKUP, DevelopmentStream.patch(projectId, "0.0.1")), userNameSupplier)); Assert.assertEquals( "patch/10.5.1/resolution/userName/wid3", - BaseGitLabApi.getWorkspaceBranchName(WorkspaceSpecification.newWorkspaceSpecification("wid3", WorkspaceType.USER, ProjectFileAccessProvider.WorkspaceAccessType.CONFLICT_RESOLUTION, WorkspaceSource.patchWorkspaceSource("10.5.1")), userNameSupplier)); + BaseGitLabApi.getWorkspaceBranchName(WorkspaceSpecification.newWorkspaceSpecification("wid3", WorkspaceType.USER, ProjectFileAccessProvider.WorkspaceAccessType.CONFLICT_RESOLUTION, DevelopmentStream.patch(projectId, "10.5.1")), userNameSupplier)); Assert.assertEquals( "patch/2.4.6/group/wid1", - BaseGitLabApi.getWorkspaceBranchName(WorkspaceSpecification.newWorkspaceSpecification("wid1", WorkspaceType.GROUP, WorkspaceSource.patchWorkspaceSource("2.4.6")), userNameSupplier)); + BaseGitLabApi.getWorkspaceBranchName(WorkspaceSpecification.newWorkspaceSpecification("wid1", WorkspaceType.GROUP, DevelopmentStream.patch(projectId, "2.4.6")), userNameSupplier)); Assert.assertEquals( "patch/1.0.0/group-backup/wid2", - BaseGitLabApi.getWorkspaceBranchName(WorkspaceSpecification.newWorkspaceSpecification("wid2", WorkspaceType.GROUP, ProjectFileAccessProvider.WorkspaceAccessType.BACKUP, WorkspaceSource.patchWorkspaceSource("1.0.0")), userNameSupplier)); + BaseGitLabApi.getWorkspaceBranchName(WorkspaceSpecification.newWorkspaceSpecification("wid2", WorkspaceType.GROUP, ProjectFileAccessProvider.WorkspaceAccessType.BACKUP, DevelopmentStream.patch(projectId, "1.0.0")), userNameSupplier)); Assert.assertEquals( "patch/99.102.3/group-resolution/wid3", - BaseGitLabApi.getWorkspaceBranchName(WorkspaceSpecification.newWorkspaceSpecification("wid3", WorkspaceType.GROUP, ProjectFileAccessProvider.WorkspaceAccessType.CONFLICT_RESOLUTION, WorkspaceSource.patchWorkspaceSource("99.102.3")), userNameSupplier)); + BaseGitLabApi.getWorkspaceBranchName(WorkspaceSpecification.newWorkspaceSpecification("wid3", WorkspaceType.GROUP, ProjectFileAccessProvider.WorkspaceAccessType.CONFLICT_RESOLUTION, DevelopmentStream.patch(projectId, "99.102.3")), userNameSupplier)); } @Test public void testParseWorkspaceBranchName() { - Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName(null)); - Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName("")); - Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName("main")); - Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName("master")); - Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName("other_branch_name")); + String projectId = "testProject"; + Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName(projectId, null)); + Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName(projectId, "")); + Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName(projectId, "main")); + Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName(projectId, "master")); + Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName(projectId, "other_branch_name")); - Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName("wirkspace/uid/wid")); - Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName("workspice/uid/wid")); - Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName("workspace")); - Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName("workspace/")); - Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName("workspace/wid")); - Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName("workspace/uid/wid/other")); - Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName("workspace//")); - Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName("workspace/workspace/uid/wid")); - Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName("workspace_uid_wid")); + Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName(projectId, "wirkspace/uid/wid")); + Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName(projectId, "workspice/uid/wid")); + Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName(projectId, "workspace")); + Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName(projectId, "workspace/")); + Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName(projectId, "workspace/wid")); + Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName(projectId, "workspace/uid/wid/other")); + Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName(projectId, "workspace//")); + Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName(projectId, "workspace/workspace/uid/wid")); + Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName(projectId, "workspace_uid_wid")); - Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName("grp/wid")); - Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName("group")); - Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName("group/")); - Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName("group/wid/other")); + Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName(projectId, "grp/wid")); + Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName(projectId, "group")); + Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName(projectId, "group/")); + Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName(projectId, "group/wid/other")); - Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName("patch/not.a.version/workspace/uid/wid")); - Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName("patch/12345678901.0.0/workspace/uid/wid")); - Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName("patch/1/workspace/uid/wid")); - Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName("patch/1.2/group/wid")); - Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName("patch/1.2.3/patch/1.2.3/group/wid")); - Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName("patch/1.2.3.4/workspace/uid/wid")); - Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName("patch/1.2.3.4.5/groupd/wid")); - Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName("patch/1_2_3/workspace/uid/wid")); - Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName("pitch/1.2.3/workspace/uid/wid")); - Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName("patch/1.2.3/workspice/uid/wid")); - Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName("patch//workspace/uid/wid")); + Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName(projectId, "patch/not.a.version/workspace/uid/wid")); + Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName(projectId, "patch/12345678901.0.0/workspace/uid/wid")); + Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName(projectId, "patch/1/workspace/uid/wid")); + Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName(projectId, "patch/1.2/group/wid")); + Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName(projectId, "patch/1.2.3/patch/1.2.3/group/wid")); + Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName(projectId, "patch/1.2.3.4/workspace/uid/wid")); + Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName(projectId, "patch/1.2.3.4.5/groupd/wid")); + Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName(projectId, "patch/1_2_3/workspace/uid/wid")); + Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName(projectId, "pitch/1.2.3/workspace/uid/wid")); + Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName(projectId, "patch/1.2.3/workspice/uid/wid")); + Assert.assertNull(BaseGitLabApi.parseWorkspaceBranchName(projectId, "patch//workspace/uid/wid")); Assert.assertEquals( - WorkspaceSpecification.newWorkspaceSpecification("wid1", WorkspaceType.USER, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, WorkspaceSource.projectWorkspaceSource(), "uid1"), - BaseGitLabApi.parseWorkspaceBranchName("workspace/uid1/wid1")); + WorkspaceSpecification.newWorkspaceSpecification("wid1", WorkspaceType.USER, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, DevelopmentStream.projectDevelopmentStream(), "uid1"), + BaseGitLabApi.parseWorkspaceBranchName(projectId, "workspace/uid1/wid1")); Assert.assertEquals( - WorkspaceSpecification.newWorkspaceSpecification("wid2", WorkspaceType.USER, ProjectFileAccessProvider.WorkspaceAccessType.BACKUP, WorkspaceSource.projectWorkspaceSource(), "uid2"), - BaseGitLabApi.parseWorkspaceBranchName("backup/uid2/wid2")); + WorkspaceSpecification.newWorkspaceSpecification("wid2", WorkspaceType.USER, ProjectFileAccessProvider.WorkspaceAccessType.BACKUP, DevelopmentStream.projectDevelopmentStream(), "uid2"), + BaseGitLabApi.parseWorkspaceBranchName(projectId, "backup/uid2/wid2")); Assert.assertEquals( - WorkspaceSpecification.newWorkspaceSpecification("wid3", WorkspaceType.USER, ProjectFileAccessProvider.WorkspaceAccessType.CONFLICT_RESOLUTION, WorkspaceSource.projectWorkspaceSource(), "uid3"), - BaseGitLabApi.parseWorkspaceBranchName("resolution/uid3/wid3")); + WorkspaceSpecification.newWorkspaceSpecification("wid3", WorkspaceType.USER, ProjectFileAccessProvider.WorkspaceAccessType.CONFLICT_RESOLUTION, DevelopmentStream.projectDevelopmentStream(), "uid3"), + BaseGitLabApi.parseWorkspaceBranchName(projectId, "resolution/uid3/wid3")); Assert.assertEquals( - WorkspaceSpecification.newWorkspaceSpecification("wid1", WorkspaceType.GROUP, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, WorkspaceSource.projectWorkspaceSource()), - BaseGitLabApi.parseWorkspaceBranchName("group/wid1")); + WorkspaceSpecification.newWorkspaceSpecification("wid1", WorkspaceType.GROUP, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, DevelopmentStream.projectDevelopmentStream()), + BaseGitLabApi.parseWorkspaceBranchName(projectId, "group/wid1")); Assert.assertEquals( - WorkspaceSpecification.newWorkspaceSpecification("wid2", WorkspaceType.GROUP, ProjectFileAccessProvider.WorkspaceAccessType.BACKUP, WorkspaceSource.projectWorkspaceSource()), - BaseGitLabApi.parseWorkspaceBranchName("group-backup/wid2")); + WorkspaceSpecification.newWorkspaceSpecification("wid2", WorkspaceType.GROUP, ProjectFileAccessProvider.WorkspaceAccessType.BACKUP, DevelopmentStream.projectDevelopmentStream()), + BaseGitLabApi.parseWorkspaceBranchName(projectId, "group-backup/wid2")); Assert.assertEquals( - WorkspaceSpecification.newWorkspaceSpecification("wid3", WorkspaceType.GROUP, ProjectFileAccessProvider.WorkspaceAccessType.CONFLICT_RESOLUTION, WorkspaceSource.projectWorkspaceSource()), - BaseGitLabApi.parseWorkspaceBranchName("group-resolution/wid3")); + WorkspaceSpecification.newWorkspaceSpecification("wid3", WorkspaceType.GROUP, ProjectFileAccessProvider.WorkspaceAccessType.CONFLICT_RESOLUTION, DevelopmentStream.projectDevelopmentStream()), + BaseGitLabApi.parseWorkspaceBranchName(projectId, "group-resolution/wid3")); Assert.assertEquals( - WorkspaceSpecification.newWorkspaceSpecification("wid1", WorkspaceType.USER, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, WorkspaceSource.patchWorkspaceSource("1.2.3"), "uid1"), - BaseGitLabApi.parseWorkspaceBranchName("patch/1.2.3/workspace/uid1/wid1")); + WorkspaceSpecification.newWorkspaceSpecification("wid1", WorkspaceType.USER, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, DevelopmentStream.patch(projectId, "1.2.3"), "uid1"), + BaseGitLabApi.parseWorkspaceBranchName(projectId, "patch/1.2.3/workspace/uid1/wid1")); Assert.assertEquals( - WorkspaceSpecification.newWorkspaceSpecification("wid2", WorkspaceType.USER, ProjectFileAccessProvider.WorkspaceAccessType.BACKUP, WorkspaceSource.patchWorkspaceSource("4.5.6"), "uid2"), - BaseGitLabApi.parseWorkspaceBranchName("patch/4.5.6/backup/uid2/wid2")); + WorkspaceSpecification.newWorkspaceSpecification("wid2", WorkspaceType.USER, ProjectFileAccessProvider.WorkspaceAccessType.BACKUP, DevelopmentStream.patch(projectId, "4.5.6"), "uid2"), + BaseGitLabApi.parseWorkspaceBranchName(projectId, "patch/4.5.6/backup/uid2/wid2")); Assert.assertEquals( - WorkspaceSpecification.newWorkspaceSpecification("wid3", WorkspaceType.USER, ProjectFileAccessProvider.WorkspaceAccessType.CONFLICT_RESOLUTION, WorkspaceSource.patchWorkspaceSource("41.25.63"), "uid3"), - BaseGitLabApi.parseWorkspaceBranchName("patch/41.25.63/resolution/uid3/wid3")); + WorkspaceSpecification.newWorkspaceSpecification("wid3", WorkspaceType.USER, ProjectFileAccessProvider.WorkspaceAccessType.CONFLICT_RESOLUTION, DevelopmentStream.patch(projectId, "41.25.63"), "uid3"), + BaseGitLabApi.parseWorkspaceBranchName(projectId, "patch/41.25.63/resolution/uid3/wid3")); Assert.assertEquals( - WorkspaceSpecification.newWorkspaceSpecification("wid1", WorkspaceType.GROUP, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, WorkspaceSource.patchWorkspaceSource("3.2.1")), - BaseGitLabApi.parseWorkspaceBranchName("patch/3.2.1/group/wid1")); + WorkspaceSpecification.newWorkspaceSpecification("wid1", WorkspaceType.GROUP, ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE, DevelopmentStream.patch(projectId, "3.2.1")), + BaseGitLabApi.parseWorkspaceBranchName(projectId, "patch/3.2.1/group/wid1")); Assert.assertEquals( - WorkspaceSpecification.newWorkspaceSpecification("wid2", WorkspaceType.GROUP, ProjectFileAccessProvider.WorkspaceAccessType.BACKUP, WorkspaceSource.patchWorkspaceSource("0.0.2")), - BaseGitLabApi.parseWorkspaceBranchName("patch/0.0.2/group-backup/wid2")); + WorkspaceSpecification.newWorkspaceSpecification("wid2", WorkspaceType.GROUP, ProjectFileAccessProvider.WorkspaceAccessType.BACKUP, DevelopmentStream.patch(projectId, "0.0.2")), + BaseGitLabApi.parseWorkspaceBranchName(projectId, "patch/0.0.2/group-backup/wid2")); Assert.assertEquals( - WorkspaceSpecification.newWorkspaceSpecification("wid3", WorkspaceType.GROUP, ProjectFileAccessProvider.WorkspaceAccessType.CONFLICT_RESOLUTION, WorkspaceSource.patchWorkspaceSource("9.9.9")), - BaseGitLabApi.parseWorkspaceBranchName("patch/9.9.9/group-resolution/wid3")); + WorkspaceSpecification.newWorkspaceSpecification("wid3", WorkspaceType.GROUP, ProjectFileAccessProvider.WorkspaceAccessType.CONFLICT_RESOLUTION, DevelopmentStream.patch(projectId, "9.9.9")), + BaseGitLabApi.parseWorkspaceBranchName(projectId, "patch/9.9.9/group-resolution/wid3")); } } diff --git a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/gitlab/api/docker/IntegrationTestGitLabPatchApis.java b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/gitlab/api/docker/IntegrationTestGitLabPatchApis.java index 4e6be811cd..e7badd785c 100644 --- a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/gitlab/api/docker/IntegrationTestGitLabPatchApis.java +++ b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/gitlab/api/docker/IntegrationTestGitLabPatchApis.java @@ -43,6 +43,12 @@ public void testCreatePatch() throws LegendSDLCServerException gitLabPatchApiTestResource.runCreatePatchTest(); } + @Test + public void testGetPatch() throws LegendSDLCServerException + { + gitLabPatchApiTestResource.runGetPatchTest(); + } + @Test public void testGetPatches() throws LegendSDLCServerException { diff --git a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/gitlab/api/server/TestGitLabServerPatchApis.java b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/gitlab/api/server/TestGitLabServerPatchApis.java index 4cf5ee9b57..5f09dc1c8f 100644 --- a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/gitlab/api/server/TestGitLabServerPatchApis.java +++ b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/gitlab/api/server/TestGitLabServerPatchApis.java @@ -54,6 +54,12 @@ public void testCreatePatch() throws LegendSDLCServerException gitLabPatchApiTestResource.runCreatePatchTest(); } + @Test + public void testGetPatch() throws LegendSDLCServerException + { + gitLabPatchApiTestResource.runGetPatchTest(); + } + @Test public void testGetPatches() throws LegendSDLCServerException { diff --git a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/backend/api/InMemoryComparisonApi.java b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/backend/api/InMemoryComparisonApi.java index e5a21a5e0f..604eb594ae 100644 --- a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/backend/api/InMemoryComparisonApi.java +++ b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/backend/api/InMemoryComparisonApi.java @@ -34,7 +34,7 @@ public Comparison getWorkspaceCreationComparison(String projectId, WorkspaceSpec } @Override - public Comparison getWorkspaceSourceComparison(String projectId, WorkspaceSpecification workspaceSpecification) + public Comparison getDevelopmentStreamComparison(String projectId, WorkspaceSpecification workspaceSpecification) { throw new UnsupportedOperationException("Not implemented"); } diff --git a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/backend/api/InMemoryEntityApi.java b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/backend/api/InMemoryEntityApi.java index ca2880c307..d786d8ca65 100644 --- a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/backend/api/InMemoryEntityApi.java +++ b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/backend/api/InMemoryEntityApi.java @@ -19,6 +19,9 @@ import org.eclipse.collections.impl.utility.ListIterate; import org.finos.legend.sdlc.domain.model.entity.Entity; import org.finos.legend.sdlc.domain.model.entity.change.EntityChange; +import org.finos.legend.sdlc.domain.model.patch.Patch; +import org.finos.legend.sdlc.domain.model.project.DevelopmentStreamVisitor; +import org.finos.legend.sdlc.domain.model.project.ProjectDevelopmentStream; import org.finos.legend.sdlc.domain.model.project.workspace.WorkspaceType; import org.finos.legend.sdlc.domain.model.revision.Revision; import org.finos.legend.sdlc.domain.model.version.VersionId; @@ -31,9 +34,6 @@ import org.finos.legend.sdlc.server.domain.api.project.source.SourceSpecificationVisitor; import org.finos.legend.sdlc.server.domain.api.project.source.VersionSourceSpecification; import org.finos.legend.sdlc.server.domain.api.project.source.WorkspaceSourceSpecification; -import org.finos.legend.sdlc.server.domain.api.workspace.PatchWorkspaceSource; -import org.finos.legend.sdlc.server.domain.api.workspace.ProjectWorkspaceSource; -import org.finos.legend.sdlc.server.domain.api.workspace.WorkspaceSourceVisitor; import org.finos.legend.sdlc.server.domain.api.workspace.WorkspaceSpecification; import org.finos.legend.sdlc.server.inmemory.backend.InMemoryBackend; import org.finos.legend.sdlc.server.inmemory.domain.api.InMemoryPatch; @@ -96,18 +96,18 @@ public InMemoryRevision visit(WorkspaceSourceSpecification sourceSpec) { throw new UnsupportedOperationException("Not implemented"); } - VersionId patchVersionId = workspaceSpec.getSource().visit(new WorkspaceSourceVisitor() + VersionId patchVersionId = workspaceSpec.getSource().visit(new DevelopmentStreamVisitor() { @Override - public VersionId visit(ProjectWorkspaceSource source) + public VersionId visit(ProjectDevelopmentStream source) { return null; } @Override - public VersionId visit(PatchWorkspaceSource source) + public VersionId visit(Patch source) { - return source.getPatchVersionId(); + return source.getPatchReleaseVersionId(); } }); InMemoryWorkspace workspace = (workspaceSpec.getType() == WorkspaceType.GROUP) ? @@ -140,18 +140,18 @@ public EntityModificationContext getEntityModificationContext(String projectId, throw new UnsupportedOperationException("Not implemented"); } InMemoryProject project = this.backend.getProject(projectId); - VersionId patchVersionId = workspaceSpec.getSource().visit(new WorkspaceSourceVisitor() + VersionId patchVersionId = workspaceSpec.getSource().visit(new DevelopmentStreamVisitor() { @Override - public VersionId visit(ProjectWorkspaceSource source) + public VersionId visit(ProjectDevelopmentStream source) { return null; } @Override - public VersionId visit(PatchWorkspaceSource source) + public VersionId visit(Patch source) { - return source.getPatchVersionId(); + return source.getPatchReleaseVersionId(); } }); InMemoryWorkspace workspace = (workspaceSpec.getType() == WorkspaceType.GROUP) ? diff --git a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/backend/api/InMemoryPatchApi.java b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/backend/api/InMemoryPatchApi.java index 95c752667d..a1d3f67bb1 100644 --- a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/backend/api/InMemoryPatchApi.java +++ b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/backend/api/InMemoryPatchApi.java @@ -49,6 +49,13 @@ public List getPatches(String projectId, Integer minMajorVersion, Integer return Lists.mutable.withAll(project.getPatches()); } + @Override + public Patch getPatch(String projectId, VersionId patchReleaseVersionId) + { + InMemoryProject project = backend.getProject(projectId); + return Lists.mutable.withAll(project.getPatches()).stream().filter(p -> p.getPatchReleaseVersionId().equals(patchReleaseVersionId)).findFirst().get(); + } + @Override public void deletePatch(String projectId, VersionId patchReleaseVersionId) { diff --git a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/backend/api/InMemoryProjectConfigurationApi.java b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/backend/api/InMemoryProjectConfigurationApi.java index cf9e4331b7..36f0be2fbd 100644 --- a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/backend/api/InMemoryProjectConfigurationApi.java +++ b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/backend/api/InMemoryProjectConfigurationApi.java @@ -14,6 +14,9 @@ package org.finos.legend.sdlc.server.inmemory.backend.api; +import org.finos.legend.sdlc.domain.model.patch.Patch; +import org.finos.legend.sdlc.domain.model.project.DevelopmentStreamVisitor; +import org.finos.legend.sdlc.domain.model.project.ProjectDevelopmentStream; import org.finos.legend.sdlc.domain.model.project.configuration.ArtifactTypeGenerationConfiguration; import org.finos.legend.sdlc.domain.model.project.configuration.ProjectConfiguration; import org.finos.legend.sdlc.domain.model.project.configuration.ProjectStructureVersion; @@ -28,9 +31,6 @@ import org.finos.legend.sdlc.server.domain.api.project.source.SourceSpecificationVisitor; import org.finos.legend.sdlc.server.domain.api.project.source.VersionSourceSpecification; import org.finos.legend.sdlc.server.domain.api.project.source.WorkspaceSourceSpecification; -import org.finos.legend.sdlc.server.domain.api.workspace.PatchWorkspaceSource; -import org.finos.legend.sdlc.server.domain.api.workspace.ProjectWorkspaceSource; -import org.finos.legend.sdlc.server.domain.api.workspace.WorkspaceSourceVisitor; import org.finos.legend.sdlc.server.domain.api.workspace.WorkspaceSpecification; import org.finos.legend.sdlc.server.inmemory.backend.InMemoryBackend; import org.finos.legend.sdlc.server.inmemory.domain.api.InMemoryPatch; @@ -86,18 +86,18 @@ public ProjectConfiguration visit(WorkspaceSourceSpecification sourceSpec) { throw new UnsupportedOperationException("Not implemented"); } - VersionId patchVersionId = workspaceSpec.getSource().visit(new WorkspaceSourceVisitor() + VersionId patchVersionId = workspaceSpec.getSource().visit(new DevelopmentStreamVisitor() { @Override - public VersionId visit(ProjectWorkspaceSource source) + public VersionId visit(ProjectDevelopmentStream source) { return null; } @Override - public VersionId visit(PatchWorkspaceSource source) + public VersionId visit(Patch source) { - return source.getPatchVersionId(); + return source.getPatchReleaseVersionId(); } }); InMemoryWorkspace workspace = (workspaceSpec.getType() == WorkspaceType.GROUP) ? diff --git a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/backend/api/InMemoryReviewApi.java b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/backend/api/InMemoryReviewApi.java index ad743c5acd..8274868557 100644 --- a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/backend/api/InMemoryReviewApi.java +++ b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/backend/api/InMemoryReviewApi.java @@ -15,7 +15,7 @@ package org.finos.legend.sdlc.server.inmemory.backend.api; import org.eclipse.collections.api.factory.Lists; -import org.finos.legend.sdlc.domain.model.project.workspace.WorkspaceType; +import org.finos.legend.sdlc.domain.model.project.DevelopmentStream; import org.finos.legend.sdlc.domain.model.review.Approval; import org.finos.legend.sdlc.domain.model.review.Review; import org.finos.legend.sdlc.domain.model.review.ReviewState; @@ -26,6 +26,7 @@ import java.time.Instant; import java.util.List; +import java.util.Set; import java.util.function.BiPredicate; import javax.inject.Inject; @@ -49,14 +50,14 @@ public Review getReview(String projectId, String reviewId) } @Override - public List getReviews(String projectId, ReviewState state, Iterable revisionIds, BiPredicate workspaceIdAndTypePredicate, Instant since, Instant until, Integer limit) + public List getReviews(String projectId, Set workspaceSources, ReviewState state, Iterable revisionIds, Instant since, Instant until, Integer limit) { InMemoryProject inMemoryProject = this.backend.getProject(projectId); return Lists.mutable.withAll(inMemoryProject.getReviews(state, revisionIds, since, until, limit)); } @Override - public List getReviews(boolean assignedToMe, boolean authoredByMe, List labels, BiPredicate workspaceIdAndTypePredicate, ReviewState state, Instant since, Instant until, Integer limit) + public List getReviews(boolean assignedToMe, boolean authoredByMe, Set workspaceSources, List labels, ReviewState state, Instant since, Instant until, Integer limit) { throw new UnsupportedOperationException("Not implemented"); } diff --git a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/backend/api/InMemoryRevisionApi.java b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/backend/api/InMemoryRevisionApi.java index d581e7883c..346d20ade9 100644 --- a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/backend/api/InMemoryRevisionApi.java +++ b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/backend/api/InMemoryRevisionApi.java @@ -15,6 +15,9 @@ package org.finos.legend.sdlc.server.inmemory.backend.api; import org.eclipse.collections.api.factory.Lists; +import org.finos.legend.sdlc.domain.model.patch.Patch; +import org.finos.legend.sdlc.domain.model.project.DevelopmentStreamVisitor; +import org.finos.legend.sdlc.domain.model.project.ProjectDevelopmentStream; import org.finos.legend.sdlc.domain.model.revision.Revision; import org.finos.legend.sdlc.domain.model.revision.RevisionStatus; import org.finos.legend.sdlc.server.domain.api.project.source.PatchSourceSpecification; @@ -24,9 +27,6 @@ import org.finos.legend.sdlc.server.domain.api.project.source.WorkspaceSourceSpecification; import org.finos.legend.sdlc.server.domain.api.revision.RevisionAccessContext; import org.finos.legend.sdlc.server.domain.api.revision.RevisionApi; -import org.finos.legend.sdlc.server.domain.api.workspace.PatchWorkspaceSource; -import org.finos.legend.sdlc.server.domain.api.workspace.ProjectWorkspaceSource; -import org.finos.legend.sdlc.server.domain.api.workspace.WorkspaceSourceVisitor; import org.finos.legend.sdlc.server.domain.api.workspace.WorkspaceSpecification; import org.finos.legend.sdlc.server.inmemory.backend.InMemoryBackend; import org.finos.legend.sdlc.server.inmemory.domain.api.InMemoryPatch; @@ -162,35 +162,35 @@ private InMemoryWorkspace getWorkspace(InMemoryProject project, WorkspaceSpecifi { case USER: { - return workspaceSpec.getSource().visit(new WorkspaceSourceVisitor() + return workspaceSpec.getSource().visit(new DevelopmentStreamVisitor() { @Override - public InMemoryWorkspace visit(ProjectWorkspaceSource source) + public InMemoryWorkspace visit(ProjectDevelopmentStream source) { return project.getUserWorkspace(workspaceSpec.getId(), null); } @Override - public InMemoryWorkspace visit(PatchWorkspaceSource source) + public InMemoryWorkspace visit(Patch source) { - return project.getUserWorkspace(workspaceSpec.getId(), source.getPatchVersionId()); + return project.getUserWorkspace(workspaceSpec.getId(), source.getPatchReleaseVersionId()); } }); } case GROUP: { - return workspaceSpec.getSource().visit(new WorkspaceSourceVisitor() + return workspaceSpec.getSource().visit(new DevelopmentStreamVisitor() { @Override - public InMemoryWorkspace visit(ProjectWorkspaceSource source) + public InMemoryWorkspace visit(ProjectDevelopmentStream source) { return project.getGroupWorkspace(workspaceSpec.getId(), null); } @Override - public InMemoryWorkspace visit(PatchWorkspaceSource source) + public InMemoryWorkspace visit(Patch source) { - return project.getGroupWorkspace(workspaceSpec.getId(), source.getPatchVersionId()); + return project.getGroupWorkspace(workspaceSpec.getId(), source.getPatchReleaseVersionId()); } }); } diff --git a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/backend/api/InMemoryWorkspaceApi.java b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/backend/api/InMemoryWorkspaceApi.java index 19291277a6..4ac64ae212 100644 --- a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/backend/api/InMemoryWorkspaceApi.java +++ b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/backend/api/InMemoryWorkspaceApi.java @@ -16,14 +16,14 @@ import org.eclipse.collections.api.factory.Lists; import org.eclipse.collections.api.list.MutableList; +import org.finos.legend.sdlc.domain.model.patch.Patch; +import org.finos.legend.sdlc.domain.model.project.DevelopmentStream; +import org.finos.legend.sdlc.domain.model.project.DevelopmentStreamVisitor; +import org.finos.legend.sdlc.domain.model.project.ProjectDevelopmentStream; import org.finos.legend.sdlc.domain.model.project.workspace.Workspace; import org.finos.legend.sdlc.domain.model.project.workspace.WorkspaceType; import org.finos.legend.sdlc.domain.model.version.VersionId; -import org.finos.legend.sdlc.server.domain.api.workspace.PatchWorkspaceSource; -import org.finos.legend.sdlc.server.domain.api.workspace.ProjectWorkspaceSource; import org.finos.legend.sdlc.server.domain.api.workspace.WorkspaceApi; -import org.finos.legend.sdlc.server.domain.api.workspace.WorkspaceSource; -import org.finos.legend.sdlc.server.domain.api.workspace.WorkspaceSourceVisitor; import org.finos.legend.sdlc.server.domain.api.workspace.WorkspaceSpecification; import org.finos.legend.sdlc.server.inmemory.backend.InMemoryBackend; import org.finos.legend.sdlc.server.inmemory.domain.api.InMemoryProject; @@ -52,18 +52,18 @@ public Workspace getWorkspace(String projectId, WorkspaceSpecification workspace throw new UnsupportedOperationException("Not implemented"); } InMemoryProject inMemoryProject = this.backend.getProject(projectId); - VersionId patchVersion = workspaceSpec.getSource().visit(new WorkspaceSourceVisitor() + VersionId patchVersion = workspaceSpec.getSource().visit(new DevelopmentStreamVisitor() { @Override - public VersionId visit(ProjectWorkspaceSource source) + public VersionId visit(ProjectDevelopmentStream source) { return null; } @Override - public VersionId visit(PatchWorkspaceSource source) + public VersionId visit(Patch source) { - return source.getPatchVersionId(); + return source.getPatchReleaseVersionId(); } }); return (workspaceSpec.getType() == WorkspaceType.GROUP) ? @@ -72,7 +72,7 @@ public VersionId visit(PatchWorkspaceSource source) } @Override - public List getWorkspaces(String projectId, Set types, Set accessTypes, Set sources) + public List getWorkspaces(String projectId, Set types, Set accessTypes, Set sources) { if (sources == null) { @@ -87,20 +87,20 @@ public List getWorkspaces(String projectId, Set types, // currently only WORKSPACE access type is supported if (resolvedAccessTypes.contains(ProjectFileAccessProvider.WorkspaceAccessType.WORKSPACE)) { - for (WorkspaceSource source : sources) + for (DevelopmentStream source : sources) { - VersionId patchVersionId = source.visit(new WorkspaceSourceVisitor() + VersionId patchVersionId = source.visit(new DevelopmentStreamVisitor() { @Override - public VersionId visit(ProjectWorkspaceSource source) + public VersionId visit(ProjectDevelopmentStream source) { return null; } @Override - public VersionId visit(PatchWorkspaceSource source) + public VersionId visit(Patch source) { - return source.getPatchVersionId(); + return source.getPatchReleaseVersionId(); } }); if (resolvedTypes.contains(WorkspaceType.GROUP)) @@ -117,13 +117,13 @@ public VersionId visit(PatchWorkspaceSource source) } @Override - public List getAllWorkspaces(String projectId, Set types, Set accessTypes, Set sources) + public List getAllWorkspaces(String projectId, Set types, Set accessTypes, Set sources) { return getWorkspaces(projectId, types, accessTypes, sources); } @Override - public Workspace newWorkspace(String projectId, String workspaceId, WorkspaceType type, WorkspaceSource source) + public Workspace newWorkspace(String projectId, String workspaceId, WorkspaceType type, DevelopmentStream source) { throw new UnsupportedOperationException("Not implemented"); } @@ -132,18 +132,18 @@ public Workspace newWorkspace(String projectId, String workspaceId, WorkspaceTyp public void deleteWorkspace(String projectId, WorkspaceSpecification workspaceSpec) { InMemoryProject project = this.backend.getProject(projectId); - VersionId patchVersion = workspaceSpec.getSource().visit(new WorkspaceSourceVisitor() + VersionId patchVersion = workspaceSpec.getSource().visit(new DevelopmentStreamVisitor() { @Override - public VersionId visit(ProjectWorkspaceSource source) + public VersionId visit(ProjectDevelopmentStream source) { return null; } @Override - public VersionId visit(PatchWorkspaceSource source) + public VersionId visit(Patch source) { - return source.getPatchVersionId(); + return source.getPatchReleaseVersionId(); } }); if (workspaceSpec.getType() == WorkspaceType.GROUP) diff --git a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/domain/api/InMemoryPatch.java b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/domain/api/InMemoryPatch.java index ebfa10298e..cfee9f4185 100644 --- a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/domain/api/InMemoryPatch.java +++ b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/domain/api/InMemoryPatch.java @@ -19,46 +19,33 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import org.eclipse.collections.api.factory.Maps; import org.finos.legend.sdlc.domain.model.patch.Patch; +import org.finos.legend.sdlc.domain.model.project.DevelopmentStreamType; import org.finos.legend.sdlc.domain.model.version.VersionId; import javax.inject.Inject; import java.util.Map; @JsonIgnoreProperties(ignoreUnknown = true) -public class InMemoryPatch implements Patch +public class InMemoryPatch extends Patch { private final Map revisions = Maps.mutable.empty(); private String currentRevisionId; - private String projectId; - private VersionId patchReleaseVersionId; @Inject public InMemoryPatch() { + } public InMemoryPatch(String projectId, VersionId patchReleaseVersionId, InMemoryRevision baseRevision) { - this.projectId = projectId; - this.patchReleaseVersionId = patchReleaseVersionId; + super(projectId, patchReleaseVersionId); InMemoryRevision revision = new InMemoryRevision("", baseRevision); this.currentRevisionId = revision.getId(); this.revisions.put(revision.getId(), revision); } - @Override - public String getProjectId() - { - return this.projectId; - } - - @Override - public VersionId getPatchReleaseVersionId() - { - return this.patchReleaseVersionId; - } - @JsonIgnore public Iterable getRevisions() { diff --git a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/domain/api/InMemoryReview.java b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/domain/api/InMemoryReview.java index 0e22da9b68..53bd9088b2 100644 --- a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/domain/api/InMemoryReview.java +++ b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/domain/api/InMemoryReview.java @@ -19,6 +19,9 @@ import org.eclipse.collections.api.factory.Maps; import org.eclipse.collections.api.map.MutableMap; import org.finos.legend.sdlc.domain.model.entity.Entity; +import org.finos.legend.sdlc.domain.model.project.DevelopmentStream; +import org.finos.legend.sdlc.domain.model.project.DevelopmentStreamType; +import org.finos.legend.sdlc.domain.model.project.workspace.Workspace; import org.finos.legend.sdlc.domain.model.review.Review; import org.finos.legend.sdlc.domain.model.review.ReviewState; @@ -36,8 +39,7 @@ public class InMemoryReview implements Review private final MutableMap entities = Maps.mutable.empty(); private String projectId; private String reviewId; - private String workspaceId; - private String workspaceType; + private Workspace workspace; private String title; private String description; private List labels; @@ -53,8 +55,32 @@ public InMemoryReview(String projectId, String reviewId) { this.projectId = projectId; this.reviewId = reviewId; - this.workspaceId = "111"; - this.workspaceType = WorkspaceType.USER.toString(); + this.workspace = new Workspace() + { + @Override + public String getProjectId() + { + return projectId; + } + + @Override + public String getUserId() + { + return null; + } + + @Override + public String getWorkspaceId() + { + return "111"; + } + + @Override + public DevelopmentStream getSource() + { + return null; + } + }; this.title = "Title"; this.description = "Description"; @@ -68,9 +94,33 @@ public InMemoryReview(String projectId, String reviewId, String workspaceId, Wor { this.projectId = projectId; this.reviewId = reviewId; - this.workspaceId = workspaceId; - this.workspaceType = workspaceType.toString(); - this.title = title; + this.workspace = new Workspace() + { + @Override + public String getProjectId() + { + return projectId; + } + + @Override + public String getUserId() + { + return workspaceType == WorkspaceType.GROUP ? null : "testUser"; + } + + @Override + public String getWorkspaceId() + { + return workspaceId; + } + + @Override + public DevelopmentStream getSource() + { + return null; + } + }; + this.title = title; this.description = description; this.labels = labels; } @@ -144,7 +194,13 @@ public String getProjectId() @Override public String getWorkspaceId() { - return this.workspaceId; + return this.workspace.getWorkspaceId(); + } + + @Override + public Workspace getWorkspace() + { + return this.workspace; } @Override diff --git a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/domain/api/InMemoryWorkspace.java b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/domain/api/InMemoryWorkspace.java index debf1e91fe..fbe44be130 100644 --- a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/domain/api/InMemoryWorkspace.java +++ b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/inmemory/domain/api/InMemoryWorkspace.java @@ -17,6 +17,8 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import org.eclipse.collections.api.factory.Maps; +import org.finos.legend.sdlc.domain.model.project.DevelopmentStream; +import org.finos.legend.sdlc.domain.model.project.DevelopmentStreamType; import org.finos.legend.sdlc.domain.model.project.workspace.Workspace; import javax.inject.Inject; @@ -29,6 +31,8 @@ public class InMemoryWorkspace implements Workspace private String currentRevisionId; private String projectId; private String workspaceId; + private DevelopmentStreamType sourceType; + private DevelopmentStream source; @Inject public InMemoryWorkspace() @@ -68,6 +72,12 @@ public String getWorkspaceId() return this.workspaceId; } + @Override + public DevelopmentStream getSource() + { + return this.source; + } + @JsonIgnore public Iterable getRevisions() { diff --git a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/resources/TestDependenciesResource.java b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/resources/TestDependenciesResource.java index 55eb714c2e..2e1d13e0bc 100644 --- a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/resources/TestDependenciesResource.java +++ b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/resources/TestDependenciesResource.java @@ -148,7 +148,7 @@ public void testGetWorkspaceRevisionUpstreamDependenciesForPatchReleaseVersion() this.backend.project("B").addEntities("w1", Arrays.asList(TestTools.newClassEntity("b3", "B")), VersionId.parseVersionId("1.0.1")); - String workspace1CurrentRevision = this.backend.getRevisionApi().getWorkspaceRevisionContext("B", SourceSpecification.newUserWorkspaceSourceSpecification("w1", VersionId.parseVersionId("1.0.1"))).getCurrentRevision().getId(); + String workspace1CurrentRevision = this.backend.getRevisionApi().getWorkspaceRevisionContext("B", SourceSpecification.newUserWorkspaceSourceSpecification("B", "w1", VersionId.parseVersionId("1.0.1"))).getCurrentRevision().getId(); // B directly depends on A String url = String.format("/api/projects/B/patches/1.0.1/workspaces/w1/revisions/%s/upstreamProjects", workspace1CurrentRevision); diff --git a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/resources/TestPatchesResource.java b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/resources/TestPatchesResource.java index c849fed660..eba55b3da0 100644 --- a/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/resources/TestPatchesResource.java +++ b/legend-sdlc-server/src/test/java/org/finos/legend/sdlc/server/resources/TestPatchesResource.java @@ -27,6 +27,25 @@ public class TestPatchesResource extends AbstractLegendSDLCServerResourceTest { + @Test + public void testGetPatch() throws HttpResponseException + { + this.backend.project("A").addVersionedClasses("1.0.0", "a1", "a2"); + this.backend.project("A").addPatch(VersionId.parseVersionId("1.0.1")); + + Response response = this.clientFor("/api/projects/A/patches/1.0.1").request().get(); + + if (response.getStatus() != 200) + { + throw new HttpResponseException(response.getStatus(), "Error during http call with status: " + response.getStatus() + " , entity: " + response.readEntity(String.class)); + } + + Patch patch = response.readEntity(new GenericType() + { + }); + + Assert.assertEquals("1.0.1", patch.getPatchReleaseVersionId().toVersionIdString()); + } @Test public void testGetAllPatches() throws HttpResponseException {