aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap/clamp/clds/client/TcaPolicyDeleteDelegate.java
blob: 31e05d7dd598d3109c9268747787d3d4d235a19c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package org.onap.clamp.clds.client;

import java.util.logging.Logger;

import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.springframework.beans.factory.annotation.Autowired;

import org.onap.clamp.clds.model.prop.ModelProperties;
import org.onap.clamp.clds.model.prop.Tca;
import org.onap.clamp.clds.model.refprop.RefProp;


/**
 * Delete Tca Policy via policy api. 
 * 
 *
 */
public class TcaPolicyDeleteDelegate implements JavaDelegate {
	// currently uses the java.util.logging.Logger like the Camunda engine
	private static final Logger logger = Logger.getLogger(TcaPolicyDeleteDelegate.class.getName());
	
	@Autowired
	private PolicyClient policyClient;
	
	/**
	 * Perform activity.  Delete Tca Policy via policy api.
	 * 
	 * @param execution
	 */
	public void execute(DelegateExecution execution) throws Exception {		

		ModelProperties prop = ModelProperties.create(execution);
		Tca tca = prop.getTca();
		if(tca.isFound()){
			prop.setCurrentModelElementId(tca.getId());
	
			String responseMessage = policyClient.deleteMicrosService(prop); 
			if(responseMessage != null)
			{
				execution.setVariable("tcaPolicyDeleteResponseMessage", responseMessage.getBytes());
			}
		}
	}
	
	
	
}