2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2019 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;
26 import java.io.ByteArrayInputStream;
28 import java.io.FileInputStream;
29 import java.io.IOException;
30 import java.io.InputStream;
31 import java.util.ArrayList;
32 import java.util.HashMap;
33 import java.util.List;
35 import java.util.Map.Entry;
36 import java.util.Properties;
38 import java.nio.charset.StandardCharsets;
39 import javax.annotation.PostConstruct;
40 import javax.mail.MessagingException;
41 import javax.script.SimpleBindings;
42 import javax.servlet.http.HttpServletRequest;
43 import javax.servlet.http.HttpServletResponse;
44 import org.json.JSONObject;
45 import org.onap.policy.admin.PolicyNotificationMail;
46 import org.onap.policy.admin.RESTfulPAPEngine;
47 import org.onap.policy.common.logging.eelf.MessageCodes;
48 import org.onap.policy.common.logging.eelf.PolicyLogger;
49 import org.onap.policy.common.logging.flexlogger.FlexLogger;
50 import org.onap.policy.common.logging.flexlogger.Logger;
51 import org.onap.policy.model.PDPGroupContainer;
52 import org.onap.policy.model.Roles;
53 import org.onap.policy.rest.XACMLRestProperties;
54 import org.onap.policy.rest.dao.CommonClassDao;
55 import org.onap.policy.rest.jpa.Datatype;
56 import org.onap.policy.rest.jpa.FunctionDefinition;
57 import org.onap.policy.rest.jpa.PolicyEntity;
58 import org.onap.policy.rest.jpa.PolicyVersion;
59 import org.onap.policy.rest.jpa.UserInfo;
60 import org.onap.policy.utils.UserUtils.Pair;
61 import org.onap.policy.xacml.api.XACMLErrorConstants;
62 import org.onap.policy.xacml.api.pap.PAPPolicyEngine;
63 import org.onap.policy.xacml.util.XACMLPolicyScanner;
64 import org.onap.portalsdk.core.controller.RestrictedBaseController;
65 import org.onap.portalsdk.core.domain.UserApp;
66 import org.onap.portalsdk.core.web.support.JsonMessage;
67 import org.onap.portalsdk.core.web.support.UserUtils;
68 import org.springframework.beans.factory.annotation.Autowired;
69 import org.springframework.http.MediaType;
70 import org.springframework.stereotype.Controller;
71 import org.springframework.web.bind.annotation.RequestMapping;
72 import org.springframework.web.bind.annotation.RequestMethod;
73 import org.springframework.web.servlet.ModelAndView;
74 import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicySetType;
75 import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType;
79 public class PolicyController extends RestrictedBaseController {
80 private static final Logger policyLogger = FlexLogger.getLogger(PolicyController.class);
82 private static CommonClassDao commonClassDao;
86 private static PAPPolicyEngine papEngine;
88 private static String logTableLimit;
89 private static String systemAlertTableLimit;
90 protected static Map<String, String> dropDownMap = new HashMap<>();
92 public static Map<String, String> getDropDownMap() {
96 public static void setDropDownMap(Map<String, String> dropDownMap) {
97 PolicyController.dropDownMap = dropDownMap;
100 public static String getDomain() {
101 return XACMLProperties.getProperty(XACMLRestProperties.PROP_ADMIN_DOMAIN, "urn");
104 private static final Object mapAccess = new Object();
105 private static Map<Datatype, List<FunctionDefinition>> mapDatatype2Function = null;
106 private static Map<String, FunctionDefinition> mapID2Function = null;
108 // Constant variables used across Policy-sdk
109 private static final String policyData = "policyData";
110 private static final String characterEncoding = "UTF-8";
111 private static final String contentType = "application/json";
112 private static final String file = "file";
113 private static final String SUPERADMIN = "super-admin";
114 private static final String POLICYGUEST = "Policy Guest";
115 private static final String LOGINID = "loginId";
117 // Smtp Java Mail Properties
118 private static String smtpHost = null;
119 private static String smtpPort = null;
120 private static String smtpUsername = null;
121 private static String smtpPassword = null;
122 private static String smtpApplicationName = null;
123 private static String smtpEmailExtension = null;
125 private static String logdbDriver = null;
126 private static String logdbUrl = null;
127 private static String logdbUserName = null;
128 private static String logdbPassword = null;
129 private static String logdbDialect = null;
130 // Xacml db properties
131 private static String xacmldbUrl = null;
132 private static String xacmldbUserName = null;
133 private static String xacmldbPassword = null;
136 private static String autoPushAvailable;
137 private static String autoPushDSClosedLoop;
138 private static String autoPushDSFirewall;
139 private static String autoPushDSMicroservice;
140 private static String autoPushPDPGroup;
143 private static String papUrl;
145 // MicroService Model Properties
146 private static String msOnapName;
147 private static String msPolicyName;
149 // WebApp directories
150 private static String configHome;
151 private static String actionHome;
154 private static long fileSizeLimit;
156 private static boolean jUnit = false;
158 public static boolean isjUnit() {
162 public static void setjUnit(boolean jUnit) {
163 PolicyController.jUnit = jUnit;
167 private PolicyController(CommonClassDao commonClassDao) {
168 PolicyController.commonClassDao = commonClassDao;
171 public PolicyController() {
176 * init method to load the properties.
180 Properties prop = new Properties();
185 fileName = new File(".").getCanonicalPath() + File.separator + "src" + File.separator + "test"
186 + File.separator + "resources" + File.separator + "JSONConfig.json";
188 fileName = "xacml.admin.properties";
191 try (InputStream input = new FileInputStream(fileName)) {
192 // load a properties file
196 // file upload size limit property
197 setFileSizeLimit(prop.getProperty("file.size.limit"));
199 setPapUrl(prop.getProperty("xacml.rest.pap.url"));
200 // get the property values
201 setSmtpHost(prop.getProperty("onap.smtp.host"));
202 setSmtpPort(prop.getProperty("onap.smtp.port"));
203 setSmtpUsername(prop.getProperty("onap.smtp.userName"));
204 setSmtpPassword(prop.getProperty("onap.smtp.password"));
205 setSmtpApplicationName(prop.getProperty("onap.application.name"));
206 setSmtpEmailExtension(prop.getProperty("onap.smtp.emailExtension"));
207 // Log Database Properties
208 setLogdbDriver(prop.getProperty("xacml.log.db.driver"));
209 setLogdbUrl(prop.getProperty("xacml.log.db.url"));
210 setLogdbUserName(prop.getProperty("xacml.log.db.user"));
211 setLogdbPassword(prop.getProperty("xacml.log.db.password"));
212 setLogdbDialect(prop.getProperty("onap.dialect"));
213 // Xacml Database Properties
214 setXacmldbUrl(prop.getProperty("javax.persistence.jdbc.url"));
215 setXacmldbUserName(prop.getProperty("javax.persistence.jdbc.user"));
216 setXacmldbPassword(prop.getProperty("javax.persistence.jdbc.password"));
218 setAutoPushAvailable(prop.getProperty("xacml.automatic.push"));
219 setAutoPushDSClosedLoop(prop.getProperty("xacml.autopush.closedloop"));
220 setAutoPushDSFirewall(prop.getProperty("xacml.autopush.firewall"));
221 setAutoPushDSMicroservice(prop.getProperty("xacml.autopush.microservice"));
222 setAutoPushPDPGroup(prop.getProperty("xacml.autopush.pdpGroup"));
223 // Micro Service Properties
224 setMsOnapName(prop.getProperty("xacml.policy.msOnapName"));
225 if (getMsOnapName() == null) {
226 setMsOnapName(prop.getProperty("xacml.policy.msEcompName"));
228 policyLogger.info("getMsOnapName => " + getMsOnapName());
229 setMsPolicyName(prop.getProperty("xacml.policy.msPolicyName"));
230 policyLogger.info("setMsPolicyName => " + getMsPolicyName());
231 // WebApp directories
232 setConfigHome(prop.getProperty("xacml.rest.config.webapps") + "Config");
233 setActionHome(prop.getProperty("xacml.rest.config.webapps") + "Action");
234 // Get the Property Values for Dashboard tab Limit
236 setLogTableLimit(prop.getProperty("xacml.onap.dashboard.logTableLimit"));
237 setSystemAlertTableLimit(prop.getProperty("xacml.onap.dashboard.systemAlertTableLimit"));
238 } catch (Exception e) {
240 .error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Dashboard tab Property fields are missing" + e);
241 setLogTableLimit("5000");
242 setSystemAlertTableLimit("2000");
244 System.setProperty(XACMLProperties.XACML_PROPERTIES_NAME, "xacml.admin.properties");
245 } catch (IOException ex) {
246 policyLogger.error(XACMLErrorConstants.ERROR_DATA_ISSUE
247 + "Exception Occured while reading the Smtp properties from xacml.admin.properties file" + ex);
250 // Initialize the FunctionDefinition table at Server Start up
251 Map<Datatype, List<FunctionDefinition>> functionMap = getFunctionDatatypeMap();
252 for (Entry<Datatype, List<FunctionDefinition>> entry : functionMap.entrySet()) {
253 List<FunctionDefinition> functionDefinations = entry.getValue();
254 for (FunctionDefinition functionDef : functionDefinations) {
255 dropDownMap.put(functionDef.getShortname(), functionDef.getXacmlid());
262 * Get FunctionData Type from DB.
264 * @return list of FunctionData.
266 public static Map<Datatype, List<FunctionDefinition>> getFunctionDatatypeMap() {
267 synchronized (mapAccess) {
268 if (mapDatatype2Function == null) {
272 return mapDatatype2Function;
278 * @return Function ID.
280 public static Map<String, FunctionDefinition> getFunctionIdMap() {
281 synchronized (mapAccess) {
282 if (mapID2Function == null) {
286 return mapID2Function;
289 private static void buildFunctionMaps() {
290 mapDatatype2Function = new HashMap<>();
291 mapID2Function = new HashMap<>();
292 List<Object> functiondefinitions = commonClassDao.getData(FunctionDefinition.class);
293 for (int i = 0; i < functiondefinitions.size(); i++) {
294 FunctionDefinition value = (FunctionDefinition) functiondefinitions.get(i);
295 mapID2Function.put(value.getXacmlid(), value);
296 if (!mapDatatype2Function.containsKey(value.getDatatypeBean())) {
297 mapDatatype2Function.put(value.getDatatypeBean(), new ArrayList<FunctionDefinition>());
299 mapDatatype2Function.get(value.getDatatypeBean()).add(value);
304 * Get Functional Definition data.
306 * @param request HttpServletRequest.
307 * @param response HttpServletResponse.
309 @RequestMapping(value = { "/get_FunctionDefinitionDataByName" }, method = {
310 org.springframework.web.bind.annotation.RequestMethod.GET }, produces = MediaType.APPLICATION_JSON_VALUE)
311 public void getFunctionDefinitionData(HttpServletRequest request, HttpServletResponse response) {
313 Map<String, Object> model = new HashMap<>();
314 ObjectMapper mapper = new ObjectMapper();
315 model.put("functionDefinitionDatas",
316 mapper.writeValueAsString(commonClassDao.getDataByColumn(FunctionDefinition.class, "shortname")));
317 JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
318 JSONObject j = new JSONObject(msg);
319 response.getWriter().write(j.toString());
320 } catch (Exception e) {
322 XACMLErrorConstants.ERROR_DATA_ISSUE + "Error while retriving the Function Definition data" + e);
327 * Get PolicyEntity Data from db.
329 * @param scope scopeName.
330 * @param policyName policyName.
331 * @return policyEntity data.
333 public PolicyEntity getPolicyEntityData(String scope, String policyName) {
334 String key = scope + ":" + policyName;
335 List<Object> data = commonClassDao.getDataById(PolicyEntity.class, "scope:policyName", key);
336 return (PolicyEntity) data.get(0);
340 * Get Policy User Roles from db.
342 * @param userId LoginID.
343 * @return list of Roles.
345 public List<String> getRolesOfUser(String userId) {
346 List<String> rolesList = new ArrayList<>();
347 List<Object> roles = commonClassDao.getDataById(Roles.class, LOGINID, userId);
348 for (Object role : roles) {
349 rolesList.add(((Roles) role).getRole());
354 public List<Object> getRoles(String userId) {
355 return commonClassDao.getDataById(Roles.class, LOGINID, userId);
359 * Get List of User Roles.
361 * @param request HttpServletRequest.
362 * @param response HttpServletResponse.
364 @RequestMapping(value = { "/get_UserRolesData" }, method = {
365 org.springframework.web.bind.annotation.RequestMethod.GET }, produces = MediaType.APPLICATION_JSON_VALUE)
366 public void getUserRolesEntityData(HttpServletRequest request, HttpServletResponse response) {
368 String userId = UserUtils.getUserSession(request).getOrgUserId();
369 Map<String, Object> model = new HashMap<>();
370 ObjectMapper mapper = new ObjectMapper();
371 model.put("userRolesDatas", mapper.writeValueAsString(getRolesOfUser(userId)));
372 JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
373 JSONObject j = new JSONObject(msg);
374 response.getWriter().write(j.toString());
375 } catch (Exception e) {
376 policyLogger.error("Exception Occured" + e);
381 * Policy tabs Model and View.
383 * @param request Request input.
384 * @return view model.
386 @RequestMapping(value = { "/policy", "/policy/Editor" }, method = RequestMethod.GET)
387 public ModelAndView view(HttpServletRequest request) {
388 getUserRoleFromSession(request);
389 String myRequestUrl = request.getRequestURL().toString();
392 // Set the URL for the RESTful PAP Engine
394 setPapEngine(new RESTfulPAPEngine(myRequestUrl));
395 new PDPGroupContainer(new RESTfulPAPEngine(myRequestUrl));
396 } catch (Exception e) {
397 policyLogger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Exception Occured while loading PAP" + e);
399 Map<String, Object> model = new HashMap<>();
400 return new ModelAndView("policy_Editor", "model", model);
404 * Read the role from session for inserting into the database.
406 * @param request Request input for Role.
408 public void getUserRoleFromSession(HttpServletRequest request) {
409 // While user landing on Policy page, fetch the userId and Role from
411 // And, Query the Roles table and if user not exists or else modified
412 // update the Roles table.
414 List<String> newRoles = new ArrayList<>();
415 String userId = UserUtils.getUserSession(request).getOrgUserId();
416 String name = UserUtils.getUserSession(request).getFullName();
417 @SuppressWarnings("unchecked")
418 Set<UserApp> userApps = UserUtils.getUserSession(request).getUserApps();
419 for (UserApp userApp : userApps) {
420 newRoles.add(userApp.getRole().getName());
422 List<Object> userRoles = getRoles(userId);
423 List<String> filteredRoles = filterRole(newRoles);
424 if (!filteredRoles.isEmpty()) {
425 cleanUpRoles(filteredRoles, userId);
427 for (String filteredRole : filteredRoles) {
428 if (userRoles == null || userRoles.isEmpty()) {
429 savePolicyRoles(name, filteredRole, userId);
431 userRoles = getRoles(userId);
432 Pair<Set<String>, List<String>> pair = org.onap.policy.utils.UserUtils.checkRoleAndScope(userRoles);
434 if (!roles.contains(filteredRole)) {
435 savePolicyRoles(name, filteredRole, userId);
442 * Build a delete query for cleaning up roles and execute it.
444 * @param filteredRoles Filtered roles list.
445 * @param userId UserID.
447 private void cleanUpRoles(List<String> filteredRoles, String userId) {
448 StringBuilder query = new StringBuilder();
449 query.append("delete from Roles where loginid = '" + userId + "'");
450 if (filteredRoles.contains(SUPERADMIN)) {
451 query.append("and not role = '" + SUPERADMIN + "'");
453 for (String filteredRole : filteredRoles) {
454 query.append("and not role = '" + filteredRole + "'");
457 query.append("and id > 0");
458 commonClassDao.updateQuery(query.toString());
462 * Save the Role to DB.
464 * @param name User Name.
465 * @param filteredRole Role Name.
466 * @param userId User LoginID.
468 private void savePolicyRoles(String name, String filteredRole, String userId) {
469 UserInfo userInfo = new UserInfo();
470 userInfo.setUserLoginId(userId);
471 userInfo.setUserName(name);
472 commonClassDao.save(userInfo);
473 Roles role = new Roles();
475 role.setRole(filteredRole);
476 role.setLoginId(userId);
477 commonClassDao.save(role);
481 * Filter the list of roles hierarchy wise.
483 * @param newRoles list of roles from request.
486 private List<String> filterRole(List<String> newRoles) {
487 List<String> roles = new ArrayList<>();
488 boolean superCheck = false;
489 for (String role : newRoles) {
490 if ("Policy Super Guest".equalsIgnoreCase(role.trim())) {
492 roles.add("super-guest");
493 } else if ("Policy Super Editor".equalsIgnoreCase(role.trim())) {
496 roles.add("super-editor");
497 } else if ("Policy Super Admin".equalsIgnoreCase(role.trim())
498 || "System Administrator".equalsIgnoreCase(role.trim())
499 || "Standard User".equalsIgnoreCase(role.trim())) {
502 roles.add(SUPERADMIN);
504 if (!roles.contains(SUPERADMIN) || (POLICYGUEST.equalsIgnoreCase(role) && !superCheck)) {
505 if ("Policy Admin".equalsIgnoreCase(role.trim())) {
507 } else if ("Policy Editor".equalsIgnoreCase(role.trim())) {
509 } else if (POLICYGUEST.equalsIgnoreCase(role.trim())) {
517 public PAPPolicyEngine getPapEngine() {
521 public static void setPapEngine(PAPPolicyEngine papEngine) {
522 PolicyController.papEngine = papEngine;
526 * Get UserName based on LoginID.
528 * @param createdBy loginID.
531 public String getUserName(String createdBy) {
532 String loginId = createdBy;
533 List<Object> data = commonClassDao.getDataById(UserInfo.class, LOGINID, loginId);
534 return data.get(0).toString();
538 * Check if the Policy is Active or not.
540 * @param query sql query.
543 public static boolean getActivePolicy(String query) {
544 return !commonClassDao.getDataByQuery(query, new SimpleBindings()).isEmpty();
547 public void executeQuery(String query) {
548 commonClassDao.updateQuery(query);
551 public void saveData(Object cloneEntity) {
552 commonClassDao.save(cloneEntity);
555 public void updateData(Object entity) {
556 commonClassDao.update(entity);
559 public void deleteData(Object entity) {
560 commonClassDao.delete(entity);
563 public List<Object> getData(@SuppressWarnings("rawtypes") Class className) {
564 return commonClassDao.getData(className);
567 public PolicyVersion getPolicyEntityFromPolicyVersion(String query) {
568 return (PolicyVersion) commonClassDao.getEntityItem(PolicyVersion.class, "policyName", query);
571 public List<Object> getDataByQuery(String query, SimpleBindings params) {
572 return commonClassDao.getDataByQuery(query, params);
575 @SuppressWarnings("rawtypes")
576 public Object getEntityItem(Class className, String columname, String key) {
577 return commonClassDao.getEntityItem(className, columname, key);
581 * Watch Policy Function.
583 * @param entity PolicyVersion entity.
584 * @param policyName updated policy name.
585 * @param mode type of action rename/delete/import.
587 public void watchPolicyFunction(PolicyVersion entity, String policyName, String mode) {
588 PolicyNotificationMail email = new PolicyNotificationMail();
590 email.sendMail(entity, policyName, mode, commonClassDao);
591 } catch (MessagingException e) {
592 policyLogger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR
593 + "Excepton Occured while Renaming/Deleting a Policy or Scope" + e);
598 * Switch Version Policy Content.
600 * @param pName which is used to find associated versions.
601 * @return list of available versions based on policy name.
603 public JSONObject switchVersionPolicyContent(String pName) {
604 String policyName = pName;
605 String dbCheckName = policyName.replace("/", ".");
606 if (dbCheckName.contains("Config_")) {
607 dbCheckName = dbCheckName.replace(".Config_", ":Config_");
608 } else if (dbCheckName.contains("Action_")) {
609 dbCheckName = dbCheckName.replace(".Action_", ":Action_");
610 } else if (dbCheckName.contains("Decision_MS_")) {
611 dbCheckName = dbCheckName.replace(".Decision_MS_", ":Decision_MS_");
612 } else if (dbCheckName.contains("Decision_")) {
613 dbCheckName = dbCheckName.replace(".Decision_", ":Decision_");
615 String[] splitDbCheckName = dbCheckName.split(":");
616 String query = "FROM PolicyEntity where policyName like :splitDBCheckName1 and scope = :splitDBCheckName0";
617 SimpleBindings params = new SimpleBindings();
618 params.put("splitDBCheckName1", splitDbCheckName[1] + "%");
619 params.put("splitDBCheckName0", splitDbCheckName[0]);
620 List<Object> policyEntity = commonClassDao.getDataByQuery(query, params);
621 List<String> av = new ArrayList<>();
622 for (Object entity : policyEntity) {
623 PolicyEntity pEntity = (PolicyEntity) entity;
624 String removeExtension = pEntity.getPolicyName().replace(".xml", "");
625 String version = removeExtension.substring(removeExtension.lastIndexOf('.') + 1);
626 String userName = getUserId(pEntity, "@ModifiedBy:");
627 av.add(version + " | " + pEntity.getModifiedDate() + " | " + userName);
629 if (policyName.contains("/")) {
630 policyName = policyName.replace("/", File.separator);
632 PolicyVersion entity = (PolicyVersion) commonClassDao.getEntityItem(PolicyVersion.class, "policyName",
634 JSONObject el = new JSONObject();
635 el.put("activeVersion", entity.getActiveVersion());
636 el.put("availableVersions", av);
637 el.put("highestVersion", entity.getHigherVersion());
641 public String getUserId(PolicyEntity data, String value) {
643 String uValue = value;
644 String description = getDescription(data);
645 if (description.contains(uValue)) {
646 userId = description.substring(description.indexOf(uValue) + uValue.length(),
647 description.lastIndexOf(uValue));
649 UserInfo userInfo = (UserInfo) getEntityItem(UserInfo.class, "userLoginId", userId);
650 if (userInfo == null) {
653 return userInfo.getUserName();
656 public String getDescription(PolicyEntity data) {
657 InputStream stream = new ByteArrayInputStream(data.getPolicyData().getBytes(StandardCharsets.UTF_8));
658 Object policy = XACMLPolicyScanner.readPolicy(stream);
659 if (policy instanceof PolicySetType) {
660 return ((PolicySetType) policy).getDescription();
661 } else if (policy instanceof PolicyType) {
662 return ((PolicyType) policy).getDescription();
664 PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + "Expecting a PolicySet/Policy/Rule object. Got: "
665 + policy.getClass().getCanonicalName());
670 public String[] getUserInfo(PolicyEntity data, List<PolicyVersion> activePolicies) {
671 String policyName = data.getScope().replace(".", File.separator) + File.separator
672 + data.getPolicyName().substring(0, data.getPolicyName().indexOf('.'));
673 PolicyVersion pVersion = activePolicies.stream().filter(a -> policyName.equals(a.getPolicyName())).findAny()
675 String[] result = new String[2];
677 UserInfo userCreate = (UserInfo) getEntityItem(UserInfo.class, "userLoginId", pVersion.getCreatedBy());
678 UserInfo userModify = (UserInfo) getEntityItem(UserInfo.class, "userLoginId", pVersion.getModifiedBy());
679 result[0] = userCreate != null ? userCreate.getUserName() : "super-admin";
680 result[1] = userModify != null ? userModify.getUserName() : "super-admin";
685 public static String getLogTableLimit() {
686 return logTableLimit;
689 public static void setLogTableLimit(String logTableLimit) {
690 PolicyController.logTableLimit = logTableLimit;
693 public static String getSystemAlertTableLimit() {
694 return systemAlertTableLimit;
697 public static void setSystemAlertTableLimit(String systemAlertTableLimit) {
698 PolicyController.systemAlertTableLimit = systemAlertTableLimit;
701 public static CommonClassDao getCommonClassDao() {
702 return commonClassDao;
705 public static void setCommonClassDao(CommonClassDao commonClassDao) {
706 PolicyController.commonClassDao = commonClassDao;
709 public static Map<Datatype, List<FunctionDefinition>> getMapDatatype2Function() {
710 return mapDatatype2Function;
713 public static void setMapDatatype2Function(Map<Datatype, List<FunctionDefinition>> mapDatatype2Function) {
714 PolicyController.mapDatatype2Function = mapDatatype2Function;
717 public static Map<String, FunctionDefinition> getMapID2Function() {
718 return mapID2Function;
721 public static void setMapID2Function(Map<String, FunctionDefinition> mapID2Function) {
722 PolicyController.mapID2Function = mapID2Function;
725 public static String getSmtpHost() {
729 public static void setSmtpHost(String smtpHost) {
730 PolicyController.smtpHost = smtpHost;
733 public static String getSmtpPort() {
737 public static void setSmtpPort(String smtpPort) {
738 PolicyController.smtpPort = smtpPort;
741 public static String getSmtpUsername() {
745 public static void setSmtpUsername(String smtpUsername) {
746 PolicyController.smtpUsername = smtpUsername;
749 public static String getSmtpPassword() {
753 public static void setSmtpPassword(String smtpPassword) {
754 PolicyController.smtpPassword = smtpPassword;
757 public static String getSmtpApplicationName() {
758 return smtpApplicationName;
761 public static void setSmtpApplicationName(String smtpApplicationName) {
762 PolicyController.smtpApplicationName = smtpApplicationName;
765 public static String getSmtpEmailExtension() {
766 return smtpEmailExtension;
769 public static void setSmtpEmailExtension(String smtpEmailExtension) {
770 PolicyController.smtpEmailExtension = smtpEmailExtension;
773 public static String getLogdbDriver() {
777 public static void setLogdbDriver(String logdbDriver) {
778 PolicyController.logdbDriver = logdbDriver;
781 public static String getLogdbUrl() {
785 public static void setLogdbUrl(String logdbUrl) {
786 PolicyController.logdbUrl = logdbUrl;
789 public static String getLogdbUserName() {
790 return logdbUserName;
793 public static void setLogdbUserName(String logdbUserName) {
794 PolicyController.logdbUserName = logdbUserName;
797 public static String getLogdbPassword() {
798 return logdbPassword;
801 public static void setLogdbPassword(String logdbPassword) {
802 PolicyController.logdbPassword = logdbPassword;
805 public static String getLogdbDialect() {
809 public static void setLogdbDialect(String logdbDialect) {
810 PolicyController.logdbDialect = logdbDialect;
813 public static String getXacmldbUrl() {
817 public static void setXacmldbUrl(String xacmldbUrl) {
818 PolicyController.xacmldbUrl = xacmldbUrl;
821 public static String getXacmldbUserName() {
822 return xacmldbUserName;
825 public static void setXacmldbUserName(String xacmldbUserName) {
826 PolicyController.xacmldbUserName = xacmldbUserName;
829 public static String getXacmldbPassword() {
830 return xacmldbPassword;
833 public static void setXacmldbPassword(String xacmldbPassword) {
834 PolicyController.xacmldbPassword = xacmldbPassword;
837 public static String getAutoPushAvailable() {
838 return autoPushAvailable;
841 public static void setAutoPushAvailable(String autoPushAvailable) {
842 PolicyController.autoPushAvailable = autoPushAvailable;
845 public static String getAutoPushDSClosedLoop() {
846 return autoPushDSClosedLoop;
849 public static void setAutoPushDSClosedLoop(String autoPushDSClosedLoop) {
850 PolicyController.autoPushDSClosedLoop = autoPushDSClosedLoop;
853 public static String getAutoPushDSFirewall() {
854 return autoPushDSFirewall;
857 public static void setAutoPushDSFirewall(String autoPushDSFirewall) {
858 PolicyController.autoPushDSFirewall = autoPushDSFirewall;
861 public static String getAutoPushDSMicroservice() {
862 return autoPushDSMicroservice;
865 public static void setAutoPushDSMicroservice(String autoPushDSMicroservice) {
866 PolicyController.autoPushDSMicroservice = autoPushDSMicroservice;
869 public static String getAutoPushPDPGroup() {
870 return autoPushPDPGroup;
873 public static void setAutoPushPDPGroup(String autoPushPDPGroup) {
874 PolicyController.autoPushPDPGroup = autoPushPDPGroup;
877 public static String getPapUrl() {
881 public static void setPapUrl(String papUrl) {
882 PolicyController.papUrl = papUrl;
885 public static String getMsOnapName() {
889 public static void setMsOnapName(String msOnapName) {
890 PolicyController.msOnapName = msOnapName;
893 public static String getMsPolicyName() {
897 public static void setMsPolicyName(String msPolicyName) {
898 PolicyController.msPolicyName = msPolicyName;
901 public static String getConfigHome() {
905 public static void setConfigHome(String configHome) {
906 PolicyController.configHome = configHome;
909 public static String getActionHome() {
913 public static void setActionHome(String actionHome) {
914 PolicyController.actionHome = actionHome;
917 public static Object getMapaccess() {
921 public static String getPolicydata() {
925 public static String getCharacterencoding() {
926 return characterEncoding;
929 public static String getContenttype() {
933 public static String getFile() {
938 * Set File Size limit.
940 * @param uploadSize value.
942 public static void setFileSizeLimit(String uploadSize) {
943 // Default size limit is 30MB
944 if (uploadSize == null || uploadSize.isEmpty()) {
945 fileSizeLimit = 30000000;
947 fileSizeLimit = Long.parseLong(uploadSize);
951 public static long getFileSizeLimit() {
952 return fileSizeLimit;
956 * Function to convert date.
958 * @param dateTTL input date value.
961 public String convertDate(String dateTTL) {
962 String formateDate = null;
963 if (dateTTL.contains("-")) {
964 formateDate = dateTTL.replace("-", "/");