use of com.dell.cpsd.paqx.fru.valueobject.NextStep in project fru-paqx-parent by dellemc-symphony.
the class WorkflowResource method installEsxi.
@POST
@Path("{jobId}/install-esxi")
public void installEsxi(@Suspended final AsyncResponse asyncResponse, @PathParam("jobId") String jobId, @Context UriInfo uriInfo) {
asyncResponse.setTimeoutHandler(asyncResponse1 -> asyncResponse1.resume(Response.status(Response.Status.SERVICE_UNAVAILABLE).entity("{\"status\":\"timeout\"}").build()));
asyncResponse.setTimeout(10, TimeUnit.SECONDS);
//
final String thisStep = findStepFromPath(uriInfo);
final Job job = workflowService.findJob(UUID.fromString(jobId));
final JobRepresentation jobRepresentation = new JobRepresentation(job);
final NextStep nextStep = workflowService.findNextStep(job.getWorkflow(), thisStep);
if (nextStep != null) {
workflowService.advanceToNextStep(job, thisStep);
jobRepresentation.addLink(createNextStepLink(uriInfo, job, nextStep.getNextStep()), findMethodFromStep(nextStep.getNextStep()));
}
LOG.info("Completing response");
asyncResponse.resume(Response.ok(jobRepresentation).build());
LOG.debug("Completed response");
}
use of com.dell.cpsd.paqx.fru.valueobject.NextStep in project fru-paqx-parent by dellemc-symphony.
the class WorkflowResource method deploySVM.
@POST
@Path("{jobId}/deploy-svm")
public void deploySVM(@Suspended final AsyncResponse asyncResponse, @PathParam("jobId") String jobId, @Context UriInfo uriInfo) {
asyncResponse.setTimeoutHandler(asyncResponse1 -> asyncResponse1.resume(Response.status(Response.Status.SERVICE_UNAVAILABLE).entity("{\"status\":\"timeout\"}").build()));
asyncResponse.setTimeout(10, TimeUnit.SECONDS);
//
final String thisStep = findStepFromPath(uriInfo);
final Job job = workflowService.findJob(UUID.fromString(jobId));
final JobRepresentation jobRepresentation = new JobRepresentation(job);
final NextStep nextStep = workflowService.findNextStep(job.getWorkflow(), thisStep);
if (nextStep != null) {
workflowService.advanceToNextStep(job, thisStep);
jobRepresentation.addLink(createNextStepLink(uriInfo, job, nextStep.getNextStep()), findMethodFromStep(nextStep.getNextStep()));
}
LOG.info("Completing response");
asyncResponse.resume(Response.ok(jobRepresentation).build());
LOG.debug("Completed response");
}
use of com.dell.cpsd.paqx.fru.valueobject.NextStep in project fru-paqx-parent by dellemc-symphony.
the class WorkflowResource method mapScaleIOVolumesToHost.
@POST
@Path("{jobId}/map-scaleio-volumes-to-host")
public void mapScaleIOVolumesToHost(@Suspended final AsyncResponse asyncResponse, @PathParam("jobId") String jobId, @Context UriInfo uriInfo) {
asyncResponse.setTimeoutHandler(asyncResponse1 -> asyncResponse1.resume(Response.status(Response.Status.SERVICE_UNAVAILABLE).entity("{\"status\":\"timeout\"}").build()));
asyncResponse.setTimeout(10, TimeUnit.SECONDS);
//
final String thisStep = findStepFromPath(uriInfo);
final Job job = workflowService.findJob(UUID.fromString(jobId));
final JobRepresentation jobRepresentation = new JobRepresentation(job);
final NextStep nextStep = workflowService.findNextStep(job.getWorkflow(), thisStep);
if (nextStep != null) {
workflowService.advanceToNextStep(job, thisStep);
jobRepresentation.addLink(createNextStepLink(uriInfo, job, nextStep.getNextStep()), findMethodFromStep(nextStep.getNextStep()));
}
LOG.info("Completing response");
asyncResponse.resume(Response.ok(jobRepresentation).build());
LOG.debug("Completed response");
}
use of com.dell.cpsd.paqx.fru.valueobject.NextStep in project fru-paqx-parent by dellemc-symphony.
the class WorkflowResource method instructPhysicalRemoval.
@POST
@Path("{jobId}/instruct-physical-removal")
public void instructPhysicalRemoval(@Suspended final AsyncResponse asyncResponse, @PathParam("jobId") String jobId, @Context UriInfo uriInfo) {
asyncResponse.setTimeoutHandler(asyncResponse1 -> asyncResponse1.resume(Response.status(Response.Status.SERVICE_UNAVAILABLE).entity("{\"status\":\"timeout\"}").build()));
asyncResponse.setTimeout(10, TimeUnit.SECONDS);
//
final String thisStep = findStepFromPath(uriInfo);
final Job job = workflowService.findJob(UUID.fromString(jobId));
final JobRepresentation jobRepresentation = new JobRepresentation(job);
final NextStep nextStep = workflowService.findNextStep(job.getWorkflow(), thisStep);
if (nextStep != null) {
workflowService.advanceToNextStep(job, thisStep);
jobRepresentation.addLink(createNextStepLink(uriInfo, job, nextStep.getNextStep()), findMethodFromStep(nextStep.getNextStep()));
}
LOG.info("Completing response");
asyncResponse.resume(Response.ok(jobRepresentation).build());
LOG.debug("Completed response");
}
use of com.dell.cpsd.paqx.fru.valueobject.NextStep in project fru-paqx-parent by dellemc-symphony.
the class WorkflowServiceImpl method advanceToNextStep.
@Override
public Job advanceToNextStep(final Job job, String currentStep) {
final NextStep nextStep = findNextStep(job.getWorkflow(), currentStep);
job.changeToNextStep(nextStep.getNextStep());
jobRepository.save(job);
return job;
}
Aggregations