use of org.kie.server.api.model.admin.MigrationReportInstance in project droolsjbpm-integration by kiegroup.
the class ProcessAdminResource method migrateProcessInstance.
@ApiOperation(value = "Migrates a specified process instance to a process definition in another KIE container.")
@ApiResponses(value = { @ApiResponse(code = 500, message = "Unexpected error"), @ApiResponse(code = 404, message = "Process instance or Container Id not found"), @ApiResponse(code = 404, message = "Container Id not found"), @ApiResponse(code = 201, response = MigrationReportInstance.class, message = "Successful response", examples = @Example(value = { @ExampleProperty(mediaType = JSON, value = GET_MIGRATION_REPORT_RESPONSE_JSON) })) })
@PUT
@Path(MIGRATE_PROCESS_INST_PUT_URI)
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response migrateProcessInstance(@javax.ws.rs.core.Context HttpHeaders headers, @ApiParam(value = "container id that process instance belongs to", required = true, example = "evaluation_1.0.0-SNAPSHOT") @PathParam(CONTAINER_ID) String containerId, @ApiParam(value = "identifier of process instance to be migrated", required = true, example = "123") @PathParam(PROCESS_INST_ID) Long processInstanceId, @ApiParam(value = "container id that new process definition belongs to", required = true) @QueryParam("targetContainerId") String targetContainerId, @ApiParam(value = "process definition that process instance should be migrated to", required = true) @QueryParam("targetProcessId") String targetProcessId, @ApiParam(value = "node mapping - unique ids of old definition to new definition given as Map", required = false, examples = @Example(value = { @ExampleProperty(mediaType = JSON, value = SIMPLE_VAR_MAP_JSON), @ExampleProperty(mediaType = XML, value = SIMPLE_VAR_MAP_XML) })) String payload) {
Variant v = getVariant(headers);
String type = getContentType(headers);
Header conversationIdHeader = buildConversationIdHeader(containerId, context, headers);
try {
MigrationReportInstance reportInstance = processAdminServiceBase.migrateProcessInstance(containerId, processInstanceId, targetContainerId, targetProcessId, payload, type);
return createCorrectVariant(reportInstance, headers, Response.Status.CREATED, conversationIdHeader);
} catch (ProcessInstanceNotFoundException e) {
return notFound(MessageFormat.format(PROCESS_INSTANCE_NOT_FOUND, processInstanceId), v, conversationIdHeader);
} catch (DeploymentNotFoundException e) {
return notFound(MessageFormat.format(CONTAINER_NOT_FOUND, containerId), v, conversationIdHeader);
} catch (Exception e) {
logger.error("Unexpected error during processing {}", e.getMessage(), e);
return internalServerError(errorMessage(e), v, conversationIdHeader);
}
}
use of org.kie.server.api.model.admin.MigrationReportInstance in project droolsjbpm-integration by kiegroup.
the class ConvertUtils method convertMigrationReports.
public static MigrationReportInstanceList convertMigrationReports(List<MigrationReport> reports) {
if (reports == null) {
return new MigrationReportInstanceList();
}
MigrationReportInstance[] reportInstances = new MigrationReportInstance[reports.size()];
int index = 0;
for (MigrationReport report : reports) {
MigrationReportInstance instance = convertMigrationReport(report);
reportInstances[index] = instance;
index++;
}
return new MigrationReportInstanceList(reportInstances);
}
Aggregations