Helper Functions

  • The properties file containing connection parameters can also be accessed using this class:

    com.oracle.ceal.BICSAutomationParameters or

    com.oracle.ceal.PBCSAutomationParameters or

    com.oracle.ceal.APEXAutomationParameters

    The Properties file must contain for BICS:

    proxyHost=
    proxyPort=
    ignoreSSLCertificationPathErrors=true or false
    bicsRestUrl=https://biserverurl
    bicsIdentityDomain=
    bicsUsername=
    bicsPassword=
    
    // this loads a file named PBCSBICSAutomation.properties 
    PbcsRestClient pbcsClient
    	
    PBCSAutomationParameters pbcsParams=new PBCSAutomationParameters(‘PBCSBICSAutomation.properties’)
    
    pbcsClient=new PbcsRestClient(pbcsParams.planningRestUrl,pbcsParams.interopRestUrl,pbcsParams.proxyHost,pbcsParams.proxyPort,pbcsParams.identityDomain,pbcsParams.username, pbcsParams.password, pbcsParams.ignoreSSLCertificationPathErrors)
    

    Properties file must contain for Planning:

    pbcsPlanningRestUrl=https://<SERVER>/rest/11.1.2.3.600
    pbcsInteropRestUrl=https://<SERVER>/interop/rest/11.1.2.3.600
    pbcsIdentityDomain=
    pbcsUsername=
    pbcsPassword=
    proxyHost=
     proxyPort=
    ignoreSSLCertificationPathErrors=true or false
    
    // this loads a file named PBCSBICSAutomation.properties 
    ApexRestClient apexClient
    
    APEXAutomationParameters apexParams=new APEXAutomationParameters('PBCSBICSAutomation.properties')
    
    apexClient=new ApexRestClient(apexParams.apexRestUrl,apexParams.proxyHost,apexParams.proxyPort,apexParams.identityDomain,apexParams.username, apexParams.password, apexParams.ignoreSSLCertificationPathErrors)
    

    The properties file must contain for Planning:

    apexRestUrl=https://apexserver/apex	
    apexIdentityDomain=
    apexUsername=
    apexPassword=
    proxyHost=
    proxyPort=
    ignoreSSLCertificationPathErrors=true or false
    
  • The Planning REST client also contains helper functions for dealing with CSV files:

    • Finding the number of columns in a .csv file

      Example:

      nbColsInCsv=pbcsClient.findNbOfColsInCSV("d:\\temp\\", "export.csv", ",")

    • Finding header names in a .csv file (first line):

      listHeaders=pbcsClient.getHeadersInCSVAsList(folder containing csv file, csv filename, delimiter)

      Example:

      listHeaders=pbcsClient.getHeadersInCSVAsList("d:\\temp\\", fileName, ",")

  • The Planning REST client also contains helpers functions for dealing with asynchronous calls:

    Class WaitForCode
                      Method retry(sleep time, nb of retries) { code to run }
    

    Example:

    // Looping to get jobId status while it s being processed on server
    	// In this example waiting 6 secs each time, and trying 100 times to get a valid status (not processing)
    	WaitForCode.retry(6000,100){
    	// second parameter is jobid (is obtained from json response from server)
    		def responseJobStatus
    		responseJobStatus=pbcsClient.getJobStatus("Vision",jobId)
    if (responseJobStatus.contains("Processing")) throw new Exception("Job not finished")
    								
    }
    
  • The Business Intelligence Cloud Service REST client also contains helpers functions for trimming lists:

    def truncateList(listName, truncateLength)

    Example to truncate headers for columns to 30 characters:

    def listHeaders
    listHeaders=pbcsClient.getHeadersInCSVAsList("d:\\temp\\", fileNameInZip, ",")
    				listHeaders=bicsClient.truncateList(listHeaders, 30)