Merge from ECOMP's repository
[vid.git] / vid-app-common / src / main / java / org / onap / vid / job / command / WatchingCommand.java
1 package org.onap.vid.job.command;
2
3 import org.onap.vid.job.Job;
4 import org.onap.vid.job.NextCommand;
5 import org.onap.vid.job.impl.JobSharedData;
6 import org.springframework.beans.factory.config.ConfigurableBeanFactory;
7 import org.springframework.context.annotation.Scope;
8 import org.springframework.stereotype.Component;
9
10 import java.util.List;
11
12 @Component
13 @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
14 public class WatchingCommand extends BaseWatchingCommand {
15
16     public WatchingCommand() {}
17
18     public WatchingCommand(JobSharedData sharedData, List<String> childrenJobsIds, boolean isService) {
19         super(sharedData, childrenJobsIds, isService);
20     }
21
22     protected NextCommand getNextCommand(Job.JobStatus cumulativeJobsStatus) {
23         if (cumulativeJobsStatus==Job.JobStatus.IN_PROGRESS) {
24             return (isService) ? new NextCommand(Job.JobStatus.IN_PROGRESS, this)
25                                : new NextCommand(Job.JobStatus.RESOURCE_IN_PROGRESS, this);
26         }
27         if (isService) {
28             asyncInstantiationBL.updateServiceInfoAndAuditStatus(getSharedData().getJobUuid(), cumulativeJobsStatus);
29         }
30         return new NextCommand(cumulativeJobsStatus);
31     }
32
33 }