import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
+import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import javax.script.SimpleBindings;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.JSONObject;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
-import org.onap.policy.model.Roles;
import org.onap.policy.rest.adapter.PolicyExportAdapter;
import org.onap.policy.rest.dao.CommonClassDao;
import org.onap.policy.rest.jpa.ActionBodyEntity;
import org.onap.policy.rest.jpa.PolicyVersion;
import org.onap.policy.rest.jpa.UserInfo;
import org.onap.policy.xacml.api.XACMLErrorConstants;
+import org.openecomp.policy.model.Roles;
import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
import org.openecomp.portalsdk.core.web.support.UserUtils;
import org.springframework.beans.factory.annotation.Autowired;
public PolicyExportAndImportController(){}
@RequestMapping(value={"/policy_download/exportPolicy.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public void exportPolicy(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public void exportPolicy(HttpServletRequest request, HttpServletResponse response) throws IOException{
try{
String file = null;
selectedPolicy = new ArrayList<>();
}
//Policy Import
- public JSONObject importRepositoryFile(String file, HttpServletRequest request) throws Exception{
+ public JSONObject importRepositoryFile(String file, HttpServletRequest request) throws IOException{
boolean configExists = false;
boolean actionExists = false;
String configName = null;
if(finalColumn){
scope = policyEntity.getScope().replace(".", File.separator);
- String query = "FROM PolicyEntity where policyName = '"+policyEntity.getPolicyName()+"' and scope ='"+policyEntity.getScope()+"'";
- List<Object> queryData = controller.getDataByQuery(query);
+ String query = "FROM PolicyEntity where policyName = :policyName and scope = :policyScope";
+ SimpleBindings params = new SimpleBindings();
+ params.put("policyName", policyEntity.getPolicyName());
+ params.put("policyScope", policyEntity.getScope());
+ List<Object> queryData = controller.getDataByQuery(query, params);
if(!queryData.isEmpty()){
continue;
}