Java Sample – RunRuleBalancing.java for Oracle Profitability and Cost Management Cloud

Prerequisites: json.jar

Prerequisites: See Oracle Profitability and Cost Management Cloud Common Helper Functions for Java

public void runRuleBalancing() throws Exception {
        
        String modelViewName = null;
        
        JSONObject json = new JSONObject();        
        json.put("stringDelimiter", "_");        
        json.put("modelViewName", modelViewName);
        
        String povGroupMember = "2014_January_Actual";
        
        String urlString = serverUrl + "/epm/rest/"+ apiVersion + "/applications/" + applicationName + "/povs/" 
                                       + povGroupMember.trim().replaceAll(" ", "%20") + "/ruleBalance";
        urlString = urlString + "?" + "queryParameter=" + json.toString();
        
        String response = executeRequest(urlString, "GET", null, "application/json");
        JSONObject jsonObj = new JSONObject(response);
        int resStatus = jsonObj.getInt("status");
        
        if(resStatus == 0) {
            System.out.println("Rule Balancing ran successfully");
            JSONArray itemsArray = jsonObj.getJSONArray("items");        
            System.out.println("Details : " + itemsArray.toString());
        } else {
            String details = jsonObj.getString("details");
            System.out.println("Rule Balancing failed. Details : " + details);
        }        
        
    }