2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
6 * Modified Copyright (C) 2018 Samsung Electronics Co., Ltd.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.policy.controller;
24 import com.att.research.xacml.util.XACMLProperties;
25 import com.fasterxml.jackson.databind.ObjectMapper;
27 import java.io.FileInputStream;
28 import java.io.IOException;
29 import java.io.InputStream;
30 import java.util.ArrayList;
31 import java.util.HashMap;
32 import java.util.List;
34 import java.util.Map.Entry;
35 import java.util.Properties;
37 import java.util.TreeMap;
38 import javax.annotation.PostConstruct;
39 import javax.mail.MessagingException;
40 import javax.script.SimpleBindings;
41 import javax.servlet.http.HttpServletRequest;
42 import javax.servlet.http.HttpServletResponse;
43 import org.json.JSONObject;
44 import org.onap.policy.admin.PolicyNotificationMail;
45 import org.onap.policy.admin.RESTfulPAPEngine;
46 import org.onap.policy.common.logging.flexlogger.FlexLogger;
47 import org.onap.policy.common.logging.flexlogger.Logger;
48 import org.onap.policy.model.PDPGroupContainer;
49 import org.onap.policy.model.Roles;
50 import org.onap.policy.rest.XACMLRestProperties;
51 import org.onap.policy.rest.dao.CommonClassDao;
52 import org.onap.policy.rest.jpa.Datatype;
53 import org.onap.policy.rest.jpa.FunctionDefinition;
54 import org.onap.policy.rest.jpa.PolicyEntity;
55 import org.onap.policy.rest.jpa.PolicyVersion;
56 import org.onap.policy.rest.jpa.UserInfo;
57 import org.onap.policy.utils.UserUtils.Pair;
58 import org.onap.policy.xacml.api.XACMLErrorConstants;
59 import org.onap.policy.xacml.api.pap.PAPPolicyEngine;
60 import org.onap.portalsdk.core.controller.RestrictedBaseController;
61 import org.onap.portalsdk.core.domain.UserApp;
62 import org.onap.portalsdk.core.web.support.JsonMessage;
63 import org.onap.portalsdk.core.web.support.UserUtils;
64 import org.springframework.beans.factory.annotation.Autowired;
65 import org.springframework.http.MediaType;
66 import org.springframework.stereotype.Controller;
67 import org.springframework.web.bind.annotation.RequestMapping;
68 import org.springframework.web.bind.annotation.RequestMethod;
69 import org.springframework.web.servlet.ModelAndView;
74 public class PolicyController extends RestrictedBaseController {
75 private static final Logger policyLogger = FlexLogger.getLogger(PolicyController.class);
77 private static CommonClassDao commonClassDao;
81 private static PAPPolicyEngine papEngine;
83 private static String logTableLimit;
84 private static String systemAlertTableLimit;
85 protected static Map<String, String> dropDownMap = new HashMap<>();
87 public static Map<String, String> getDropDownMap() {
91 public static void setDropDownMap(Map<String, String> dropDownMap) {
92 PolicyController.dropDownMap = dropDownMap;
95 public static String getDomain() {
96 return XACMLProperties.getProperty(XACMLRestProperties.PROP_ADMIN_DOMAIN, "urn");
99 private static final Object mapAccess = new Object();
100 private static Map<Datatype, List<FunctionDefinition>> mapDatatype2Function = null;
101 private static Map<String, FunctionDefinition> mapID2Function = null;
103 // Constant variables used across Policy-sdk
104 private static final String policyData = "policyData";
105 private static final String characterEncoding = "UTF-8";
106 private static final String contentType = "application/json";
107 private static final String file = "file";
109 // Smtp Java Mail Properties
110 private static String smtpHost = null;
111 private static String smtpPort = null;
112 private static String smtpUsername = null;
113 private static String smtpPassword = null;
114 private static String smtpApplicationName = null;
115 private static String smtpEmailExtension = null;
117 private static String logdbDriver = null;
118 private static String logdbUrl = null;
119 private static String logdbUserName = null;
120 private static String logdbPassword = null;
121 private static String logdbDialect = null;
122 // Xacml db properties
123 private static String xacmldbUrl = null;
124 private static String xacmldbUserName = null;
125 private static String xacmldbPassword = null;
128 private static String autoPushAvailable;
129 private static String autoPushDSClosedLoop;
130 private static String autoPushDSFirewall;
131 private static String autoPushDSMicroservice;
132 private static String autoPushPDPGroup;
135 private static String papUrl;
137 // MicroService Model Properties
138 private static String msOnapName;
139 private static String msPolicyName;
141 // WebApp directories
142 private static String configHome;
143 private static String actionHome;
146 private static long fileSizeLimit;
148 private static boolean jUnit = false;
151 public static boolean isjUnit() {
155 public static void setjUnit(boolean jUnit) {
156 PolicyController.jUnit = jUnit;
160 private PolicyController(CommonClassDao commonClassDao) {
161 PolicyController.commonClassDao = commonClassDao;
164 public PolicyController() {
169 * init method to load the properties.
173 Properties prop = new Properties();
178 fileName = new File(".").getCanonicalPath() + File.separator + "src" + File.separator + "test"
179 + File.separator + "resources" + File.separator + "JSONConfig.json";
181 fileName = "xacml.admin.properties";
184 try (InputStream input = new FileInputStream(fileName)) {
185 // load a properties file
189 // file upload size limit property
190 setFileSizeLimit(prop.getProperty("file.size.limit"));
192 setPapUrl(prop.getProperty("xacml.rest.pap.url"));
193 // get the property values
194 setSmtpHost(prop.getProperty("onap.smtp.host"));
195 setSmtpPort(prop.getProperty("onap.smtp.port"));
196 setSmtpUsername(prop.getProperty("onap.smtp.userName"));
197 setSmtpPassword(prop.getProperty("onap.smtp.password"));
198 setSmtpApplicationName(prop.getProperty("onap.application.name"));
199 setSmtpEmailExtension(prop.getProperty("onap.smtp.emailExtension"));
200 // Log Database Properties
201 setLogdbDriver(prop.getProperty("xacml.log.db.driver"));
202 setLogdbUrl(prop.getProperty("xacml.log.db.url"));
203 setLogdbUserName(prop.getProperty("xacml.log.db.user"));
204 setLogdbPassword(prop.getProperty("xacml.log.db.password"));
205 setLogdbDialect(prop.getProperty("onap.dialect"));
206 // Xacml Database Properties
207 setXacmldbUrl(prop.getProperty("javax.persistence.jdbc.url"));
208 setXacmldbUserName(prop.getProperty("javax.persistence.jdbc.user"));
209 setXacmldbPassword(prop.getProperty("javax.persistence.jdbc.password"));
211 setAutoPushAvailable(prop.getProperty("xacml.automatic.push"));
212 setAutoPushDSClosedLoop(prop.getProperty("xacml.autopush.closedloop"));
213 setAutoPushDSFirewall(prop.getProperty("xacml.autopush.firewall"));
214 setAutoPushDSMicroservice(prop.getProperty("xacml.autopush.microservice"));
215 setAutoPushPDPGroup(prop.getProperty("xacml.autopush.pdpGroup"));
216 // Micro Service Properties
217 setMsOnapName(prop.getProperty("xacml.policy.msOnapName"));
218 if (getMsOnapName() == null) {
219 setMsOnapName(prop.getProperty("xacml.policy.msEcompName"));
221 policyLogger.info("getMsOnapName => " + getMsOnapName());
222 setMsPolicyName(prop.getProperty("xacml.policy.msPolicyName"));
223 policyLogger.info("setMsPolicyName => " + getMsPolicyName());
224 // WebApp directories
225 setConfigHome(prop.getProperty("xacml.rest.config.webapps") + "Config");
226 setActionHome(prop.getProperty("xacml.rest.config.webapps") + "Action");
227 // Get the Property Values for Dashboard tab Limit
229 setLogTableLimit(prop.getProperty("xacml.onap.dashboard.logTableLimit"));
230 setSystemAlertTableLimit(prop.getProperty("xacml.onap.dashboard.systemAlertTableLimit"));
231 } catch (Exception e) {
233 .error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Dashboard tab Property fields are missing" + e);
234 setLogTableLimit("5000");
235 setSystemAlertTableLimit("2000");
237 System.setProperty(XACMLProperties.XACML_PROPERTIES_NAME, "xacml.admin.properties");
238 } catch (IOException ex) {
239 policyLogger.error(XACMLErrorConstants.ERROR_DATA_ISSUE
240 + "Exception Occured while reading the Smtp properties from xacml.admin.properties file" + ex);
243 // Initialize the FunctionDefinition table at Server Start up
244 Map<Datatype, List<FunctionDefinition>> functionMap = getFunctionDatatypeMap();
245 for (Entry<Datatype, List<FunctionDefinition>> entry : functionMap.entrySet()) {
246 List<FunctionDefinition> functionDefinations = entry.getValue();
247 for (FunctionDefinition functionDef : functionDefinations) {
248 dropDownMap.put(functionDef.getShortname(), functionDef.getXacmlid());
255 * Get FunctionData Type from DB.
257 * @return list of FunctionData.
259 public static Map<Datatype, List<FunctionDefinition>> getFunctionDatatypeMap() {
260 synchronized (mapAccess) {
261 if (mapDatatype2Function == null) {
265 return mapDatatype2Function;
271 * @return Function ID.
273 public static Map<String, FunctionDefinition> getFunctionIdMap() {
274 synchronized (mapAccess) {
275 if (mapID2Function == null) {
279 return mapID2Function;
282 private static void buildFunctionMaps() {
283 mapDatatype2Function = new HashMap<>();
284 mapID2Function = new HashMap<>();
285 List<Object> functiondefinitions = commonClassDao.getData(FunctionDefinition.class);
286 for (int i = 0; i < functiondefinitions.size(); i++) {
287 FunctionDefinition value = (FunctionDefinition) functiondefinitions.get(i);
288 mapID2Function.put(value.getXacmlid(), value);
289 if (!mapDatatype2Function.containsKey(value.getDatatypeBean())) {
290 mapDatatype2Function.put(value.getDatatypeBean(), new ArrayList<FunctionDefinition>());
292 mapDatatype2Function.get(value.getDatatypeBean()).add(value);
297 * Get Functional Definition data.
299 * @param request HttpServletRequest.
300 * @param response HttpServletResponse.
302 @RequestMapping(value = {"/get_FunctionDefinitionDataByName"},
303 method = {org.springframework.web.bind.annotation.RequestMethod.GET},
304 produces = MediaType.APPLICATION_JSON_VALUE)
305 public void getFunctionDefinitionData(HttpServletRequest request, HttpServletResponse response) {
307 Map<String, Object> model = new HashMap<>();
308 ObjectMapper mapper = new ObjectMapper();
309 model.put("functionDefinitionDatas",
310 mapper.writeValueAsString(commonClassDao.getDataByColumn(FunctionDefinition.class, "shortname")));
311 JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
312 JSONObject j = new JSONObject(msg);
313 response.getWriter().write(j.toString());
314 } catch (Exception e) {
316 XACMLErrorConstants.ERROR_DATA_ISSUE + "Error while retriving the Function Definition data" + e);
321 * Get PolicyEntity Data from db.
323 * @param scope scopeName.
324 * @param policyName policyName.
325 * @return policyEntity data.
327 public PolicyEntity getPolicyEntityData(String scope, String policyName) {
328 String key = scope + ":" + policyName;
329 List<Object> data = commonClassDao.getDataById(PolicyEntity.class, "scope:policyName", key);
330 return (PolicyEntity) data.get(0);
334 * Get Policy User Roles from db.
336 * @param userId LoginID.
337 * @return list of Roles.
339 public List<String> getRolesOfUser(String userId) {
340 List<String> rolesList = new ArrayList<>();
341 List<Object> roles = commonClassDao.getDataById(Roles.class, "loginId", userId);
342 for (Object role : roles) {
343 rolesList.add(((Roles) role).getRole());
348 public List<Object> getRoles(String userId) {
349 return commonClassDao.getDataById(Roles.class, "loginId", userId);
353 * Get List of User Roles.
355 * @param request HttpServletRequest.
356 * @param response HttpServletResponse.
358 @RequestMapping(value = {"/get_UserRolesData"},
359 method = {org.springframework.web.bind.annotation.RequestMethod.GET},
360 produces = MediaType.APPLICATION_JSON_VALUE)
361 public void getUserRolesEntityData(HttpServletRequest request, HttpServletResponse response) {
363 String userId = UserUtils.getUserSession(request).getOrgUserId();
364 Map<String, Object> model = new HashMap<>();
365 ObjectMapper mapper = new ObjectMapper();
366 model.put("userRolesDatas", mapper.writeValueAsString(getRolesOfUser(userId)));
367 JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
368 JSONObject j = new JSONObject(msg);
369 response.getWriter().write(j.toString());
370 } catch (Exception e) {
371 policyLogger.error("Exception Occured" + e);
376 * Policy tabs Model and View.
378 * @param request Request input.
379 * @return view model.
381 @RequestMapping(value = {"/policy", "/policy/Editor"}, method = RequestMethod.GET)
382 public ModelAndView view(HttpServletRequest request) {
383 getUserRoleFromSession(request);
384 String myRequestUrl = request.getRequestURL().toString();
387 // Set the URL for the RESTful PAP Engine
389 setPapEngine((PAPPolicyEngine) new RESTfulPAPEngine(myRequestUrl));
390 new PDPGroupContainer((PAPPolicyEngine) new RESTfulPAPEngine(myRequestUrl));
391 } catch (Exception e) {
392 policyLogger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Exception Occured while loading PAP" + e);
394 Map<String, Object> model = new HashMap<>();
395 return new ModelAndView("policy_Editor", "model", model);
399 * Read the role from session.
401 * @param request Request input.
403 public void getUserRoleFromSession(HttpServletRequest request) {
404 // While user landing on Policy page, fetch the userId and Role from
406 // And, Query the Roles table and if user not exists or else modified
407 // update the Roles table.
409 List<String> newRoles = new ArrayList<>();
410 String userId = UserUtils.getUserSession(request).getOrgUserId();
411 String name = UserUtils.getUserSession(request).getFullName();
412 @SuppressWarnings("unchecked")
413 Set<UserApp> userApps = UserUtils.getUserSession(request).getUserApps();
414 for (UserApp userApp : userApps) {
415 newRoles.add(userApp.getRole().getName());
417 List<Object> userRoles = getRoles(userId);
418 String filteredRole = filterRole(newRoles);
419 if (userRoles == null || userRoles.isEmpty()) {
420 savePolicyRoles(name, filteredRole, userId);
422 Pair<Set<String>, List<String>> pair = org.onap.policy.utils.UserUtils.checkRoleAndScope(userRoles);
424 if (!roles.contains(filteredRole)) {
425 String query = "delete from Roles where loginid='" + userId + "'";
426 commonClassDao.updateQuery(query);
427 savePolicyRoles(name, filteredRole, userId);
433 * Save the Role to DB.
435 * @param name User Name.
436 * @param filteredRole Role Name.
437 * @param userId User LoginID.
439 private void savePolicyRoles(String name, String filteredRole, String userId) {
440 UserInfo userInfo = new UserInfo();
441 userInfo.setUserLoginId(userId);
442 userInfo.setUserName(name);
443 commonClassDao.save(userInfo);
444 Roles role = new Roles();
446 role.setRole(filteredRole);
447 role.setLoginId(userId);
448 commonClassDao.save(role);
452 * Filter the list of roles hierarchy wise.
454 * @param newRoles list of roles from request.
457 private String filterRole(List<String> newRoles) {
458 Map<Integer, String> roleMap = new TreeMap<>();
459 roleMap.put(6, "guest");
460 for (String role : newRoles) {
461 if ("Policy Super Admin".equalsIgnoreCase(role.trim())
462 || "System Administrator".equalsIgnoreCase(role.trim())
463 || "Standard User".equalsIgnoreCase(role.trim())) {
464 roleMap.put(1, "super-admin");
465 } else if ("Policy Super Editor".equalsIgnoreCase(role.trim())) {
466 roleMap.put(2, "super-editor");
467 } else if ("Policy Super Guest".equalsIgnoreCase(role.trim())) {
468 roleMap.put(3, "super-guest");
469 } else if ("Policy Admin".equalsIgnoreCase(role.trim())) {
470 roleMap.put(4, "admin");
471 } else if ("Policy Editor".equalsIgnoreCase(role.trim())) {
472 roleMap.put(5, "editor");
475 return roleMap.entrySet().iterator().next().getValue();
478 public PAPPolicyEngine getPapEngine() {
482 public static void setPapEngine(PAPPolicyEngine papEngine) {
483 PolicyController.papEngine = papEngine;
487 * Get UserName based on LoginID.
489 * @param createdBy loginID.
492 public String getUserName(String createdBy) {
493 String loginId = createdBy;
494 List<Object> data = commonClassDao.getDataById(UserInfo.class, "loginId", loginId);
495 return data.get(0).toString();
499 * Check if the Policy is Active or not.
500 * @param query sql query.
503 public static boolean getActivePolicy(String query) {
504 return !commonClassDao.getDataByQuery(query, new SimpleBindings()).isEmpty();
507 public void executeQuery(String query) {
508 commonClassDao.updateQuery(query);
511 public void saveData(Object cloneEntity) {
512 commonClassDao.save(cloneEntity);
515 public void updateData(Object entity) {
516 commonClassDao.update(entity);
519 public void deleteData(Object entity) {
520 commonClassDao.delete(entity);
523 public List<Object> getData(@SuppressWarnings("rawtypes") Class className) {
524 return commonClassDao.getData(className);
527 public PolicyVersion getPolicyEntityFromPolicyVersion(String query) {
528 return (PolicyVersion) commonClassDao.getEntityItem(PolicyVersion.class, "policyName", query);
531 public List<Object> getDataByQuery(String query, SimpleBindings params) {
532 return commonClassDao.getDataByQuery(query, params);
536 @SuppressWarnings("rawtypes")
537 public Object getEntityItem(Class className, String columname, String key) {
538 return commonClassDao.getEntityItem(className, columname, key);
543 * Watch Policy Function.
545 * @param entity PolicyVersion entity.
546 * @param policyName updated policy name.
547 * @param mode type of action rename/delete/import.
549 public void watchPolicyFunction(PolicyVersion entity, String policyName, String mode) {
550 PolicyNotificationMail email = new PolicyNotificationMail();
552 email.sendMail(entity, policyName, mode, commonClassDao);
553 } catch (MessagingException e) {
554 policyLogger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR
555 + "Excepton Occured while Renaming/Deleting a Policy or Scope" + e);
560 * Switch Version Policy Content.
562 * @param pName which is used to find associated versions.
563 * @return list of available versions based on policy name.
565 public JSONObject switchVersionPolicyContent(String pName) {
566 String policyName = pName;
567 String dbCheckName = policyName.replace("/", ".");
568 if (dbCheckName.contains("Config_")) {
569 dbCheckName = dbCheckName.replace(".Config_", ":Config_");
570 } else if (dbCheckName.contains("Action_")) {
571 dbCheckName = dbCheckName.replace(".Action_", ":Action_");
572 } else if (dbCheckName.contains("Decision_")) {
573 dbCheckName = dbCheckName.replace(".Decision_", ":Decision_");
575 String[] splitDbCheckName = dbCheckName.split(":");
576 String query = "FROM PolicyEntity where policyName like :splitDBCheckName1 and scope = :splitDBCheckName0";
577 SimpleBindings params = new SimpleBindings();
578 params.put("splitDBCheckName1", splitDbCheckName[1] + "%");
579 params.put("splitDBCheckName0", splitDbCheckName[0]);
580 List<Object> policyEntity = commonClassDao.getDataByQuery(query, params);
581 List<String> av = new ArrayList<>();
582 for (Object entity : policyEntity) {
583 PolicyEntity pEntity = (PolicyEntity) entity;
584 String removeExtension = pEntity.getPolicyName().replace(".xml", "");
585 String version = removeExtension.substring(removeExtension.lastIndexOf('.') + 1);
588 if (policyName.contains("/")) {
589 policyName = policyName.replace("/", File.separator);
591 PolicyVersion entity =
592 (PolicyVersion) commonClassDao.getEntityItem(PolicyVersion.class, "policyName", policyName);
593 JSONObject el = new JSONObject();
594 el.put("activeVersion", entity.getActiveVersion());
595 el.put("availableVersions", av);
596 el.put("highestVersion", entity.getHigherVersion());
600 public static String getLogTableLimit() {
601 return logTableLimit;
604 public static void setLogTableLimit(String logTableLimit) {
605 PolicyController.logTableLimit = logTableLimit;
608 public static String getSystemAlertTableLimit() {
609 return systemAlertTableLimit;
612 public static void setSystemAlertTableLimit(String systemAlertTableLimit) {
613 PolicyController.systemAlertTableLimit = systemAlertTableLimit;
616 public static CommonClassDao getCommonClassDao() {
617 return commonClassDao;
620 public static void setCommonClassDao(CommonClassDao commonClassDao) {
621 PolicyController.commonClassDao = commonClassDao;
624 public static Map<Datatype, List<FunctionDefinition>> getMapDatatype2Function() {
625 return mapDatatype2Function;
628 public static void setMapDatatype2Function(Map<Datatype, List<FunctionDefinition>> mapDatatype2Function) {
629 PolicyController.mapDatatype2Function = mapDatatype2Function;
632 public static Map<String, FunctionDefinition> getMapID2Function() {
633 return mapID2Function;
636 public static void setMapID2Function(Map<String, FunctionDefinition> mapID2Function) {
637 PolicyController.mapID2Function = mapID2Function;
640 public static String getSmtpHost() {
644 public static void setSmtpHost(String smtpHost) {
645 PolicyController.smtpHost = smtpHost;
648 public static String getSmtpPort() {
652 public static void setSmtpPort(String smtpPort) {
653 PolicyController.smtpPort = smtpPort;
656 public static String getSmtpUsername() {
660 public static void setSmtpUsername(String smtpUsername) {
661 PolicyController.smtpUsername = smtpUsername;
664 public static String getSmtpPassword() {
668 public static void setSmtpPassword(String smtpPassword) {
669 PolicyController.smtpPassword = smtpPassword;
672 public static String getSmtpApplicationName() {
673 return smtpApplicationName;
676 public static void setSmtpApplicationName(String smtpApplicationName) {
677 PolicyController.smtpApplicationName = smtpApplicationName;
680 public static String getSmtpEmailExtension() {
681 return smtpEmailExtension;
684 public static void setSmtpEmailExtension(String smtpEmailExtension) {
685 PolicyController.smtpEmailExtension = smtpEmailExtension;
688 public static String getLogdbDriver() {
692 public static void setLogdbDriver(String logdbDriver) {
693 PolicyController.logdbDriver = logdbDriver;
696 public static String getLogdbUrl() {
700 public static void setLogdbUrl(String logdbUrl) {
701 PolicyController.logdbUrl = logdbUrl;
704 public static String getLogdbUserName() {
705 return logdbUserName;
708 public static void setLogdbUserName(String logdbUserName) {
709 PolicyController.logdbUserName = logdbUserName;
712 public static String getLogdbPassword() {
713 return logdbPassword;
716 public static void setLogdbPassword(String logdbPassword) {
717 PolicyController.logdbPassword = logdbPassword;
720 public static String getLogdbDialect() {
724 public static void setLogdbDialect(String logdbDialect) {
725 PolicyController.logdbDialect = logdbDialect;
728 public static String getXacmldbUrl() {
732 public static void setXacmldbUrl(String xacmldbUrl) {
733 PolicyController.xacmldbUrl = xacmldbUrl;
736 public static String getXacmldbUserName() {
737 return xacmldbUserName;
740 public static void setXacmldbUserName(String xacmldbUserName) {
741 PolicyController.xacmldbUserName = xacmldbUserName;
744 public static String getXacmldbPassword() {
745 return xacmldbPassword;
748 public static void setXacmldbPassword(String xacmldbPassword) {
749 PolicyController.xacmldbPassword = xacmldbPassword;
752 public static String getAutoPushAvailable() {
753 return autoPushAvailable;
756 public static void setAutoPushAvailable(String autoPushAvailable) {
757 PolicyController.autoPushAvailable = autoPushAvailable;
760 public static String getAutoPushDSClosedLoop() {
761 return autoPushDSClosedLoop;
764 public static void setAutoPushDSClosedLoop(String autoPushDSClosedLoop) {
765 PolicyController.autoPushDSClosedLoop = autoPushDSClosedLoop;
768 public static String getAutoPushDSFirewall() {
769 return autoPushDSFirewall;
772 public static void setAutoPushDSFirewall(String autoPushDSFirewall) {
773 PolicyController.autoPushDSFirewall = autoPushDSFirewall;
776 public static String getAutoPushDSMicroservice() {
777 return autoPushDSMicroservice;
780 public static void setAutoPushDSMicroservice(String autoPushDSMicroservice) {
781 PolicyController.autoPushDSMicroservice = autoPushDSMicroservice;
784 public static String getAutoPushPDPGroup() {
785 return autoPushPDPGroup;
788 public static void setAutoPushPDPGroup(String autoPushPDPGroup) {
789 PolicyController.autoPushPDPGroup = autoPushPDPGroup;
792 public static String getPapUrl() {
796 public static void setPapUrl(String papUrl) {
797 PolicyController.papUrl = papUrl;
800 public static String getMsOnapName() {
804 public static void setMsOnapName(String msOnapName) {
805 PolicyController.msOnapName = msOnapName;
808 public static String getMsPolicyName() {
812 public static void setMsPolicyName(String msPolicyName) {
813 PolicyController.msPolicyName = msPolicyName;
816 public static String getConfigHome() {
820 public static void setConfigHome(String configHome) {
821 PolicyController.configHome = configHome;
824 public static String getActionHome() {
828 public static void setActionHome(String actionHome) {
829 PolicyController.actionHome = actionHome;
832 public static Object getMapaccess() {
836 public static String getPolicydata() {
840 public static String getCharacterencoding() {
841 return characterEncoding;
844 public static String getContenttype() {
848 public static String getFile() {
853 * Set File Size limit.
855 * @param uploadSize value.
857 public static void setFileSizeLimit(String uploadSize) {
858 // Default size limit is 30MB
859 if (uploadSize == null || uploadSize.isEmpty()) {
860 fileSizeLimit = 30000000;
862 fileSizeLimit = Long.parseLong(uploadSize);
866 public static long getFileSizeLimit() {
867 return fileSizeLimit;
871 * Function to convert date.
873 * @param dateTTL input date value.
876 public String convertDate(String dateTTL) {
877 String formateDate = null;
878 if (dateTTL.contains("-")) {
879 formateDate = dateTTL.replace("-", "/");