diff --git a/data-audit/data-audit-common/src/main/java/org/kie/kogito/app/audit/graphql/type/UserTaskInstanceAttachmentTO.java b/data-audit/data-audit-common/src/main/java/org/kie/kogito/app/audit/graphql/type/UserTaskInstanceAttachmentTO.java index 0eabf896f1..a5dd338c0e 100644 --- a/data-audit/data-audit-common/src/main/java/org/kie/kogito/app/audit/graphql/type/UserTaskInstanceAttachmentTO.java +++ b/data-audit/data-audit-common/src/main/java/org/kie/kogito/app/audit/graphql/type/UserTaskInstanceAttachmentTO.java @@ -59,7 +59,9 @@ public UserTaskInstanceAttachmentTO(String eventId, Date eventDate, String event this.businessKey = businessKey; this.attachmentId = attachmentId; this.attachmentName = attachmentName; - this.attachmentURI = URI.create(new String(attachmentURI)); + if (attachmentURI != null) { + this.attachmentURI = URI.create(new String(attachmentURI)); + } this.eventType = eventType; } diff --git a/data-audit/data-audit-common/src/main/resources/META-INF/data-audit-usertask-query.graphqls b/data-audit/data-audit-common/src/main/resources/META-INF/data-audit-usertask-query.graphqls index 861b884187..98ac378344 100644 --- a/data-audit/data-audit-common/src/main/resources/META-INF/data-audit-usertask-query.graphqls +++ b/data-audit/data-audit-common/src/main/resources/META-INF/data-audit-usertask-query.graphqls @@ -2,7 +2,7 @@ type Query { GetAllUserTaskInstanceState (pagination: Pagination) : [UserTaskInstanceStateLog] GetAllUserTaskInstanceAssignments (userTaskInstanceId : String!, pagination: Pagination) : [UserTaskInstanceAssignmentLog] GetAllUserTaskInstanceAttachments (userTaskInstanceId : String!, pagination: Pagination) : [UserTaskInstanceAttachmentLog] - GetAllUserTaskInstanceComment (userTaskInstanceId : String!, pagination: Pagination) : [UserTaskInstanceCommentLog] - GetAllUserTaskInstanceDeadline (userTaskInstanceId : String!, pagination: Pagination) : [UserTaskInstanceDeadlineLog] - GetAllUserTaskInstanceVariable (userTaskInstanceId : String!, pagination: Pagination) : [UserTaskInstanceVariableLog] + GetAllUserTaskInstanceComments (userTaskInstanceId : String!, pagination: Pagination) : [UserTaskInstanceCommentLog] + GetAllUserTaskInstanceDeadlines (userTaskInstanceId : String!, pagination: Pagination) : [UserTaskInstanceDeadlineLog] + GetAllUserTaskInstanceVariables (userTaskInstanceId : String!, pagination: Pagination) : [UserTaskInstanceVariableLog] } \ No newline at end of file diff --git a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/java/org/kie/kogito/app/audit/jpa/queries/JPAGraphQLSchemaUserTaskInstancesQueryProvider.java b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/java/org/kie/kogito/app/audit/jpa/queries/JPAGraphQLSchemaUserTaskInstancesQueryProvider.java index 5460acf1f9..9fa5a6f114 100644 --- a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/java/org/kie/kogito/app/audit/jpa/queries/JPAGraphQLSchemaUserTaskInstancesQueryProvider.java +++ b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/java/org/kie/kogito/app/audit/jpa/queries/JPAGraphQLSchemaUserTaskInstancesQueryProvider.java @@ -41,10 +41,10 @@ public List> queries() { return List.of( new JPASimpleNamedQuery("GetAllUserTaskInstanceState", UserTaskInstanceStateTO.class), new JPASimpleNamedQuery("GetAllUserTaskInstanceAttachments", UserTaskInstanceAttachmentTO.class), - new JPASimpleNamedQuery("GetAllUserTaskInstanceComment", UserTaskInstanceCommentTO.class), - new JPASimpleNamedQuery("GetAllUserTaskInstanceVariable", UserTaskInstanceVariableTO.class), + new JPASimpleNamedQuery("GetAllUserTaskInstanceComments", UserTaskInstanceCommentTO.class), + new JPASimpleNamedQuery("GetAllUserTaskInstanceVariables", UserTaskInstanceVariableTO.class), new JPAComplexNamedQuery("GetAllUserTaskInstanceAssignments", new UserTaskInstanceAssignmentTOMapper()), - new JPAComplexNamedQuery("GetAllUserTaskInstanceDeadline", new UserTaskInstanceDeadlineTOMapper())); + new JPAComplexNamedQuery("GetAllUserTaskInstanceDeadlines", new UserTaskInstanceDeadlineTOMapper())); } public OffsetDateTime toDateTime(Date date) { diff --git a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/META-INF/data-audit-orm.xml b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/META-INF/data-audit-orm.xml index 1d30aa1b01..8d384fe7af 100644 --- a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/META-INF/data-audit-orm.xml +++ b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/META-INF/data-audit-orm.xml @@ -600,7 +600,7 @@ - + SELECT log.event_id, @@ -621,7 +621,7 @@ - + SELECT log.event_id as eventId, log.event_date as eventDate, @@ -639,7 +639,7 @@ - + SELECT log.event_id, diff --git a/data-audit/kogito-addons-data-audit-quarkus/src/test/java/org/kie/kogito/app/audit/quarkus/QuarkusAuditUserTaskInstanceServiceTest.java b/data-audit/kogito-addons-data-audit-quarkus/src/test/java/org/kie/kogito/app/audit/quarkus/QuarkusAuditUserTaskInstanceServiceTest.java index e89087d241..eae56c4c4a 100644 --- a/data-audit/kogito-addons-data-audit-quarkus/src/test/java/org/kie/kogito/app/audit/quarkus/QuarkusAuditUserTaskInstanceServiceTest.java +++ b/data-audit/kogito-addons-data-audit-quarkus/src/test/java/org/kie/kogito/app/audit/quarkus/QuarkusAuditUserTaskInstanceServiceTest.java @@ -111,8 +111,8 @@ public void init() { UserTaskInstanceAttachmentEventBody.EVENT_TYPE_ADDED); publisher.publish(attEvent); - attEvent = newUserTaskInstanceAttachmentEvent(uEvent, "eventUser", "att2", "attName2", URI.create("http://localhost:8080/att2"), - UserTaskInstanceAttachmentEventBody.EVENT_TYPE_ADDED); + attEvent = newUserTaskInstanceAttachmentEvent(uEvent, "eventUser", "att2", "attName2", null, + UserTaskInstanceAttachmentEventBody.EVENT_TYPE_DELETED); publisher.publish(attEvent); UserTaskInstanceCommentDataEvent commentEvent; @@ -193,7 +193,7 @@ public void testGetAllUserTaskInstanceAttachments() { @Test public void testGetAllUserTaskInstanceComment() { String query = - "{ GetAllUserTaskInstanceComment (userTaskInstanceId : \\\"1\\\") { eventId, eventDate, userTaskDefinitionId, userTaskInstanceId, processInstanceId, businessKey, commentId, commentContent, eventType } }"; + "{ GetAllUserTaskInstanceComments (userTaskInstanceId : \\\"1\\\") { eventId, eventDate, userTaskDefinitionId, userTaskInstanceId, processInstanceId, businessKey, commentId, commentContent, eventType } }"; query = wrapQuery(query); List> data = given() .contentType(ContentType.JSON) @@ -204,7 +204,7 @@ public void testGetAllUserTaskInstanceComment() { .assertThat() .statusCode(200) .and() - .extract().path("data.GetAllUserTaskInstanceComment"); + .extract().path("data.GetAllUserTaskInstanceComments"); assertThat(data).hasSize(1); @@ -213,7 +213,7 @@ public void testGetAllUserTaskInstanceComment() { @Test public void testGetAllUserTaskInstanceDeadline() { String query = - "{ GetAllUserTaskInstanceDeadline (userTaskInstanceId : \\\"1\\\") { eventId, eventDate, userTaskDefinitionId, userTaskInstanceId, processInstanceId, businessKey, eventType, notification } }"; + "{ GetAllUserTaskInstanceDeadlines (userTaskInstanceId : \\\"1\\\") { eventId, eventDate, userTaskDefinitionId, userTaskInstanceId, processInstanceId, businessKey, eventType, notification } }"; query = wrapQuery(query); List> data = given() .contentType(ContentType.JSON) @@ -224,7 +224,7 @@ public void testGetAllUserTaskInstanceDeadline() { .assertThat() .statusCode(200) .and() - .extract().path("data.GetAllUserTaskInstanceDeadline"); + .extract().path("data.GetAllUserTaskInstanceDeadlines"); assertThat(data).hasSize(1); @@ -233,7 +233,7 @@ public void testGetAllUserTaskInstanceDeadline() { @Test public void testGetAllUserTaskInstanceVariable() { String query = - "{ GetAllUserTaskInstanceVariable (userTaskInstanceId : \\\"1\\\") { eventId, eventDate, userTaskDefinitionId, userTaskInstanceId, processInstanceId, businessKey, variableId, variableName, variableValue, variableType } }"; + "{ GetAllUserTaskInstanceVariables (userTaskInstanceId : \\\"1\\\") { eventId, eventDate, userTaskDefinitionId, userTaskInstanceId, processInstanceId, businessKey, variableId, variableName, variableValue, variableType } }"; query = wrapQuery(query); List> data = given() .contentType(ContentType.JSON) @@ -244,7 +244,7 @@ public void testGetAllUserTaskInstanceVariable() { .assertThat() .statusCode(200) .and() - .extract().path("data.GetAllUserTaskInstanceVariable"); + .extract().path("data.GetAllUserTaskInstanceVariables"); assertThat(data).hasSize(3);