2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
20 package org.onap.policy.pap.xacml.rest.service;
22 import java.io.IOException;
24 import javax.servlet.http.HttpServletRequest;
25 import javax.servlet.http.HttpServletResponse;
27 import org.onap.policy.pap.xacml.rest.controller.ActionPolicyDictionaryController;
28 import org.onap.policy.pap.xacml.rest.controller.BRMSDictionaryController;
29 import org.onap.policy.pap.xacml.rest.controller.ClosedLoopDictionaryController;
30 import org.onap.policy.pap.xacml.rest.controller.DecisionPolicyDictionaryController;
31 import org.onap.policy.pap.xacml.rest.controller.DescriptiveDictionaryController;
32 import org.onap.policy.pap.xacml.rest.controller.DictionaryController;
33 import org.onap.policy.pap.xacml.rest.controller.EnforcerDictionaryController;
34 import org.onap.policy.pap.xacml.rest.controller.FirewallDictionaryController;
35 import org.onap.policy.pap.xacml.rest.controller.MicroServiceDictionaryController;
36 import org.onap.policy.pap.xacml.rest.controller.PolicyScopeDictionaryController;
37 import org.onap.policy.pap.xacml.rest.controller.SafePolicyController;
38 import org.springframework.stereotype.Service;
39 import org.springframework.web.servlet.ModelAndView;
42 @Service("DictionaryService")
43 public class DictionaryService {
46 * Methods that call the controller method directly to Save and Update dictionary data
48 public String saveOnapDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException {
50 DictionaryController dictionary = new DictionaryController();
51 String responseString = null;
52 ModelAndView result = dictionary.saveOnapDictionary(request, response);
53 responseString = result.getViewName();
54 return responseString;
58 public String saveAttributeDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
60 DictionaryController dictionary = new DictionaryController();
61 String responseString = null;
62 ModelAndView result = dictionary.saveAttributeDictionary(request, response);
63 responseString = result.getViewName();
64 return responseString;
67 public String saveActionPolicyDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException {
69 ActionPolicyDictionaryController action = new ActionPolicyDictionaryController();
70 String responseString = null;
71 ModelAndView result = action.saveActionPolicyDictionary(request, response);
72 responseString = result.getViewName();
73 return responseString;
76 public String saveBRMSParamDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException {
78 BRMSDictionaryController dictionary = new BRMSDictionaryController();
79 String responseString = null;
80 ModelAndView result = dictionary.saveBRMSParamDictionary(request, response);
81 responseString = result.getViewName();
82 return responseString;
85 public String saveVSCLAction(HttpServletRequest request, HttpServletResponse response) throws IOException{
87 ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController();
88 String responseString = null;
89 ModelAndView result = dictionary.saveVSCLAction(request, response);
90 responseString = result.getViewName();
91 return responseString;
94 public String saveVnfType(HttpServletRequest request, HttpServletResponse response) throws IOException{
96 ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController();
97 String responseString = null;
98 ModelAndView result = dictionary.saveVnfType(request, response);
99 responseString = result.getViewName();
100 return responseString;
103 public String savePEPOptions(HttpServletRequest request, HttpServletResponse response) throws IOException{
105 ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController();
106 String responseString = null;
107 ModelAndView result = dictionary.savePEPOptions(request, response);
108 responseString = result.getViewName();
109 return responseString;
112 public String saveVarbind(HttpServletRequest request, HttpServletResponse response) throws IOException{
114 ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController();
115 String responseString = null;
116 ModelAndView result = dictionary.saveVarbind(request, response);
117 responseString = result.getViewName();
118 return responseString;
121 public String saveServiceType(HttpServletRequest request, HttpServletResponse response) throws IOException{
123 ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController();
124 String responseString = null;
125 ModelAndView result = dictionary.saveServiceType(request, response);
126 responseString = result.getViewName();
127 return responseString;
130 public String saveSiteType(HttpServletRequest request, HttpServletResponse response) throws IOException{
132 ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController();
133 String responseString = null;
134 ModelAndView result = dictionary.saveSiteType(request, response);
135 responseString = result.getViewName();
136 return responseString;
139 public String saveSettingsDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
141 DecisionPolicyDictionaryController dictionary = new DecisionPolicyDictionaryController();
142 String responseString = null;
143 ModelAndView result = dictionary.saveSettingsDictionary(request, response);
144 responseString = result.getViewName();
145 return responseString;
148 public String saveDescriptiveDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
150 DescriptiveDictionaryController dictionary = new DescriptiveDictionaryController();
151 String responseString = null;
152 ModelAndView result = dictionary.saveDescriptiveDictionary(request, response);
153 responseString = result.getViewName();
154 return responseString;
157 public String saveEnforcerDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
159 EnforcerDictionaryController dictionary = new EnforcerDictionaryController();
160 String responseString = null;
161 ModelAndView result = dictionary.saveEnforcerDictionary(request, response);
162 responseString = result.getViewName();
163 return responseString;
166 public String saveActionListDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
168 FirewallDictionaryController dictionary = new FirewallDictionaryController();
169 String responseString = null;
170 ModelAndView result = dictionary.saveActionListDictionary(request, response);
171 responseString = result.getViewName();
172 return responseString;
175 public String saveProtocolListDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
177 FirewallDictionaryController dictionary = new FirewallDictionaryController();
178 String responseString = null;
179 ModelAndView result = dictionary.saveProtocolListDictionary(request, response);
180 responseString = result.getViewName();
181 return responseString;
184 public String saveZoneDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
186 FirewallDictionaryController dictionary = new FirewallDictionaryController();
187 String responseString = null;
188 ModelAndView result = dictionary.saveZoneDictionary(request, response);
189 responseString = result.getViewName();
190 return responseString;
193 public String saveSecurityZoneDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
195 FirewallDictionaryController dictionary = new FirewallDictionaryController();
196 String responseString = null;
197 ModelAndView result = dictionary.saveSecurityZoneDictionary(request, response);
198 responseString = result.getViewName();
199 return responseString;
202 public String savePrefixListDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
204 FirewallDictionaryController dictionary = new FirewallDictionaryController();
205 String responseString = null;
206 ModelAndView result = dictionary.savePrefixListDictionary(request, response);
207 responseString = result.getViewName();
208 return responseString;
211 public String saveAddressGroupDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
213 FirewallDictionaryController dictionary = new FirewallDictionaryController();
214 String responseString = null;
215 ModelAndView result = dictionary.saveAddressGroupDictionary(request, response);
216 responseString = result.getViewName();
217 return responseString;
220 public String saveServiceGroupDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
222 FirewallDictionaryController dictionary = new FirewallDictionaryController();
223 String responseString = null;
224 ModelAndView result = dictionary.saveServiceGroupDictionary(request, response);
225 responseString = result.getViewName();
226 return responseString;
229 public String saveServiceListDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
231 FirewallDictionaryController dictionary = new FirewallDictionaryController();
232 String responseString = null;
233 ModelAndView result = dictionary.saveServiceListDictionary(request, response);
234 responseString = result.getViewName();
235 return responseString;
238 public String saveTermListDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
240 FirewallDictionaryController dictionary = new FirewallDictionaryController();
241 String responseString = null;
242 ModelAndView result = dictionary.saveTermListDictionary(request, response);
243 responseString = result.getViewName();
244 return responseString;
250 public String saveMicroServiceLocationDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
252 MicroServiceDictionaryController dictionary = new MicroServiceDictionaryController();
253 String responseString = null;
254 ModelAndView result = dictionary.saveMicroServiceLocationDictionary(request, response);
255 responseString = result.getViewName();
256 return responseString;
259 public String saveMicroServiceConfigNameDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
261 MicroServiceDictionaryController dictionary = new MicroServiceDictionaryController();
262 String responseString = null;
263 ModelAndView result = dictionary.saveMicroServiceConfigNameDictionary(request, response);
264 responseString = result.getViewName();
265 return responseString;
268 public String saveDCAEUUIDDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
270 MicroServiceDictionaryController dictionary = new MicroServiceDictionaryController();
271 String responseString = null;
272 ModelAndView result = dictionary.saveDCAEUUIDDictionary(request, response);
273 responseString = result.getViewName();
274 return responseString;
277 public String saveMicroServiceModelsDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
279 MicroServiceDictionaryController dictionary = new MicroServiceDictionaryController();
280 String responseString = null;
281 ModelAndView result = dictionary.saveMicroServiceModelsDictionary(request, response);
282 responseString = result.getViewName();
283 return responseString;
286 public String saveMicroServiceDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
288 MicroServiceDictionaryController dictionary = new MicroServiceDictionaryController();
289 String responseString = null;
290 ModelAndView result = dictionary.saveMicroServiceAttributeDictionary(request, response);
291 responseString = result.getViewName();
292 return responseString;
295 public String savePSServiceDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
297 PolicyScopeDictionaryController dictionary = new PolicyScopeDictionaryController();
298 String responseString = null;
299 ModelAndView result = dictionary.savePSServiceDictionary(request, response);
300 responseString = result.getViewName();
301 return responseString;
304 public String savePSResourceDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
306 PolicyScopeDictionaryController dictionary = new PolicyScopeDictionaryController();
307 String responseString = null;
308 ModelAndView result = dictionary.savePSResourceDictionary(request, response);
309 responseString = result.getViewName();
310 return responseString;
313 public String savePSTypeDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
315 PolicyScopeDictionaryController dictionary = new PolicyScopeDictionaryController();
316 String responseString = null;
317 ModelAndView result = dictionary.savePSTypeDictionary(request, response);
318 responseString = result.getViewName();
319 return responseString;
322 public String savePSClosedLoopDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
324 PolicyScopeDictionaryController dictionary = new PolicyScopeDictionaryController();
325 String responseString = null;
326 ModelAndView result = dictionary.savePSClosedLoopDictionary(request, response);
327 responseString = result.getViewName();
328 return responseString;
331 public String savePSGroupScopeDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
333 PolicyScopeDictionaryController dictionary = new PolicyScopeDictionaryController();
334 String responseString = null;
335 ModelAndView result = dictionary.savePSGroupScopeDictionary(request, response);
336 responseString = result.getViewName();
337 return responseString;
340 public String saveRiskTypeDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
342 SafePolicyController dictionary = new SafePolicyController();
343 String responseString = null;
344 ModelAndView result = dictionary.saveRiskTypeDictionary(request, response);
345 responseString = result.getViewName();
346 return responseString;
349 public String saveSafePolicyWarningDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
350 SafePolicyController dictionary = new SafePolicyController();
351 String responseString = null;
352 ModelAndView result = dictionary.saveSafePolicyWarningDictionary(request, response);
353 responseString = result.getViewName();
354 return responseString;
359 * Methods that call the controller get methods directly to get dictionary data
361 public void getOnapDictionary(HttpServletRequest request, HttpServletResponse response){
362 DictionaryController dictionary = new DictionaryController();
363 dictionary.getOnapNameDictionaryEntityData(request, response);
366 public void getAttributeDictionary(HttpServletRequest request, HttpServletResponse response){
367 DictionaryController dictionary = new DictionaryController();
368 dictionary.getAttributeDictionaryEntityData(request, response);
371 public void getActionPolicyDictionary(HttpServletRequest request, HttpServletResponse response){
372 ActionPolicyDictionaryController action = new ActionPolicyDictionaryController();
373 action.getActionPolicyDictionaryEntityData(request, response);
376 public void getBRMSParamDictionary(HttpServletRequest request, HttpServletResponse response){
377 BRMSDictionaryController dictionary = new BRMSDictionaryController();
378 dictionary.getBRMSParamDictionaryEntityData(request, response);
381 public void getVSCLAction(HttpServletRequest request, HttpServletResponse response){
382 ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController();
383 dictionary.getVSCLActionDictionaryEntityData(request, response);
386 public void getVnfType(HttpServletRequest request, HttpServletResponse response){
387 ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController();
388 dictionary.getVNFTypeDictionaryEntityData(request, response);
391 public void getPEPOptions(HttpServletRequest request, HttpServletResponse response){
392 ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController();
393 dictionary.getPEPOptionsDictionaryEntityData(request, response);
396 public void getVarbind(HttpServletRequest request, HttpServletResponse response){
397 ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController();
398 dictionary.getVarbindDictionaryEntityData(request, response);
401 public void getServiceType(HttpServletRequest request, HttpServletResponse response){
402 ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController();
403 dictionary.getClosedLoopServiceDictionaryEntityData(request, response);
406 public void getSiteType(HttpServletRequest request, HttpServletResponse response){
407 ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController();
408 dictionary.getClosedLoopSiteDictionaryEntityData(request, response);
411 public void getSettingsDictionary(HttpServletRequest request, HttpServletResponse response){
412 DecisionPolicyDictionaryController dictionary = new DecisionPolicyDictionaryController();
413 dictionary.getSettingsDictionaryEntityData(request, response);
416 public void getDescriptiveDictionary(HttpServletRequest request, HttpServletResponse response){
417 DescriptiveDictionaryController dictionary = new DescriptiveDictionaryController();
418 dictionary.getDescriptiveDictionaryEntityData(request, response);
421 public void getEnforcerDictionary(HttpServletRequest request, HttpServletResponse response){
422 EnforcerDictionaryController dictionary = new EnforcerDictionaryController();
423 dictionary.getEnforcerDictionaryEntityData(request, response);
426 public void getActionListDictionary(HttpServletRequest request, HttpServletResponse response){
427 FirewallDictionaryController dictionary = new FirewallDictionaryController();
428 dictionary.getActionListDictionaryEntityData(request, response);
431 public void getProtocolListDictionary(HttpServletRequest request, HttpServletResponse response){
432 FirewallDictionaryController dictionary = new FirewallDictionaryController();
433 dictionary.getProtocolListDictionaryEntityData(request, response);
436 public void getZoneDictionary(HttpServletRequest request, HttpServletResponse response){
437 FirewallDictionaryController dictionary = new FirewallDictionaryController();
438 dictionary.getZoneDictionaryEntityData(request, response);
441 public void getSecurityZoneDictionary(HttpServletRequest request, HttpServletResponse response){
442 FirewallDictionaryController dictionary = new FirewallDictionaryController();
443 dictionary.getSecurityZoneDictionaryEntityData(request, response);
446 public void getPrefixListDictionary(HttpServletRequest request, HttpServletResponse response){
447 FirewallDictionaryController dictionary = new FirewallDictionaryController();
448 dictionary.getPrefixListDictionaryEntityData(request, response);
451 public void getAddressGroupDictionary(HttpServletRequest request, HttpServletResponse response){
452 FirewallDictionaryController dictionary = new FirewallDictionaryController();
453 dictionary.getAddressGroupDictionaryEntityData(request, response);
456 public void getServiceGroupDictionary(HttpServletRequest request, HttpServletResponse response){
457 FirewallDictionaryController dictionary = new FirewallDictionaryController();
458 dictionary.getServiceGroupDictionaryEntityData(request, response);
461 public void getServiceListDictionary(HttpServletRequest request, HttpServletResponse response){
462 FirewallDictionaryController dictionary = new FirewallDictionaryController();
463 dictionary.getServiceListDictionaryEntityData(request, response);
466 public void getTermListDictionary(HttpServletRequest request, HttpServletResponse response){
467 FirewallDictionaryController dictionary = new FirewallDictionaryController();
468 dictionary.getTermListDictionaryEntityData(request, response);
472 public void getMicroServiceLocationDictionary(HttpServletRequest request, HttpServletResponse response){
473 MicroServiceDictionaryController dictionary = new MicroServiceDictionaryController();
474 dictionary.getMicroServiceLocationDictionaryEntityData(request, response);
477 public void getMicroServiceConfigNameDictionary(HttpServletRequest request, HttpServletResponse response){
478 MicroServiceDictionaryController dictionary = new MicroServiceDictionaryController();
479 dictionary.getMicroServiceConfigNameDictionaryEntityData(request, response);
482 public void getDCAEUUIDDictionary(HttpServletRequest request, HttpServletResponse response){
483 MicroServiceDictionaryController dictionary = new MicroServiceDictionaryController();
484 dictionary.getDCAEUUIDDictionaryEntityData(request, response);
487 public void getMicroServiceModelsDictionary(HttpServletRequest request, HttpServletResponse response){
488 MicroServiceDictionaryController dictionary = new MicroServiceDictionaryController();
489 dictionary.getMicroServiceModelsDictionaryEntityData(request, response);
492 public void getMicroServiceDictionary(HttpServletRequest request, HttpServletResponse response){
493 MicroServiceDictionaryController dictionary = new MicroServiceDictionaryController();
494 dictionary.getMicroServiceModelsDictionaryEntityData(request, response);
497 public void getPSServiceDictionary(HttpServletRequest request, HttpServletResponse response){
498 PolicyScopeDictionaryController dictionary = new PolicyScopeDictionaryController();
499 dictionary.getPSServiceEntityData(request, response);
502 public void getPSResourceDictionary(HttpServletRequest request, HttpServletResponse response){
503 PolicyScopeDictionaryController dictionary = new PolicyScopeDictionaryController();
504 dictionary.getPSResourceEntityData(request, response);
507 public void getPSTypeDictionary(HttpServletRequest request, HttpServletResponse response){
508 PolicyScopeDictionaryController dictionary = new PolicyScopeDictionaryController();
509 dictionary.getPSTypeEntityData(request, response);
512 public void getPSClosedLoopDictionary(HttpServletRequest request, HttpServletResponse response){
513 PolicyScopeDictionaryController dictionary = new PolicyScopeDictionaryController();
514 dictionary.getPSClosedLoopEntityData(request, response);
517 public void getPSGroupScopeDictionary(HttpServletRequest request, HttpServletResponse response){
518 PolicyScopeDictionaryController dictionary = new PolicyScopeDictionaryController();
519 dictionary.getGroupPolicyScopeEntityData(request, response);
522 public void getRiskTypeDictionary(HttpServletRequest request, HttpServletResponse response){
523 SafePolicyController dictionary = new SafePolicyController();
524 dictionary.getOnapNameDictionaryEntityData(request, response);
527 public void getSafePolicyWarningDictionary(HttpServletRequest request, HttpServletResponse response) {
528 SafePolicyController dictionary = new SafePolicyController();
529 dictionary.getSafePolicyWarningeEntityData(request, response);