You can invoke form handler handlers from within any endpoint by using the FormHandlerExecutor class. You must configure the FormHandlerExecutor with a handle method that is contained within the form handler that you wish to call.

The FormHandlerExecutor is where form handler input is added. For example, the CartCommerceItemRestSubresource.addItem handle method uses the addInputsForAddItem hook method to set up the data required by the form handler. It accepts parameters such as those accepted by the endpoint, or a ResourceUpdateInfo, which contains the updates as detected by the framework.

The parameters for this method are:

FormHandlerExecutor pExecutor, Order pOrder, JSONObject pInputJson,
    ResourceUpdateInfo
pResourceUpdateInfo, AddCommerceItemInfo[] pItemsToAdd

The following shows how you might invoke the CartModifierFormHandler:

FormHandlerExecutor executor = new FormHandlerExecutor
    (getCartModifierFormHandlerPath(), getAddItemsHandleMethod());
addInputsForAddItem(executor, order, pInputJson, RestUtils.getRestUtils().
    getResourceUpdateInfo(), itemsToAdd);
executor.processFormHandlerResult(executor.execute());

The result returns as a FormHandlerInvocationResult that contains the FormExceptions or FormError.

Note: It is recommended that you do not set properties directly on the form handler itself, but use one of the addinputFor hook methods.

To invoke a form handler:


Copyright © 1997, 2017 Oracle and/or its affiliates. All rights reserved. Legal Notices