Skip to content

Commit

Permalink
[Fix_3473] Fixing build (apache#3474)
Browse files Browse the repository at this point in the history
  • Loading branch information
fjtirado authored and rgdoliveira committed Apr 16, 2024
1 parent 3902bea commit 498a031
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -37,9 +36,6 @@
@Path("/management/processes/")
public class ProcessInstanceManagementResource extends BaseProcessInstanceManagementResource<Response> {

@Inject
ProcessService processService;

//CDI
public ProcessInstanceManagementResource() {
this(null, null);
Expand Down Expand Up @@ -111,15 +107,15 @@ 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
@POST
@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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -38,9 +37,6 @@
@RequestMapping("/management/processes")
public class ProcessInstanceManagementRestController extends BaseProcessInstanceManagementResource<ResponseEntity> {

@Autowired
ProcessService processService;

@Autowired
@Lazy
public ProcessInstanceManagementRestController(Processes processes, Application application) {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 498a031

Please sign in to comment.