Search in sources :

Example 1 with FormAuthorizationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.FormAuthorizationType in project midpoint by Evolveum.

the class DynamicFormPanel method createObjectWrapper.

private PrismObjectWrapper<O> createObjectWrapper(PrismObjectWrapperFactory<O> factory, Task task, PrismObject<O> prismObject, boolean enforceRequiredFields) {
    FormAuthorizationType formAuthorization = form.getFormDefinition().getAuthorization();
    AuthorizationPhaseType authorizationPhase = formAuthorization != null && formAuthorization.getPhase() != null ? formAuthorization.getPhase() : AuthorizationPhaseType.REQUEST;
    OperationResult result = task.getResult();
    WrapperContext context = new WrapperContext(task, result);
    context.setShowEmpty(true);
    context.setAuthzPhase(authorizationPhase);
    // TODO: enforce required fields???? what is it?
    PrismObjectWrapper<O> objectWrapper = null;
    try {
        objectWrapper = factory.createObjectWrapper(prismObject, prismObject.getOid() == null ? ItemStatus.ADDED : ItemStatus.NOT_CHANGED, context);
        result.recordSuccess();
    } catch (SchemaException e) {
        result.recordFatalError(createStringResource("DynamicFormPanel.message.createObjectWrapper.fatalError", e.getMessage()).getString());
        getPageBase().showResult(result);
    }
    return objectWrapper;
}
Also used : WrapperContext(com.evolveum.midpoint.gui.api.factory.wrapper.WrapperContext) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) AuthorizationPhaseType(com.evolveum.midpoint.xml.ns._public.common.common_3.AuthorizationPhaseType) FormAuthorizationType(com.evolveum.midpoint.xml.ns._public.common.common_3.FormAuthorizationType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult)

Aggregations

WrapperContext (com.evolveum.midpoint.gui.api.factory.wrapper.WrapperContext)1 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)1 AuthorizationPhaseType (com.evolveum.midpoint.xml.ns._public.common.common_3.AuthorizationPhaseType)1 FormAuthorizationType (com.evolveum.midpoint.xml.ns._public.common.common_3.FormAuthorizationType)1