diff --git a/addons/common/process-management/src/main/java/org/kie/kogito/process/management/BaseProcessInstanceManagementResource.java b/addons/common/process-management/src/main/java/org/kie/kogito/process/management/BaseProcessInstanceManagementResource.java index f2614a1640c..64c56c8d20b 100644 --- a/addons/common/process-management/src/main/java/org/kie/kogito/process/management/BaseProcessInstanceManagementResource.java +++ b/addons/common/process-management/src/main/java/org/kie/kogito/process/management/BaseProcessInstanceManagementResource.java @@ -37,7 +37,6 @@ import org.kie.kogito.process.ProcessError; import org.kie.kogito.process.ProcessInstance; import org.kie.kogito.process.ProcessInstanceExecutionException; -import org.kie.kogito.process.ProcessService; import org.kie.kogito.process.Processes; import org.kie.kogito.process.WorkItem; import org.kie.kogito.process.impl.AbstractProcess; @@ -129,10 +128,10 @@ public T doGetInstanceInError(String processId, String processInstanceId) { }); } - public T doMigrateInstance(ProcessService processService, String processId, ProcessMigrationSpec migrationSpec, String processInstanceId) { + public T doMigrateInstance(String processId, ProcessMigrationSpec migrationSpec, String processInstanceId) { try { Process<? extends Model> process = processes.get().processById(processId); - processService.migrateProcessInstances(process, migrationSpec.getTargetProcessId(), migrationSpec.getTargetProcessVersion(), processInstanceId); + process.instances().migrateProcessInstances(migrationSpec.getTargetProcessId(), migrationSpec.getTargetProcessVersion(), processInstanceId); Map<String, Object> message = new HashMap<>(); message.put("message", processInstanceId + " instance migrated"); message.put("processInstanceId", processInstanceId); @@ -142,10 +141,10 @@ public T doMigrateInstance(ProcessService processService, String processId, Proc } } - public T doMigrateAllInstances(ProcessService processService, String processId, ProcessMigrationSpec migrationSpec) { + public T doMigrateAllInstances(String processId, ProcessMigrationSpec migrationSpec) { try { Process<? extends Model> process = processes.get().processById(processId); - long numberOfProcessInstanceMigrated = processService.migrateAll(process, migrationSpec.getTargetProcessId(), migrationSpec.getTargetProcessVersion()); + long numberOfProcessInstanceMigrated = process.instances().migrateAll(migrationSpec.getTargetProcessId(), migrationSpec.getTargetProcessVersion()); Map<String, Object> message = new HashMap<>(); message.put("message", "All intances migrated"); message.put("numberOfProcessInstanceMigrated", numberOfProcessInstanceMigrated); diff --git a/quarkus/addons/process-management/runtime/src/main/java/org/kie/kogito/process/management/ProcessInstanceManagementResource.java b/quarkus/addons/process-management/runtime/src/main/java/org/kie/kogito/process/management/ProcessInstanceManagementResource.java index b792afaa8e7..c2b9bf1cc54 100644 --- a/quarkus/addons/process-management/runtime/src/main/java/org/kie/kogito/process/management/ProcessInstanceManagementResource.java +++ b/quarkus/addons/process-management/runtime/src/main/java/org/kie/kogito/process/management/ProcessInstanceManagementResource.java @@ -19,7 +19,6 @@ package org.kie.kogito.process.management; import org.kie.kogito.Application; -import org.kie.kogito.process.ProcessService; import org.kie.kogito.process.Processes; import jakarta.enterprise.inject.Instance; @@ -37,9 +36,6 @@ @Path("/management/processes/") public class ProcessInstanceManagementResource extends BaseProcessInstanceManagementResource<Response> { - @Inject - ProcessService processService; - //CDI public ProcessInstanceManagementResource() { this(null, null); @@ -111,7 +107,7 @@ public Response getInstanceInError(@PathParam("processId") String processId, @Pa @Path("{processId}/instances/{processInstanceId}/migrate") @Produces(MediaType.APPLICATION_JSON) public Response migrateInstance(@PathParam("processId") String processId, @PathParam("processInstanceId") String processInstanceId, ProcessMigrationSpec migrationSpec) { - return doMigrateInstance(processService, processId, migrationSpec, processInstanceId); + return doMigrateInstance(processId, migrationSpec, processInstanceId); } @Override @@ -119,7 +115,7 @@ public Response migrateInstance(@PathParam("processId") String processId, @PathP @Path("{processId}/migrate") @Produces(MediaType.APPLICATION_JSON) public Response migrateAllInstances(@PathParam("processId") String processId, ProcessMigrationSpec migrationSpec) { - return doMigrateAllInstances(processService, processId, migrationSpec); + return doMigrateAllInstances(processId, migrationSpec); } @Override diff --git a/springboot/addons/process-management/src/main/java/org/kie/kogito/process/management/ProcessInstanceManagementRestController.java b/springboot/addons/process-management/src/main/java/org/kie/kogito/process/management/ProcessInstanceManagementRestController.java index 205498e5da3..5f143aac29f 100644 --- a/springboot/addons/process-management/src/main/java/org/kie/kogito/process/management/ProcessInstanceManagementRestController.java +++ b/springboot/addons/process-management/src/main/java/org/kie/kogito/process/management/ProcessInstanceManagementRestController.java @@ -19,7 +19,6 @@ package org.kie.kogito.process.management; import org.kie.kogito.Application; -import org.kie.kogito.process.ProcessService; import org.kie.kogito.process.Processes; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; @@ -38,9 +37,6 @@ @RequestMapping("/management/processes") public class ProcessInstanceManagementRestController extends BaseProcessInstanceManagementResource<ResponseEntity> { - @Autowired - ProcessService processService; - @Autowired @Lazy public ProcessInstanceManagementRestController(Processes processes, Application application) { @@ -83,13 +79,13 @@ public ResponseEntity getProcessNodes(@PathVariable("processId") String processI @Override @PostMapping(value = "{processId}/instances/{processInstanceId}/migrate", produces = APPLICATION_JSON_VALUE) public ResponseEntity migrateInstance(@PathVariable("processId") String processId, @PathVariable("processInstanceId") String processInstanceId, ProcessMigrationSpec migrationSpec) { - return doMigrateInstance(processService, processId, migrationSpec, processInstanceId); + return doMigrateInstance(processId, migrationSpec, processInstanceId); } @Override @PostMapping(value = "{processId}/migrate", produces = APPLICATION_JSON_VALUE) public ResponseEntity migrateAllInstances(String processId, ProcessMigrationSpec migrationSpec) { - return doMigrateAllInstances(processService, processId, migrationSpec); + return doMigrateAllInstances(processId, migrationSpec); } @Override