Skip to content

Commit

Permalink
Merge pull request #351 from camunda-community-hub/process-instance-d…
Browse files Browse the repository at this point in the history
…ecision-evaluations

fix: Add missing pagination for fetching decision evaluations
  • Loading branch information
saig0 authored Mar 21, 2023
2 parents b1cb587 + d8731e5 commit 5953595
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,16 @@ interface DecisionEvaluationRepository : PagingAndSortingRepository<DecisionEval

fun countByDecisionKey(decisionKey: Long): Long

fun findAllByProcessInstanceKey(processInstanceKey: Long): List<DecisionEvaluation>
fun findAllByProcessInstanceKeyAndStateIn(
processInstanceKey: Long,
stateIn: List<DecisionEvaluationState>,
pageable: Pageable
): List<DecisionEvaluation>

fun countByProcessInstanceKey(processInstanceKey: Long): Long
fun countByProcessInstanceKeyAndStateIn(
processInstanceKey: Long,
stateIn: List<DecisionEvaluationState>
): Long

fun findAllByElementInstanceKey(elementInstanceKey: Long): List<DecisionEvaluation>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,26 @@ class ProcessInstanceResolver(
}

@SchemaMapping(typeName = "ProcessInstance", field = "decisionEvaluations")
fun decisionEvaluations(processInstance: ProcessInstance): DecisionEvaluationConnection {
fun decisionEvaluations(
processInstance: ProcessInstance,
@Argument perPage: Int,
@Argument page: Int,
@Argument stateIn: List<DecisionEvaluationState>
): DecisionEvaluationConnection {
return DecisionEvaluationConnection(
getItems = { decisionEvaluationRepository.findAllByProcessInstanceKey(processInstanceKey = processInstance.key) },
getCount = { decisionEvaluationRepository.countByProcessInstanceKey(processInstanceKey = processInstance.key) }
getItems = {
decisionEvaluationRepository.findAllByProcessInstanceKeyAndStateIn(
processInstanceKey = processInstance.key,
stateIn = stateIn,
pageable = PageRequest.of(page, perPage)
)
},
getCount = {
decisionEvaluationRepository.countByProcessInstanceKeyAndStateIn(
processInstanceKey = processInstance.key,
stateIn = stateIn
)
}
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ type ProcessInstance {
# the opened message subscriptions related to the process instance (e.g. message catch events)
messageSubscriptions: [MessageSubscription!]
# The evaluated decisions that are called by a business rule task of this process instance.
decisionEvaluations: DecisionEvaluationConnection
decisionEvaluations(
perPage: Int = 10,
page: Int = 0,
stateIn: [DecisionEvaluationState!] = [EVALUATED, FAILED]
): DecisionEvaluationConnection
# the occurred error related to the process instance
error: Error
}
Expand Down

0 comments on commit 5953595

Please sign in to comment.