Search in sources :

Example 1 with RawValidationError

use of org.apache.wicket.validation.RawValidationError in project midpoint by Evolveum.

the class PageReport method createFullXmlValidator.

private IValidator<String> createFullXmlValidator() {
    return new IValidator<String>() {

        @Override
        public void validate(IValidatable<String> validatable) {
            String value = validatable.getValue();
            OperationResult result = new OperationResult(OPERATION_VALIDATE_REPORT);
            Holder<PrismObject<ReportType>> reportHolder = new Holder<>(null);
            OpResult opResult = null;
            try {
                validateObject(value, reportHolder, PrismContext.LANG_XML, true, result);
                if (!result.isAcceptable()) {
                    result.recordFatalError("Could not validate object", result.getCause());
                    opResult = OpResult.getOpResult((PageBase) getPage(), result);
                    validatable.error(new RawValidationError(opResult));
                }
            } catch (Exception e) {
                LOGGER.error("Validation problem occured." + e.getMessage());
                result.recordFatalError("Could not validate object.", e);
                try {
                    opResult = OpResult.getOpResult((PageBase) getPage(), result);
                    validatable.error(new RawValidationError(opResult));
                } catch (Exception ex) {
                    error(ex);
                }
            }
        }
    };
}
Also used : PrismObject(com.evolveum.midpoint.prism.PrismObject) IValidator(org.apache.wicket.validation.IValidator) Holder(com.evolveum.midpoint.util.Holder) OpResult(com.evolveum.midpoint.gui.api.component.result.OpResult) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PageBase(com.evolveum.midpoint.gui.api.page.PageBase) RawValidationError(org.apache.wicket.validation.RawValidationError) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) RestartResponseException(org.apache.wicket.RestartResponseException) IValidatable(org.apache.wicket.validation.IValidatable)

Aggregations

OpResult (com.evolveum.midpoint.gui.api.component.result.OpResult)1 PageBase (com.evolveum.midpoint.gui.api.page.PageBase)1 PrismObject (com.evolveum.midpoint.prism.PrismObject)1 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1 Holder (com.evolveum.midpoint.util.Holder)1 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)1 RestartResponseException (org.apache.wicket.RestartResponseException)1 IValidatable (org.apache.wicket.validation.IValidatable)1 IValidator (org.apache.wicket.validation.IValidator)1 RawValidationError (org.apache.wicket.validation.RawValidationError)1