Merge changes from topic '13891'
[policy/engine.git] / POLICY-SDK-APP / src / main / java / org / onap / policy / controller / PolicyController.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP Policy Engine
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.policy.controller;
22
23
24 import java.io.File;
25 import java.io.FileInputStream;
26 import java.io.IOException;
27 import java.io.InputStream;
28 import java.util.ArrayList;
29 import java.util.HashMap;
30 import java.util.List;
31 import java.util.Map;
32 import java.util.Properties;
33
34 import javax.annotation.PostConstruct;
35 import javax.mail.MessagingException;
36 import javax.script.SimpleBindings;
37 import javax.servlet.http.HttpServletRequest;
38 import javax.servlet.http.HttpServletResponse;
39
40 import org.json.JSONObject;
41 import org.onap.policy.admin.PolicyNotificationMail;
42 import org.onap.policy.admin.RESTfulPAPEngine;
43 import org.onap.policy.common.logging.flexlogger.FlexLogger;
44 import org.onap.policy.common.logging.flexlogger.Logger;
45 import org.onap.policy.model.PDPGroupContainer;
46 import org.onap.policy.rest.XACMLRestProperties;
47 import org.onap.policy.rest.XacmlAdminAuthorization;
48 import org.onap.policy.rest.dao.CommonClassDao;
49 import org.onap.policy.rest.jpa.Datatype;
50 import org.onap.policy.rest.jpa.FunctionDefinition;
51 import org.onap.policy.rest.jpa.PolicyEntity;
52 import org.onap.policy.rest.jpa.PolicyVersion;
53 import org.onap.policy.rest.jpa.UserInfo;
54 import org.onap.policy.xacml.api.XACMLErrorConstants;
55 import org.onap.policy.xacml.api.pap.PAPPolicyEngine;
56 import org.openecomp.policy.model.Roles;
57 import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
58 import org.openecomp.portalsdk.core.web.support.JsonMessage;
59 import org.openecomp.portalsdk.core.web.support.UserUtils;
60 import org.springframework.beans.factory.annotation.Autowired;
61 import org.springframework.http.MediaType;
62 import org.springframework.stereotype.Controller;
63 import org.springframework.web.bind.annotation.RequestMapping;
64 import org.springframework.web.bind.annotation.RequestMethod;
65 import org.springframework.web.servlet.ModelAndView;
66
67 import com.att.research.xacml.util.XACMLProperties;
68 import com.fasterxml.jackson.databind.ObjectMapper;
69
70
71 @Controller
72 @RequestMapping("/")
73 public class PolicyController extends RestrictedBaseController {
74         private static final Logger     policyLogger    = FlexLogger.getLogger(PolicyController.class);
75
76         private static CommonClassDao commonClassDao;
77
78         // Our authorization object
79         //
80         XacmlAdminAuthorization authorizer = new XacmlAdminAuthorization();
81         //
82         // The PAP Engine
83         //
84         private static PAPPolicyEngine papEngine;
85
86         private static String logTableLimit;
87         private static String systemAlertTableLimit;
88         protected static Map<String, String> dropDownMap = new HashMap<>();
89         public static Map<String, String> getDropDownMap() {
90                 return dropDownMap;
91         }
92
93         public static void setDropDownMap(Map<String, String> dropDownMap) {
94                 PolicyController.dropDownMap = dropDownMap;
95         }
96
97         public static String getDomain() {
98                 return XACMLProperties.getProperty(XACMLRestProperties.PROP_ADMIN_DOMAIN, "urn");
99         }
100
101         private static final Object mapAccess = new Object();
102         private static Map<Datatype, List<FunctionDefinition>> mapDatatype2Function = null;
103         private static Map<String, FunctionDefinition> mapID2Function = null;
104
105         //Constant variables used across Policy-sdk
106         private static final String policyData = "policyData";
107         private static final String characterEncoding = "UTF-8";
108         private static final String contentType = "application/json";
109         private static final String file = "file";
110
111         //Smtp Java Mail Properties
112         private static String smtpHost = null;
113         private static String smtpPort = null;
114         private static String smtpUsername = null;
115         private static String smtpPassword = null;
116         private static String smtpApplicationName = null;
117         private static String smtpEmailExtension = null;
118         //log db Properties
119         private static String logdbDriver = null;
120         private static String logdbUrl = null;
121         private static String logdbUserName = null;
122         private static String logdbPassword = null;
123         private static String logdbDialect = null;
124         //Xacml db properties
125         private static String xacmldbUrl = null;
126         private static String xacmldbUserName = null;
127         private static String xacmldbPassword = null;
128
129         //AutoPush feature.
130         private static String autoPushAvailable;
131         private static String autoPushDSClosedLoop;
132         private static String autoPushDSFirewall;
133         private static String autoPushDSMicroservice;
134         private static String autoPushPDPGroup;
135
136         //papURL
137         private static String papUrl;
138
139         //MicroService Model Properties
140         private static String msOnapName;
141         private static String msPolicyName;
142
143         //WebApp directories
144         private static String configHome;
145         private static String actionHome;
146         
147         private static boolean jUnit = false;
148         
149
150         public static boolean isjUnit() {
151                 return jUnit;
152         }
153
154         public static void setjUnit(boolean jUnit) {
155                 PolicyController.jUnit = jUnit;
156         }
157
158         @Autowired
159         private PolicyController(CommonClassDao commonClassDao){
160                 PolicyController.commonClassDao = commonClassDao;
161         }
162
163         public PolicyController() {
164         }
165
166         @PostConstruct
167         public void init(){
168                 Properties prop = new Properties();
169                 InputStream input = null;
170                 try {
171                         if(jUnit){
172                                 File file = new File(new File(".").getCanonicalPath() + File.separator + "src"+ File.separator + "test" + File.separator + "resources" + File.separator + "JSONConfig.json");
173                                 input = new FileInputStream(file);
174                         }else{
175                                 input = new FileInputStream("xacml.admin.properties");
176                         }
177                         // load a properties file
178                         prop.load(input);
179                         //pap url
180                         setPapUrl(prop.getProperty("xacml.rest.pap.url"));
181                         // get the property values
182                         setSmtpHost(prop.getProperty("onap.smtp.host"));
183                         setSmtpPort(prop.getProperty("onap.smtp.port"));
184                         setSmtpUsername(prop.getProperty("onap.smtp.userName"));
185                         setSmtpPassword(prop.getProperty("onap.smtp.password"));
186                         setSmtpApplicationName(prop.getProperty("onap.application.name"));
187                         setSmtpEmailExtension(prop.getProperty("onap.smtp.emailExtension"));
188                         //Log Database Properties
189                         setLogdbDriver(prop.getProperty("xacml.log.db.driver"));
190                         setLogdbUrl(prop.getProperty("xacml.log.db.url"));
191                         setLogdbUserName(prop.getProperty("xacml.log.db.user"));
192                         setLogdbPassword(prop.getProperty("xacml.log.db.password"));
193                         setLogdbDialect(prop.getProperty("onap.dialect"));
194                         //Xacml Database Properties
195                         setXacmldbUrl(prop.getProperty("javax.persistence.jdbc.url"));
196                         setXacmldbUserName(prop.getProperty("javax.persistence.jdbc.user"));
197                         setXacmldbPassword(prop.getProperty("javax.persistence.jdbc.password"));
198                         //AutoPuh
199                         setAutoPushAvailable(prop.getProperty("xacml.automatic.push"));
200                         setAutoPushDSClosedLoop(prop.getProperty("xacml.autopush.closedloop"));
201                         setAutoPushDSFirewall(prop.getProperty("xacml.autopush.firewall"));
202                         setAutoPushDSMicroservice(prop.getProperty("xacml.autopush.microservice"));
203                         setAutoPushPDPGroup(prop.getProperty("xacml.autopush.pdpGroup"));
204                         //Micro Service Properties
205                         setMsOnapName(prop.getProperty("xacml.policy.msOnapName"));
206                         setMsPolicyName(prop.getProperty("xacml.policy.msPolicyName"));
207                         //WebApp directories
208                         setConfigHome(prop.getProperty("xacml.rest.config.webapps") + "Config");
209                         setActionHome(prop.getProperty("xacml.rest.config.webapps") + "Action");
210                         //Get the Property Values for Dashboard tab Limit
211                         try{
212                                 setLogTableLimit(prop.getProperty("xacml.onap.dashboard.logTableLimit"));
213                                 setSystemAlertTableLimit(prop.getProperty("xacml.onap.dashboard.systemAlertTableLimit"));
214                         }catch(Exception e){
215                                 policyLogger.error(XACMLErrorConstants.ERROR_DATA_ISSUE+"Dashboard tab Property fields are missing" +e);
216                                 setLogTableLimit("5000");
217                                 setSystemAlertTableLimit("2000");
218                         }
219                         System.setProperty(XACMLProperties.XACML_PROPERTIES_NAME, "xacml.admin.properties");
220                 } catch (IOException ex) {
221                         policyLogger.error(XACMLErrorConstants.ERROR_DATA_ISSUE+"Exception Occured while reading the Smtp properties from xacml.admin.properties file" +ex);
222                 } finally {
223                         if (input != null) {
224                                 try {
225                                         input.close();
226                                 } catch (IOException e) {
227                                         policyLogger.error(XACMLErrorConstants.ERROR_DATA_ISSUE+"Exception Occured while Closing the xacml.admin.properties file" +e);
228                                 }
229                         }
230                 }
231
232                 //Initialize the FunctionDefinition table at Server Start up
233                 Map<Datatype, List<FunctionDefinition>> functionMap = getFunctionDatatypeMap();
234                 for (Datatype id : functionMap.keySet()) {
235                         List<FunctionDefinition> functionDefinations = functionMap.get(id);
236                         for (FunctionDefinition functionDef : functionDefinations) {
237                                 dropDownMap.put(functionDef.getShortname(),functionDef.getXacmlid());
238                         }
239                 }
240
241         }
242
243         public static  Map<Datatype, List<FunctionDefinition>>  getFunctionDatatypeMap() {
244                 synchronized(mapAccess) {
245                         if (mapDatatype2Function == null) {
246                                 buildFunctionMaps();
247                         }
248                 }
249                 return mapDatatype2Function;
250         }
251
252         public static Map<String, FunctionDefinition> getFunctionIDMap() {
253                 synchronized(mapAccess) {
254                         if (mapID2Function == null) {
255                                 buildFunctionMaps();
256                         }
257                 }
258                 return mapID2Function;
259         }
260
261         private static  void buildFunctionMaps() {
262                 mapDatatype2Function = new HashMap<>();
263                 mapID2Function = new  HashMap<>();
264                 List<Object> functiondefinitions = commonClassDao.getData(FunctionDefinition.class);
265                 for (int i = 0; i < functiondefinitions.size(); i ++) {
266                         FunctionDefinition value = (FunctionDefinition) functiondefinitions.get(i);
267                         mapID2Function.put(value.getXacmlid(), value);
268                         if (!mapDatatype2Function.containsKey(value.getDatatypeBean())) {
269                                 mapDatatype2Function.put(value.getDatatypeBean(), new ArrayList<FunctionDefinition>());
270                         }
271                         mapDatatype2Function.get(value.getDatatypeBean()).add(value);
272                 }
273         }
274
275         @RequestMapping(value={"/get_FunctionDefinitionDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
276         public void getFunctionDefinitionData(HttpServletRequest request, HttpServletResponse response){
277                 try{
278                         Map<String, Object> model = new HashMap<>();
279                         ObjectMapper mapper = new ObjectMapper();
280                         model.put("functionDefinitionDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(FunctionDefinition.class, "shortname")));
281                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
282                         JSONObject j = new JSONObject(msg);
283                         response.getWriter().write(j.toString());
284                 }
285                 catch (Exception e){
286                         policyLogger.error(XACMLErrorConstants.ERROR_DATA_ISSUE +"Error while retriving the Function Definition data"+e);
287                 }
288         }
289
290         public PolicyEntity getPolicyEntityData(String scope, String policyName){
291                 String key = scope + ":" + policyName;
292                 List<Object> data = commonClassDao.getDataById(PolicyEntity.class, "scope:policyName", key);
293                 return (PolicyEntity) data.get(0);
294         }
295
296         public static Map<String, Roles> getUserRoles(String userId) {
297                 Map<String, Roles> scopes = new HashMap<>();
298                 List<Object> roles = commonClassDao.getDataById(Roles.class, "loginId", userId);
299                 if (roles != null && !roles.isEmpty()) {
300                         for (Object role : roles) {
301                                 scopes.put(((Roles) role).getScope(), (Roles) role);
302                         }
303                 }
304                 return scopes;
305         }
306
307         public List<String> getRolesOfUser(String userId) {
308                 List<String> rolesList = new ArrayList<>();
309                 List<Object> roles = commonClassDao.getDataById(Roles.class, "loginId", userId);
310                 for (Object role: roles) {
311                         rolesList.add(((Roles) role).getRole());
312                 }
313                 return rolesList;
314         }
315
316         public List<Object> getRoles(String userId) {
317                 return commonClassDao.getDataById(Roles.class, "loginId", userId);
318         }
319
320         //Get List of User Roles
321         @RequestMapping(value={"/get_UserRolesData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
322         public void getUserRolesEntityData(HttpServletRequest request, HttpServletResponse response){
323                 try{
324                         String userId = UserUtils.getUserSession(request).getOrgUserId();
325                         Map<String, Object> model = new HashMap<>();
326                         ObjectMapper mapper = new ObjectMapper();
327                         model.put("userRolesDatas", mapper.writeValueAsString(getRolesOfUser(userId)));
328                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
329                         JSONObject j = new JSONObject(msg);
330                         response.getWriter().write(j.toString());
331                 }
332                 catch (Exception e){
333                         policyLogger.error("Exception Occured"+e);
334                 }
335         }
336
337         //Policy tabs Model and View
338     @RequestMapping(value= {"/policy", "/policy/Editor" } , method = RequestMethod.GET)
339         public ModelAndView view(HttpServletRequest request){
340                 String myRequestURL = request.getRequestURL().toString();
341                 try {
342                         //
343                         // Set the URL for the RESTful PAP Engine
344                         //
345                         setPapEngine((PAPPolicyEngine) new RESTfulPAPEngine(myRequestURL));
346                         new PDPGroupContainer((PAPPolicyEngine) new RESTfulPAPEngine(myRequestURL));
347                 } catch (Exception e) {
348                         policyLogger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR+"Exception Occured while loading PAP"+e);
349                 }
350                 Map<String, Object> model = new HashMap<>();
351                 return new ModelAndView("policy_Editor","model", model);
352         }
353
354         public PAPPolicyEngine getPapEngine() {
355                 return papEngine;
356         }
357
358         public static void setPapEngine(PAPPolicyEngine papEngine) {
359                 PolicyController.papEngine = papEngine;
360         }
361
362         public String getUserName(String createdBy) {
363                 String loginId = createdBy;
364                 List<Object> data = commonClassDao.getDataById(UserInfo.class, "loginId", loginId);
365                 return data.get(0).toString();
366         }
367
368         public static boolean getActivePolicy(String query) {
369                 if(!commonClassDao.getDataByQuery(query, new SimpleBindings()).isEmpty()){
370                         return true;
371                 }else{
372                         return false;
373                 }
374         }
375
376         public void executeQuery(String query) {
377                 commonClassDao.updateQuery(query);
378         }
379
380         public void saveData(Object cloneEntity) {
381                 commonClassDao.save(cloneEntity);
382         }
383
384         public void updateData(Object entity) {
385                 commonClassDao.update(entity);
386         }
387
388         public void deleteData(Object entity) {
389                 commonClassDao.delete(entity);
390         }
391
392         public List<Object> getData(@SuppressWarnings("rawtypes") Class className){
393                 return commonClassDao.getData(className);
394         }
395
396         public PolicyVersion getPolicyEntityFromPolicyVersion(String query){
397                 return (PolicyVersion) commonClassDao.getEntityItem(PolicyVersion.class, "policyName", query);
398         }
399
400         public List<Object> getDataByQuery(String query, SimpleBindings params){
401                 return commonClassDao.getDataByQuery(query, params);
402         }
403
404
405         @SuppressWarnings("rawtypes")
406         public Object getEntityItem(Class className, String columname, String key){
407                 return commonClassDao.getEntityItem(className, columname, key);
408         }
409
410
411         public void watchPolicyFunction(PolicyVersion entity, String policyName, String mode){
412                 PolicyNotificationMail email = new PolicyNotificationMail();
413                 try {
414                         email.sendMail(entity, policyName, mode, commonClassDao);
415                 } catch (MessagingException e) {
416                         policyLogger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Excepton Occured while Renaming/Deleting a Policy or Scope" + e);
417                 }
418         }
419
420         //Switch Version
421         public JSONObject switchVersionPolicyContent(String policyName) {
422                 String dbCheckName = policyName.replace("/", ".");
423                 if(dbCheckName.contains("Config_")){
424                         dbCheckName = dbCheckName.replace(".Config_", ":Config_");
425                 }else if(dbCheckName.contains("Action_")){
426                         dbCheckName = dbCheckName.replace(".Action_", ":Action_");
427                 }else if(dbCheckName.contains("Decision_")){
428                         dbCheckName = dbCheckName.replace(".Decision_", ":Decision_");
429                 }
430                 String[] splitDBCheckName = dbCheckName.split(":");
431                 String query =   "FROM PolicyEntity where policyName like :splitDBCheckName1 and scope = :splitDBCheckName0";
432                 SimpleBindings params = new SimpleBindings();
433                 params.put("splitDBCheckName1", splitDBCheckName[1] + "%");
434                 params.put("splitDBCheckName0", splitDBCheckName[0]);
435                 List<Object> policyEntity = commonClassDao.getDataByQuery(query, params);
436                 List<String> av = new ArrayList<>();
437                 for(Object entity : policyEntity){
438                         PolicyEntity pEntity = (PolicyEntity) entity;
439                         String removeExtension = pEntity.getPolicyName().replace(".xml", "");
440                         String version = removeExtension.substring(removeExtension.lastIndexOf(".")+1);
441                         av.add(version);
442                 }
443                 if(policyName.contains("/")){
444                         policyName = policyName.replace("/", File.separator);
445                 }
446                 PolicyVersion entity = (PolicyVersion) commonClassDao.getEntityItem(PolicyVersion.class, "policyName", policyName);
447                 JSONObject el = new JSONObject();
448                 el.put("activeVersion", entity.getActiveVersion());
449                 el.put("availableVersions", av);
450                 el.put("highestVersion", entity.getHigherVersion());
451                 return el;
452         }
453
454         public static String getLogTableLimit() {
455                 return logTableLimit;
456         }
457
458         public static void setLogTableLimit(String logTableLimit) {
459                 PolicyController.logTableLimit = logTableLimit;
460         }
461
462         public static String getSystemAlertTableLimit() {
463                 return systemAlertTableLimit;
464         }
465
466         public static void setSystemAlertTableLimit(String systemAlertTableLimit) {
467                 PolicyController.systemAlertTableLimit = systemAlertTableLimit;
468         }
469
470         public static CommonClassDao getCommonClassDao() {
471                 return commonClassDao;
472         }
473
474         public static void setCommonClassDao(CommonClassDao commonClassDao) {
475                 PolicyController.commonClassDao = commonClassDao;
476         }
477
478         public XacmlAdminAuthorization getAuthorizer() {
479                 return authorizer;
480         }
481
482         public void setAuthorizer(XacmlAdminAuthorization authorizer) {
483                 this.authorizer = authorizer;
484         }
485
486         public static Map<Datatype, List<FunctionDefinition>> getMapDatatype2Function() {
487                 return mapDatatype2Function;
488         }
489
490         public static void setMapDatatype2Function(Map<Datatype, List<FunctionDefinition>> mapDatatype2Function) {
491                 PolicyController.mapDatatype2Function = mapDatatype2Function;
492         }
493
494         public static Map<String, FunctionDefinition> getMapID2Function() {
495                 return mapID2Function;
496         }
497
498         public static void setMapID2Function(Map<String, FunctionDefinition> mapID2Function) {
499                 PolicyController.mapID2Function = mapID2Function;
500         }
501
502         public static String getSmtpHost() {
503                 return smtpHost;
504         }
505
506         public static void setSmtpHost(String smtpHost) {
507                 PolicyController.smtpHost = smtpHost;
508         }
509
510         public static String getSmtpPort() {
511                 return smtpPort;
512         }
513
514         public static void setSmtpPort(String smtpPort) {
515                 PolicyController.smtpPort = smtpPort;
516         }
517
518         public static String getSmtpUsername() {
519                 return smtpUsername;
520         }
521
522         public static void setSmtpUsername(String smtpUsername) {
523                 PolicyController.smtpUsername = smtpUsername;
524         }
525
526         public static String getSmtpPassword() {
527                 return smtpPassword;
528         }
529
530         public static void setSmtpPassword(String smtpPassword) {
531                 PolicyController.smtpPassword = smtpPassword;
532         }
533
534         public static String getSmtpApplicationName() {
535                 return smtpApplicationName;
536         }
537
538         public static void setSmtpApplicationName(String smtpApplicationName) {
539                 PolicyController.smtpApplicationName = smtpApplicationName;
540         }
541
542         public static String getSmtpEmailExtension() {
543                 return smtpEmailExtension;
544         }
545
546         public static void setSmtpEmailExtension(String smtpEmailExtension) {
547                 PolicyController.smtpEmailExtension = smtpEmailExtension;
548         }
549
550         public static String getLogdbDriver() {
551                 return logdbDriver;
552         }
553
554         public static void setLogdbDriver(String logdbDriver) {
555                 PolicyController.logdbDriver = logdbDriver;
556         }
557
558         public static String getLogdbUrl() {
559                 return logdbUrl;
560         }
561
562         public static void setLogdbUrl(String logdbUrl) {
563                 PolicyController.logdbUrl = logdbUrl;
564         }
565
566         public static String getLogdbUserName() {
567                 return logdbUserName;
568         }
569
570         public static void setLogdbUserName(String logdbUserName) {
571                 PolicyController.logdbUserName = logdbUserName;
572         }
573
574         public static String getLogdbPassword() {
575                 return logdbPassword;
576         }
577
578         public static void setLogdbPassword(String logdbPassword) {
579                 PolicyController.logdbPassword = logdbPassword;
580         }
581
582         public static String getLogdbDialect() {
583                 return logdbDialect;
584         }
585
586         public static void setLogdbDialect(String logdbDialect) {
587                 PolicyController.logdbDialect = logdbDialect;
588         }
589
590         public static String getXacmldbUrl() {
591                 return xacmldbUrl;
592         }
593
594         public static void setXacmldbUrl(String xacmldbUrl) {
595                 PolicyController.xacmldbUrl = xacmldbUrl;
596         }
597
598         public static String getXacmldbUserName() {
599                 return xacmldbUserName;
600         }
601
602         public static void setXacmldbUserName(String xacmldbUserName) {
603                 PolicyController.xacmldbUserName = xacmldbUserName;
604         }
605
606         public static String getXacmldbPassword() {
607                 return xacmldbPassword;
608         }
609
610         public static void setXacmldbPassword(String xacmldbPassword) {
611                 PolicyController.xacmldbPassword = xacmldbPassword;
612         }
613
614         public static String getAutoPushAvailable() {
615                 return autoPushAvailable;
616         }
617
618         public static void setAutoPushAvailable(String autoPushAvailable) {
619                 PolicyController.autoPushAvailable = autoPushAvailable;
620         }
621
622         public static String getAutoPushDSClosedLoop() {
623                 return autoPushDSClosedLoop;
624         }
625
626         public static void setAutoPushDSClosedLoop(String autoPushDSClosedLoop) {
627                 PolicyController.autoPushDSClosedLoop = autoPushDSClosedLoop;
628         }
629
630         public static String getAutoPushDSFirewall() {
631                 return autoPushDSFirewall;
632         }
633
634         public static void setAutoPushDSFirewall(String autoPushDSFirewall) {
635                 PolicyController.autoPushDSFirewall = autoPushDSFirewall;
636         }
637
638         public static String getAutoPushDSMicroservice() {
639                 return autoPushDSMicroservice;
640         }
641
642         public static void setAutoPushDSMicroservice(String autoPushDSMicroservice) {
643                 PolicyController.autoPushDSMicroservice = autoPushDSMicroservice;
644         }
645
646         public static String getAutoPushPDPGroup() {
647                 return autoPushPDPGroup;
648         }
649
650         public static void setAutoPushPDPGroup(String autoPushPDPGroup) {
651                 PolicyController.autoPushPDPGroup = autoPushPDPGroup;
652         }
653
654         public static String getPapUrl() {
655                 return papUrl;
656         }
657
658         public static void setPapUrl(String papUrl) {
659                 PolicyController.papUrl = papUrl;
660         }
661
662         public static String getMsOnapName() {
663                 return msOnapName;
664         }
665
666         public static void setMsOnapName(String msOnapName) {
667                 PolicyController.msOnapName = msOnapName;
668         }
669
670         public static String getMsPolicyName() {
671                 return msPolicyName;
672         }
673
674         public static void setMsPolicyName(String msPolicyName) {
675                 PolicyController.msPolicyName = msPolicyName;
676         }
677
678         public static String getConfigHome() {
679                 return configHome;
680         }
681
682         public static void setConfigHome(String configHome) {
683                 PolicyController.configHome = configHome;
684         }
685
686         public static String getActionHome() {
687                 return actionHome;
688         }
689
690         public static void setActionHome(String actionHome) {
691                 PolicyController.actionHome = actionHome;
692         }
693
694         public static Object getMapaccess() {
695                 return mapAccess;
696         }
697
698         public static String getPolicydata() {
699                 return policyData;
700         }
701
702         public static String getCharacterencoding() {
703                 return characterEncoding;
704         }
705
706         public static String getContenttype() {
707                 return contentType;
708         }
709
710         public static String getFile() {
711                 return file;
712         }
713         
714         public String convertDate(String dateTTL) {
715                 String formateDate = null;
716                 if(dateTTL.contains("-")){
717                         formateDate = dateTTL.replace("-", "/");
718                 }
719                 return formateDate;
720         }
721 }