Skip to content

Commit

Permalink
Merge pull request #65 from rgdoliveira/sync_main
Browse files Browse the repository at this point in the history
Sync main branch with Apache main branch
  • Loading branch information
rgdoliveira authored Oct 11, 2024
2 parents c720f0c + cc6557d commit b516e43
Show file tree
Hide file tree
Showing 107 changed files with 4,354 additions and 1,943 deletions.
13 changes: 0 additions & 13 deletions addons/common/persistence/ddl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,4 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>productized</id>
<activation>
<property>
<name>productized</name>
</property>
</activation>
<properties>
<db.scripts.descriptor>src/assembly/productized-db-scripts.xml</db.scripts.descriptor>
</properties>
</profile>
</profiles>
</project>

This file was deleted.

20 changes: 0 additions & 20 deletions addons/common/persistence/postgresql/.gitignore

This file was deleted.

25 changes: 8 additions & 17 deletions addons/common/persistence/postgresql/pom.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
Expand Down Expand Up @@ -31,9 +31,10 @@
<description>PostgreSQL based persistence for KIE</description>
<properties>
<path.to.jdbc.addon>../jdbc</path.to.jdbc.addon>
<path.to.script.folder>src/main/resources/kie-flyway/db/</path.to.script.folder>
<path.to.migration.scripts.from>${path.to.jdbc.addon}/${path.to.script.folder}/persistence-jdbc/postgresql</path.to.migration.scripts.from>
<path.to.migration.scripts.to>${path.to.script.folder}/persistence-postgresql/postgresql</path.to.migration.scripts.to>
<path.to.flyway.location>kie-flyway/db</path.to.flyway.location>
<path.to.script.folder>src/main/resources/${path.to.flyway.location}/persistence-jdbc/postgresql</path.to.script.folder>
<path.to.migration.scripts.source>${path.to.jdbc.addon}/${path.to.script.folder}</path.to.migration.scripts.source>
<path.to.migration.scripts.target>target/classes/${path.to.flyway.location}/persistence-postgresql/postgresql</path.to.migration.scripts.target>
<java.module.name>org.kie.kogito.persistence.postgresql</java.module.name>
</properties>

