Search in sources :

Example 1 with UiMessageStack

use of io.vertigo.vega.webservice.validation.UiMessageStack in project vertigo by KleeGroup.

the class ValidatorWebServiceHandlerPlugin method handle.

/**
 * {@inheritDoc}
 */
@Override
public Object handle(final Request request, final Response response, final WebServiceCallContext routeContext, final HandlerChain chain) throws SessionException {
    final WebServiceDefinition webServiceDefinition = routeContext.getWebServiceDefinition();
    final UiMessageStack uiMessageStack = routeContext.getUiMessageStack();
    for (final WebServiceParam webServiceParam : webServiceDefinition.getWebServiceParams()) {
        final Object value = routeContext.getParamValue(webServiceParam);
        validateParam(value, uiMessageStack, webServiceParam, routeContext);
    }
    if (uiMessageStack.hasErrors()) {
        throw new ValidationUserException();
    }
    return chain.handle(request, response, routeContext);
}
Also used : WebServiceDefinition(io.vertigo.vega.webservice.metamodel.WebServiceDefinition) WebServiceParam(io.vertigo.vega.webservice.metamodel.WebServiceParam) ValidationUserException(io.vertigo.vega.webservice.validation.ValidationUserException) ExtendedObject(io.vertigo.vega.webservice.model.ExtendedObject) DtObject(io.vertigo.dynamo.domain.model.DtObject) UiObject(io.vertigo.vega.webservice.model.UiObject) UiMessageStack(io.vertigo.vega.webservice.validation.UiMessageStack)

Aggregations

DtObject (io.vertigo.dynamo.domain.model.DtObject)1 WebServiceDefinition (io.vertigo.vega.webservice.metamodel.WebServiceDefinition)1 WebServiceParam (io.vertigo.vega.webservice.metamodel.WebServiceParam)1 ExtendedObject (io.vertigo.vega.webservice.model.ExtendedObject)1 UiObject (io.vertigo.vega.webservice.model.UiObject)1 UiMessageStack (io.vertigo.vega.webservice.validation.UiMessageStack)1 ValidationUserException (io.vertigo.vega.webservice.validation.ValidationUserException)1