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

[incubator-kie-issues-576] Data Audit apps for kogito #3267

Merged
merged 8 commits into from
Dec 27, 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 @@ -18,7 +18,9 @@
*/
package org.kie.kogito.internal.process.runtime;

import java.util.Collections;
import java.util.Date;
import java.util.Map;

import org.kie.api.runtime.process.NodeInstance;

Expand Down Expand Up @@ -67,4 +69,10 @@ default boolean isCancelled() {
* @return actual leave time
*/
Date getLeaveTime();

Date getSlaDueDate();

default Map<String, Object> getMetaData() {
return Collections.emptyMap();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public interface KogitoWorkflowProcessInstance extends WorkflowProcessInstance,
*/
String getNodeIdInError();

String getNodeInstanceIdInError();

/**
* Returns error message associated with this process instance in case it is in an error
* state. It will consists of
Expand Down Expand Up @@ -88,4 +90,6 @@ public interface KogitoWorkflowProcessInstance extends WorkflowProcessInstance,
*/
Collection<AdHocFragment> adHocFragments();

Date getSlaDueDate();

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ public class ProcessInstanceNodeEventBody {

public static final int EVENT_TYPE_EXIT = 2;

public static final int EVENT_TYPE_ABORTED = 3;

public static final int EVENT_TYPE_SKIPPED = 4;

public static final int EVENT_TYPE_OBSOLETE = 5;

public static final int EVENT_TYPE_ERROR = 6;

// common fields for events

private Date eventDate;
Expand All @@ -47,7 +55,7 @@ public class ProcessInstanceNodeEventBody {

// custom data fields

private String connectionNodeInstanceId; // only for entering and leaving
private String connectionNodeDefinitionId; // only for entering and leaving

private String nodeDefinitionId; // definition on bpmn2

Expand All @@ -57,6 +65,10 @@ public class ProcessInstanceNodeEventBody {

private String nodeInstanceId;

private String workItemId;

private Date slaDueDate;

private Map<String, Object> data;

private ProcessInstanceNodeEventBody() {
Expand Down Expand Up @@ -87,8 +99,8 @@ public String getProcessInstanceId() {
return processInstanceId;
}

public String getConnectionNodeInstanceId() {
return connectionNodeInstanceId;
public String getConnectionNodeDefinitionId() {
return connectionNodeDefinitionId;
}

public String getNodeDefinitionId() {
Expand All @@ -107,14 +119,22 @@ public String getNodeInstanceId() {
return nodeInstanceId;
}

public Date getSlaDueDate() {
return slaDueDate;
}

public String getWorkItemId() {
return workItemId;
}

public Map<String, Object> getData() {
return data;
}

@Override
public String toString() {
return "ProcessInstanceNodeEventBody [eventDate=" + eventDate + ", eventUser=" + eventUser + ", eventType=" + eventType + ", processId=" + processId + ", processVersion=" + processVersion
+ ", processInstanceId=" + processInstanceId + ", connectionNodeInstanceId=" + connectionNodeInstanceId + ", nodeDefinitionId=" + nodeDefinitionId + ", nodeName=" + nodeName
+ ", processInstanceId=" + processInstanceId + ", connectionNodeInstanceId=" + connectionNodeDefinitionId + ", nodeDefinitionId=" + nodeDefinitionId + ", nodeName=" + nodeName
+ ", nodeType=" + nodeType + ", nodeInstanceId=" + nodeInstanceId + ", data=" + data + "]";
}

Expand Down Expand Up @@ -181,8 +201,8 @@ public Builder processInstanceId(String processInstanceId) {
return this;
}

public Builder connectionNodeInstanceId(String connectionNodeInstanceId) {
instance.connectionNodeInstanceId = connectionNodeInstanceId;
public Builder connectionNodeDefinitionId(String connectionNodeDefinitionId) {
instance.connectionNodeDefinitionId = connectionNodeDefinitionId;
return this;
}

Expand Down Expand Up @@ -211,8 +231,20 @@ public Builder data(String name, Object value) {
return this;
}

public Builder slaDueDate(Date slaDueDate) {
instance.slaDueDate = slaDueDate;
return this;
}

public Builder workItemId(String workItemId) {
instance.workItemId = workItemId;
return this;
}

public ProcessInstanceNodeEventBody build() {
return instance;
}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,20 @@ public class ProcessInstanceSLAEventBody {

private String nodeInstanceId;

private String nodeName;

private String nodeType;

private Date slaDueDate;

public Date getSlaDueDate() {
return slaDueDate;
}

public void setSlaDueDate(Date slaDueDate) {
this.slaDueDate = slaDueDate;
}

public Date getEventDate() {
return eventDate;
}
Expand Down Expand Up @@ -69,6 +83,14 @@ public String getNodeInstanceId() {
return nodeInstanceId;
}

public String getNodeName() {
return nodeName;
}

public String getNodeType() {
return nodeType;
}

@Override
public String toString() {
return "ProcessErrorEventBody [processId=" + processId + ", processInstanceId=" + processInstanceId + ", nodeDefinitionId=" + nodeDefinitionId + ", nodeInstanceId=" + nodeInstanceId + "]";
Expand All @@ -86,6 +108,11 @@ private Builder(ProcessInstanceSLAEventBody instance) {
this.instance = instance;
}

public Builder slaDueDate(Date slaDueDate) {
this.instance.slaDueDate = slaDueDate;
return this;
}

public Builder eventDate(Date eventDate) {
this.instance.eventDate = eventDate;
return this;
Expand Down Expand Up @@ -121,8 +148,19 @@ public Builder nodeDefinitionId(String nodeDefinitionId) {
return this;
}

public Builder nodeName(String nodeName) {
instance.nodeName = nodeName;
return this;
}

public Builder nodeType(String nodeType) {
instance.nodeType = nodeType;
return this;
}

public ProcessInstanceSLAEventBody build() {
return instance;
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ public class ProcessInstanceStateEventBody {

private Set<String> roles;

public Date slaDueDate;

public Date getEventDate() {
return eventDate;
}
Expand Down Expand Up @@ -118,6 +120,10 @@ public Set<String> getRoles() {
return roles;
}

public Date getSlaDueDate() {
return slaDueDate;
}

public Builder update() {
return new Builder(this);
}
Expand Down Expand Up @@ -245,8 +251,14 @@ public Builder roles(String... roles) {
return this;
}

public Builder slaDueDate(Date slaDueDate) {
instance.slaDueDate = slaDueDate;
return this;
}

public ProcessInstanceStateEventBody build() {
return instance;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ public class UserTaskInstanceStateEventBody {
private String userTaskInstanceId;
private String userTaskName;

// custom data fields
private Integer eventType; // CREATED, ADDED, CLAIMED....

private String userTaskDescription;
private String userTaskPriority;
private String userTaskReferenceName;
Expand All @@ -48,6 +45,8 @@ public class UserTaskInstanceStateEventBody {

private String processInstanceId;

private String eventType;

public Date getEventDate() {
return eventDate;
}
Expand All @@ -68,10 +67,6 @@ public String getUserTaskName() {
return userTaskName;
}

public Integer getEventType() {
return eventType;
}

public String getUserTaskDescription() {
return userTaskDescription;
}
Expand All @@ -96,6 +91,10 @@ public String getProcessInstanceId() {
return processInstanceId;
}

public String getEventType() {
return eventType;
}

public Map<String, Object> metaData() {
Map<String, Object> metadata = new HashMap<>();
metadata.put(UserTaskInstanceEventMetadata.USER_TASK_INSTANCE_ID_META_DATA, userTaskInstanceId);
Expand All @@ -107,7 +106,7 @@ public Map<String, Object> metaData() {
@Override
public String toString() {
return "UserTaskInstanceStateEventBody [eventDate=" + eventDate + ", eventUser=" + eventUser + ", userTaskDefinitionId=" + userTaskDefinitionId + ", userTaskInstanceId=" + userTaskInstanceId
+ ", userTaskName=" + userTaskName + ", eventType=" + eventType + ", userTaskDescription=" + userTaskDescription + ", userTaskPriority=" + userTaskPriority + ", userTaskReferenceName="
+ ", userTaskName=" + userTaskName + ", userTaskDescription=" + userTaskDescription + ", userTaskPriority=" + userTaskPriority + ", userTaskReferenceName="
+ userTaskReferenceName
+ ", state=" + state + ", actualOwner=" + actualOwner + ", processInstanceId=" + processInstanceId + "]";
}
Expand Down Expand Up @@ -170,11 +169,6 @@ public Builder userTaskName(String userTaskName) {
return this;
}

public Builder eventType(Integer eventType) {
this.instance.eventType = eventType;
return this;
}

public Builder userTaskDescription(String userTaskDescription) {
this.instance.userTaskDescription = userTaskDescription;
return this;
Expand All @@ -200,6 +194,11 @@ public Builder actualOwner(String userId) {
return this;
}

public Builder eventType(String eventType) {
this.instance.eventType = eventType;
return this;
}

public Builder processInstanceId(String processInstanceId) {
this.instance.processInstanceId = processInstanceId;
return this;
Expand All @@ -209,4 +208,5 @@ public UserTaskInstanceStateEventBody build() {
return this.instance;
}
}

}
Loading
Loading