Skip to content

Commit

Permalink
fix: Fixed getting project baseline (#161)
Browse files Browse the repository at this point in the history
* fix: Fixed getting project baseline

Refs: #160

* fix: Fixed getting project baseline

Refs: #160

---------

Co-authored-by: Adam Ruberti <adam.ruberti@sbb.ch>
  • Loading branch information
pbezliapovich and ariwk authored Aug 22, 2024
1 parent 5fb657c commit d3163c5
Showing 1 changed file with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,27 @@ public ILocation getDocumentLocation(String locationPath, String revision) {
return String.format("%s/%s", projectId, locationPath);
}

@Nullable
@NotNull
private String getRevisionBaseline(@NotNull String projectId, @NotNull IPObject iPObject, @Nullable String revision) {
IInternalBaselinesManager baselinesManager = (IInternalBaselinesManager) pdfExporterPolarionService.getTrackerProject(projectId).getBaselinesManager();
IBaseline baseline = baselinesManager.getRevisionBaseline(iPObject, revision != null ? revision : iPObject.getLastRevision());
return baseline != null ? baseline.getName() : null;
revision = revision == null ? iPObject.getLastRevision() : revision;

StringBuilder baselineNameBuilder = new StringBuilder();

IBaseline projectBaseline = baselinesManager.getRevisionBaseline(revision);
if (projectBaseline != null) {
baselineNameBuilder.append("pb. ").append(projectBaseline.getName());
}

IBaseline moduleBaseline = baselinesManager.getRevisionBaseline(iPObject, revision);
if (moduleBaseline != null) {
if (!baselineNameBuilder.isEmpty()) {
baselineNameBuilder.append(" | ");
}
baselineNameBuilder.append("db. ").append(moduleBaseline.getName());
}

return baselineNameBuilder.toString();
}

@Builder
Expand Down

0 comments on commit d3163c5

Please sign in to comment.