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