import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Properties;
import javax.annotation.PostConstruct;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.model.PDPGroupContainer;
+import org.onap.policy.model.Roles;
import org.onap.policy.rest.XACMLRestProperties;
import org.onap.policy.rest.XacmlAdminAuthorization;
import org.onap.policy.rest.dao.CommonClassDao;
import org.onap.policy.rest.jpa.UserInfo;
import org.onap.policy.xacml.api.XACMLErrorConstants;
import org.onap.policy.xacml.api.pap.PAPPolicyEngine;
-import org.openecomp.policy.model.Roles;
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
-import org.openecomp.portalsdk.core.web.support.JsonMessage;
-import org.openecomp.portalsdk.core.web.support.UserUtils;
+import org.onap.portalsdk.core.controller.RestrictedBaseController;
+import org.onap.portalsdk.core.web.support.JsonMessage;
+import org.onap.portalsdk.core.web.support.UserUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
private static String configHome;
private static String actionHome;
+ //File upload size
+ private static long fileSizeLimit;
+
private static boolean jUnit = false;
}
public PolicyController() {
+ // Empty constructor
}
@PostConstruct
}
// load a properties file
prop.load(input);
+ //file upload size limit property
+ setFileSizeLimit(prop.getProperty("file.size.limit"));
//pap url
setPapUrl(prop.getProperty("xacml.rest.pap.url"));
// get the property values
setAutoPushPDPGroup(prop.getProperty("xacml.autopush.pdpGroup"));
//Micro Service Properties
setMsOnapName(prop.getProperty("xacml.policy.msOnapName"));
+ if(getMsOnapName() == null){
+ setMsOnapName(prop.getProperty("xacml.policy.msEcompName"));
+ }
+ policyLogger.info("getMsOnapName => " + getMsOnapName());
setMsPolicyName(prop.getProperty("xacml.policy.msPolicyName"));
+ policyLogger.info("setMsPolicyName => " + getMsPolicyName());
//WebApp directories
setConfigHome(prop.getProperty("xacml.rest.config.webapps") + "Config");
setActionHome(prop.getProperty("xacml.rest.config.webapps") + "Action");
//Initialize the FunctionDefinition table at Server Start up
Map<Datatype, List<FunctionDefinition>> functionMap = getFunctionDatatypeMap();
- for (Datatype id : functionMap.keySet()) {
- List<FunctionDefinition> functionDefinations = functionMap.get(id);
+ for ( Entry<Datatype, List<FunctionDefinition>> entry : functionMap.entrySet()) {
+ List<FunctionDefinition> functionDefinations = entry.getValue();
for (FunctionDefinition functionDef : functionDefinations) {
dropDownMap.put(functionDef.getShortname(),functionDef.getXacmlid());
}
for(Object entity : policyEntity){
PolicyEntity pEntity = (PolicyEntity) entity;
String removeExtension = pEntity.getPolicyName().replace(".xml", "");
- String version = removeExtension.substring(removeExtension.lastIndexOf(".")+1);
+ String version = removeExtension.substring(removeExtension.lastIndexOf('.')+1);
av.add(version);
}
if(policyName.contains("/")){
return file;
}
+ public static void setFileSizeLimit(String uploadSize) {
+ //Default size limit is 30MB
+ if (uploadSize == null || uploadSize.isEmpty()) {
+ fileSizeLimit = 30000000;
+ }
+ else {
+ fileSizeLimit = Long.parseLong(uploadSize);
+ }
+ }
+
+ public static long getFileSizeLimit() {
+ return fileSizeLimit;
+ }
public String convertDate(String dateTTL) {
String formateDate = null;
if(dateTTL.contains("-")){