Submit a task with Promptsets via JavaAPI (Application Interface) in AE v9 and v10

Document ID : KB000089102
Last Modified Date : 14/04/2018
Show Technical Document Details
Issue:
Affects Release version(s): null

Submit a task with Promptsets via JavaAPI (Application Interface) in AE v9 and v10
Resolution:

Question: How to execute an object with promptset via Java api (Application Interface) in AE v9 and v10?


Resolution:

Executinga job or a workflow with Prompset via Java api is not the same with AE v9 and v10

In v10, there isa new function called "putPromptBuffer"in class "ExecuteObject". With this function, the value of each prompsetvariable could be stored in the buffer before executing the object thatcontains the prompsets. So the steps to execute an object with promptsets are:

  1. - Initiate the executable object
  2. - Put the promptsets'value to the buffer
  3. - Execute the object.

 

Example:

//Step 1: initiate the executable object

ExecuteObject exec = newExecuteObject(new UC4ObjectName("GEN.SCRI_PROMPT_DEMO"));

//Step 2: Put the promptset's values to the buffer

exec.putPromptBuffer("FIRSTPROMPTSET1","a");

exec.putPromptBuffer("FIRSTPROMPTSET2","b");

exec.putPromptBuffer("SECONDPROMPTSET1","c");

exec.putPromptBuffer("SECONDPROMPTSET2","d");

//Ste 3: Execute the object

uc4.sendRequestAndWait(exec);

In v9, there's no similar function to "putPrompBuffer" as inv10. The approach is:

  1. - Initiate and execute the object
  2. - Wait until the prompt is notified via the callback function
  3. - Fill the promptsets' value after the workflow isstarted.

 

Example:

//Inthe main flow:

waitForPrompt = newCountDownLatch(1);

ExecuteObject exec = newExecuteObject(new UC4ObjectName("GEN.SCRI_PROMPT_DEMO"));

uc4.sendRequest(exec, this);

waitForPrompt.await();

SubmitPrompt submit = newSubmitPrompt(names, promptSets.toArray(newTaskPromptSetContent[promptSets.size()]));

uc4.sendRequestAndWait (submit);

//Overwritethe call back functions of the DefaultNotificationListener to count down the countdownlatch

public void promptInputRequired(intrun) {

 waitForPrompt.countDown();

 }

public voidhandleIOException(IOException e) {

 waitForPrompt.countDown();