31e05d7dd598d3109c9268747787d3d4d235a19c
[clamp.git] / src / main / java / org / onap / clamp / clds / client / TcaPolicyDeleteDelegate.java
1 package org.onap.clamp.clds.client;
2
3 import java.util.logging.Logger;
4
5 import org.camunda.bpm.engine.delegate.DelegateExecution;
6 import org.camunda.bpm.engine.delegate.JavaDelegate;
7 import org.springframework.beans.factory.annotation.Autowired;
8
9 import org.onap.clamp.clds.model.prop.ModelProperties;
10 import org.onap.clamp.clds.model.prop.Tca;
11 import org.onap.clamp.clds.model.refprop.RefProp;
12
13
14 /**
15  * Delete Tca Policy via policy api. 
16  * 
17  *
18  */
19 public class TcaPolicyDeleteDelegate implements JavaDelegate {
20         // currently uses the java.util.logging.Logger like the Camunda engine
21         private static final Logger logger = Logger.getLogger(TcaPolicyDeleteDelegate.class.getName());
22         
23         @Autowired
24         private PolicyClient policyClient;
25         
26         /**
27          * Perform activity.  Delete Tca Policy via policy api.
28          * 
29          * @param execution
30          */
31         public void execute(DelegateExecution execution) throws Exception {             
32
33                 ModelProperties prop = ModelProperties.create(execution);
34                 Tca tca = prop.getTca();
35                 if(tca.isFound()){
36                         prop.setCurrentModelElementId(tca.getId());
37         
38                         String responseMessage = policyClient.deleteMicrosService(prop); 
39                         if(responseMessage != null)
40                         {
41                                 execution.setVariable("tcaPolicyDeleteResponseMessage", responseMessage.getBytes());
42                         }
43                 }
44         }
45         
46         
47         
48 }