Commit includes ControlLoopPolicy API and bugfixes
[policy/engine.git] / PolicyEngineAPI / src / main / java / org / openecomp / policy / api / PolicyEngine.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * PolicyEngineAPI
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.policy.api;
22
23 import java.util.Collection;
24 import java.util.Map;
25 import java.util.UUID;
26
27 import javax.json.JsonObject;
28
29 import org.openecomp.policy.api.NotificationHandler;
30 import org.openecomp.policy.api.PDPNotification;
31 import org.openecomp.policy.std.StdPolicyEngine;
32
33 /**
34  * PolicyEngine is the Interface that applications use to make policy queries against a PEPEngine 
35  * 
36  * @version 2.0
37  */
38 public class PolicyEngine{
39         private String propertyFilePath = null;
40         private StdPolicyEngine stdPolicyEngine;
41         private NotificationScheme scheme = null;
42         private NotificationHandler handler = null;
43         
44         /**
45          * PolicyEngine Constructor with <code>String</code> format of propertiesFilePathname
46          * 
47          * @param propertiesFilePathname the <code>String</code> format of the propertiesFilePathname 
48          * @throws PolicyEngineException PolicyEngine Exception
49          */
50         public PolicyEngine(String propertiesFilePathname) throws PolicyEngineException {
51                 this.propertyFilePath = propertiesFilePathname ; 
52                 this.stdPolicyEngine= new StdPolicyEngine(this.propertyFilePath, (String)null);
53         }
54         
55         /**
56          * PolicyEngine Constructor with <code>String</code> format of propertiesFilePathname
57          * 
58          * @param propertiesFilePathname the <code>String</code> format of the propertiesFilePathname
59          * @param clientKey depicts String format of Password/ Client_Key.  
60          * @throws PolicyEngineException PolicyEngine Exception
61          */
62         public PolicyEngine(String propertiesFilePathname, String clientKey) throws PolicyEngineException {
63                 this.propertyFilePath = propertiesFilePathname ; 
64                 this.stdPolicyEngine= new StdPolicyEngine(this.propertyFilePath, clientKey);
65         }
66         
67         /**
68          * PolicyEngine Constructor with <code>String</code> format of PropertiesFilePathname and <code>NotificationScheme</code>
69          * 
70          * @param propertiesFilePathname the <code>String</code> format of the propertiesFilePathname
71          * @param scheme the <code>NotificationScheme</code> of {@link org.openecomp.policy.api.NotificationScheme} which defines the Notification Scheme
72          * @throws PolicyEngineException PolicyEngine Exception
73          */
74         public PolicyEngine(String propertiesFilePathname, NotificationScheme scheme) throws PolicyEngineException{
75                 this.propertyFilePath = propertiesFilePathname;
76                 this.scheme = scheme;
77                 this.stdPolicyEngine = new StdPolicyEngine(this.propertyFilePath, this.scheme);
78         }
79         
80         /**
81          * PolicyEngine Constructor with <code>String</code> format of PropertiesFilePathname, <code>NotificationScheme</code> and <code>NotificationHandler</code>
82          *  
83          *  @param propertiesFilePathname the <code>String</code> format of the propertiesFilePathname 
84          *  @param scheme the <code>NotificationScheme</code> of {@link org.openecomp.policy.api.NotificationScheme} which defines the Notification Scheme
85          *  @param handler the <code>NotificationHandler</code> of {@link org.openecomp.policy.api.NotificationHandler} which defines what should happen when a notification is received.
86          *  @throws PolicyEngineException PolicyEngine Exception
87          */
88         public PolicyEngine(String propertiesFilePathname, NotificationScheme scheme, NotificationHandler handler) throws PolicyEngineException {
89                 this.propertyFilePath = propertiesFilePathname ;
90                 this.scheme = scheme;
91                 this.handler = handler;
92                 this.stdPolicyEngine= new StdPolicyEngine(this.propertyFilePath,this.scheme,this.handler);
93         }
94         
95         /**
96          * Gets the configuration from the PolicyDecisionPoint(PDP) for the <code>String</code> which represents the Policy File Name 
97          * 
98          * @param policyName the <code>String</code> format of the PolicyFile Name whose configuration is required. 
99          * @return <code>Collection</code> of {@link org.openecomp.policy.api.PolicyConfig} which has the configuration. 
100          * @throws PolicyConfigException PolicyConfig Exception
101          * @deprecated use {@link #getConfig(ConfigRequestParameters configRequestParameters)} Instead.
102          */
103         @Deprecated
104         public Collection<PolicyConfig> getConfigByPolicyName(String policyName) throws PolicyConfigException {
105                 return getConfig(setConfigRequestParameters(policyName, null, null, null, null));
106         }
107         
108         /**
109          * Gets the configuration from the PolicyDecisionPoint(PDP) for the <code>String</code> which represents the Policy File Name 
110          * 
111          * @param policyName the <code>String</code> format of the PolicyFile Name whose configuration is required. 
112          * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
113          * A different request ID should be passed for each request.
114          * @return <code>Collection</code> of {@link org.openecomp.policy.api.PolicyConfig} which has the configuration. 
115          * @throws PolicyConfigException PolicyConfig Exception
116          * @deprecated use {@link #getConfig(ConfigRequestParameters configRequestParameters)} Instead.
117          */
118         @Deprecated
119         public Collection<PolicyConfig> getConfigByPolicyName(String policyName, UUID requestID) throws PolicyConfigException {
120                 return getConfig(setConfigRequestParameters(policyName, null, null, null, requestID));  
121         }
122         
123         /**
124          * Gets the configuration from the PolicyDecisionPoint(PDP) for the <code>String</code> which represents the eCOMPComponentName 
125          * 
126          * @param eCOMPComponentName the <code>String</code> format of the eCOMPComponentName whose configuration is required. 
127          * @return <code>Collection</code> of {@link org.openecomp.policy.api.PolicyConfig} which has the configuration.
128          * @throws PolicyConfigException PolicyConfig Exception
129          * @deprecated use {@link #getConfig(ConfigRequestParameters)} Instead.
130          */
131         @Deprecated
132         public Collection<PolicyConfig> getConfig(String eCOMPComponentName) throws PolicyConfigException {
133                 return getConfig(setConfigRequestParameters(null, eCOMPComponentName, null, null, null));
134         }
135         
136         /**
137          * Gets the configuration from the PolicyDecisionPoint(PDP) for the <code>String</code> which represents the eCOMPComponentName 
138          * 
139          * @param eCOMPComponentName the <code>String</code> format of the eCOMPComponentName whose configuration is required. 
140          * @return <code>Collection</code> of {@link org.openecomp.policy.api.PolicyConfig} which has the configuration.
141          * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
142          * A different request ID should be passed for each request.
143          * @throws PolicyConfigException PolicyConfig Exception
144          * @deprecated use {@link #getConfig(ConfigRequestParameters)} Instead.
145          */
146         @Deprecated
147         public Collection<PolicyConfig> getConfig(String eCOMPComponentName, UUID requestID) throws PolicyConfigException {
148                 return getConfig(setConfigRequestParameters(null, eCOMPComponentName, null, null, requestID));
149         }
150         
151         /**
152          * Requests the configuration of the <code>String</code> which represents the eCOMPComponentName and <code>String</code>
153          * which represents the configName and returns the configuration if different Configurations exist for the
154          * particular eCOMPComponentName.  
155          * 
156          * @param eCOMPComponentName the <code>String</code> format of the eCOMPComponentName whose configuration is required.
157          * @param configName the <code>String</code> format of the configurationName whose configuration is required.
158          * @return <code>Collection</code> of {@link org.openecomp.policy.api.PolicyConfig} which has the configuration. 
159          * @throws PolicyConfigException PolicyConfig Exception
160          * @deprecated use {@link #getConfig(ConfigRequestParameters)} Instead.
161          */
162         @Deprecated
163         public Collection<PolicyConfig> getConfig(String eCOMPComponentName, String configName) throws PolicyConfigException {
164                 return getConfig(setConfigRequestParameters(null, eCOMPComponentName, configName, null, null));
165         }
166         
167         /**
168          * Requests the configuration of the <code>String</code> which represents the eCOMPComponentName and <code>String</code>
169          * which represents the configName and returns the configuration if different Configurations exist for the
170          * particular eCOMPComponentName.  
171          * 
172          * @param eCOMPComponentName the <code>String</code> format of the eCOMPComponentName whose configuration is required.
173          * @param configName the <code>String</code> format of the configurationName whose configuration is required.
174          * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
175          * A different request ID should be passed for each request.
176          * @return <code>Collection</code> of {@link org.openecomp.policy.api.PolicyConfig} which has the configuration. 
177          * @throws PolicyConfigException PolicyConfig Exception
178          * @deprecated use {@link #getConfig(ConfigRequestParameters)} Instead.
179          */
180         @Deprecated
181         public Collection<PolicyConfig> getConfig(String eCOMPComponentName, String configName, UUID requestID) throws PolicyConfigException {
182                 return getConfig(setConfigRequestParameters(null, eCOMPComponentName, configName, null, requestID));
183         }
184         
185         /**
186          * Requests the configuration of the <code>String</code> which represents the eCOMPComponentName, <code>String</code>
187          * which represents the configName and <code>Map</code> of <code>String,String</code> which has the configAttribute and returns the specific 
188          * configuration related to the configAttributes mentioned.
189          * 
190          * @param eCOMPComponentName the <code>String</code> format of the eCOMPComponentName whose configuration is required.
191          * @param configName the <code>String</code> format of the configurationName whose configuration is required.
192          * @param configAttributes the <code>Map</code> of <code>String,String</code> format of the configuration attributes which are required.
193          * @return <code>Collection</code> of {@link org.openecomp.policy.api.PolicyConfig} which has the configuration.
194          * @throws PolicyConfigException PolicyConfig Exception
195          * @deprecated use {@link #getConfig(ConfigRequestParameters)} Instead.
196          */
197         @Deprecated
198         public Collection<PolicyConfig> getConfig(String eCOMPComponentName, String configName, Map<String, String> configAttributes) throws PolicyConfigException{
199                 return getConfig(setConfigRequestParameters(null, eCOMPComponentName, configName, configAttributes, null));
200         }
201         
202         /**
203          * Requests the configuration of the <code>String</code> which represents the eCOMPComponentName, <code>String</code>
204          * which represents the configName and <code>Map</code> of <code>String,String</code> which has the configAttribute and returns the specific 
205          * configuration related to the configAttributes mentioned.
206          * 
207          * @param eCOMPComponentName the <code>String</code> format of the eCOMPComponentName whose configuration is required.
208          * @param configName the <code>String</code> format of the configurationName whose configuration is required.
209          * @param configAttributes the <code>Map</code> of <code>String,String</code> format of the configuration attributes which are required.
210          * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
211          * A different request ID should be passed for each request.
212          * @return <code>Collection</code> of {@link org.openecomp.policy.api.PolicyConfig} which has the configuration.
213          * @throws PolicyConfigException PolicyConfig Exception
214          * @deprecated use {@link #getConfig(ConfigRequestParameters)} Instead.
215          */
216         @Deprecated
217         public Collection<PolicyConfig> getConfig(String eCOMPComponentName, String configName, Map<String, String> configAttributes, UUID requestID) throws PolicyConfigException{
218                 return getConfig(setConfigRequestParameters(null, eCOMPComponentName, configName, configAttributes, requestID));
219         }
220         
221         /**
222          * Requests the configuration of the <code>ConfigRequestParameters</code> which represents the Config policy request parameters 
223          * and returns the specific configuration related to the matching parameters. 
224          * 
225          * @param configRequestParameters {@link org.openecomp.policy.api.ConfigRequestParameters} which represents the Config policy request parameters. 
226          * @return <code>Collection</code> of {@link org.openecomp.policy.api.PolicyConfig} which has the configuration.
227          * @throws PolicyConfigException PolicyConfig Exception
228          */
229         public Collection<PolicyConfig> getConfig(ConfigRequestParameters configRequestParameters)  throws PolicyConfigException{
230                 return stdPolicyEngine.getConfig(configRequestParameters);
231         }
232         
233         /**
234          * Requests the list of policies based on the <code>ConfigRequestParameters</code> which represents the policy request parameters 
235          * and returns the list of policies filtered by the parameters. 
236          * 
237          * @param configRequestParameters {@link org.openecomp.policy.api.ConfigRequestParameters} which represents the List Policy request parameters. 
238          * @return <code>Collection</code> of <code>String</code> which returns the list of policies.
239          * @throws PolicyConfigException PolicyConfig Exception
240          */
241         public Collection<String> listConfig(ConfigRequestParameters listPolicyRequestParameters)  throws PolicyConfigException{
242                 return stdPolicyEngine.listConfig(listPolicyRequestParameters);
243         }
244         
245         
246         /**
247          * Sends the Events specified to the PEP and returns back the PolicyResponse. 
248          * 
249          * @param eventAttributes the <code>Map</code> of <code>String,String</code> format of the eventAttributes that must contain the event ID and values.
250          * @return <code>Collection</code> of {@link org.openecomp.policy.api.PolicyResponse} which has the Response. 
251          * @throws PolicyEventException PolicyEvent Exception
252          * @deprecated use {@link #sendEvent(EventRequestParameters)} Instead.
253          */
254         @Deprecated
255         public Collection<PolicyResponse> sendEvent(Map<String, String> eventAttributes) throws PolicyEventException {
256                 return stdPolicyEngine.sendEvent(eventAttributes, (UUID) null);
257         }
258         
259         /**
260          * Sends the Events specified to the PEP and returns back the PolicyResponse. 
261          * 
262          * @param eventAttributes the <code>Map</code> of <code>String,String</code> format of the eventAttributes that must contain the event ID and values.
263          * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
264          * A different request ID should be passed for each request.
265          * @return <code>Collection</code> of {@link org.openecomp.policy.api.PolicyResponse} which has the Response. 
266          * @throws PolicyEventException PolicyEvent Exception
267          * @deprecated use {@link #sendEvent(EventRequestParameters)} Instead.
268          */
269         @Deprecated
270         public Collection<PolicyResponse> sendEvent(Map<String, String> eventAttributes, UUID requestID) throws PolicyEventException {
271                 return stdPolicyEngine.sendEvent(eventAttributes, requestID);
272         }
273         
274         /**
275          * Sends the Events specified to the PEP and returns back the PolicyResponse.
276          * 
277          * @param eventRequestParameters {@link org.openecomp.policy.api.EventRequestParameters} which represents the Event Request Parameters. 
278          * @return <code>Collection</code> of {@link org.openecomp.policy.api.PolicyResponse} which has the Response.
279          * @throws PolicyEventException PolicyEvent Exception
280          */
281         public Collection<PolicyResponse> sendEvent(EventRequestParameters eventRequestParameters) throws PolicyEventException {
282                 return stdPolicyEngine.sendEvent(eventRequestParameters);
283         }
284         
285         /**
286          * Sends the decision Attributes specified to the PEP and returns back the PolicyDecision. 
287          * 
288          * @param eCOMPComponentName the <code>String</code> format of the eCOMPComponentName whose Decision is required.
289          * @param decisionAttributes the <code>Map</code> of <code>String,String</code> format of the decisionAttributes that must contain the ID and values.
290          * @return {@link org.openecomp.policy.api.DecisionResponse} which has the Decision. 
291          * @throws PolicyDecisionException PolicyDecision Exception
292          * @deprecated use {@link #getDecision(DecisionRequestParameters)} Instead.
293          */
294         @Deprecated
295         public DecisionResponse getDecision(String eCOMPComponentName, Map<String,String> decisionAttributes) throws PolicyDecisionException {
296                 return stdPolicyEngine.getDecision(eCOMPComponentName, decisionAttributes, null);
297         }
298         
299         /**
300          * Sends the decision Attributes specified to the PEP and returns back the PolicyDecision. 
301          * 
302          * @param eCOMPComponentName the <code>String</code> format of the eCOMPComponentName whose Decision is required.
303          * @param decisionAttributes the <code>Map</code> of <code>String,String</code> format of the decisionAttributes that must contain the ID and values.
304          * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
305          * A different request ID should be passed for each request.
306          * @return {@link org.openecomp.policy.api.DecisionResponse} which has the Decision. 
307          * @throws PolicyDecisionException PolicyDecision Exception
308          * @deprecated use {@link #getDecision(DecisionRequestParameters)} Instead.
309          */
310         @Deprecated
311         public DecisionResponse getDecision(String eCOMPComponentName, Map<String,String> decisionAttributes, UUID requestID) throws PolicyDecisionException {
312                 return stdPolicyEngine.getDecision(eCOMPComponentName, decisionAttributes, requestID);
313         }
314         
315         /**
316          * Sends the decision Attributes specified to the PEP and returns back the PolicyDecision. 
317          * 
318          * @param decisionRequestParameters {@link org.openecomp.policy.api.DecisionRequestParameters} which represents the Decision Request Parameters.
319          * @return {@link org.openecomp.policy.api.DecisionResponse} which has the Decision.
320          * @throws PolicyDecisionException PolicyDecision Exception
321          */
322         public DecisionResponse getDecision(DecisionRequestParameters decisionRequestParameters) throws PolicyDecisionException {
323                 return stdPolicyEngine.getDecision(decisionRequestParameters);
324         }
325         
326         /**
327          * Retrieves the count of policies on the PAP, PDP, and Policy Engine as a whole
328          * 
329          * @param parameters {@link  org.openecomp.policy.api.MetricsRequestParameters} which represents the Parameters required to get the Policy Metrics 
330          * @return {@link org.openecomp.policy.api.MetricsResponse} which consists of the response related to getMetrics Request. 
331          * @throws PolicyException PolicyException related to the operation      
332          * 
333          * */
334         public MetricsResponse getMetrics(MetricsRequestParameters parameters) throws PolicyException {
335                 return stdPolicyEngine.getMetrics(parameters);
336         }
337         
338         /**
339          * Creates a Config Policy based on given arguments
340          * @param policyName the <code>String</code> format of the Policy Name
341          * @param policyDescription the <code>String</code> format of the Policy Description
342          * @param ecompName the <code>String</code> format of the ECOMP Name
343          * @param configName the <code>String</code> format of the Config Name
344          * @param configAttributes the <code>List</code> the <code>Map</code> Attributes that must contain the key and value.
345          * @param configType the <code>String</code> format of the Config Type
346          * @param body the <code>String</code> format of the Policy Body
347          * @param policyScope the <code>String</code> value of the sub scope directory where the policy will be created and stored
348          * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
349          * A different request ID should be passed for each request.
350          * @param riskLevel the <code>String</code> value of risk Level. 
351          * @param riskType the <code>String</code> value of risk Type. 
352          * @param guard the <code>String</code> value of guard. 
353          * @param ttlDate the <code>String</code> value of time to live Date. 
354          * @throws PolicyException PolicyException related to the operation. 
355          * @return <code>String</code> format of response
356          * @deprecated use {@link #createPolicy(PolicyParameters)} Instead.
357          */
358         @Deprecated
359         public String createConfigPolicy(String policyName, String policyDescription, String ecompName, String configName, 
360                                                                                                 Map<String, String> configAttributes, String configType, String body, String policyScope, UUID requestID,
361                                                                                                 String riskLevel, String riskType, String guard, String ttlDate) throws PolicyException {
362                 return stdPolicyEngine.createUpdateConfigPolicy(policyName, policyDescription, ecompName, configName, 
363                                 configAttributes, configType, body, policyScope, requestID,
364                                 riskLevel, riskType, guard, ttlDate, false);
365         }
366         
367         /**
368          * Creates a Config Policy based on given arguments
369          * @param policyName the <code>String</code> format of the Policy Name
370          * @param policyDescription the <code>String</code> format of the Policy Description
371          * @param ecompName the <code>String</code> format of the ECOMP Name
372          * @param configName the <code>String</code> format of the Config Name
373          * @param configAttributes the <code>List</code> the <code>Map</code> Attributes that must contain the key and value.
374          * @param configType the <code>String</code> format of the Config Type
375          * @param body the <code>String</code> format of the Policy Body
376          * @param policyScope the <code>String</code> value of the sub scope directory where the policy will be created and stored
377          * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
378          * A different request ID should be passed for each request.
379          * @param riskLevel the <code>String</code> value of risk Level. 
380          * @param riskType the <code>String</code> value of risk Type. 
381          * @param guard the <code>String</code> value of guard. 
382          * @param ttlDate the <code>String</code> value of time to live Date. 
383          * @throws PolicyException PolicyException related to the operation. 
384          * @return <code>String</code> format of response
385          * @deprecated use {@link #updatePolicy(PolicyParameters)} Instead.
386          */
387         @Deprecated
388         public String updateConfigPolicy(String policyName, String policyDescription, String ecompName, String configName, 
389                                                                                                 Map<String, String> configAttributes, String configType, String body, String policyScope, UUID requestID,
390                                                                                                 String riskLevel, String riskType, String guard, String ttlDate) throws PolicyException {
391                 return stdPolicyEngine.createUpdateConfigPolicy(policyName, policyDescription, ecompName, configName, 
392                                 configAttributes, configType, body, policyScope, requestID,riskLevel, riskType, guard, ttlDate, true);
393         }
394         
395         /**
396          * Creates a Config Firewall Policy based on given arguments
397          * @param policyName the <code>String</code> format of the Policy Name
398          * @param firewallJson the <code>JsonObject</code> representation of the Firewall Rules List
399          * @param policyScope the <code>String</code> value of the sub scope directory where the policy will be created and stored
400          * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
401          * A different request ID should be passed for each request.
402          * @param riskLevel the <code>String</code> value of risk Level. 
403          * @param riskType the <code>String</code> value of risk Type. 
404          * @param guard the <code>String</code> value of guard. 
405          * @param ttlDate the <code>String</code> value of time to live Date. 
406          * @throws PolicyException PolicyException related to the operation. 
407          * @return <code>String</code> format of response.
408          * @deprecated use {@link #createPolicy(PolicyParameters)} Instead.
409          */
410         @Deprecated
411         public String createConfigFirewallPolicy(String policyName, JsonObject firewallJson, String policyScope, UUID requestID,
412                         String riskLevel, String riskType, String guard, String ttlDate) throws PolicyException {
413                 return stdPolicyEngine.createUpdateConfigFirewallPolicy(policyName, firewallJson, policyScope, requestID,riskLevel, 
414                                 riskType, guard, ttlDate, false);
415         }
416         
417         /**
418          * Updates a Config Firewall Policy based on given arguments
419          * @param policyName the <code>String</code> format of the Policy Name
420          * @param firewallJson the <code>JsonObject</code> representation of the Firewall Rules List
421          * @param policyScope the <code>String</code> value of the sub scope directory where the policy will be created and stored
422          * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
423          * A different request ID should be passed for each request.
424          * @param riskLevel the <code>String</code> value of risk Level. 
425          * @param riskType the <code>String</code> value of risk Type. 
426          * @param guard the <code>String</code> value of guard. 
427          * @param ttlDate the <code>String</code> value of time to live Date. 
428          * @throws PolicyException PolicyException related to the operation. 
429          * @return <code>String</code> format of response. 
430          * @deprecated use {@link #updatePolicy(PolicyParameters)} Instead.
431          */
432         @Deprecated
433         public String updateConfigFirewallPolicy(String policyName, JsonObject firewallJson, String policyScope, UUID requestID,
434                         String riskLevel, String riskType, String guard, String ttlDate) throws PolicyException {
435                 return stdPolicyEngine.createUpdateConfigFirewallPolicy(policyName, firewallJson, policyScope, requestID,riskLevel, riskType, guard, ttlDate, true);
436         }
437         
438         /**
439          * Retrieves Dictionary Items for a specified dictionary
440          * 
441          * @param parameters {@link org.openecomp.policy.api.DictionaryParameters} which represents the Dictionary Parameters required to create a Dictionary Item. 
442          * @return {@link org.openecomp.policy.api.DictionaryResponse} which consists of the response related to create dictionary item Request. 
443          * @throws PolicyException PolicyException related to the operation      
444          * 
445          * */
446         public DictionaryResponse getDictionaryItem(DictionaryParameters parameters) throws PolicyException {
447                 return stdPolicyEngine.getDictionaryItem(parameters);
448         }
449         
450         /**
451          * Creates a Dictionary Item based on given Dictionary Parameters
452          * 
453          * @param parameters {@link org.openecomp.policy.api.DictionaryParameters} which represents the Dictionary Parameters required to create a Dictionary Item. 
454          * @return {@link org.openecomp.policy.api.PolicyChangeResponse} which consists of the response related to create dictionary item Request. 
455          * @throws PolicyException  PolicyException related to the operation. 
456          */
457         public PolicyChangeResponse createDictionaryItem(DictionaryParameters parameters) throws PolicyException {
458                 return stdPolicyEngine.createDictionaryItem(parameters);
459         }
460         
461         /**
462          * Updates a Dictionary Item based on given Dictionary Parameters
463          * 
464          * @param  parameters {@link org.openecomp.policy.api.DictionaryParameters} which represents the Dictionary Parameters required to update a Dictionary Item. 
465          * @return {@link org.openecomp.policy.api.PolicyChangeResponse} which consists of the response related to update dictionary item Request. 
466          * @throws PolicyException PolicyException related to the operation. 
467          */
468         public PolicyChangeResponse updateDictionaryItem(DictionaryParameters parameters) throws PolicyException {
469                 return stdPolicyEngine.updateDictionaryItem(parameters);
470         }
471         
472         /**
473          * Creates a Policy based on given Policy Parameters. 
474          * 
475          * @param policyParameters {@link org.openecomp.policy.api.PolicyParameters} which represents the Policy Parameters required to create a Policy. 
476          * @return {@link org.openecomp.policy.api.PolicyChangeResponse} which consists of the response related to create policy Request. 
477          * @throws PolicyException  PolicyException related to the operation. 
478          */
479         public PolicyChangeResponse createPolicy(PolicyParameters policyParameters) throws PolicyException {
480                 return stdPolicyEngine.createPolicy(policyParameters);
481         }
482         
483         /**
484          * Update Policy based on given Policy Parameters. 
485          * 
486          * @param policyParameters {@link org.openecomp.policy.api.PolicyParameters} which represents the Policy Parameters required to update a Policy. 
487          * @return {@link org.openecomp.policy.api.PolicyChangeResponse} which consists of the response related to create policy Request. 
488          * @throws PolicyException  PolicyException related to the operation. 
489          */
490         public PolicyChangeResponse updatePolicy(PolicyParameters policyParameters) throws PolicyException {
491                 return stdPolicyEngine.updatePolicy(policyParameters);
492         }
493         
494         /**
495          * Pushes the specified policy to the PDP Group. If no PDP group is selected default is used. 
496          * 
497          * @param policyScope the <code>String</code> value of the sub scope directory where the policy is located
498          * @param policyName the <code>String</code> format of the Policy Name being pushed. 
499          * @param policyType the <code>String</code> format of the Policy Type which is being pushed.  
500          * @param pdpGroup the <code>String</code> format of the PDP Group name to which the policy needs to be pushed to. 
501          * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
502          * @return <code>String</code> format of the response related to the push Policy Request. 
503          * @throws PolicyException  PolicyException related to the operation. 
504          * @deprecated use {@link #pushPolicy(PushPolicyParameters)} instead. 
505          */
506         @Deprecated
507         public String pushPolicy(String policyScope, String policyName, String policyType, String pdpGroup, UUID requestID) throws PolicyException {
508                 return stdPolicyEngine.pushPolicy(policyScope, policyName, policyType, pdpGroup, requestID);
509         }
510         
511         /**
512          * Pushes the specified policy to the PDP Group. If no PDP group is selected default is used. 
513          * 
514          * @param pushPolicyParameters {@link org.openecomp.policy.api.PushPolicyParameters} which represents the Push Policy parameters required to push a policy. 
515          * @return {@link org.openecomp.policy.api.PolicyChangeResponse} which consists of the response related to the push Policy Request. 
516          * @throws PolicyException  PolicyException related to the operation. 
517          */
518         public PolicyChangeResponse pushPolicy(PushPolicyParameters pushPolicyParameters) throws PolicyException {
519                 return stdPolicyEngine.pushPolicy(pushPolicyParameters);
520         }
521         
522         /**
523          * Deletes the specified policy from the PAP or PDP.
524          * 
525          * @param deletePolicyParameters {@link org.openecomp.policy.api.DeletePolicyParameters} which represents the Delete Policy parameters to delete a policy.
526          * @return {@link org.openecomp.policy.api.PolicyChangeResponse} which consists of the response related to the Delete Policy Request.
527          * @throws PolicyException PolicyException related to the operation. 
528          */
529         public PolicyChangeResponse deletePolicy(DeletePolicyParameters deletePolicyParameters) throws PolicyException {
530                 return stdPolicyEngine.deletePolicy(deletePolicyParameters);
531         }
532         
533         /**
534          * Creates a new Policy Service based on given Service Parameters. 
535          * 
536          * @param importParameters {@link org.openecomp.policy.api.ImportParameters} which represents the Service Parameters required to create a Policy Service. 
537          * @return {@link org.openecomp.policy.api.PolicyChangeResponse} which consists of the response related to create import Service. 
538          * @throws PolicyException PolicyException related to the operation. 
539          */
540         public PolicyChangeResponse policyEngineImport(ImportParameters importParameters) throws PolicyException {
541                 return stdPolicyEngine.policyEngineImport(importParameters);
542         }
543         
544         /**
545          * <code>setNotification</code> allows changes to the Notification Scheme and Notification Handler
546          * 
547          * @param scheme the <code>NotificationScheme</code> of {@link org.openecomp.policy.api.NotificationScheme} which defines the Notification Scheme
548          * @param handler the <code>NotificationHandler</code> of {@link org.openecomp.policy.api.NotificationHandler} which defines what should happen when a notification is received.
549          */
550         public void setNotification(NotificationScheme scheme, NotificationHandler handler) {
551                 this.scheme = scheme;
552                 this.handler = handler;
553                 stdPolicyEngine.notification(this.scheme,this.handler);
554         }
555         
556         /**
557          * <code>clearNotification</code> shutsDown the Notification Service if the Auto Scehme Notification service is running.
558          */
559         public void clearNotification(){
560                 stdPolicyEngine.stopNotification();
561         }
562         
563         /**
564          * <code>setNotification</code> allows changes to the Notification Scheme
565          * 
566          * @param scheme the <code>NotificationScheme</code> of {@link org.openecomp.policy.api.NotificationScheme} which defines the Notification Scheme
567          */
568         public void setScheme(NotificationScheme scheme){
569                 this.scheme = scheme;
570                 stdPolicyEngine.setScheme(this.scheme);
571         }
572         
573         /**
574          * Gets the <code>PDPNotification</code> if there is one exists. This is used for Polling Patterns. 
575          * 
576          * @return <code>PDPNotification</code> of {@link org.openecomp.policy.api.PDPNotification} which has the Notification. 
577          */
578         public PDPNotification getNotification() {
579                 return stdPolicyEngine.getNotification();
580         }
581         
582         /**
583          * setClientKey allows the client to use their own implementation logic for Password Protection 
584          * and will be used to set the clear text password, this will be used while making Requests. 
585          *   
586          * @param clientKey depicts String format of Password/ Client_Key.  
587          */
588         public void setClientKey(String clientKey){
589                 stdPolicyEngine.setClientKey(clientKey);
590         }
591         
592         // Internal Setter Method to help build configRequestParameters.
593         private ConfigRequestParameters setConfigRequestParameters(String policyName, String eCOMPComponentName, String configName, Map<String, String> configAttributes, UUID requestID){
594                 ConfigRequestParameters configRequestParameters = new ConfigRequestParameters();
595                 configRequestParameters.setPolicyName(policyName);
596                 configRequestParameters.setEcompName(eCOMPComponentName);
597                 configRequestParameters.setConfigName(configName);
598                 configRequestParameters.setConfigAttributes(configAttributes);
599                 configRequestParameters.setRequestID(requestID);
600                 return configRequestParameters;
601         }
602 }