32c852b0e1f37135882bcd9463b62de9426e668d
[so.git] /
1 package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
2
3 import org.onap.so.bpmn.common.BuildingBlockExecution;
4 import org.onap.so.client.exception.ExceptionBuilder;
5 import org.slf4j.Logger;
6 import org.slf4j.LoggerFactory;
7 import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.core.env.Environment;
9 import org.springframework.stereotype.Component;
10
11 @Component
12 public class ActivateVfModule {
13
14     private static final Logger logger = LoggerFactory.getLogger(ActivateVfModule.class);
15         
16         protected static final String VF_MODULE_TIMER_DURATION_PATH = "mso.workflow.vfModuleActivate.timer.duration";
17         protected static final String DEFAULT_TIMER_DURATION = "PT180S";
18         
19         @Autowired
20         private ExceptionBuilder exceptionUtil;
21         
22         @Autowired
23     private Environment environment;
24
25
26         public void setTimerDuration(BuildingBlockExecution execution) {
27                 try {
28                         String waitDuration = this.environment.getProperty(VF_MODULE_TIMER_DURATION_PATH, DEFAULT_TIMER_DURATION);
29                         logger.debug("Sleeping before proceeding with SDNC activate. Timer duration: {}", waitDuration);
30                         execution.setVariable("vfModuleActivateTimerDuration", waitDuration);
31                 } catch (Exception e) {
32                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, e);
33                 }
34         }
35 }