Expand Down Expand Up @@ -117,17 +118,7 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<filesets>
<fileset>
<directory>${path.to.script.folder}</directory>
</fileset>
</filesets>
</configuration>
</plugin>
<!-- The cleanest way would be to use the maven-dependency-plugin to unpack and copy scripts from the built artifact `kie-addons-persistence-jdbc` but there's a limitation to using this only in the `package` phase whereas we need that into the `generate-sources` phase. See also https://issues.apache.org/jira/browse/MDEP-98 -->
<!-- The cleanest way would be to use the maven-dependency-plugin to unpack and copy scripts from the built artifact `kie-addons-persistence-jdbc` but there's a limitation to using this only in the `package` phase whereas we need that into the `generate-sources` phase. See also https://issues.apache.org/jira/browse/MDEP-98 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
Expand All @@ -139,10 +130,10 @@
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${path.to.migration.scripts.to}</outputDirectory>
<outputDirectory>${path.to.migration.scripts.target}</outputDirectory>
<resources>
<resource>
<directory>${path.to.migration.scripts.from}</directory>
<directory>${path.to.migration.scripts.source}</directory>
</resource>
</resources>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public interface KogitoWorkItemHandlerFactory {

public static List<KogitoWorkItemHandler> findAllKogitoWorkItemHandlersRegistered() {
List<KogitoWorkItemHandler> handlers = new ArrayList<>();
ServiceLoader.load(KogitoWorkItemHandlerFactory.class).stream()
ServiceLoader.load(KogitoWorkItemHandlerFactory.class, Thread.currentThread().getContextClassLoader()).stream()
.map(ServiceLoader.Provider<KogitoWorkItemHandlerFactory>::get)
.map(KogitoWorkItemHandlerFactory::provide)
.flatMap(List::stream)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import org.kie.kogito.usertask.UserTaskEventListener;
import org.kie.kogito.usertask.UserTaskInstance;
import org.kie.kogito.usertask.lifecycle.UserTaskState;
import org.kie.kogito.usertask.model.Attachment;
import org.kie.kogito.usertask.model.Comment;

Expand All @@ -37,7 +38,7 @@ enum AssignmentType {

void fireOneUserTaskStateChange(
UserTaskInstance instance,
String oldPhaseStatus, String newPhaseStatus);
UserTaskState oldPhaseStatus, UserTaskState newPhaseStatus);

void fireOnUserTaskNotStartedDeadline(
UserTaskInstance instance,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ public String getUpdatedBy() {
return updatedBy;
}

public void setId(K id) {
this.id = id;
}

public K getId() {
return id;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,6 @@ public interface UserTask {

Collection<DeadlineInfo<Reassignment>> getNotCompletedReassigments();

UserTaskAssignmentStrategy getAssignmentStrategy();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* 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.kogito.usertask;

import java.util.Optional;

import org.kie.kogito.auth.IdentityProvider;

public interface UserTaskAssignmentStrategy {

static final String DEFAULT_NAME = "default";

default String getName() {
return getClass().getName();
}

Optional<String> computeAssigment(UserTaskInstance userTaskInstance, IdentityProvider identityProvider);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* 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.kogito.usertask;

import java.util.List;

public interface UserTaskAssignmentStrategyConfig {

List<UserTaskAssignmentStrategy> userTaskAssignmentStrategies();

UserTaskAssignmentStrategy forName(String name);

default UserTaskAssignmentStrategy defaultUserTaskAssignmentStrategy() {
return forName(UserTaskAssignmentStrategy.DEFAULT_NAME);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public interface UserTaskConfig extends KogitoConfig {

UserTaskEventListenerConfig userTaskEventListeners();

UserTaskAssignmentStrategyConfig userTaskAssignmentStrategies();

UserTaskLifeCycle userTaskLifeCycle();

UnitOfWorkManager unitOfWorkManager();
Expand All @@ -36,4 +38,6 @@ public interface UserTaskConfig extends KogitoConfig {

IdentityProvider identityProvider();

UserTaskInstances userTaskInstances();

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import java.util.Map;
import java.util.Set;

import org.kie.kogito.auth.IdentityProvider;
import org.kie.kogito.usertask.lifecycle.UserTaskState;
import org.kie.kogito.usertask.lifecycle.UserTaskTransitionToken;
import org.kie.kogito.usertask.model.Attachment;
import org.kie.kogito.usertask.model.Comment;

Expand All @@ -35,19 +35,15 @@ public interface UserTaskInstance {

UserTaskState getStatus();

String getUserTaskId();

boolean hasActualOwner();

void setActuaOwner(String string);
void setActuaOwner(String actualOwner);

String getActualOwner();

UserTaskTransitionToken createTransitionToken(String transitionId, Map<String, Object> data);

void transition(UserTaskTransitionToken token);

void complete();

void abort();
void transition(String transitionId, Map<String, Object> data, IdentityProvider identityProvider);

String getExternalReferenceId();

Expand All @@ -59,6 +55,14 @@ public interface UserTaskInstance {

Map<String, Object> getMetadata();

Map<String, Object> getOutputs();

Map<String, Object> getInputs();

void setInput(String key, Object value);

void setOutput(String key, Object value);

/**
* Returns potential users that can work on this task
*
Expand Down Expand Up @@ -94,23 +98,24 @@ public interface UserTaskInstance {
*/
Set<String> getExcludedUsers();

void addAttachment(Attachment attachment);
Attachment findAttachmentById(String attachmentId);

void updateAttachment(Attachment newAttachment);
Attachment addAttachment(Attachment attachment);

void removeAttachment(Attachment oldAttachment);
Attachment updateAttachment(Attachment newAttachment);

void addComment(Comment comment);
Attachment removeAttachment(Attachment oldAttachment);

void updateComment(Comment newComment);
Collection<Attachment> getAttachments();

void removeComment(Comment comment);
Comment findCommentById(String commentId);

Collection<Comment> getComments();
Comment addComment(Comment comment);

Collection<Attachment> getAttachments();
Comment updateComment(Comment newComment);

Attachment findAttachmentById(String attachmentId);
Comment removeComment(Comment comment);

Collection<Comment> getComments();

Comment findCommentById(String commentId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,20 @@
*/
package org.kie.kogito.usertask;

import java.util.List;
import java.util.Optional;
import java.util.function.Function;

import org.kie.kogito.auth.IdentityProvider;

public interface UserTaskInstances {

void setReconnectUserTaskInstance(Function<UserTaskInstance, UserTaskInstance> reconnectUserTaskInstance);

void setDisconnectUserTaskInstance(Function<UserTaskInstance, UserTaskInstance> disconnectUserTaskInstance);

List<UserTaskInstance> findByIdentity(IdentityProvider identityProvider);

Optional<UserTaskInstance> findById(String userTaskInstanceId);

boolean exists(String userTaskInstanceId);
Expand All @@ -33,8 +42,4 @@ public interface UserTaskInstances {

UserTaskInstance remove(String userTaskInstanceId);

void setReconnectUserTaskInstance(Function<UserTaskInstance, UserTaskInstance> reconnectUserTaskInstance);

void setDisconnectUserTaskInstance(Function<UserTaskInstance, UserTaskInstance> disconnectUserTaskInstance);

}
Loading

0 comments on commit b516e43

Please sign in to comment.