Skip Navigation

Accessing Workflow Data (deprecated)

The Red App can access and manipulate workflow data with following classes:

FlowExtPointCommand

Execution time - Workflow data is provided to Red App handler registered to extension point by FlowExtPointCommand type Object. This Object contains basic information about flow data and parameters:

  • Command received from FrontEnd.

  • Extension point name.

  • List of requests. Parameters used by workflow logic.

  • List of responses. Output data returned by workflow logic.

  • Status of workflow execution.

  • User context.

FlowExtPointRequestWrapper

Red App can access workflow command parameters. Parameter is packed within special wrapper Object, which is responsible for providing information about which operation was done by Red App on request. Adding new request from Red App can be done by creating new FlowExtPointRequestWrapper Object and providing new request data. When Red App will change request or add new one, it must set wrapper operation value accordingly. Otherwise, all changes will be ignored. Additionally, all data passed to extension points are deep copy of the original Objects, which means that no changes will be applied until you ask for that explicitly.

FlowExtPointRequestWrapper Object contains requested Object and information about operation done on request Object by Red App.

  • Request.

  • Operation. Type of operation done by RedApp.

Getting request sample:

Optional <FlowExtPointRequestWrapper> rqWrapper = extPointCommand.getRequests().stream().findFirst();
if (rqWrapper.isPresent())
{
rqWrapper.get().getRequest();
}

In many cases you may need to add your data model instance to the list of requests.

Note: your data model needs to be serializable by JAXB and registered in Transformer service.

Adding request sample:

FlowExtPointRequestWrapper rqWrapper = newFlowExtPointRequestWrapper();
rqWrapper.setOperation(FlowExtPointDataOperation.ADD);
rqWrapper.setRequest(request);
extPointCommand.getRequests().add(rqWrapper);

Modifying request sample:

FlowExtPointRequestWrapper rqWrapper = extPointCommand.getRequests().stream().findFirst();
if (rqWrapper.isPresent())
{
Object request = rqWrapper.get().getRequest();
// __modify request object__
rqWrapper.setOperation(FlowExtPointDataOperation.MODIFY);
}

FlowExtPointResponseWrapper

Red App can access workflow responses. Response is packed within special wrapper Object, which is responsible for providing information about which operation was done by Red App on response. Adding new response from Red App can be done by creating new FlowExtPointResponseWrapper Object and providing new response data. When Red App will change response or add new one, it must set wrapper operation value accordingly. Otherwise, all changes will be ignored. Additionally, all data passed to extension points are deep copy of the original Objects, which means no changes will be applied until you ask for that explicitly.

FlowExtPointResponseWrapper Object contains request Object and information about operation done on request Object by Red App.

  • Response

  • Operation.

Getting response sample:

Optional <FlowExtPointResponseWrapper> rsWrapper = extPointCommand.getResponses().stream().findFirst();
if (rsWrapper.isPresent())
{
 rsWrapper.get().getResponse();
}

In many cases you may need to add your data model instance to the list of responses.

Note: your data model needs to be serializable by JAXB and registered in Transformer service.

Adding response sample:

Object response = // __your data model object__
FlowExtPointResponseWrapper rsWrapper = new FlowExtPointResponseWrapper();
rsWrapper.setOperation(FlowExtPointDataOperation.ADD);
rsWrapper.setResponses(response);
extPointCommand.getResponses().add(rsWrapper);

Modifying response sample:

Optional <FlowExtPointResponseWrapper> rsWrapper = extPointCommand.getResponses().stream().findFirst();
if (rsWrapper.isPresent()()
{
Object response = rsWrapper.get().getResponse();
// __modify response object__
rsWrapper.setOperation(FlowExtPointDataOperation.MODIFY);
}

FlowExtPointResponse

Workflow response may be text which should be displayed by FrontEnd or Structure Object. Structure Object is transformed to JSON when workflow Object will be passed to FrontEnd. It contains:

  • Text

  • Structure

Red App data model

Some of extension points are exposing data model that can be used by Red App for reading or updating some information. The following code listing shows how to get access to RedAppAirShoppingRq class:

Optional <FlowExtPointRequestWrapper> wrapperOptional = FlowExtPointCommandUtils.getRequestWrapper(extPointCommand,   RedAppAirShoppingRq.class);

if (wrapperOptional.isPresent())  {
FlowExtPointRequestWrapper wrapper = wrapperOptional.get();
RedAppAirShoppingRq shoppingRequest = (RedAppAirShoppingRq)wrapper.get().getRequest();
// __do something__
}

Note: We strongly recommend to always check if the specified data class is present in FlowExtPointCommand object before using it.