Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public GetDataEventOutcome getData(String taskId, Map<String, String> params) {
}

@Override
public SetDataEventOutcome setData(String taskId, Map<String, Map<String, String>> dataSet, Map<String, String> params) throws JsonProcessingException {
public SetDataEventOutcome setData(String taskId, Map<String, Map<String, Object>> dataSet, Map<String, String> params) throws JsonProcessingException {
log.debug("Setting data for task [{}] with params: [{}]", taskId, params == null ? "null" : params.toString());
ObjectMapper mapper = new ObjectMapper();
String json = mapper.writeValueAsString(dataSet);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ public List<EventOutcome> runActions(List<Action> actions, Case useCase, Optiona
List<Function> functions = useCase == null ? Collections.emptyList() : useCase.getPetriNet().getFunctions();
actions.forEach(action -> {
List<EventOutcome> outcomes = actionsRunner.run(action, useCase, task, params, functions);
if (useCase != null) {
workflowService.updateCaseFromDb(useCase);
}
Comment thread
renczesstefan marked this conversation as resolved.
outcomes.stream().filter(SetDataEventOutcome.class::isInstance)
.forEach(outcome -> {
if (((SetDataEventOutcome) outcome).getChangedFields().isEmpty()) return;
Expand All @@ -75,6 +78,9 @@ public List<EventOutcome> runEventActions(Case useCase, Task task, List<Action>
List<Function> functions = useCase == null ? Collections.emptyList() : useCase.getPetriNet().getFunctions();
actions.forEach(action -> {
List<EventOutcome> outcomes = actionsRunner.run(action, useCase, taskOpt, params, functions);
if (useCase != null) {
workflowService.updateCaseFromDb(useCase);
}
outcomes.stream().filter(SetDataEventOutcome.class::isInstance)
.forEach(outcome -> {
if (((SetDataEventOutcome) outcome).getChangedFields().isEmpty()) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,16 @@ public Case resolveActorRef(Case useCase, boolean canSaveUseCase) {
return useCase;
}

@Override
public void updateCaseFromDb(Case useCase) {
Case actual = findOne(useCase.getStringId());
actual.getDataSet().forEach((id, dataField) -> {
if (dataField.isNewerThen(useCase.getDataField(id))) {
useCase.getDataSet().put(id, dataField);
}
});
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

/**
* Resolves actor permissions for the useCase based on the actor list data field.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public interface IWorkflowService {

Case resolveActorRef(Case useCase, boolean canSaveUseCase);

void updateCaseFromDb(Case useCase);

CreateCaseEventOutcome createCase(CreateCaseParams createCaseParams);

Page<Case> findAllByAuthor(String authorId, String petriNet, Pageable pageable);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public interface ActionApi {
* @return the outcome of the set data operation
* @throws JsonProcessingException if there is an error processing JSON data
*/
SetDataEventOutcome setData(String taskId, Map<String, Map<String, String>> dataSet, Map<String, String> params) throws JsonProcessingException;
SetDataEventOutcome setData(String taskId, Map<String, Map<String, Object>> dataSet, Map<String, String> params) throws JsonProcessingException;

/**
* Finds a specific case by its ID.
Expand Down
Loading