Merge "Restrict file upload size in policy editor"
[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.model.Roles;
47 import org.onap.policy.rest.XACMLRestProperties;
48 import org.onap.policy.rest.XacmlAdminAuthorization;
49 import org.onap.policy.rest.dao.CommonClassDao;
50 import org.onap.policy.rest.jpa.Datatype;
51 import org.onap.policy.rest.jpa.FunctionDefinition;
52 import org.onap.policy.rest.jpa.PolicyEntity;
53 import org.onap.policy.rest.jpa.PolicyVersion;
54 import org.onap.policy.rest.jpa.UserInfo;
55 import org.onap.policy.xacml.api.XACMLErrorConstants;
56 import org.onap.policy.xacml.api.pap.PAPPolicyEngine;
57 import org.onap.portalsdk.core.controller.RestrictedBaseController;
58 import org.onap.portalsdk.core.web.support.JsonMessage;
59 import org.onap.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         //File upload size
148         private static long fileSizeLimit;
149         
150         private static boolean jUnit = false;
151         
152
153         public static boolean isjUnit() {
154                 return jUnit;
155         }
156
157         public static void setjUnit(boolean jUnit) {
158                 PolicyController.jUnit = jUnit;
159         }
160
161         @Autowired
162         private PolicyController(CommonClassDao commonClassDao){
163                 PolicyController.commonClassDao = commonClassDao;
164         }
165
166         public PolicyController() {
167         }
168
169         @PostConstruct
170         public void init(){
171                 Properties prop = new Properties();
172                 InputStream input = null;
173                 try {
174                         if(jUnit){
175                                 File file = new File(new File(".").getCanonicalPath() + File.separator + "src"+ File.separator + "test" + File.separator + "resources" + File.separator + "JSONConfig.json");
176                                 input = new FileInputStream(file);
177                         }else{
178                                 input = new FileInputStream("xacml.admin.properties");
179                         }
180                         // load a properties file
181                         prop.load(input);
182                         //file upload size limit property
183                         setFileSizeLimit(prop.getProperty("file.size.limit"));
184                         //pap url
185                         setPapUrl(prop.getProperty("xacml.rest.pap.url"));
186                         // get the property values
187                         setSmtpHost(prop.getProperty("onap.smtp.host"));
188                         setSmtpPort(prop.getProperty("onap.smtp.port"));
189                         setSmtpUsername(prop.getProperty("onap.smtp.userName"));
190                         setSmtpPassword(prop.getProperty("onap.smtp.password"));
191                         setSmtpApplicationName(prop.getProperty("onap.application.name"));
192                         setSmtpEmailExtension(prop.getProperty("onap.smtp.emailExtension"));
193                         //Log Database Properties
194                         setLogdbDriver(prop.getProperty("xacml.log.db.driver"));
195                         setLogdbUrl(prop.getProperty("xacml.log.db.url"));
196                         setLogdbUserName(prop.getProperty("xacml.log.db.user"));
197                         setLogdbPassword(prop.getProperty("xacml.log.db.password"));
198                         setLogdbDialect(prop.getProperty("onap.dialect"));
199                         //Xacml Database Properties
200                         setXacmldbUrl(prop.getProperty("javax.persistence.jdbc.url"));
201                         setXacmldbUserName(prop.getProperty("javax.persistence.jdbc.user"));
202                         setXacmldbPassword(prop.getProperty("javax.persistence.jdbc.password"));
203                         //AutoPuh
204                         setAutoPushAvailable(prop.getProperty("xacml.automatic.push"));
205                         setAutoPushDSClosedLoop(prop.getProperty("xacml.autopush.closedloop"));
206                         setAutoPushDSFirewall(prop.getProperty("xacml.autopush.firewall"));
207                         setAutoPushDSMicroservice(prop.getProperty("xacml.autopush.microservice"));
208                         setAutoPushPDPGroup(prop.getProperty("xacml.autopush.pdpGroup"));
209                         //Micro Service Properties
210                         setMsOnapName(prop.getProperty("xacml.policy.msOnapName"));
211                         if(getMsOnapName() == null){
212                                 setMsOnapName(prop.getProperty("xacml.policy.msEcompName"));
213                         }
214                         policyLogger.info("getMsOnapName => " + getMsOnapName());
215                         setMsPolicyName(prop.getProperty("xacml.policy.msPolicyName"));
216                         policyLogger.info("setMsPolicyName => " + getMsPolicyName());
217                         //WebApp directories
218                         setConfigHome(prop.getProperty("xacml.rest.config.webapps") + "Config");
219                         setActionHome(prop.getProperty("xacml.rest.config.webapps") + "Action");
220                         //Get the Property Values for Dashboard tab Limit
221                         try{
222                                 setLogTableLimit(prop.getProperty("xacml.onap.dashboard.logTableLimit"));
223                                 setSystemAlertTableLimit(prop.getProperty("xacml.onap.dashboard.systemAlertTableLimit"));
224                         }catch(Exception e){
225                                 policyLogger.error(XACMLErrorConstants.ERROR_DATA_ISSUE+"Dashboard tab Property fields are missing" +e);
226                                 setLogTableLimit("5000");
227                                 setSystemAlertTableLimit("2000");
228                         }
229                         System.setProperty(XACMLProperties.XACML_PROPERTIES_NAME, "xacml.admin.properties");
230                 } catch (IOException ex) {
231                         policyLogger.error(XACMLErrorConstants.ERROR_DATA_ISSUE+"Exception Occured while reading the Smtp properties from xacml.admin.properties file" +ex);
232                 } finally {
233                         if (input != null) {
234                                 try {
235                                         input.close();
236                                 } catch (IOException e) {
237                                         policyLogger.error(XACMLErrorConstants.ERROR_DATA_ISSUE+"Exception Occured while Closing the xacml.admin.properties file" +e);
238                                 }
239                         }
240                 }
241
242                 //Initialize the FunctionDefinition table at Server Start up
243                 Map<Datatype, List<FunctionDefinition>> functionMap = getFunctionDatatypeMap();
244                 for (Datatype id : functionMap.keySet()) {
245                         List<FunctionDefinition> functionDefinations = functionMap.get(id);
246                         for (FunctionDefinition functionDef : functionDefinations) {
247                                 dropDownMap.put(functionDef.getShortname(),functionDef.getXacmlid());
248                         }
249                 }
250
251         }
252
253         public static  Map<Datatype, List<FunctionDefinition>>  getFunctionDatatypeMap() {
254                 synchronized(mapAccess) {
255                         if (mapDatatype2Function == null) {
256                                 buildFunctionMaps();
257                         }
258                 }
259                 return mapDatatype2Function;
260         }
261
262         public static Map<String, FunctionDefinition> getFunctionIDMap() {
263                 synchronized(mapAccess) {
264                         if (mapID2Function == null) {
265                                 buildFunctionMaps();
266                         }
267                 }
268                 return mapID2Function;
269         }
270
271         private static  void buildFunctionMaps() {
272                 mapDatatype2Function = new HashMap<>();
273                 mapID2Function = new  HashMap<>();
274                 List<Object> functiondefinitions = commonClassDao.getData(FunctionDefinition.class);
275                 for (int i = 0; i < functiondefinitions.size(); i ++) {
276                         FunctionDefinition value = (FunctionDefinition) functiondefinitions.get(i);
277                         mapID2Function.put(value.getXacmlid(), value);
278                         if (!mapDatatype2Function.containsKey(value.getDatatypeBean())) {
279                                 mapDatatype2Function.put(value.getDatatypeBean(), new ArrayList<FunctionDefinition>());
280                         }
281                         mapDatatype2Function.get(value.getDatatypeBean()).add(value);
282                 }
283         }
284
285         @RequestMapping(value={"/get_FunctionDefinitionDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
286         public void getFunctionDefinitionData(HttpServletRequest request, HttpServletResponse response){
287                 try{
288                         Map<String, Object> model = new HashMap<>();
289                         ObjectMapper mapper = new ObjectMapper();
290                         model.put("functionDefinitionDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(FunctionDefinition.class, "shortname")));
291                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
292                         JSONObject j = new JSONObject(msg);
293                         response.getWriter().write(j.toString());
294                 }
295                 catch (Exception e){
296                         policyLogger.error(XACMLErrorConstants.ERROR_DATA_ISSUE +"Error while retriving the Function Definition data"+e);
297                 }
298         }
299
300         public PolicyEntity getPolicyEntityData(String scope, String policyName){
301                 String key = scope + ":" + policyName;
302                 List<Object> data = commonClassDao.getDataById(PolicyEntity.class, "scope:policyName", key);
303                 return (PolicyEntity) data.get(0);
304         }
305
306         public static Map<String, Roles> getUserRoles(String userId) {
307                 Map<String, Roles> scopes = new HashMap<>();
308                 List<Object> roles = commonClassDao.getDataById(Roles.class, "loginId", userId);
309                 if (roles != null && !roles.isEmpty()) {
310                         for (Object role : roles) {
311                                 scopes.put(((Roles) role).getScope(), (Roles) role);
312                         }
313                 }
314                 return scopes;
315         }
316
317         public List<String> getRolesOfUser(String userId) {
318                 List<String> rolesList = new ArrayList<>();
319                 List<Object> roles = commonClassDao.getDataById(Roles.class, "loginId", userId);
320                 for (Object role: roles) {
321                         rolesList.add(((Roles) role).getRole());
322                 }
323                 return rolesList;
324         }
325
326         public List<Object> getRoles(String userId) {
327                 return commonClassDao.getDataById(Roles.class, "loginId", userId);
328         }
329
330         //Get List of User Roles
331         @RequestMapping(value={"/get_UserRolesData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
332         public void getUserRolesEntityData(HttpServletRequest request, HttpServletResponse response){
333                 try{
334                         String userId = UserUtils.getUserSession(request).getOrgUserId();
335                         Map<String, Object> model = new HashMap<>();
336                         ObjectMapper mapper = new ObjectMapper();
337                         model.put("userRolesDatas", mapper.writeValueAsString(getRolesOfUser(userId)));
338                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
339                         JSONObject j = new JSONObject(msg);
340                         response.getWriter().write(j.toString());
341                 }
342                 catch (Exception e){
343                         policyLogger.error("Exception Occured"+e);
344                 }
345         }
346
347         //Policy tabs Model and View
348     @RequestMapping(value= {"/policy", "/policy/Editor" } , method = RequestMethod.GET)
349         public ModelAndView view(HttpServletRequest request){
350                 String myRequestURL = request.getRequestURL().toString();
351                 try {
352                         //
353                         // Set the URL for the RESTful PAP Engine
354                         //
355                         setPapEngine((PAPPolicyEngine) new RESTfulPAPEngine(myRequestURL));
356                         new PDPGroupContainer((PAPPolicyEngine) new RESTfulPAPEngine(myRequestURL));
357                 } catch (Exception e) {
358                         policyLogger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR+"Exception Occured while loading PAP"+e);
359                 }
360                 Map<String, Object> model = new HashMap<>();
361                 return new ModelAndView("policy_Editor","model", model);
362         }
363
364         public PAPPolicyEngine getPapEngine() {
365                 return papEngine;
366         }
367
368         public static void setPapEngine(PAPPolicyEngine papEngine) {
369                 PolicyController.papEngine = papEngine;
370         }
371
372         public String getUserName(String createdBy) {
373                 String loginId = createdBy;
374                 List<Object> data = commonClassDao.getDataById(UserInfo.class, "loginId", loginId);
375                 return data.get(0).toString();
376         }
377
378         public static boolean getActivePolicy(String query) {
379                 if(!commonClassDao.getDataByQuery(query, new SimpleBindings()).isEmpty()){
380                         return true;
381                 }else{
382                         return false;
383                 }
384         }
385
386         public void executeQuery(String query) {
387                 commonClassDao.updateQuery(query);
388         }
389
390         public void saveData(Object cloneEntity) {
391                 commonClassDao.save(cloneEntity);
392         }
393
394         public void updateData(Object entity) {
395                 commonClassDao.update(entity);
396         }
397
398         public void deleteData(Object entity) {
399                 commonClassDao.delete(entity);
400         }
401
402         public List<Object> getData(@SuppressWarnings("rawtypes") Class className){
403                 return commonClassDao.getData(className);
404         }
405
406         public PolicyVersion getPolicyEntityFromPolicyVersion(String query){
407                 return (PolicyVersion) commonClassDao.getEntityItem(PolicyVersion.class, "policyName", query);
408         }
409
410         public List<Object> getDataByQuery(String query, SimpleBindings params){
411                 return commonClassDao.getDataByQuery(query, params);
412         }
413
414
415         @SuppressWarnings("rawtypes")
416         public Object getEntityItem(Class className, String columname, String key){
417                 return commonClassDao.getEntityItem(className, columname, key);
418         }
419
420
421         public void watchPolicyFunction(PolicyVersion entity, String policyName, String mode){
422                 PolicyNotificationMail email = new PolicyNotificationMail();
423                 try {
424                         email.sendMail(entity, policyName, mode, commonClassDao);
425                 } catch (MessagingException e) {
426                         policyLogger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Excepton Occured while Renaming/Deleting a Policy or Scope" + e);
427                 }
428         }
429
430         //Switch Version
431         public JSONObject switchVersionPolicyContent(String policyName) {
432                 String dbCheckName = policyName.replace("/", ".");
433                 if(dbCheckName.contains("Config_")){
434                         dbCheckName = dbCheckName.replace(".Config_", ":Config_");
435                 }else if(dbCheckName.contains("Action_")){
436                         dbCheckName = dbCheckName.replace(".Action_", ":Action_");
437                 }else if(dbCheckName.contains("Decision_")){
438                         dbCheckName = dbCheckName.replace(".Decision_", ":Decision_");
439                 }
440                 String[] splitDBCheckName = dbCheckName.split(":");
441                 String query =   "FROM PolicyEntity where policyName like :splitDBCheckName1 and scope = :splitDBCheckName0";
442                 SimpleBindings params = new SimpleBindings();
443                 params.put("splitDBCheckName1", splitDBCheckName[1] + "%");
444                 params.put("splitDBCheckName0", splitDBCheckName[0]);
445                 List<Object> policyEntity = commonClassDao.getDataByQuery(query, params);
446                 List<String> av = new ArrayList<>();
447                 for(Object entity : policyEntity){
448                         PolicyEntity pEntity = (PolicyEntity) entity;
449                         String removeExtension = pEntity.getPolicyName().replace(".xml", "");
450                         String version = removeExtension.substring(removeExtension.lastIndexOf(".")+1);
451                         av.add(version);
452                 }
453                 if(policyName.contains("/")){
454                         policyName = policyName.replace("/", File.separator);
455                 }
456                 PolicyVersion entity = (PolicyVersion) commonClassDao.getEntityItem(PolicyVersion.class, "policyName", policyName);
457                 JSONObject el = new JSONObject();
458                 el.put("activeVersion", entity.getActiveVersion());
459                 el.put("availableVersions", av);
460                 el.put("highestVersion", entity.getHigherVersion());
461                 return el;
462         }
463
464         public static String getLogTableLimit() {
465                 return logTableLimit;
466         }
467
468         public static void setLogTableLimit(String logTableLimit) {
469                 PolicyController.logTableLimit = logTableLimit;
470         }
471
472         public static String getSystemAlertTableLimit() {
473                 return systemAlertTableLimit;
474         }
475
476         public static void setSystemAlertTableLimit(String systemAlertTableLimit) {
477                 PolicyController.systemAlertTableLimit = systemAlertTableLimit;
478         }
479
480         public static CommonClassDao getCommonClassDao() {
481                 return commonClassDao;
482         }
483
484         public static void setCommonClassDao(CommonClassDao commonClassDao) {
485                 PolicyController.commonClassDao = commonClassDao;
486         }
487
488         public XacmlAdminAuthorization getAuthorizer() {
489                 return authorizer;
490         }
491
492         public void setAuthorizer(XacmlAdminAuthorization authorizer) {
493                 this.authorizer = authorizer;
494         }
495
496         public static Map<Datatype, List<FunctionDefinition>> getMapDatatype2Function() {
497                 return mapDatatype2Function;
498         }
499
500         public static void setMapDatatype2Function(Map<Datatype, List<FunctionDefinition>> mapDatatype2Function) {
501                 PolicyController.mapDatatype2Function = mapDatatype2Function;
502         }
503
504         public static Map<String, FunctionDefinition> getMapID2Function() {
505                 return mapID2Function;
506         }
507
508         public static void setMapID2Function(Map<String, FunctionDefinition> mapID2Function) {
509                 PolicyController.mapID2Function = mapID2Function;
510         }
511
512         public static String getSmtpHost() {
513                 return smtpHost;
514         }
515
516         public static void setSmtpHost(String smtpHost) {
517                 PolicyController.smtpHost = smtpHost;
518         }
519
520         public static String getSmtpPort() {
521                 return smtpPort;
522         }
523
524         public static void setSmtpPort(String smtpPort) {
525                 PolicyController.smtpPort = smtpPort;
526         }
527
528         public static String getSmtpUsername() {
529                 return smtpUsername;
530         }
531
532         public static void setSmtpUsername(String smtpUsername) {
533                 PolicyController.smtpUsername = smtpUsername;
534         }
535
536         public static String getSmtpPassword() {
537                 return smtpPassword;
538         }
539
540         public static void setSmtpPassword(String smtpPassword) {
541                 PolicyController.smtpPassword = smtpPassword;
542         }
543
544         public static String getSmtpApplicationName() {
545                 return smtpApplicationName;
546         }
547
548         public static void setSmtpApplicationName(String smtpApplicationName) {
549                 PolicyController.smtpApplicationName = smtpApplicationName;
550         }
551
552         public static String getSmtpEmailExtension() {
553                 return smtpEmailExtension;
554         }
555
556         public static void setSmtpEmailExtension(String smtpEmailExtension) {
557                 PolicyController.smtpEmailExtension = smtpEmailExtension;
558         }
559
560         public static String getLogdbDriver() {
561                 return logdbDriver;
562         }
563
564         public static void setLogdbDriver(String logdbDriver) {
565                 PolicyController.logdbDriver = logdbDriver;
566         }
567
568         public static String getLogdbUrl() {
569                 return logdbUrl;
570         }
571
572         public static void setLogdbUrl(String logdbUrl) {
573                 PolicyController.logdbUrl = logdbUrl;
574         }
575
576         public static String getLogdbUserName() {
577                 return logdbUserName;
578         }
579
580         public static void setLogdbUserName(String logdbUserName) {
581                 PolicyController.logdbUserName = logdbUserName;
582         }
583
584         public static String getLogdbPassword() {
585                 return logdbPassword;
586         }
587
588         public static void setLogdbPassword(String logdbPassword) {
589                 PolicyController.logdbPassword = logdbPassword;
590         }
591
592         public static String getLogdbDialect() {
593                 return logdbDialect;
594         }
595
596         public static void setLogdbDialect(String logdbDialect) {
597                 PolicyController.logdbDialect = logdbDialect;
598         }
599
600         public static String getXacmldbUrl() {
601                 return xacmldbUrl;
602         }
603
604         public static void setXacmldbUrl(String xacmldbUrl) {
605                 PolicyController.xacmldbUrl = xacmldbUrl;
606         }
607
608         public static String getXacmldbUserName() {
609                 return xacmldbUserName;
610         }
611
612         public static void setXacmldbUserName(String xacmldbUserName) {
613                 PolicyController.xacmldbUserName = xacmldbUserName;
614         }
615
616         public static String getXacmldbPassword() {
617                 return xacmldbPassword;
618         }
619
620         public static void setXacmldbPassword(String xacmldbPassword) {
621                 PolicyController.xacmldbPassword = xacmldbPassword;
622         }
623
624         public static String getAutoPushAvailable() {
625                 return autoPushAvailable;
626         }
627
628         public static void setAutoPushAvailable(String autoPushAvailable) {
629                 PolicyController.autoPushAvailable = autoPushAvailable;
630         }
631
632         public static String getAutoPushDSClosedLoop() {
633                 return autoPushDSClosedLoop;
634         }
635
636         public static void setAutoPushDSClosedLoop(String autoPushDSClosedLoop) {
637                 PolicyController.autoPushDSClosedLoop = autoPushDSClosedLoop;
638         }
639
640         public static String getAutoPushDSFirewall() {
641                 return autoPushDSFirewall;
642         }
643
644         public static void setAutoPushDSFirewall(String autoPushDSFirewall) {
645                 PolicyController.autoPushDSFirewall = autoPushDSFirewall;
646         }
647
648         public static String getAutoPushDSMicroservice() {
649                 return autoPushDSMicroservice;
650         }
651
652         public static void setAutoPushDSMicroservice(String autoPushDSMicroservice) {
653                 PolicyController.autoPushDSMicroservice = autoPushDSMicroservice;
654         }
655
656         public static String getAutoPushPDPGroup() {
657                 return autoPushPDPGroup;
658         }
659
660         public static void setAutoPushPDPGroup(String autoPushPDPGroup) {
661                 PolicyController.autoPushPDPGroup = autoPushPDPGroup;
662         }
663
664         public static String getPapUrl() {
665                 return papUrl;
666         }
667
668         public static void setPapUrl(String papUrl) {
669                 PolicyController.papUrl = papUrl;
670         }
671
672         public static String getMsOnapName() {
673                 return msOnapName;
674         }
675
676         public static void setMsOnapName(String msOnapName) {
677                 PolicyController.msOnapName = msOnapName;
678         }
679
680         public static String getMsPolicyName() {
681                 return msPolicyName;
682         }
683
684         public static void setMsPolicyName(String msPolicyName) {
685                 PolicyController.msPolicyName = msPolicyName;
686         }
687
688         public static String getConfigHome() {
689                 return configHome;
690         }
691
692         public static void setConfigHome(String configHome) {
693                 PolicyController.configHome = configHome;
694         }
695
696         public static String getActionHome() {
697                 return actionHome;
698         }
699
700         public static void setActionHome(String actionHome) {
701                 PolicyController.actionHome = actionHome;
702         }
703
704         public static Object getMapaccess() {
705                 return mapAccess;
706         }
707
708         public static String getPolicydata() {
709                 return policyData;
710         }
711
712         public static String getCharacterencoding() {
713                 return characterEncoding;
714         }
715
716         public static String getContenttype() {
717                 return contentType;
718         }
719
720         public static String getFile() {
721                 return file;
722         }
723         
724         public static void setFileSizeLimit(String uploadSize) {
725                 //Default size limit is 30MB
726                 if (uploadSize == null || uploadSize.isEmpty()) {
727                         fileSizeLimit = 30000000;
728                 }
729                 else {
730                         fileSizeLimit = Long.parseLong(uploadSize);
731                 }
732         }
733         
734         public static long getFileSizeLimit() {
735                 return fileSizeLimit;
736         }
737         public String convertDate(String dateTTL) {
738                 String formateDate = null;
739                 if(dateTTL.contains("-")){
740                         formateDate = dateTTL.replace("-", "/");
741                 }
742                 return formateDate;
743         }
744 }