Skip to content

Commit

Permalink
KOGITO-9611 - Track user identity in Kogito event (#1807)
Browse files Browse the repository at this point in the history
  • Loading branch information
cristianonicolai authored Aug 1, 2023
1 parent 7f983dd commit 24e82b2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public static ProcessInstanceDataEvent getProcessCloudEvent(String processId, St
.build() : null)
.build();

return new ProcessInstanceDataEvent(URI.create("http://localhost:8080/" + processId).toString(), "jobs-management,prometheus-monitoring,process-management", body.metaData(), body);
return new ProcessInstanceDataEvent(URI.create("http://localhost:8080/" + processId).toString(), "jobs-management,prometheus-monitoring,process-management", null, body.metaData(), body);
}

public static ProcessInstance getProcessInstance(String processId, String processInstanceId, Integer status, String rootProcessInstanceId, String rootProcessId) {
Expand Down Expand Up @@ -229,7 +229,7 @@ public static UserTaskInstanceDataEvent getUserTaskCloudEvent(String taskId, Str
.outputs(emptyMap())
.build();

return new UserTaskInstanceDataEvent(URI.create("http://localhost:8080/" + processId).toString(), null, body.metaData(), body);
return new UserTaskInstanceDataEvent(URI.create("http://localhost:8080/" + processId).toString(), null, null, body.metaData(), body);
}

public static AttachmentEventBody getTaskAttachment(String id, String user, String name, String content) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public TestingDataEvent(String type,
String kogitoProcessId,
String kogitoRootProcessId) {
super(type, source, data, kogitoProcessInstanceId, kogitoRootProcessInstanceId, kogitoProcessId,
kogitoRootProcessId, null);
kogitoRootProcessId, null, null);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,16 @@ public class JobDataEvent extends AbstractDataEvent<ScheduledJob> {

public static final String JOB_EVENT_TYPE = "JobEvent";

public JobDataEvent(String source, ScheduledJob data) {
public JobDataEvent(String source, String identity, ScheduledJob data) {
super(JOB_EVENT_TYPE,
source,
data,
data.getProcessInstanceId(),
data.getRootProcessInstanceId(),
data.getProcessId(),
data.getRootProcessId(),
null);
null,
identity);
}

@JsonIgnore
Expand All @@ -49,19 +50,25 @@ public static class JobDataEventBuilder {

private String source;
private ScheduledJob data;
private String identity;

public JobDataEventBuilder source(String source) {
this.source = source;
return this;
}

public JobDataEventBuilder identity(String identity) {
this.identity = identity;
return this;
}

public JobDataEventBuilder data(ScheduledJob data) {
this.data = data;
return this;
}

public JobDataEvent build() {
return new JobDataEvent(source, data);
return new JobDataEvent(source, identity, data);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ public void onJobStatusChange(JobDetails jobDetails) {
scheduledJob.getProcessInstanceId(),
scheduledJob.getRootProcessInstanceId(),
scheduledJob.getProcessId(),
scheduledJob.getRootProcessId());
scheduledJob.getRootProcessId(),
null);
try {
eventPublisher.publish(event);
} catch (Exception e) {
Expand All @@ -103,9 +104,10 @@ public EventPublisherJobDataEvent(String type,
String kogitoProcessInstanceId,
String kogitoRootProcessInstanceId,
String kogitoProcessId,
String kogitoRootProcessId) {
String kogitoRootProcessId,
String kogitoIdentity) {
super(type, source, data, kogitoProcessInstanceId, kogitoRootProcessInstanceId, kogitoProcessId,
kogitoRootProcessId, null);
kogitoRootProcessId, null, kogitoIdentity);
}
}
}

0 comments on commit 24e82b2

Please sign in to comment.