To invoke a method before an endpoint method, annotate it with the @PreAction annotation. The value parameter of the annotation is the endpoint method name. This method should use the same parameters as the endpoint method.
For example:
@PreAction("addItems")
public void preAddItems(JSONObject pInputData) throws RestException {
// pre endpoint logic
}
@POST
@Endpoint(id="/{commerceItems}/#POST", validatorId="commerceitems.add",
filterId="commerceitems-CollectionDefault", updateTarget=true)
public RepresentationModel addItems(JSONObject pInputData)
throws RestException {
// endpoint logic
}
