Automic Workload Automation

 View Only
  • 1.  Using UC4 how to retrieve promptsets variables

    Broadcom Employee
    Posted Jan 13, 2020 07:58 AM

    Hi Team,

    I am integrating my product with Automic I am using UC4 and not using REST API, my challenge here is how to get the promptsets variables for the given clientid and the given workflow, like we are we are getting this using REST API: 

    GET/{client_id}/objects/{object_name}/inputs

    List all inputs for a given object.



    I want to achieve the same thing using UC4 in my code. Appreciate your help on this.

    Thanks
    Ashok.



  • 2.  RE: Using UC4 how to retrieve promptsets variables

    Broadcom Employee
    Posted Jan 14, 2020 02:05 AM
    Hi Ashok,
    the 'Activation' report includes a list of all variables provided by the execution of the object.
    :SET &HND# = PREP_PROCESS_REPORT(,<RuniD>, "ACT", "*")
    :
    PROCESS &HND#
    :   
    SET &RET# = GET_PROCESS_LINE(&HND#)
    :   
    PRINT &RET#
    :
    ENDPROCESS
    You find in the Automic Script documentation more details

    ------------------------------
    Sr. Solution Architect
    Broadcom
    ------------------------------



  • 3.  RE: Using UC4 how to retrieve promptsets variables

    Broadcom Employee
    Posted Jan 14, 2020 03:58 AM
    Hi Kay,

    Thanks for the response, actually we are not looking for getting them inside the script, we are looking for API's outside the Automic using UC4 jar, we already have an API for that using REST(GET/{client_id}/objects/{object_name}/inputs).

    Similar thing we are looking using UC4 jar.

    Thanks
    Ashok.


  • 4.  RE: Using UC4 how to retrieve promptsets variables

    Broadcom Employee
    Posted Jan 14, 2020 05:49 AM
    Hi Ashok,
    here is the Java API code to execute a Job with parameters and print the Job report which is, beside others,  an ACT (Activation Report)

    System.out.println("\n######################################################");
    System.out.println("## Java API :Call Automic Object with parameters " + jobName);

    com.uc4.communication.requests.ExecuteObject execObj = null;
    // Connection Open Method can not deal with READ forms easily.
    // Prompts are the better choice here. The following SCRI object uses a Prompt object and not a READ form
    // This is working with v9 and and newer
    //jobName = "JOBS.50.ASYNC.LONG.RUNNER";

    UC4ObjectName formObj = new UC4ObjectName(AUTOMICPARAM_JOB);
    execObj = new com.uc4.communication.requests.ExecuteObject(formObj);
    execObj.putPromptBuffer("ITEM_0#", "VALUES_0");
    execObj.putPromptBuffer("ITEM_1#", "VALUES_1");

    _con.sendRequestAndWait(execObj);

    try {
    Thread.sleep(1000);
    } catch (InterruptedException ex) {
    Thread.currentThread().interrupt();
    }

    System.out.println("## RPC Call:Run ID of the called object: " + execObj.getRunID());

    if (execObj.getRunID() > 0) {
    ReportTypeList repList = new ReportTypeList(execObj.getRunID());
    _con.sendRequestAndWait(repList);

    System.out.println("\n################################################################");
    System.out.println("## Java API : List of all reports provided by the Automic Job ");

    for (String repListItem : repList) {
    System.out.println("## Job report type: " + execObj.getRunID() + " Report Type: " + repListItem);

    if (repListItem.length() > 0) {
    System.out.println("\n################################################################");
    System.out.println("## Java API : Output of the Job Report ");

    TaskDetails taskDetails = new TaskDetails(execObj.getRunID());
    _con.sendRequestAndWait(taskDetails);

    String jobStatus = taskDetails.findByName("Status");
    String jobActivationTime = taskDetails.findByName("Activation");
    String jobStart = taskDetails.findByName("Start");
    String jobEnd = taskDetails.findByName("End");
    String jobRuntime = taskDetails.findByName("Runtime");

    while (jobStatus.equalsIgnoreCase("active") || jobStatus.equalsIgnoreCase("sleeping") || jobStatus.equalsIgnoreCase("start initiated") || jobStatus.equalsIgnoreCase("waiting for start time")) {
    try {
    Thread.sleep(1000);
    } catch (InterruptedException ex) {
    Thread.currentThread().interrupt();
    }
    taskDetails = new TaskDetails(execObj.getRunID());
    _con.sendRequestAndWait(taskDetails);
    jobStatus = taskDetails.findByName("Status");
    }
    //Read report
    Report act = new Report(execObj.getRunID(), repListItem);
    _con.sendRequestAndWait(act);
    String reportType = act.getReportType();
    String report = act.getReport();
    System.out.println(act.getReport());
    }
    }

    System.out.println("################################################################\n");
    } else {
    System.out.println("Error: Unable to find the give Automic Object");
    }

    ------------------------------
    Sr. Solution Architect
    Broadcom
    ------------------------------



  • 5.  RE: Using UC4 how to retrieve promptsets variables

    Broadcom Employee
    Posted Jan 14, 2020 06:13 AM
    Hi Kay,

    We want achieve this without running the job, I mean without using run Id and much before running the job we want to get the prompset list. At this moment I know my client_id & workflow name only.

    Like how we can achieve in REST API by passing client_id & object_name.
    https://docs.automic.com/documentation/webhelp/english/ASO/12.2/DOCU/12.2/REST%20API/Automation.Engine/index.html?overrideUrls=../Automation.Engine/swagger.json,../Continuous.Delivery.Automation/swagger.json,../Analytics/swagger.json#/object/get

    Get: 
    /{client_id}/objects/{object_name}/inputs
    List all inputs for a given object.



  • 6.  RE: Using UC4 how to retrieve promptsets variables
    Best Answer

    Broadcom Employee
    Posted Jan 14, 2020 10:13 AM
    Hi Ashok,

    okay, I got it. Following piece of Java code reads the Promptset Definition.

    UC4ObjectName promptName = new UC4ObjectName("PCK.ITPA_SHARED.PRV.PROMPTSET.OVERWRITE_AGENT");
    OpenObject openPromptName = new OpenObject(promptName);
    _con.sendRequestAndWait(openPromptName);
    PromptSet promptObj= (PromptSet) openPromptName.getUC4Object();
    PromptDesigner promptDesigner = promptObj.designer();

    for(PromptElement element: promptDesigner) {
    System.out.println("Name: " + element.getVariable());
    System.out.println("Value: " + element.getValue());
    }

    You find a Java API documentation along with few examples in the 'API/ApplicationInteface' folder of the Automic installation set.


    ------------------------------
    Sr. Solution Architect
    Broadcom
    ------------------------------



  • 7.  RE: Using UC4 how to retrieve promptsets variables

    Broadcom Employee
    Posted Jan 14, 2020 10:46 AM
    Thanks a lot Kay!, this is what I am expecting....thanks again!. I will try this and let you know.

    Thanks
    Ashok.