Skip to content

Commit

Permalink
fix query
Browse files Browse the repository at this point in the history
  • Loading branch information
elguardian committed Nov 22, 2023
1 parent 55104cd commit d65c69c
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 59 deletions.
33 changes: 18 additions & 15 deletions data-audit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,26 +56,29 @@ org.kie.kogito.app.audit.spi.GraphQLSchemaQueryProvider: this allow the subsyste

You need to add two different dependencies to your project.

<dependency>
<groupId>org.kie.kogito</groupId>
<artifactId>kogito-addons-data-audit-<runtime></artifactId>
<version>${version}</version>
</dependency>
<dependency>
<groupId>org.kie.kogito</groupId>
<artifactId>kogito-addons-data-audit-jpa-<runtime></artifactId>
<version>${version}</version>
</dependency>
<dependency>
<groupId>org.kie.kogito</groupId>
<artifactId>kogito-addons-data-audit-<runtime></artifactId>
<version>${version}</version>
</dependency>
<dependency>
<groupId>org.kie.kogito</groupId>
<artifactId>kogito-addons-data-audit-jpa-<runtime></artifactId>
<version>${version}</version>
</dependency>




The first dependency is related how to you want to deploy it. In this case as collocated/embedded service
The second dependency is which implementation you want to use.

Each implementation might require additional dependencies. In our case for using JPA implementation we might require driver

<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jdbc-h2</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jdbc-h2</artifactId>
</dependency>

No additional configuration is requires besides the default datasource use by the application already.

Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ public class UserTaskInstanceStateTO {

private String businessKey;

private String taskId;

private String name;

private String description;
Expand All @@ -47,27 +45,20 @@ public class UserTaskInstanceStateTO {

private String state;

private String nodeDefitionId;

private String nodeInstanceId;

private String eventType;

public UserTaskInstanceStateTO(String eventId, Date eventDate, String userTaskDefinitionId, String userTaskInstanceId, String processInstanceId, String businessKey,
String taskId, String name, String description, String actualUser, String state, String nodeDefitionId, String nodeInstanceId, String eventType) {
String name, String description, String actualUser, String state, String eventType) {
this.eventId = eventId;
this.eventDate = OffsetDateTime.ofInstant(eventDate.toInstant(), ZoneId.of("UTC"));
this.userTaskDefinitionId = userTaskDefinitionId;
this.userTaskInstanceId = userTaskInstanceId;
this.processInstanceId = processInstanceId;
this.businessKey = businessKey;
this.taskId = taskId;
this.name = name;
this.description = description;
this.actualUser = actualUser;
this.state = state;
this.nodeDefitionId = nodeDefitionId;
this.nodeInstanceId = nodeInstanceId;
this.eventType = eventType;
}

Expand Down Expand Up @@ -119,14 +110,6 @@ public void setBusinessKey(String businessKey) {
this.businessKey = businessKey;
}

public String getTaskId() {
return taskId;
}

public void setTaskId(String taskId) {
this.taskId = taskId;
}

public String getName() {
return name;
}
Expand Down Expand Up @@ -159,14 +142,6 @@ public void setState(String state) {
this.state = state;
}

public String getNodeInstanceId() {
return nodeInstanceId;
}

public void setNodeInstanceId(String nodeInstanceId) {
this.nodeInstanceId = nodeInstanceId;
}

public String getEventType() {
return eventType;
}
Expand All @@ -175,12 +150,4 @@ public void setEventType(String eventType) {
this.eventType = eventType;
}

public String getNodeDefitionId() {
return nodeDefitionId;
}

public void setNodeDefitionId(String nodeDefitionId) {
this.nodeDefitionId = nodeDefitionId;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ type ProcessInstanceStateLog {
type ProcessInstanceNodeLog {
eventId : String!
eventDate : DateTime
processType : String
processId : String
processType : String
sprocessId : String
processVersion : String
parentProcessInstanceId : String
rootProcessId : String
Expand Down Expand Up @@ -102,13 +102,10 @@ type UserTaskInstanceStateLog {
userTaskInstanceId : String
processInstanceId : String
businessKey : String
taskId : String
name : String
description : String
actualUser : String
state : String
nodeDefitionId : String
nodeInstanceId : String
eventType : String
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public void storeProcessInstanceDataEvent(DataAuditContext context, ProcessInsta
ProcessInstanceStateLog log = new ProcessInstanceStateLog();
setProcessCommonAttributes(log, event);
log.setEventType(ProcessStateLogType.SLA_VIOLATION);

log.setSlaDueDate(event.getData().getSlaDueDate());
entityManager.persist(log);
} else {
ProcessInstanceNodeLog log = new ProcessInstanceNodeLog();
Expand All @@ -191,6 +191,7 @@ public void storeProcessInstanceDataEvent(DataAuditContext context, ProcessInsta
log.setNodeName(event.getData().getNodeName());
log.setNodeType(event.getData().getNodeType());
log.setEventType(NodeLogType.SLA_VIOLATION);
log.setSlaDueDate(event.getData().getSlaDueDate());
entityManager.persist(log);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -545,13 +545,10 @@
log.user_task_instance_id,
log.process_instance_id,
log.business_key,
log.task_id,
log.name,
log.description,
log.actual_user,
log.state,
log.node_definition_id,
log.node_instance_id,
log.event_type
FROM Task_Instance_State_Log log
LEFT JOIN Task_Instance_State_Log log_newer ON log.user_task_instance_id = log_newer.user_task_instance_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public void init() {
public void testGetAllUserTaskInstanceState() {

String query =
"{ GetAllUserTaskInstanceState { eventId, eventDate, userTaskDefinitionId, userTaskInstanceId, processInstanceId, businessKey, taskId, name, description, actualUser, state, nodeDefitionId, nodeInstanceId, eventType } }";
"{ GetAllUserTaskInstanceState { eventId, eventDate, userTaskDefinitionId, userTaskInstanceId, processInstanceId, businessKey, name, description, actualUser, state, eventType } }";
query = wrapQuery(query);
List<Map<String, Object>> data = given()
.contentType(ContentType.JSON)
Expand Down

0 comments on commit d65c69c

Please sign in to comment.