Skip to content

Commit 963de49

Browse files
committed
Allow explicit mapping of downstream -> upstream statuses
for better handling of the transition sync
1 parent 745acd3 commit 963de49

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/main/java/org/hibernate/infra/replicate/jira/JiraConfig.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ interface JiraProjectGroup {
5858
*/
5959
StatusesValueMapping statuses();
6060

61+
/**
62+
* Same as {@link #statuses()}, but to map downstream statuses to upstream one
63+
* for the backwards sync.
64+
*/
65+
Optional<StatusesValueMapping> downstreamStatuses();
66+
6167
/**
6268
* Mapping of upstream issue types to downstream ones. Please make sure to
6369
* review your project scheme to see which issue types are available.

src/main/java/org/hibernate/infra/replicate/jira/service/jira/HandlerProjectGroupContext.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@ public HandlerProjectGroupContext(String projectGroupName, JiraConfig.JiraProjec
7272
TimeUnit.MILLISECONDS, downstreamWorkQueue);
7373

7474
this.invertedUsers = invert(projectGroup.users().mapping());
75-
this.invertedStatuses = invert(projectGroup.statuses().mapping());
75+
// use the explicit config if present, but fallback to the inverted map
76+
// otherwise.
77+
this.invertedStatuses = projectGroup.downstreamStatuses().map(JiraConfig.ValueMapping::mapping)
78+
.orElseGet(() -> invert(projectGroup.statuses().mapping()));
7679
this.sourceJiraClient = source;
7780
this.destinationJiraClient = destination;
7881

0 commit comments

Comments
 (0)