-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d664018
commit 880fa4f
Showing
38 changed files
with
946 additions
and
140 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Camunda Platform 7 Test Adapter | ||
|
||
Current purpose of this adapter is to create a simple (not production-ready) implementation of the process engine API. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...mcrafters/processengineapi/adapter/c7/task/delivery/EmbeddedEventBasedUserTaskDelivery.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package dev.bpmcrafters.processengineapi.adapter.c7.task.delivery | ||
|
||
import dev.bpmcrafters.processengineapi.adapter.c7.task.SubscriptionRepository | ||
import dev.bpmcrafters.processengineapi.adapter.c7.task.TaskSubscriptionHandle | ||
import dev.bpmcrafters.processengineapi.adapter.c7.task.completion.UserTaskCompletionStrategy | ||
import org.camunda.bpm.engine.delegate.DelegateTask | ||
|
||
class EmbeddedEventBasedUserTaskDelivery( | ||
private val subscriptionRepository: SubscriptionRepository | ||
) : UserTaskDelivery { | ||
|
||
fun userTaskCreated(delegateTask: DelegateTask) { | ||
val subscriptions = subscriptionRepository.getTaskSubscriptions() | ||
|
||
subscriptions | ||
.firstOrNull { subscription -> subscription.matches(delegateTask) } | ||
?.let { activeSubscription -> | ||
|
||
subscriptionRepository.activateSubscriptionForTask(delegateTask.id, activeSubscription) | ||
|
||
val variables = if (activeSubscription.payloadDescription.isEmpty()) { | ||
delegateTask.variables | ||
} else { | ||
delegateTask.variables.filterKeys { key -> activeSubscription.payloadDescription.contains(key) } | ||
} | ||
|
||
activeSubscription.action.accept(delegateTask.toTaskInformation(), variables) | ||
} | ||
} | ||
|
||
fun userTaskModified(delegateTask: DelegateTask) { | ||
subscriptionRepository.getActiveSubscriptionForTask(delegateTask.id)?.apply { | ||
|
||
val variables = if (this.payloadDescription.isEmpty()) { | ||
delegateTask.variables | ||
} else { | ||
delegateTask.variables.filterKeys { key -> this.payloadDescription.contains(key) } | ||
} | ||
|
||
modification.modified(delegateTask.toTaskInformation(), variables) | ||
} | ||
} | ||
|
||
fun userTaskDeleted(delegateTask: DelegateTask) { | ||
subscriptionRepository.getActiveSubscriptionForTask(delegateTask.id)?.modification?.terminated(delegateTask.id) | ||
} | ||
|
||
|
||
private fun TaskSubscriptionHandle.matches(task: DelegateTask): Boolean = | ||
UserTaskCompletionStrategy.supports(this.restrictions) | ||
&& (this.taskDescriptionKey == null || this.taskDescriptionKey == task.taskDefinitionKey || this.taskDescriptionKey == task.id) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
.../dev/bpmcrafters/processengineapi/adapter/c7/task/delivery/ExternalServiceTaskDelivery.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package dev.bpmcrafters.processengineapi.adapter.c7.task.delivery | ||
|
||
/** | ||
* Common interface for external service task delivery. | ||
*/ | ||
interface ExternalServiceTaskDelivery |
Oops, something went wrong.