Consolidate PolicyRestAdapter setup
[policy/engine.git] / POLICY-SDK-APP / src / main / java / org / onap / policy / controller / PolicyExportAndImportController.java
index 11075ef..8f508ca 100644 (file)
@@ -64,6 +64,7 @@ import org.onap.policy.rest.jpa.PolicyEditorScopes;
 import org.onap.policy.rest.jpa.PolicyEntity;
 import org.onap.policy.rest.jpa.PolicyVersion;
 import org.onap.policy.rest.jpa.UserInfo;
+import org.onap.policy.utils.PolicyUtils;
 import org.onap.policy.utils.UserUtils.Pair;
 import org.onap.policy.xacml.api.XACMLErrorConstants;
 import org.onap.portalsdk.core.controller.RestrictedBaseController;
@@ -174,8 +175,8 @@ public class PolicyExportAndImportController extends RestrictedBaseController {
             workBook2.write(fos);
             fos.flush();
 
-            response.setContentType("application / json");
-            request.setCharacterEncoding("UTF-8");
+            response.setContentType(PolicyUtils.APPLICATION_JSON);
+            request.setCharacterEncoding(PolicyUtils.CHARACTER_ENCODING);
 
             PrintWriter out = response.getWriter();
             String successMap = file.substring(file.lastIndexOf("webapps") + 8);
@@ -268,8 +269,8 @@ public class PolicyExportAndImportController extends RestrictedBaseController {
         // Check if the Role and Scope Size are Null get the values from db.
         List<Object> userRoles = controller.getRoles(userId);
         Pair<Set<String>, List<String>> pair = org.onap.policy.utils.UserUtils.checkRoleAndScope(userRoles);
-        List<String> roles = pair.u;
-        Set<String> scopes = pair.t;
+        List<String> roles = pair.second;
+        Set<String> scopes = pair.first;
 
         try (FileInputStream excelFile = new FileInputStream(new File(file));
                 HSSFWorkbook workbook = new HSSFWorkbook(excelFile)) {
@@ -563,6 +564,7 @@ public class PolicyExportAndImportController extends RestrictedBaseController {
         return false;
     }
 
+    @SuppressWarnings("rawtypes")
     private boolean isContinue(List<String> roles, String scope, UserInfo userInfo, Set scopes) {
         if (roles.contains(admin) || roles.contains(editor)) {
             if (scopes.isEmpty()) {