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 * Modifications Copyright (C) 2019 Bell Canada
8 * ================================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ============LICENSE_END=========================================================
23 package org.onap.policy.controller;
25 import com.att.research.xacml.util.XACMLProperties;
26 import com.fasterxml.jackson.databind.ObjectMapper;
28 import java.io.ByteArrayInputStream;
30 import java.io.FileInputStream;
31 import java.io.IOException;
32 import java.io.InputStream;
33 import java.nio.charset.StandardCharsets;
34 import java.util.ArrayList;
35 import java.util.HashMap;
36 import java.util.List;
38 import java.util.Map.Entry;
39 import java.util.Properties;
42 import javax.annotation.PostConstruct;
43 import javax.script.SimpleBindings;
44 import javax.servlet.http.HttpServletRequest;
45 import javax.servlet.http.HttpServletResponse;
47 import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicySetType;
48 import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType;
50 import org.json.JSONObject;
51 import org.onap.policy.admin.PolicyNotificationMail;
52 import org.onap.policy.admin.RESTfulPAPEngine;
53 import org.onap.policy.common.logging.eelf.MessageCodes;
54 import org.onap.policy.common.logging.eelf.PolicyLogger;
55 import org.onap.policy.common.logging.flexlogger.FlexLogger;
56 import org.onap.policy.common.logging.flexlogger.Logger;
57 import org.onap.policy.model.PDPGroupContainer;
58 import org.onap.policy.model.Roles;
59 import org.onap.policy.rest.XacmlRestProperties;
60 import org.onap.policy.rest.dao.CommonClassDao;
61 import org.onap.policy.rest.jpa.Datatype;
62 import org.onap.policy.rest.jpa.FunctionDefinition;
63 import org.onap.policy.rest.jpa.PolicyEntity;
64 import org.onap.policy.rest.jpa.PolicyVersion;
65 import org.onap.policy.rest.jpa.UserInfo;
66 import org.onap.policy.utils.PeCryptoUtils;
67 import org.onap.policy.utils.PolicyUtils;
68 import org.onap.policy.utils.UserUtils.Pair;
69 import org.onap.policy.xacml.api.XACMLErrorConstants;
70 import org.onap.policy.xacml.api.pap.PAPPolicyEngine;
71 import org.onap.policy.xacml.util.XACMLPolicyScanner;
72 import org.onap.portalsdk.core.controller.RestrictedBaseController;
73 import org.onap.portalsdk.core.domain.UserApp;
74 import org.onap.portalsdk.core.web.support.JsonMessage;
75 import org.onap.portalsdk.core.web.support.UserUtils;
76 import org.springframework.beans.factory.annotation.Autowired;
77 import org.springframework.http.MediaType;
78 import org.springframework.stereotype.Controller;
79 import org.springframework.web.bind.annotation.RequestMapping;
80 import org.springframework.web.bind.annotation.RequestMethod;
81 import org.springframework.web.servlet.ModelAndView;
85 public class PolicyController extends RestrictedBaseController {
86 private static final Logger policyLogger = FlexLogger.getLogger(PolicyController.class);
88 private static CommonClassDao commonClassDao;
92 private static PAPPolicyEngine papEngine;
94 private static String logTableLimit;
95 private static String systemAlertTableLimit;
96 protected static Map<String, String> dropDownMap = new HashMap<>();
98 public static Map<String, String> getDropDownMap() {
102 public static void setDropDownMap(Map<String, String> dropDownMap) {
103 PolicyController.dropDownMap = dropDownMap;
106 public static String getDomain() {
107 return XACMLProperties.getProperty(XacmlRestProperties.PROP_ADMIN_DOMAIN, "urn");
110 private static final Object mapAccess = new Object();
111 private static Map<Datatype, List<FunctionDefinition>> mapDatatype2Function = null;
112 private static Map<String, FunctionDefinition> mapID2Function = null;
114 // Constant variables used across Policy-sdk
115 private static final String policyData = "policyData";
116 private static final String file = "file";
117 private static final String SUPERADMIN = "super-admin";
118 private static final String POLICYGUEST = "Policy Guest";
119 private static final String LOGINID = "loginId";
121 // Smtp Java Mail Properties
122 private static String smtpHost = null;
123 private static String smtpPort = null;
124 private static String smtpUsername = null;
125 private static String smtpPassword = null;
126 private static String smtpApplicationName = null;
127 private static String smtpEmailExtension = null;
129 private static String logdbDriver = null;
130 private static String logdbUrl = null;
131 private static String logdbUserName = null;
132 private static String logdbPassword = null;
133 private static String logdbDialect = null;
134 // Xacml db properties
135 private static String xacmldbUrl = null;
136 private static String xacmldbUserName = null;
137 private static String xacmldbPassword = null;
140 private static String autoPushAvailable;
141 private static String autoPushDSClosedLoop;
142 private static String autoPushDSFirewall;
143 private static String autoPushDSMicroservice;
144 private static String autoPushPDPGroup;
147 private static String papUrl;
149 // MicroService Model Properties
150 private static String msOnapName;
151 private static String msPolicyName;
153 // WebApp directories
154 private static String configHome;
155 private static String actionHome;
158 private static long fileSizeLimit;
160 private static boolean jUnit = false;
162 public static boolean isjUnit() {
166 public static void setjUnit(boolean isJunit) {
167 PolicyController.jUnit = isJunit;
171 private PolicyController(CommonClassDao commonClassDao) {
172 PolicyController.commonClassDao = commonClassDao;
175 public PolicyController() {
180 * init method to load the properties.
184 Properties prop = new Properties();
189 fileName = new File(".").getCanonicalPath() + File.separator + "src" + File.separator + "test"
190 + File.separator + "resources" + File.separator + "JSONConfig.json";
192 fileName = "xacml.admin.properties";
195 try (InputStream input = new FileInputStream(fileName)) {
196 // load a properties file
200 // file upload size limit property
201 setFileSizeLimit(prop.getProperty("file.size.limit"));
203 setPapUrl(prop.getProperty("xacml.rest.pap.url"));
204 // get the property values
205 setSmtpHost(prop.getProperty("onap.smtp.host"));
206 setSmtpPort(prop.getProperty("onap.smtp.port"));
207 setSmtpUsername(prop.getProperty("onap.smtp.userName"));
208 setSmtpPassword(prop.getProperty("onap.smtp.password"));
209 setSmtpApplicationName(prop.getProperty("onap.application.name"));
210 setSmtpEmailExtension(prop.getProperty("onap.smtp.emailExtension"));
211 // Log Database Properties
212 setLogdbDriver(prop.getProperty("xacml.log.db.driver"));
213 setLogdbUrl(prop.getProperty("xacml.log.db.url"));
214 setLogdbUserName(prop.getProperty("xacml.log.db.user"));
215 setLogdbPassword(PeCryptoUtils.decrypt(prop.getProperty("xacml.log.db.password")));
216 setLogdbDialect(prop.getProperty("onap.dialect"));
217 // Xacml Database Properties
218 setXacmldbUrl(prop.getProperty("javax.persistence.jdbc.url"));
219 setXacmldbUserName(prop.getProperty("javax.persistence.jdbc.user"));
220 setXacmldbPassword(PeCryptoUtils.decrypt(prop.getProperty("javax.persistence.jdbc.password")));
222 setAutoPushAvailable(prop.getProperty("xacml.automatic.push"));
223 setAutoPushDSClosedLoop(prop.getProperty("xacml.autopush.closedloop"));
224 setAutoPushDSFirewall(prop.getProperty("xacml.autopush.firewall"));
225 setAutoPushDSMicroservice(prop.getProperty("xacml.autopush.microservice"));
226 setAutoPushPDPGroup(prop.getProperty("xacml.autopush.pdpGroup"));
227 // Micro Service Properties
228 setMsOnapName(prop.getProperty("xacml.policy.msOnapName"));
229 if (getMsOnapName() == null) {
230 setMsOnapName(prop.getProperty("xacml.policy.msEcompName"));
232 policyLogger.info("getMsOnapName => " + getMsOnapName());
233 setMsPolicyName(prop.getProperty("xacml.policy.msPolicyName"));
234 policyLogger.info("setMsPolicyName => " + getMsPolicyName());
235 // WebApp directories
236 setConfigHome(prop.getProperty("xacml.rest.config.webapps") + "Config");
237 setActionHome(prop.getProperty("xacml.rest.config.webapps") + "Action");
238 // Get the Property Values for Dashboard tab Limit
240 setLogTableLimit(prop.getProperty("xacml.onap.dashboard.logTableLimit"));
241 setSystemAlertTableLimit(prop.getProperty("xacml.onap.dashboard.systemAlertTableLimit"));
242 } catch (Exception e) {
244 .error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Dashboard tab Property fields are missing" + e);
245 setLogTableLimit("5000");
246 setSystemAlertTableLimit("2000");
248 System.setProperty(XACMLProperties.XACML_PROPERTIES_NAME, "xacml.admin.properties");
249 } catch (IOException ex) {
250 policyLogger.error(XACMLErrorConstants.ERROR_DATA_ISSUE
251 + "Exception Occured while reading the Smtp properties from xacml.admin.properties file" + ex);
254 // Initialize the FunctionDefinition table at Server Start up
255 Map<Datatype, List<FunctionDefinition>> functionMap = getFunctionDatatypeMap();
256 for (Entry<Datatype, List<FunctionDefinition>> entry : functionMap.entrySet()) {
257 List<FunctionDefinition> functionDefinations = entry.getValue();
258 for (FunctionDefinition functionDef : functionDefinations) {
259 dropDownMap.put(functionDef.getShortname(), functionDef.getXacmlid());
266 * Get FunctionData Type from DB.
268 * @return list of FunctionData.
270 public static Map<Datatype, List<FunctionDefinition>> getFunctionDatatypeMap() {
271 synchronized (mapAccess) {
272 if (mapDatatype2Function == null) {
276 return mapDatatype2Function;
282 * @return Function ID.
284 public static Map<String, FunctionDefinition> getFunctionIdMap() {
285 synchronized (mapAccess) {
286 if (mapID2Function == null) {
290 return mapID2Function;
293 private static void buildFunctionMaps() {
294 mapDatatype2Function = new HashMap<>();
295 mapID2Function = new HashMap<>();
296 List<Object> functiondefinitions = commonClassDao.getData(FunctionDefinition.class);
297 for (int i = 0; i < functiondefinitions.size(); i++) {
298 FunctionDefinition value = (FunctionDefinition) functiondefinitions.get(i);
299 mapID2Function.put(value.getXacmlid(), value);
300 if (!mapDatatype2Function.containsKey(value.getDatatypeBean())) {
301 mapDatatype2Function.put(value.getDatatypeBean(), new ArrayList<FunctionDefinition>());
303 mapDatatype2Function.get(value.getDatatypeBean()).add(value);
308 * Get Functional Definition data.
310 * @param request HttpServletRequest.
311 * @param response HttpServletResponse.
314 value = {"/get_FunctionDefinitionDataByName"},
315 method = {org.springframework.web.bind.annotation.RequestMethod.GET},
316 produces = MediaType.APPLICATION_JSON_VALUE)
317 public void getFunctionDefinitionData(HttpServletRequest request, HttpServletResponse response) {
319 Map<String, Object> model = new HashMap<>();
320 ObjectMapper mapper = new ObjectMapper();
321 model.put("functionDefinitionDatas",
322 mapper.writeValueAsString(commonClassDao.getDataByColumn(FunctionDefinition.class, "shortname")));
323 response.getWriter().write(new JSONObject(new JsonMessage(mapper.writeValueAsString(model))).toString());
324 } catch (Exception e) {
326 XACMLErrorConstants.ERROR_DATA_ISSUE + "Error while retriving the Function Definition data" + e);
331 * Get PolicyEntity Data from db.
333 * @param scope scopeName.
334 * @param policyName policyName.
335 * @return policyEntity data.
337 public PolicyEntity getPolicyEntityData(String scope, String policyName) {
338 String key = scope + ":" + policyName;
339 List<Object> data = commonClassDao.getDataById(PolicyEntity.class, "scope:policyName", key);
340 return (PolicyEntity) data.get(0);
344 * Get Policy User Roles from db.
346 * @param userId LoginID.
347 * @return list of Roles.
349 public List<String> getRolesOfUser(String userId) {
350 List<String> rolesList = new ArrayList<>();
351 List<Object> roles = commonClassDao.getDataById(Roles.class, LOGINID, userId);
352 for (Object role : roles) {
353 rolesList.add(((Roles) role).getRole());
358 public List<Object> getRoles(String userId) {
359 return commonClassDao.getDataById(Roles.class, LOGINID, userId);
363 * Get List of User Roles.
365 * @param request HttpServletRequest.
366 * @param response HttpServletResponse.
369 value = {"/get_UserRolesData"},
370 method = {org.springframework.web.bind.annotation.RequestMethod.GET},
371 produces = MediaType.APPLICATION_JSON_VALUE)
372 public void getUserRolesEntityData(HttpServletRequest request, HttpServletResponse response) {
374 String userId = UserUtils.getUserSession(request).getOrgUserId();
375 Map<String, Object> model = new HashMap<>();
376 ObjectMapper mapper = new ObjectMapper();
377 model.put("userRolesDatas", mapper.writeValueAsString(getRolesOfUser(userId)));
378 response.getWriter().write(new JSONObject(new JsonMessage(mapper.writeValueAsString(model))).toString());
379 } catch (Exception e) {
380 policyLogger.error("Exception Occured" + e);
385 * Policy tabs Model and View.
387 * @param request Request input.
388 * @return view model.
390 @RequestMapping(value = {"/policy", "/policy/Editor"}, method = RequestMethod.GET)
391 public ModelAndView view(HttpServletRequest request) {
392 getUserRoleFromSession(request);
393 String myRequestUrl = request.getRequestURL().toString();
396 // Set the URL for the RESTful PAP Engine
398 setPapEngine(new RESTfulPAPEngine(myRequestUrl));
399 new PDPGroupContainer(new RESTfulPAPEngine(myRequestUrl));
400 } catch (Exception e) {
401 policyLogger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Exception Occured while loading PAP" + e);
403 Map<String, Object> model = new HashMap<>();
404 return new ModelAndView("policy_Editor", "model", model);
408 * Read the role from session for inserting into the database.
410 * @param request Request input for Role.
412 public void getUserRoleFromSession(HttpServletRequest request) {
413 // While user landing on Policy page, fetch the userId and Role from
415 // And, Query the Roles table and if user not exists or else modified
416 // update the Roles table.
418 List<String> newRoles = new ArrayList<>();
419 String userId = UserUtils.getUserSession(request).getOrgUserId();
420 String name = UserUtils.getUserSession(request).getFullName();
421 @SuppressWarnings("unchecked")
422 Set<UserApp> userApps = UserUtils.getUserSession(request).getUserApps();
423 for (UserApp userApp : userApps) {
424 newRoles.add(userApp.getRole().getName());
426 List<Object> userRoles = getRoles(userId);
427 List<String> filteredRoles = filterRole(newRoles);
428 if (!filteredRoles.isEmpty()) {
429 cleanUpRoles(filteredRoles, userId);
431 for (String filteredRole : filteredRoles) {
432 if (userRoles == null || userRoles.isEmpty()) {
433 savePolicyRoles(name, filteredRole, userId);
435 userRoles = getRoles(userId);
436 Pair<Set<String>, List<String>> pair = org.onap.policy.utils.UserUtils.checkRoleAndScope(userRoles);
438 if (!roles.contains(filteredRole)) {
439 savePolicyRoles(name, filteredRole, userId);
446 * Build a delete query for cleaning up roles and execute it.
448 * @param filteredRoles Filtered roles list.
449 * @param userId UserID.
451 private void cleanUpRoles(List<String> filteredRoles, String userId) {
452 StringBuilder query = new StringBuilder();
453 query.append("delete from Roles where loginid = '" + userId + "'");
454 if (filteredRoles.contains(SUPERADMIN)) {
455 query.append("and not role = '" + SUPERADMIN + "'");
457 for (String filteredRole : filteredRoles) {
458 query.append("and not role = '" + filteredRole + "'");
461 query.append("and id > 0");
462 commonClassDao.updateQuery(query.toString());
466 * Save the Role to DB.
468 * @param name User Name.
469 * @param filteredRole Role Name.
470 * @param userId User LoginID.
472 private void savePolicyRoles(String name, String filteredRole, String userId) {
473 UserInfo userInfo = new UserInfo();
474 userInfo.setUserLoginId(userId);
475 userInfo.setUserName(name);
476 commonClassDao.save(userInfo);
477 Roles role = new Roles();
479 role.setRole(filteredRole);
480 role.setLoginId(userId);
481 commonClassDao.save(role);
485 * Filter the list of roles hierarchy wise.
487 * @param newRoles list of roles from request.
490 private List<String> filterRole(List<String> newRoles) {
491 List<String> roles = new ArrayList<>();
492 boolean superCheck = false;
493 for (String role : newRoles) {
494 if ("Policy Super Guest".equalsIgnoreCase(role.trim())) {
496 roles.add("super-guest");
497 } else if ("Policy Super Editor".equalsIgnoreCase(role.trim())) {
500 roles.add("super-editor");
501 } else if ("Policy Super Admin".equalsIgnoreCase(role.trim())
502 || "System Administrator".equalsIgnoreCase(role.trim())
503 || "Standard User".equalsIgnoreCase(role.trim())) {
506 roles.add(SUPERADMIN);
508 if (!roles.contains(SUPERADMIN) || (POLICYGUEST.equalsIgnoreCase(role) && !superCheck)) {
509 if ("Policy Admin".equalsIgnoreCase(role.trim())) {
511 } else if ("Policy Editor".equalsIgnoreCase(role.trim())) {
513 } else if (POLICYGUEST.equalsIgnoreCase(role.trim())) {
521 public PAPPolicyEngine getPapEngine() {
525 public static void setPapEngine(PAPPolicyEngine papEngine) {
526 PolicyController.papEngine = papEngine;
530 * Get UserName based on LoginID.
532 * @param createdBy loginID.
535 public String getUserName(String createdBy) {
536 String loginId = createdBy;
537 List<Object> data = commonClassDao.getDataById(UserInfo.class, LOGINID, loginId);
538 return data.get(0).toString();
542 * Check if the Policy is Active or not.
544 * @param query sql query.
547 public static boolean getActivePolicy(String query) {
548 return !commonClassDao.getDataByQuery(query, new SimpleBindings()).isEmpty();
551 public void executeQuery(String query) {
552 commonClassDao.updateQuery(query);
555 public void saveData(Object cloneEntity) {
556 commonClassDao.save(cloneEntity);
559 public void updateData(Object entity) {
560 commonClassDao.update(entity);
563 public void deleteData(Object entity) {
564 commonClassDao.delete(entity);
567 public List<Object> getData(@SuppressWarnings("rawtypes") Class className) {
568 return commonClassDao.getData(className);
571 public PolicyVersion getPolicyEntityFromPolicyVersion(String query) {
572 return (PolicyVersion) commonClassDao.getEntityItem(PolicyVersion.class, "policyName", query);
575 public List<Object> getDataByQuery(String query, SimpleBindings params) {
576 return commonClassDao.getDataByQuery(query, params);
579 @SuppressWarnings("rawtypes")
580 public Object getEntityItem(Class className, String columname, String key) {
581 return commonClassDao.getEntityItem(className, columname, key);
585 * Watch Policy Function.
587 * @param entity PolicyVersion entity.
588 * @param policyName updated policy name.
589 * @param mode type of action rename/delete/import.
591 public void watchPolicyFunction(PolicyVersion entity, String policyName, String mode) {
592 PolicyNotificationMail email = new PolicyNotificationMail();
593 email.sendMail(entity, policyName, mode, commonClassDao);
597 * Switch Version Policy Content.
599 * @param thePolicyName which is used to find associated versions.
600 * @return list of available versions based on policy name.
602 public JSONObject switchVersionPolicyContent(String thePolicyName) {
603 String policyName = thePolicyName;
604 String dbCheckName = policyName.replace("/", ".");
605 if (dbCheckName.contains("Config_")) {
606 dbCheckName = dbCheckName.replace(".Config_", ":Config_");
607 } else if (dbCheckName.contains("Action_")) {
608 dbCheckName = dbCheckName.replace(".Action_", ":Action_");
609 } else if (dbCheckName.contains("Decision_MS_")) {
610 dbCheckName = dbCheckName.replace(".Decision_MS_", ":Decision_MS_");
611 } else if (dbCheckName.contains("Decision_")) {
612 dbCheckName = dbCheckName.replace(".Decision_", ":Decision_");
614 String[] splitDbCheckName = dbCheckName.split(":");
615 String query = "FROM PolicyEntity where policyName like :splitDBCheckName1 and scope = :splitDBCheckName0";
616 SimpleBindings params = new SimpleBindings();
617 params.put("splitDBCheckName1", splitDbCheckName[1] + "%");
618 params.put("splitDBCheckName0", splitDbCheckName[0]);
619 List<String> av = new ArrayList<>();
620 for (Object entity : commonClassDao.getDataByQuery(query, params)) {
621 PolicyEntity policyEntity = (PolicyEntity) entity;
622 String removeExtension = policyEntity.getPolicyName().replace(".xml", "");
623 String version = removeExtension.substring(removeExtension.lastIndexOf('.') + 1);
624 String userName = getUserId(policyEntity, "@ModifiedBy:");
625 av.add(version + " | " + policyEntity.getModifiedDate() + " | " + userName);
627 if (policyName.contains("/")) {
628 policyName = policyName.replace("/", File.separator);
630 PolicyVersion entity =
631 (PolicyVersion) commonClassDao.getEntityItem(PolicyVersion.class, "policyName", policyName);
632 JSONObject el = new JSONObject();
633 el.put("activeVersion", entity.getActiveVersion());
634 el.put("availableVersions", av);
635 el.put("highestVersion", entity.getHigherVersion());
642 * @param data PolicyEntity
643 * @param value String
646 public String getUserId(PolicyEntity data, String value) {
648 String userValue = value; // Why?
649 String description = getDescription(data);
650 if (description.contains(userValue)) {
651 userId = description.substring(description.indexOf(userValue) + userValue.length(),
652 description.lastIndexOf(userValue));
654 UserInfo userInfo = (UserInfo) getEntityItem(UserInfo.class, "userLoginId", userId);
655 if (userInfo == null) {
658 return userInfo.getUserName();
664 * @param data PolicyEntity
667 public String getDescription(PolicyEntity data) {
668 InputStream stream = new ByteArrayInputStream(data.getPolicyData().getBytes(StandardCharsets.UTF_8));
669 Object policy = XACMLPolicyScanner.readPolicy(stream);
670 if (policy instanceof PolicySetType) {
671 return ((PolicySetType) policy).getDescription();
672 } else if (policy instanceof PolicyType) {
673 return ((PolicyType) policy).getDescription();
675 PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + "Expecting a PolicySet/Policy/Rule object. Got: "
676 + policy.getClass().getCanonicalName());
683 * @param data PolicyEntity
684 * @param activePolicies list of active policies
685 * @return array of String
687 public String[] getUserInfo(PolicyEntity data, List<PolicyVersion> activePolicies) {
688 String policyName = data.getScope().replace(".", File.separator) + File.separator
689 + data.getPolicyName().substring(0, data.getPolicyName().indexOf('.'));
690 PolicyVersion polVersion =
691 activePolicies.stream().filter(a -> policyName.equals(a.getPolicyName())).findAny().orElse(null);
692 String[] result = new String[2];
693 UserInfo userCreate = null;
694 UserInfo userModify = null;
695 if (polVersion != null) {
696 userCreate = (UserInfo) getEntityItem(UserInfo.class, "userLoginId", polVersion.getCreatedBy());
697 userModify = (UserInfo) getEntityItem(UserInfo.class, "userLoginId", polVersion.getModifiedBy());
700 result[0] = userCreate != null ? userCreate.getUserName() : SUPERADMIN;
701 result[1] = userModify != null ? userModify.getUserName() : SUPERADMIN;
706 public static String getLogTableLimit() {
707 return logTableLimit;
710 public static void setLogTableLimit(String logTableLimit) {
711 PolicyController.logTableLimit = logTableLimit;
714 public static String getSystemAlertTableLimit() {
715 return systemAlertTableLimit;
718 public static void setSystemAlertTableLimit(String systemAlertTableLimit) {
719 PolicyController.systemAlertTableLimit = systemAlertTableLimit;
722 public static CommonClassDao getCommonClassDao() {
723 return commonClassDao;
726 public static void setCommonClassDao(CommonClassDao commonClassDao) {
727 PolicyController.commonClassDao = commonClassDao;
730 public static Map<Datatype, List<FunctionDefinition>> getMapDatatype2Function() {
731 return mapDatatype2Function;
734 public static void setMapDatatype2Function(Map<Datatype, List<FunctionDefinition>> mapDatatype2Function) {
735 PolicyController.mapDatatype2Function = mapDatatype2Function;
738 public static Map<String, FunctionDefinition> getMapID2Function() {
739 return mapID2Function;
742 public static void setMapID2Function(Map<String, FunctionDefinition> mapID2Function) {
743 PolicyController.mapID2Function = mapID2Function;
746 public static String getSmtpHost() {
750 public static void setSmtpHost(String smtpHost) {
751 PolicyController.smtpHost = smtpHost;
754 public static String getSmtpPort() {
758 public static void setSmtpPort(String smtpPort) {
759 PolicyController.smtpPort = smtpPort;
762 public static String getSmtpUsername() {
766 public static void setSmtpUsername(String smtpUsername) {
767 PolicyController.smtpUsername = smtpUsername;
770 public static String getSmtpPassword() {
774 public static void setSmtpPassword(String smtpPassword) {
775 PolicyController.smtpPassword = smtpPassword;
778 public static String getSmtpApplicationName() {
779 return smtpApplicationName;
782 public static void setSmtpApplicationName(String smtpApplicationName) {
783 PolicyController.smtpApplicationName = smtpApplicationName;
786 public static String getSmtpEmailExtension() {
787 return smtpEmailExtension;
790 public static void setSmtpEmailExtension(String smtpEmailExtension) {
791 PolicyController.smtpEmailExtension = smtpEmailExtension;
794 public static String getLogdbDriver() {
798 public static void setLogdbDriver(String logdbDriver) {
799 PolicyController.logdbDriver = logdbDriver;
802 public static String getLogdbUrl() {
806 public static void setLogdbUrl(String logdbUrl) {
807 PolicyController.logdbUrl = logdbUrl;
810 public static String getLogdbUserName() {
811 return logdbUserName;
814 public static void setLogdbUserName(String logdbUserName) {
815 PolicyController.logdbUserName = logdbUserName;
818 public static String getLogdbPassword() {
819 return logdbPassword;
822 public static void setLogdbPassword(String logdbPassword) {
823 PolicyController.logdbPassword = logdbPassword;
826 public static String getLogdbDialect() {
830 public static void setLogdbDialect(String logdbDialect) {
831 PolicyController.logdbDialect = logdbDialect;
834 public static String getXacmldbUrl() {
838 public static void setXacmldbUrl(String xacmldbUrl) {
839 PolicyController.xacmldbUrl = xacmldbUrl;
842 public static String getXacmldbUserName() {
843 return xacmldbUserName;
846 public static void setXacmldbUserName(String xacmldbUserName) {
847 PolicyController.xacmldbUserName = xacmldbUserName;
850 public static String getXacmldbPassword() {
851 return xacmldbPassword;
854 public static void setXacmldbPassword(String xacmldbPassword) {
855 PolicyController.xacmldbPassword = xacmldbPassword;
858 public static String getAutoPushAvailable() {
859 return autoPushAvailable;
862 public static void setAutoPushAvailable(String autoPushAvailable) {
863 PolicyController.autoPushAvailable = autoPushAvailable;
866 public static String getAutoPushDSClosedLoop() {
867 return autoPushDSClosedLoop;
870 public static void setAutoPushDSClosedLoop(String autoPushDSClosedLoop) {
871 PolicyController.autoPushDSClosedLoop = autoPushDSClosedLoop;
874 public static String getAutoPushDSFirewall() {
875 return autoPushDSFirewall;
878 public static void setAutoPushDSFirewall(String autoPushDSFirewall) {
879 PolicyController.autoPushDSFirewall = autoPushDSFirewall;
882 public static String getAutoPushDSMicroservice() {
883 return autoPushDSMicroservice;
886 public static void setAutoPushDSMicroservice(String autoPushDSMicroservice) {
887 PolicyController.autoPushDSMicroservice = autoPushDSMicroservice;
890 public static String getAutoPushPDPGroup() {
891 return autoPushPDPGroup;
894 public static void setAutoPushPDPGroup(String autoPushPDPGroup) {
895 PolicyController.autoPushPDPGroup = autoPushPDPGroup;
898 public static String getPapUrl() {
902 public static void setPapUrl(String papUrl) {
903 PolicyController.papUrl = papUrl;
906 public static String getMsOnapName() {
910 public static void setMsOnapName(String msOnapName) {
911 PolicyController.msOnapName = msOnapName;
914 public static String getMsPolicyName() {
918 public static void setMsPolicyName(String msPolicyName) {
919 PolicyController.msPolicyName = msPolicyName;
922 public static String getConfigHome() {
926 public static void setConfigHome(String configHome) {
927 PolicyController.configHome = configHome;
930 public static String getActionHome() {
934 public static void setActionHome(String actionHome) {
935 PolicyController.actionHome = actionHome;
938 public static Object getMapaccess() {
942 public static String getPolicydata() {
946 public static String getCharacterencoding() {
947 return PolicyUtils.CHARACTER_ENCODING;
950 public static String getContenttype() {
951 return PolicyUtils.APPLICATION_JSON;
954 public static String getFile() {
959 * Set File Size limit.
961 * @param uploadSize value.
963 public static void setFileSizeLimit(String uploadSize) {
964 // Default size limit is 30MB
965 if (uploadSize == null || uploadSize.isEmpty()) {
966 fileSizeLimit = 30000000;
968 fileSizeLimit = Long.parseLong(uploadSize);
972 public static long getFileSizeLimit() {
973 return fileSizeLimit;