Merge from ECOMP's repository
[vid.git] / vid-app-common / src / main / java / org / onap / vid / job / command / VnfInstantiationCommand.java
1 package org.onap.vid.job.command;
2
3 import org.onap.vid.changeManagement.RequestDetailsWrapper;
4 import org.onap.vid.job.Job;
5 import org.onap.vid.job.JobAdapter;
6 import org.onap.vid.job.NextCommand;
7 import org.onap.vid.job.command.CommandParentData.CommandDataKey;
8 import org.onap.vid.model.serviceInstantiation.Vnf;
9 import org.onap.vid.mso.model.VnfInstantiationRequestDetails;
10 import org.onap.vid.services.AsyncInstantiationBusinessLogic;
11 import org.springframework.beans.factory.config.ConfigurableBeanFactory;
12 import org.springframework.context.annotation.Scope;
13 import org.springframework.stereotype.Component;
14
15 import javax.inject.Inject;
16
17 @Component
18 @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
19 public class VnfInstantiationCommand extends ResourceInstantiationCommand {
20
21     @Inject
22     private AsyncInstantiationBusinessLogic asyncInstantiationBL;
23
24     @Override
25     protected String getRequestPath() {
26         return asyncInstantiationBL.getVnfInstantiationPath( commandParentData.getInstanceId(CommandDataKey.SERVICE_INSTANCE_ID));
27     }
28
29     @Override
30     protected RequestDetailsWrapper<VnfInstantiationRequestDetails> generateMSORequest(JobAdapter.AsyncJobRequest request, String userId) {
31         return asyncInstantiationBL.generateVnfInstantiationRequest(
32                 (Vnf) getSharedData().getRequest(),
33                 commandParentData.getModelInfo(CommandDataKey.SERVICE_MODEL_INFO),
34                 commandParentData.getInstanceId(CommandDataKey.SERVICE_INSTANCE_ID),
35                 getSharedData().getUserId()
36         );
37     }
38
39     @Override
40     protected String getJobAuditMSOStatus() {
41         return "VNF_REQUESTED";
42     }
43
44     @Override
45     protected NextCommand getNextCommand(String requestId, String instanceId) {
46         return new NextCommand(Job.JobStatus.RESOURCE_IN_PROGRESS,
47                 new VnfInProgressStatusCommand(getSharedData(), requestId, instanceId, commandParentData));
48     }
49
50 }