Skip to content

Commit

Permalink
feat(orchestrator): Service logic - synchronize GoldenRecordTaskServi…
Browse files Browse the repository at this point in the history
…ce methods
  • Loading branch information
martinfkaeser committed Oct 16, 2023
1 parent 0519ee2 commit 85c6800
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,23 @@ class GoldenRecordTaskService(
val goldenRecordTaskStateMachine: GoldenRecordTaskStateMachine
) {

@Synchronized
fun createTasks(createRequest: TaskCreateRequest): TaskCreateResponse {
return createRequest.businessPartners
.map { businessPartnerGeneric -> taskStorage.addTask(initTask(createRequest, businessPartnerGeneric)) }
.map(::toTaskClientStateDto)
.let { TaskCreateResponse(createdTasks = it) }
}

@Synchronized
fun searchTaskStates(stateRequest: TaskStateRequest): TaskStateResponse {
return stateRequest.taskIds
.mapNotNull { taskId -> taskStorage.getTask(taskId) } // skip missing tasks
.map(::toTaskClientStateDto)
.let { TaskStateResponse(tasks = it) }
}

@Synchronized
fun reserveTasksForStep(reservationRequest: TaskStepReservationRequest): TaskStepReservationResponse {
val now = Instant.now()

Expand All @@ -72,6 +75,7 @@ class GoldenRecordTaskService(
)
}

@Synchronized
fun resolveStepResults(resultRequest: TaskStepResultRequest) {
resultRequest.results
.forEach { resultEntry ->
Expand Down

0 comments on commit 85c6800

Please sign in to comment.