1 package org.onap.vid.job.command;
3 import org.onap.vid.job.Job;
4 import org.onap.vid.job.JobType;
5 import org.onap.vid.job.NextCommand;
6 import org.onap.vid.job.command.CommandParentData.CommandDataKey;
7 import org.onap.vid.job.impl.JobSharedData;
8 import org.onap.vid.model.serviceInstantiation.VfModule;
9 import org.springframework.beans.factory.config.ConfigurableBeanFactory;
10 import org.springframework.context.annotation.Scope;
11 import org.springframework.stereotype.Component;
13 import java.util.Arrays;
14 import java.util.List;
18 @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
19 public class VolumeGroupInProgressStatusCommand extends ResourceWithChildrenInProgressCommand {
21 public VolumeGroupInProgressStatusCommand(
22 JobSharedData sharedData,
25 CommandParentData parentData) {
26 super(sharedData, requestId, instanceId, parentData);
29 public VolumeGroupInProgressStatusCommand() {
33 protected NextCommand processJobStatus(Job.JobStatus jobStatus) {
34 if (jobStatus == Job.JobStatus.FAILED) {
35 return new NextCommand(Job.JobStatus.FAILED);
37 VfModule request = (VfModule) getSharedData().getRequest();
39 if (jobStatus == Job.JobStatus.COMPLETED) {
41 Map<String, Object> dataForChild = buildDataForChild();
42 List<String> vfModuleJob = Arrays.asList(jobsBrokerService.add(
43 jobAdapter.createChildJob(JobType.VfmoduleInstantiation, Job.JobStatus.CREATING , request, getSharedData(), dataForChild)).toString());
45 return new NextCommand(Job.JobStatus.RESOURCE_IN_PROGRESS, new WatchingCommand(getSharedData(), vfModuleJob, false));
48 //in case of JobStatus.PAUSE we leave the job itself as IN_PROGRESS, for keep tracking job progress
49 if (jobStatus == Job.JobStatus.PAUSE) {
50 return new NextCommand(Job.JobStatus.RESOURCE_IN_PROGRESS, this);
52 return new NextCommand(jobStatus, this);
56 protected Map<String, Object> buildDataForChild() {
57 commandParentData.addInstanceId(CommandDataKey.VG_INSTANCE_ID, this.instanceId);
58 return super.buildDataForChild();
62 protected ExpiryChecker getExpiryChecker() {