aboutsummaryrefslogtreecommitdiffstats
path: root/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyEngine.java
blob: 4e2c092c1f02ffd1bf0d7ca4f5e4a14f9cd4697a (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
/*-
 * ============LICENSE_START=======================================================
 * PolicyEngineAPI
 * ================================================================================
 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
 * ================================================================================
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ============LICENSE_END=========================================================
 */

package org.openecomp.policy.api;

import java.util.Collection;
import java.util.Map;
import java.util.UUID;

import javax.json.JsonObject;

import org.openecomp.policy.api.NotificationHandler;
import org.openecomp.policy.api.PDPNotification;
import org.openecomp.policy.std.StdPolicyEngine;

/**
 * PolicyEngine is the Interface that applications use to make policy queries against a PEPEngine 
 * 
 * @version 2.0
 */
public class PolicyEngine{
	private String propertyFilePath = null;
	private StdPolicyEngine stdPolicyEngine;
	private NotificationScheme scheme = null;
	private NotificationHandler handler = null;
	
	/**
	 * PolicyEngine Constructor with <code>String</code> format of propertiesFilePathname
	 * 
	 * @param propertiesFilePathname the <code>String</code> format of the propertiesFilePathname 
	 * @throws PolicyEngineException PolicyEngine Exception
	 */
	public PolicyEngine(String propertiesFilePathname) throws PolicyEngineException {
		this.propertyFilePath = propertiesFilePathname ; 
		this.stdPolicyEngine= new StdPolicyEngine(this.propertyFilePath, (String)null);
	}
	
	/**
	 * PolicyEngine Constructor with <code>String</code> format of propertiesFilePathname
	 * 
	 * @param propertiesFilePathname the <code>String</code> format of the propertiesFilePathname
	 * @param clientKey depicts String format of Password/ Client_Key.  
	 * @throws PolicyEngineException PolicyEngine Exception
	 */
	public PolicyEngine(String propertiesFilePathname, String clientKey) throws PolicyEngineException {
		this.propertyFilePath = propertiesFilePathname ; 
		this.stdPolicyEngine= new StdPolicyEngine(this.propertyFilePath, clientKey);
	}
	
	/**
	 * PolicyEngine Constructor with <code>String</code> format of PropertiesFilePathname and <code>NotificationScheme</code>
	 * 
	 * @param propertiesFilePathname the <code>String</code> format of the propertiesFilePathname
	 * @param scheme the <code>NotificationScheme</code> of {@link org.openecomp.policy.api.NotificationScheme} which defines the Notification Scheme
	 * @throws PolicyEngineException PolicyEngine Exception
	 */
	public PolicyEngine(String propertiesFilePathname, NotificationScheme scheme) throws PolicyEngineException{
		this.propertyFilePath = propertiesFilePathname;
		this.scheme = scheme;
		this.stdPolicyEngine = new StdPolicyEngine(this.propertyFilePath, this.scheme);
	}
	
	/**
	 * PolicyEngine Constructor with <code>String</code> format of PropertiesFilePathname, <code>NotificationScheme</code> and <code>NotificationHandler</code>
	 *  
	 *  @param propertiesFilePathname the <code>String</code> format of the propertiesFilePathname 
	 *  @param scheme the <code>NotificationScheme</code> of {@link org.openecomp.policy.api.NotificationScheme} which defines the Notification Scheme
	 *  @param handler the <code>NotificationHandler</code> of {@link org.openecomp.policy.api.NotificationHandler} which defines what should happen when a notification is received.
	 *  @throws PolicyEngineException PolicyEngine Exception
	 */
	public PolicyEngine(String propertiesFilePathname, NotificationScheme scheme, NotificationHandler handler) throws PolicyEngineException {
		this.propertyFilePath = propertiesFilePathname ;
		this.scheme = scheme;
		this.handler = handler;
		this.stdPolicyEngine= new StdPolicyEngine(this.propertyFilePath,this.scheme,this.handler);
	}
	
	/**
	 * Gets the configuration from the PolicyDecisionPoint(PDP) for the <code>String</code> which represents the Policy File Name 
	 * 
	 * @param policyName the <code>String</code> format of the PolicyFile Name whose configuration is required. 
	 * @return <code>Collection</code> of {@link org.openecomp.policy.api.PolicyConfig} which has the configuration. 
	 * @throws PolicyConfigException PolicyConfig Exception
	 * @deprecated use {@link #getConfig(ConfigRequestParameters configRequestParameters)} Instead.
	 */
	@Deprecated
	public Collection<PolicyConfig> getConfigByPolicyName(String policyName) throws PolicyConfigException {
		return getConfig(setConfigRequestParameters(policyName, null, null, null, null));
	}
	
	/**
	 * Gets the configuration from the PolicyDecisionPoint(PDP) for the <code>String</code> which represents the Policy File Name 
	 * 
	 * @param policyName the <code>String</code> format of the PolicyFile Name whose configuration is required. 
	 * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
	 * A different request ID should be passed for each request.
	 * @return <code>Collection</code> of {@link org.openecomp.policy.api.PolicyConfig} which has the configuration. 
	 * @throws PolicyConfigException PolicyConfig Exception
	 * @deprecated use {@link #getConfig(ConfigRequestParameters configRequestParameters)} Instead.
	 */
	@Deprecated
	public Collection<PolicyConfig> getConfigByPolicyName(String policyName, UUID requestID) throws PolicyConfigException {
		return getConfig(setConfigRequestParameters(policyName, null, null, null, requestID));	
	}
	
	/**
	 * Gets the configuration from the PolicyDecisionPoint(PDP) for the <code>String</code> which represents the eCOMPComponentName 
	 * 
	 * @param eCOMPComponentName the <code>String</code> format of the eCOMPComponentName whose configuration is required. 
	 * @return <code>Collection</code> of {@link org.openecomp.policy.api.PolicyConfig} which has the configuration.
	 * @throws PolicyConfigException PolicyConfig Exception
	 * @deprecated use {@link #getConfig(ConfigRequestParameters)} Instead.
	 */
	@Deprecated
	public Collection<PolicyConfig> getConfig(String eCOMPComponentName) throws PolicyConfigException {
		return getConfig(setConfigRequestParameters(null, eCOMPComponentName, null, null, null));
	}
	
	/**
	 * Gets the configuration from the PolicyDecisionPoint(PDP) for the <code>String</code> which represents the eCOMPComponentName 
	 * 
	 * @param eCOMPComponentName the <code>String</code> format of the eCOMPComponentName whose configuration is required. 
	 * @return <code>Collection</code> of {@link org.openecomp.policy.api.PolicyConfig} which has the configuration.
	 * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
	 * A different request ID should be passed for each request.
	 * @throws PolicyConfigException PolicyConfig Exception
	 * @deprecated use {@link #getConfig(ConfigRequestParameters)} Instead.
	 */
	@Deprecated
	public Collection<PolicyConfig> getConfig(String eCOMPComponentName, UUID requestID) throws PolicyConfigException {
		return getConfig(setConfigRequestParameters(null, eCOMPComponentName, null, null, requestID));
	}
	
	/**
	 * Requests the configuration of the <code>String</code> which represents the eCOMPComponentName and <code>String</code>
	 * which represents the configName and returns the configuration if different Configurations exist for the
	 * particular eCOMPComponentName.  
	 * 
	 * @param eCOMPComponentName the <code>String</code> format of the eCOMPComponentName whose configuration is required.
	 * @param configName the <code>String</code> format of the configurationName whose configuration is required.
	 * @return <code>Collection</code> of {@link org.openecomp.policy.api.PolicyConfig} which has the configuration. 
	 * @throws PolicyConfigException PolicyConfig Exception
	 * @deprecated use {@link #getConfig(ConfigRequestParameters)} Instead.
	 */
	@Deprecated
	public Collection<PolicyConfig> getConfig(String eCOMPComponentName, String configName) throws PolicyConfigException {
		return getConfig(setConfigRequestParameters(null, eCOMPComponentName, configName, null, null));
	}
	
	/**
	 * Requests the configuration of the <code>String</code> which represents the eCOMPComponentName and <code>String</code>
	 * which represents the configName and returns the configuration if different Configurations exist for the
	 * particular eCOMPComponentName.  
	 * 
	 * @param eCOMPComponentName the <code>String</code> format of the eCOMPComponentName whose configuration is required.
	 * @param configName the <code>String</code> format of the configurationName whose configuration is required.
	 * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
	 * A different request ID should be passed for each request.
	 * @return <code>Collection</code> of {@link org.openecomp.policy.api.PolicyConfig} which has the configuration. 
	 * @throws PolicyConfigException PolicyConfig Exception
	 * @deprecated use {@link #getConfig(ConfigRequestParameters)} Instead.
	 */
	@Deprecated
	public Collection<PolicyConfig> getConfig(String eCOMPComponentName, String configName, UUID requestID) throws PolicyConfigException {
		return getConfig(setConfigRequestParameters(null, eCOMPComponentName, configName, null, requestID));
	}
	
	/**
	 * Requests the configuration of the <code>String</code> which represents the eCOMPComponentName, <code>String</code>
	 * which represents the configName and <code>Map</code> of <code>String,String</code> which has the configAttribute and returns the specific 
	 * configuration related to the configAttributes mentioned.
	 * 
	 * @param eCOMPComponentName the <code>String</code> format of the eCOMPComponentName whose configuration is required.
	 * @param configName the <code>String</code> format of the configurationName whose configuration is required.
	 * @param configAttributes the <code>Map</code> of <code>String,String</code> format of the configuration attributes which are required.
	 * @return <code>Collection</code> of {@link org.openecomp.policy.api.PolicyConfig} which has the configuration.
	 * @throws PolicyConfigException PolicyConfig Exception
	 * @deprecated use {@link #getConfig(ConfigRequestParameters)} Instead.
	 */
	@Deprecated
	public Collection<PolicyConfig> getConfig(String eCOMPComponentName, String configName, Map<String, String> configAttributes) throws PolicyConfigException{
		return getConfig(setConfigRequestParameters(null, eCOMPComponentName, configName, configAttributes, null));
	}
	
	/**
	 * Requests the configuration of the <code>String</code> which represents the eCOMPComponentName, <code>String</code>
	 * which represents the configName and <code>Map</code> of <code>String,String</code> which has the configAttribute and returns the specific 
	 * configuration related to the configAttributes mentioned.
	 * 
	 * @param eCOMPComponentName the <code>String</code> format of the eCOMPComponentName whose configuration is required.
	 * @param configName the <code>String</code> format of the configurationName whose configuration is required.
	 * @param configAttributes the <code>Map</code> of <code>String,String</code> format of the configuration attributes which are required.
	 * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
	 * A different request ID should be passed for each request.
	 * @return <code>Collection</code> of {@link org.openecomp.policy.api.PolicyConfig} which has the configuration.
	 * @throws PolicyConfigException PolicyConfig Exception
	 * @deprecated use {@link #getConfig(ConfigRequestParameters)} Instead.
	 */
	@Deprecated
	public Collection<PolicyConfig> getConfig(String eCOMPComponentName, String configName, Map<String, String> configAttributes, UUID requestID) throws PolicyConfigException{
		return getConfig(setConfigRequestParameters(null, eCOMPComponentName, configName, configAttributes, requestID));
	}
	
	/**
	 * Requests the configuration of the <code>ConfigRequestParameters</code> which represents the Config policy request parameters 
	 * and returns the specific configuration related to the matching parameters. 
	 * 
	 * @param configRequestParameters {@link org.openecomp.policy.api.ConfigRequestParameters} which represents the Config policy request parameters. 
	 * @return <code>Collection</code> of {@link org.openecomp.policy.api.PolicyConfig} which has the configuration.
	 * @throws PolicyConfigException PolicyConfig Exception
	 */
	public Collection<PolicyConfig> getConfig(ConfigRequestParameters configRequestParameters)  throws PolicyConfigException{
		return stdPolicyEngine.getConfig(configRequestParameters);
	}
	
	/**
	 * Requests the list of policies based on the <code>ConfigRequestParameters</code> which represents the policy request parameters 
	 * and returns the list of policies filtered by the parameters. 
	 * 
	 * @param configRequestParameters {@link org.openecomp.policy.api.ConfigRequestParameters} which represents the List Policy request parameters. 
	 * @return <code>Collection</code> of <code>String</code> which returns the list of policies.
	 * @throws PolicyConfigException PolicyConfig Exception
	 */
	public Collection<String> listConfig(ConfigRequestParameters listPolicyRequestParameters)  throws PolicyConfigException{
		return stdPolicyEngine.listConfig(listPolicyRequestParameters);
	}
	
	
	/**
	 * Sends the Events specified to the PEP and returns back the PolicyResponse. 
	 * 
	 * @param eventAttributes the <code>Map</code> of <code>String,String</code> format of the eventAttributes that must contain the event ID and values.
	 * @return <code>Collection</code> of {@link org.openecomp.policy.api.PolicyResponse} which has the Response. 
	 * @throws PolicyEventException PolicyEvent Exception
	 * @deprecated use {@link #sendEvent(EventRequestParameters)} Instead.
	 */
	@Deprecated
	public Collection<PolicyResponse> sendEvent(Map<String, String> eventAttributes) throws PolicyEventException {
		return stdPolicyEngine.sendEvent(eventAttributes, (UUID) null);
	}
	
	/**
	 * Sends the Events specified to the PEP and returns back the PolicyResponse. 
	 * 
	 * @param eventAttributes the <code>Map</code> of <code>String,String</code> format of the eventAttributes that must contain the event ID and values.
	 * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
	 * A different request ID should be passed for each request.
	 * @return <code>Collection</code> of {@link org.openecomp.policy.api.PolicyResponse} which has the Response. 
	 * @throws PolicyEventException PolicyEvent Exception
	 * @deprecated use {@link #sendEvent(EventRequestParameters)} Instead.
	 */
	@Deprecated
	public Collection<PolicyResponse> sendEvent(Map<String, String> eventAttributes, UUID requestID) throws PolicyEventException {
		return stdPolicyEngine.sendEvent(eventAttributes, requestID);
	}
	
	/**
	 * Sends the Events specified to the PEP and returns back the PolicyResponse.
	 * 
	 * @param eventRequestParameters {@link org.openecomp.policy.api.EventRequestParameters} which represents the Event Request Parameters. 
	 * @return <code>Collection</code> of {@link org.openecomp.policy.api.PolicyResponse} which has the Response.
	 * @throws PolicyEventException PolicyEvent Exception
	 */
	public Collection<PolicyResponse> sendEvent(EventRequestParameters eventRequestParameters) throws PolicyEventException {
		return stdPolicyEngine.sendEvent(eventRequestParameters);
	}
	
	/**
	 * Sends the decision Attributes specified to the PEP and returns back the PolicyDecision. 
	 * 
	 * @param eCOMPComponentName the <code>String</code> format of the eCOMPComponentName whose Decision is required.
	 * @param decisionAttributes the <code>Map</code> of <code>String,String</code> format of the decisionAttributes that must contain the ID and values.
	 * @return {@link org.openecomp.policy.api.DecisionResponse} which has the Decision. 
	 * @throws PolicyDecisionException PolicyDecision Exception
	 * @deprecated use {@link #getDecision(DecisionRequestParameters)} Instead.
	 */
	@Deprecated
	public DecisionResponse getDecision(String eCOMPComponentName, Map<String,String> decisionAttributes) throws PolicyDecisionException {
		return stdPolicyEngine.getDecision(eCOMPComponentName, decisionAttributes, null);
	}
	
	/**
	 * Sends the decision Attributes specified to the PEP and returns back the PolicyDecision. 
	 * 
	 * @param eCOMPComponentName the <code>String</code> format of the eCOMPComponentName whose Decision is required.
	 * @param decisionAttributes the <code>Map</code> of <code>String,String</code> format of the decisionAttributes that must contain the ID and values.
	 * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
	 * A different request ID should be passed for each request.
	 * @return {@link org.openecomp.policy.api.DecisionResponse} which has the Decision. 
	 * @throws PolicyDecisionException PolicyDecision Exception
	 * @deprecated use {@link #getDecision(DecisionRequestParameters)} Instead.
	 */
	@Deprecated
	public DecisionResponse getDecision(String eCOMPComponentName, Map<String,String> decisionAttributes, UUID requestID) throws PolicyDecisionException {
		return stdPolicyEngine.getDecision(eCOMPComponentName, decisionAttributes, requestID);
	}
	
	/**
	 * Sends the decision Attributes specified to the PEP and returns back the PolicyDecision. 
	 * 
	 * @param decisionRequestParameters {@link org.openecomp.policy.api.DecisionRequestParameters} which represents the Decision Request Parameters.
	 * @return {@link org.openecomp.policy.api.DecisionResponse} which has the Decision.
	 * @throws PolicyDecisionException PolicyDecision Exception
	 */
	public DecisionResponse getDecision(DecisionRequestParameters decisionRequestParameters) throws PolicyDecisionException {
		return stdPolicyEngine.getDecision(decisionRequestParameters);
	}
	
	/**
	 * Retrieves the count of policies on the PAP, PDP, and Policy Engine as a whole
	 * 
	 * @param parameters {@link  org.openecomp.policy.api.MetricsRequestParameters} which represents the Parameters required to get the Policy Metrics 
	 * @return {@link org.openecomp.policy.api.MetricsResponse} which consists of the response related to getMetrics Request. 
	 * @throws PolicyException PolicyException related to the operation	 
	 * 
	 * */
	public MetricsResponse getMetrics(MetricsRequestParameters parameters) throws PolicyException {
		return stdPolicyEngine.getMetrics(parameters);
	}
	
	/**
	 * Creates a Config Policy based on given arguments
	 * @param policyName the <code>String</code> format of the Policy Name
	 * @param policyDescription the <code>String</code> format of the Policy Description
	 * @param ecompName the <code>String</code> format of the ECOMP Name
	 * @param configName the <code>String</code> format of the Config Name
	 * @param configAttributes the <code>List</code> the <code>Map</code> Attributes that must contain the key and value.
	 * @param configType the <code>String</code> format of the Config Type
	 * @param body the <code>String</code> format of the Policy Body
	 * @param policyScope the <code>String</code> value of the sub scope directory where the policy will be created and stored
	 * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
	 * A different request ID should be passed for each request.
	 * @param riskLevel the <code>String</code> value of risk Level. 
	 * @param riskType the <code>String</code> value of risk Type. 
	 * @param guard the <code>String</code> value of guard. 
	 * @param ttlDate the <code>String</code> value of time to live Date. 
	 * @throws PolicyException PolicyException related to the operation. 
	 * @return <code>String</code> format of response
	 * @deprecated use {@link #createPolicy(PolicyParameters)} Instead.
	 */
	@Deprecated
	public String createConfigPolicy(String policyName, String policyDescription, String ecompName, String configName, 
												Map<String, String> configAttributes, String configType, String body, String policyScope, UUID requestID,
												String riskLevel, String riskType, String guard, String ttlDate) throws PolicyException {
		return stdPolicyEngine.createUpdateConfigPolicy(policyName, policyDescription, ecompName, configName, 
				configAttributes, configType, body, policyScope, requestID,
				riskLevel, riskType, guard, ttlDate, false);
	}
	
	/**
	 * Creates a Config Policy based on given arguments
	 * @param policyName the <code>String</code> format of the Policy Name
	 * @param policyDescription the <code>String</code> format of the Policy Description
	 * @param ecompName the <code>String</code> format of the ECOMP Name
	 * @param configName the <code>String</code> format of the Config Name
	 * @param configAttributes the <code>List</code> the <code>Map</code> Attributes that must contain the key and value.
	 * @param configType the <code>String</code> format of the Config Type
	 * @param body the <code>String</code> format of the Policy Body
	 * @param policyScope the <code>String</code> value of the sub scope directory where the policy will be created and stored
	 * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
	 * A different request ID should be passed for each request.
	 * @param riskLevel the <code>String</code> value of risk Level. 
	 * @param riskType the <code>String</code> value of risk Type. 
	 * @param guard the <code>String</code> value of guard. 
	 * @param ttlDate the <code>String</code> value of time to live Date. 
	 * @throws PolicyException PolicyException related to the operation. 
	 * @return <code>String</code> format of response
	 * @deprecated use {@link #updatePolicy(PolicyParameters)} Instead.
	 */
	@Deprecated
	public String updateConfigPolicy(String policyName, String policyDescription, String ecompName, String configName, 
												Map<String, String> configAttributes, String configType, String body, String policyScope, UUID requestID,
												String riskLevel, String riskType, String guard, String ttlDate) throws PolicyException {
		return stdPolicyEngine.createUpdateConfigPolicy(policyName, policyDescription, ecompName, configName, 
				configAttributes, configType, body, policyScope, requestID,riskLevel, riskType, guard, ttlDate, true);
	}
	
	/**
	 * Creates a Config Firewall Policy based on given arguments
	 * @param policyName the <code>String</code> format of the Policy Name
	 * @param firewallJson the <code>JsonObject</code> representation of the Firewall Rules List
	 * @param policyScope the <code>String</code> value of the sub scope directory where the policy will be created and stored
	 * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
	 * A different request ID should be passed for each request.
	 * @param riskLevel the <code>String</code> value of risk Level. 
	 * @param riskType the <code>String</code> value of risk Type. 
	 * @param guard the <code>String</code> value of guard. 
	 * @param ttlDate the <code>String</code> value of time to live Date. 
	 * @throws PolicyException PolicyException related to the operation. 
	 * @return <code>String</code> format of response.
	 * @deprecated use {@link #createPolicy(PolicyParameters)} Instead.
	 */
	@Deprecated
	public String createConfigFirewallPolicy(String policyName, JsonObject firewallJson, String policyScope, UUID requestID,
			String riskLevel, String riskType, String guard, String ttlDate) throws PolicyException {
		return stdPolicyEngine.createUpdateConfigFirewallPolicy(policyName, firewallJson, policyScope, requestID,riskLevel, 
				riskType, guard, ttlDate, false);
	}
	
	/**
	 * Updates a Config Firewall Policy based on given arguments
	 * @param policyName the <code>String</code> format of the Policy Name
	 * @param firewallJson the <code>JsonObject</code> representation of the Firewall Rules List
	 * @param policyScope the <code>String</code> value of the sub scope directory where the policy will be created and stored
	 * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
	 * A different request ID should be passed for each request.
	 * @param riskLevel the <code>String</code> value of risk Level. 
	 * @param riskType the <code>String</code> value of risk Type. 
	 * @param guard the <code>String</code> value of guard. 
	 * @param ttlDate the <code>String</code> value of time to live Date. 
	 * @throws PolicyException PolicyException related to the operation. 
	 * @return <code>String</code> format of response. 
	 * @deprecated use {@link #updatePolicy(PolicyParameters)} Instead.
	 */
	@Deprecated
	public String updateConfigFirewallPolicy(String policyName, JsonObject firewallJson, String policyScope, UUID requestID,
			String riskLevel, String riskType, String guard, String ttlDate) throws PolicyException {
		return stdPolicyEngine.createUpdateConfigFirewallPolicy(policyName, firewallJson, policyScope, requestID,riskLevel, riskType, guard, ttlDate, true);
	}
	
	/**
	 * Retrieves Dictionary Items for a specified dictionary
	 * 
	 * @param parameters {@link org.openecomp.policy.api.DictionaryParameters} which represents the Dictionary Parameters required to create a Dictionary Item. 
	 * @return {@link org.openecomp.policy.api.DictionaryResponse} which consists of the response related to create dictionary item Request. 
	 * @throws PolicyException PolicyException related to the operation	 
	 * 
	 * */
	public DictionaryResponse getDictionaryItem(DictionaryParameters parameters) throws PolicyException {
		return stdPolicyEngine.getDictionaryItem(parameters);
	}
	
	/**
	 * Creates a Dictionary Item based on given Dictionary Parameters
	 * 
	 * @param parameters {@link org.openecomp.policy.api.DictionaryParameters} which represents the Dictionary Parameters required to create a Dictionary Item. 
	 * @return {@link org.openecomp.policy.api.PolicyChangeResponse} which consists of the response related to create dictionary item Request. 
	 * @throws PolicyException  PolicyException related to the operation. 
	 */
	public PolicyChangeResponse createDictionaryItem(DictionaryParameters parameters) throws PolicyException {
		return stdPolicyEngine.createDictionaryItem(parameters);
	}
	
	/**
	 * Updates a Dictionary Item based on given Dictionary Parameters
	 * 
	 * @param  parameters {@link org.openecomp.policy.api.DictionaryParameters} which represents the Dictionary Parameters required to update a Dictionary Item. 
	 * @return {@link org.openecomp.policy.api.PolicyChangeResponse} which consists of the response related to update dictionary item Request. 
	 * @throws PolicyException PolicyException related to the operation. 
	 */
	public PolicyChangeResponse updateDictionaryItem(DictionaryParameters parameters) throws PolicyException {
		return stdPolicyEngine.updateDictionaryItem(parameters);
	}
	
	/**
	 * Creates a Policy based on given Policy Parameters. 
	 * 
	 * @param policyParameters {@link org.openecomp.policy.api.PolicyParameters} which represents the Policy Parameters required to create a Policy. 
	 * @return {@link org.openecomp.policy.api.PolicyChangeResponse} which consists of the response related to create policy Request. 
	 * @throws PolicyException  PolicyException related to the operation. 
	 */
	public PolicyChangeResponse createPolicy(PolicyParameters policyParameters) throws PolicyException {
		return stdPolicyEngine.createPolicy(policyParameters);
	}
	
	/**
	 * Update Policy based on given Policy Parameters. 
	 * 
	 * @param policyParameters {@link org.openecomp.policy.api.PolicyParameters} which represents the Policy Parameters required to update a Policy. 
	 * @return {@link org.openecomp.policy.api.PolicyChangeResponse} which consists of the response related to create policy Request. 
	 * @throws PolicyException  PolicyException related to the operation. 
	 */
	public PolicyChangeResponse updatePolicy(PolicyParameters policyParameters) throws PolicyException {
		return stdPolicyEngine.updatePolicy(policyParameters);
	}
	
	/**
	 * Pushes the specified policy to the PDP Group. If no PDP group is selected default is used. 
	 * 
	 * @param policyScope the <code>String</code> value of the sub scope directory where the policy is located
	 * @param policyName the <code>String</code> format of the Policy Name being pushed. 
	 * @param policyType the <code>String</code> format of the Policy Type which is being pushed.  
	 * @param pdpGroup the <code>String</code> format of the PDP Group name to which the policy needs to be pushed to. 
	 * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
	 * @return <code>String</code> format of the response related to the push Policy Request. 
	 * @throws PolicyException  PolicyException related to the operation. 
	 * @deprecated use {@link #pushPolicy(PushPolicyParameters)} instead. 
	 */
	@Deprecated
	public String pushPolicy(String policyScope, String policyName, String policyType, String pdpGroup, UUID requestID) throws PolicyException {
		return stdPolicyEngine.pushPolicy(policyScope, policyName, policyType, pdpGroup, requestID);
	}
	
	/**
	 * Pushes the specified policy to the PDP Group. If no PDP group is selected default is used. 
	 * 
	 * @param pushPolicyParameters {@link org.openecomp.policy.api.PushPolicyParameters} which represents the Push Policy parameters required to push a policy. 
	 * @return {@link org.openecomp.policy.api.PolicyChangeResponse} which consists of the response related to the push Policy Request. 
	 * @throws PolicyException  PolicyException related to the operation. 
	 */
	public PolicyChangeResponse pushPolicy(PushPolicyParameters pushPolicyParameters) throws PolicyException {
		return stdPolicyEngine.pushPolicy(pushPolicyParameters);
	}
	
	/**
	 * Deletes the specified policy from the PAP or PDP.
	 * 
	 * @param deletePolicyParameters {@link org.openecomp.policy.api.DeletePolicyParameters} which represents the Delete Policy parameters to delete a policy.
	 * @return {@link org.openecomp.policy.api.PolicyChangeResponse} which consists of the response related to the Delete Policy Request.
	 * @throws PolicyException PolicyException related to the operation. 
	 */
	public PolicyChangeResponse deletePolicy(DeletePolicyParameters deletePolicyParameters) throws PolicyException {
		return stdPolicyEngine.deletePolicy(deletePolicyParameters);
	}
	
	/**
	 * Creates a new Policy Service based on given Service Parameters. 
	 * 
	 * @param importParameters {@link org.openecomp.policy.api.ImportParameters} which represents the Service Parameters required to create a Policy Service. 
	 * @return {@link org.openecomp.policy.api.PolicyChangeResponse} which consists of the response related to create import Service. 
	 * @throws PolicyException PolicyException related to the operation. 
	 */
	public PolicyChangeResponse policyEngineImport(ImportParameters importParameters) throws PolicyException {
		return stdPolicyEngine.policyEngineImport(importParameters);
	}
	
	/**
	 * <code>setNotification</code> allows changes to the Notification Scheme and Notification Handler
	 * 
	 * @param scheme the <code>NotificationScheme</code> of {@link org.openecomp.policy.api.NotificationScheme} which defines the Notification Scheme
	 * @param handler the <code>NotificationHandler</code> of {@link org.openecomp.policy.api.NotificationHandler} which defines what should happen when a notification is received.
	 */
	public void setNotification(NotificationScheme scheme, NotificationHandler handler) {
		this.scheme = scheme;
		this.handler = handler;
		stdPolicyEngine.notification(this.scheme,this.handler);
	}
	
	/**
	 * <code>clearNotification</code> shutsDown the Notification Service if the Auto Scehme Notification service is running.
	 */
	public void clearNotification(){
		stdPolicyEngine.stopNotification();
	}
	
	/**
	 * <code>setNotification</code> allows changes to the Notification Scheme
	 * 
	 * @param scheme the <code>NotificationScheme</code> of {@link org.openecomp.policy.api.NotificationScheme} which defines the Notification Scheme
	 */
	public void setScheme(NotificationScheme scheme){
		this.scheme = scheme;
		stdPolicyEngine.setScheme(this.scheme);
	}
	
	/**
	 * Gets the <code>PDPNotification</code> if there is one exists. This is used for Polling Patterns. 
	 * 
	 * @return <code>PDPNotification</code> of {@link org.openecomp.policy.api.PDPNotification} which has the Notification. 
	 */
	public PDPNotification getNotification() {
		return stdPolicyEngine.getNotification();
	}
	
	/**
	 * setClientKey allows the client to use their own implementation logic for Password Protection 
	 * and will be used to set the clear text password, this will be used while making Requests. 
	 *   
	 * @param clientKey depicts String format of Password/ Client_Key.  
	 */
	public void setClientKey(String clientKey){
		stdPolicyEngine.setClientKey(clientKey);
	}
	
	// Internal Setter Method to help build configRequestParameters.
	private ConfigRequestParameters setConfigRequestParameters(String policyName, String eCOMPComponentName, String configName, Map<String, String> configAttributes, UUID requestID){
		ConfigRequestParameters configRequestParameters = new ConfigRequestParameters();
		configRequestParameters.setPolicyName(policyName);
		configRequestParameters.setEcompName(eCOMPComponentName);
		configRequestParameters.setConfigName(configName);
		configRequestParameters.setConfigAttributes(configAttributes);
		configRequestParameters.setRequestID(requestID);
		return configRequestParameters;
	}
}