From 3dc985a3a5702fa6ba130c16f34cb687f50c2bc0 Mon Sep 17 00:00:00 2001 From: Enrique Date: Wed, 18 Oct 2023 19:26:37 +0200 Subject: [PATCH] [kie-issues-249] Data index improvements (#5529) --- .../kie/api/event/usertask/Attachment.java | 37 +++++++++++ .../org/kie/api/event/usertask/Comment.java | 34 ++++++++++ .../usertask/UserTaskAssignmentEvent.java | 30 +++++++++ .../usertask/UserTaskAttachmentEvent.java | 28 +++++++++ .../event/usertask/UserTaskCommentEvent.java | 28 +++++++++ .../event/usertask/UserTaskDeadlineEvent.java | 56 +++++++++++++++++ .../kie/api/event/usertask/UserTaskEvent.java | 62 +++++++++++++++++++ .../event/usertask/UserTaskStateEvent.java | 26 ++++++++ .../event/usertask/UserTaskVariableEvent.java | 34 ++++++++++ .../api/runtime/process/ProcessInstance.java | 2 + 10 files changed, 337 insertions(+) create mode 100644 kie-api/src/main/java/org/kie/api/event/usertask/Attachment.java create mode 100644 kie-api/src/main/java/org/kie/api/event/usertask/Comment.java create mode 100644 kie-api/src/main/java/org/kie/api/event/usertask/UserTaskAssignmentEvent.java create mode 100644 kie-api/src/main/java/org/kie/api/event/usertask/UserTaskAttachmentEvent.java create mode 100644 kie-api/src/main/java/org/kie/api/event/usertask/UserTaskCommentEvent.java create mode 100644 kie-api/src/main/java/org/kie/api/event/usertask/UserTaskDeadlineEvent.java create mode 100644 kie-api/src/main/java/org/kie/api/event/usertask/UserTaskEvent.java create mode 100644 kie-api/src/main/java/org/kie/api/event/usertask/UserTaskStateEvent.java create mode 100644 kie-api/src/main/java/org/kie/api/event/usertask/UserTaskVariableEvent.java diff --git a/kie-api/src/main/java/org/kie/api/event/usertask/Attachment.java b/kie-api/src/main/java/org/kie/api/event/usertask/Attachment.java new file mode 100644 index 00000000000..ded0ce0df24 --- /dev/null +++ b/kie-api/src/main/java/org/kie/api/event/usertask/Attachment.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.kie.api.event.usertask; + +import java.net.URI; +import java.util.Date; + +public interface Attachment { + + String getAttachmentId(); + + String getAttachmentName(); + + URI getAttachmentURI(); + + String getUpdatedBy(); + + Date getUpdatedAt(); + +} diff --git a/kie-api/src/main/java/org/kie/api/event/usertask/Comment.java b/kie-api/src/main/java/org/kie/api/event/usertask/Comment.java new file mode 100644 index 00000000000..004d3e7d6ee --- /dev/null +++ b/kie-api/src/main/java/org/kie/api/event/usertask/Comment.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.kie.api.event.usertask; + +import java.util.Date; + +public interface Comment { + + String getCommentId(); + + String getCommentContent(); + + String getUpdatedBy(); + + Date getUpdatedAt(); + +} diff --git a/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskAssignmentEvent.java b/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskAssignmentEvent.java new file mode 100644 index 00000000000..01d460e0ddb --- /dev/null +++ b/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskAssignmentEvent.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.kie.api.event.usertask; + +public interface UserTaskAssignmentEvent extends UserTaskEvent { + + String getAssignmentType(); + + String[] getNewUsersId(); + + String[] getOldUsersId(); + +} diff --git a/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskAttachmentEvent.java b/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskAttachmentEvent.java new file mode 100644 index 00000000000..9f82c73605e --- /dev/null +++ b/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskAttachmentEvent.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.kie.api.event.usertask; + +public interface UserTaskAttachmentEvent extends UserTaskEvent { + + Attachment getOldAttachment(); + + Attachment getNewAttachment(); + +} diff --git a/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskCommentEvent.java b/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskCommentEvent.java new file mode 100644 index 00000000000..b51eb3e6bd6 --- /dev/null +++ b/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskCommentEvent.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.kie.api.event.usertask; + +public interface UserTaskCommentEvent extends UserTaskEvent { + + Comment getOldComment(); + + Comment getNewComment(); + +} diff --git a/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskDeadlineEvent.java b/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskDeadlineEvent.java new file mode 100644 index 00000000000..c1c46b7a1d0 --- /dev/null +++ b/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskDeadlineEvent.java @@ -0,0 +1,56 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.kie.api.event.usertask; + +import java.util.Map; + +import org.kie.api.runtime.process.WorkItem; + +/** + * An event when a dealine for task has expired + */ +public interface UserTaskDeadlineEvent extends UserTaskEvent { + + enum DeadlineType { + Started, + Completed + } + + /** + * Returns work item which timeout expires + * + * @return work item + */ + WorkItem getWorkItem(); + + /** + * Returns notification data + * + * @return key-value pair list + */ + Map getNotification(); + + /** + * Returns dealine type + * + * @return not started or not completed + */ + DeadlineType getType(); +} \ No newline at end of file diff --git a/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskEvent.java b/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskEvent.java new file mode 100644 index 00000000000..8f45c48b905 --- /dev/null +++ b/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskEvent.java @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.kie.api.event.usertask; + +import java.util.Date; + +import org.kie.api.event.KieRuntimeEvent; +import org.kie.api.runtime.process.NodeInstance; +import org.kie.api.runtime.process.ProcessInstance; +import org.kie.api.runtime.process.WorkItem; + +/** + * A runtime event related to the execution of process instances. + */ +public interface UserTaskEvent + extends + KieRuntimeEvent { + + /** + * The ProcessInstance this event relates to. + * + * @return the process instance + */ + ProcessInstance getProcessInstance(); + + NodeInstance getNodeInstance(); + + WorkItem getWorkItem(); + + String getUserTaskId(); + + String getUserTaskDefinitionId(); + + /** + * Returns exact date when the event was created + * @return time when event was created + */ + Date getEventDate(); + + /** + * @return associated identity that performed the event + */ + String getEventUser(); + +} diff --git a/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskStateEvent.java b/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskStateEvent.java new file mode 100644 index 00000000000..41c2ecf021c --- /dev/null +++ b/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskStateEvent.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.kie.api.event.usertask; + +public interface UserTaskStateEvent extends UserTaskEvent { + + + +} diff --git a/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskVariableEvent.java b/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskVariableEvent.java new file mode 100644 index 00000000000..a7dab82d79f --- /dev/null +++ b/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskVariableEvent.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.kie.api.event.usertask; + +public interface UserTaskVariableEvent extends UserTaskEvent { + + enum VariableEventType { + INPUT, OUTPUT + } + + String getVariableName(); + + Object getOldValue(); + + Object getNewValue(); + + VariableEventType getVariableType(); +} diff --git a/kie-api/src/main/java/org/kie/api/runtime/process/ProcessInstance.java b/kie-api/src/main/java/org/kie/api/runtime/process/ProcessInstance.java index 7d46c14a1b8..68789b07dea 100644 --- a/kie-api/src/main/java/org/kie/api/runtime/process/ProcessInstance.java +++ b/kie-api/src/main/java/org/kie/api/runtime/process/ProcessInstance.java @@ -89,4 +89,6 @@ public interface ProcessInstance */ String getParentProcessInstanceId(); + String getProcessVersion(); + }