From d910818fefe2e5cd7266ce51b1b532202f68ea20 Mon Sep 17 00:00:00 2001 From: Christian Kurz Date: Fri, 27 Sep 2024 01:26:05 +0200 Subject: [PATCH 1/2] initial issue type by name --- .../src/main/kotlin/gropius/sync/jira/JiraDataService.kt | 6 +++++- .../src/main/kotlin/gropius/sync/jira/model/IssueData.kt | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/sync-jira/src/main/kotlin/gropius/sync/jira/JiraDataService.kt b/sync-jira/src/main/kotlin/gropius/sync/jira/JiraDataService.kt index 4d9d5aad..6af02ca3 100644 --- a/sync-jira/src/main/kotlin/gropius/sync/jira/JiraDataService.kt +++ b/sync-jira/src/main/kotlin/gropius/sync/jira/JiraDataService.kt @@ -109,9 +109,13 @@ class JiraDataService( * @param imsProject The IMSProject to work with * @return the IssueType */ - suspend fun issueType(imsProject: IMSProject): IssueType { + suspend fun issueType(imsProject: IMSProject, name: String): IssueType { val template = issueTemplate(imsProject) val imsProjectConfig = IMSProjectConfig(helper, imsProject) + val namedType = template.issueTypes().firstOrNull { it.name == name } + if (namedType != null) { + return namedType + } if (imsProjectConfig.defaultType != null) { val type = neoOperations.findById(imsProjectConfig.defaultType) if ((type != null) && (type.partOf().contains(template))) { diff --git a/sync-jira/src/main/kotlin/gropius/sync/jira/model/IssueData.kt b/sync-jira/src/main/kotlin/gropius/sync/jira/model/IssueData.kt index 35ecf263..f49183ee 100644 --- a/sync-jira/src/main/kotlin/gropius/sync/jira/model/IssueData.kt +++ b/sync-jira/src/main/kotlin/gropius/sync/jira/model/IssueData.kt @@ -428,7 +428,8 @@ data class IssueData( issue.state().value = jiraService.issueState(imsProject, null, true) issue.template().value = jiraService.issueTemplate(imsProject) issue.trackables() += jiraService.neoOperations.findAll(Project::class.java).awaitFirst() - issue.type().value = jiraService.issueType(imsProject) + issue.type().value = + jiraService.issueType(imsProject, fields["issuetype"]?.jsonObject?.get("name")?.jsonPrimitive?.content!!) return issue } } From 3e18df9496301ae25d7b0903b1c05ea1dd6c4fca Mon Sep 17 00:00:00 2001 From: Christian Kurz Date: Fri, 27 Sep 2024 01:42:27 +0200 Subject: [PATCH 2/2] fix pipeline error --- sync-jira/src/main/kotlin/gropius/sync/jira/JiraSync.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sync-jira/src/main/kotlin/gropius/sync/jira/JiraSync.kt b/sync-jira/src/main/kotlin/gropius/sync/jira/JiraSync.kt index 885f0a16..89b1b4bd 100644 --- a/sync-jira/src/main/kotlin/gropius/sync/jira/JiraSync.kt +++ b/sync-jira/src/main/kotlin/gropius/sync/jira/JiraSync.kt @@ -129,7 +129,7 @@ final class JiraSync( override suspend fun fetchData(imsProjects: List) { for (imsProject in imsProjects) { jiraDataService.issueTemplate(imsProject) - jiraDataService.issueType(imsProject) + jiraDataService.issueType(imsProject, "") jiraDataService.issueState(imsProject, null, true) jiraDataService.issueState(imsProject, null, false) }