How to Create and Update Output at Run Time

BusinessWorks Plug-in Development Kit provides a private <A> void buildStructuredOutput(N inputData, N outPutNode, ProcessingContext<N> processingContext, Object data) method to create and update runtime output.

You can find this method in the ActivityName_ActivityTypeActivity.java file from the runtime bundle. If you have selected using XSD to create the activity output, then the XSD elements are created inside this method.

private <A> void buildStructuredOutput(N inputData, N SayHelloOutput, ProcessingContext<N> processingContext, Object data) throws Exception {
    MutableModel<N> mutableModel = processingContext.getMutableContext().getModel();
    NodeFactory<N> noteFactory = mutableModel.getFactory(SayHelloOutput);
    //if the element's MaxOccurs and MinOccurs are 1, that means this element's size is 1
    N Output = noteFactory.createElement("", "Output", "");
    mutableModel.appendChild(SayHelloOutput, Output);
    //set default value here, please set value by your business
    N OutputvalueNode = noteFactory.createText("string value");
    mutableModel.appendChild(Output, OutputvalueNode);
    // begin-custom-code
    // add your own business code here
    // end-custom-code
}