Skip to content

Commit

Permalink
added triggeringWorkflowId
Browse files Browse the repository at this point in the history
  • Loading branch information
Aravindan Ramkumar committed Oct 13, 2022
1 parent f172d9d commit c3d3eb1
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ public void addPermission(Permission permission, String allowedAuthority) {
this.accessPolicy.put(permission, allowedAuthority);
}

public void addPermissionIfAbsent(Permission permission, String allowedAuthority) {
this.accessPolicy.putIfAbsent(permission, allowedAuthority);
}

public void removePermission(Permission permission) {
this.accessPolicy.remove(permission);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public class StartWorkflowInput {
private String event;
private Map<String, String> taskToDomain;
private String workflowId;
private String triggeringWorkflowId;

public StartWorkflowInput() {}

Expand Down Expand Up @@ -143,6 +144,14 @@ public void setWorkflowId(String workflowId) {
this.workflowId = workflowId;
}

public String getTriggeringWorkflowId() {
return triggeringWorkflowId;
}

public void setTriggeringWorkflowId(String triggeringWorkflowId) {
this.triggeringWorkflowId = triggeringWorkflowId;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
Expand All @@ -160,6 +169,7 @@ public boolean equals(Object o) {
&& Objects.equals(parentWorkflowTaskId, that.parentWorkflowTaskId)
&& Objects.equals(event, that.event)
&& Objects.equals(taskToDomain, that.taskToDomain)
&& Objects.equals(triggeringWorkflowId, that.triggeringWorkflowId)
&& Objects.equals(workflowId, that.workflowId);
}

Expand All @@ -177,6 +187,7 @@ public int hashCode() {
parentWorkflowTaskId,
event,
taskToDomain,
triggeringWorkflowId,
workflowId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,7 @@ public WorkflowModel terminateWorkflow(
startWorkflowInput.setCorrelationId(workflow.getCorrelationId());
startWorkflowInput.setTaskToDomain(workflow.getTaskToDomain());
startWorkflowInput.setWorkflowId(failureWFId);
startWorkflowInput.setTriggeringWorkflowId(workflowId);

eventPublisher.publishEvent(new WorkflowCreationEvent(startWorkflowInput));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void start(
request.getCorrelationId(), workflow.getCorrelationId()));

try {
String workflowId = startWorkflow(request);
String workflowId = startWorkflow(request, workflow.getWorkflowId());
taskModel.addOutput(WORKFLOW_ID, workflowId);
taskModel.setStatus(COMPLETED);
} catch (TransientException te) {
Expand Down Expand Up @@ -136,8 +136,10 @@ private StartWorkflowRequest getRequest(TaskModel taskModel) {
return startWorkflowRequest;
}

private String startWorkflow(StartWorkflowRequest request) {
return startWorkflowOperation.execute(new StartWorkflowInput(request));
private String startWorkflow(StartWorkflowRequest request, String workflowId) {
StartWorkflowInput input = new StartWorkflowInput(request);
input.setTriggeringWorkflowId(workflowId);
return startWorkflowOperation.execute(input);
}

@Override
Expand Down

0 comments on commit c3d3eb1

Please sign in to comment.