Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KOGITO-9611 - Track user identity in Kogito event #1807

Merged
merged 1 commit into from
Aug 1, 2023
Merged
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 @@ -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);
}
}
}