use of com.evolveum.midpoint.gui.api.factory.wrapper.WrapperContext in project midpoint by Evolveum.
the class PagePostAuthentication method initStaticLayout.
@Override
protected WebMarkupContainer initStaticLayout() {
Task task = createSimpleTask(OPERATION_LOAD_WRAPPER);
OperationResult result = new OperationResult(OPERATION_LOAD_WRAPPER);
PrismObjectWrapperFactory<UserType> factory = findObjectWrapperFactory(userModel.getObject().asPrismObject().getDefinition());
WrapperContext context = new WrapperContext(task, result);
try {
objectWrapper = factory.createObjectWrapper(userModel.getObject().asPrismObject(), ItemStatus.NOT_CHANGED, context);
} catch (SchemaException e) {
result.recordFatalError(getString("PagePostAuthentication.message.couldntPerformPostAuth.fatalError"));
showResult(result);
throw new RestartResponseException(PageLogin.class);
}
WebMarkupContainer wrappers = new WebMarkupContainer(ID_WRAPPER_CONTENT);
try {
Panel main = initItemPanel(ID_MAIN_PANEL, UserType.COMPLEX_TYPE, PrismContainerWrapperModel.fromContainerWrapper(Model.of(objectWrapper), ItemPath.EMPTY_PATH), null);
wrappers.add(main);
Panel password = initItemPanel(ID_PASSWORD_PANEL, PasswordType.COMPLEX_TYPE, PrismContainerWrapperModel.fromContainerWrapper(Model.of(objectWrapper), ItemPath.create(UserType.F_CREDENTIALS, CredentialsType.F_PASSWORD)), null);
wrappers.add(password);
} catch (SchemaException e) {
LOGGER.error("Cannot create panel, {}", e.getMessage(), e);
getSession().error("Unexpected error occurred. Please contact system administrator.");
throw new RestartResponseException(PageLogin.class);
}
return wrappers;
}
use of com.evolveum.midpoint.gui.api.factory.wrapper.WrapperContext in project midpoint by Evolveum.
the class FocusProjectionsPanel method loadShadowWrapper.
@NotNull
public ShadowWrapper loadShadowWrapper(PrismObject<ShadowType> projection, Task task, OperationResult result) throws SchemaException {
PrismObjectWrapperFactory<ShadowType> factory = getPageBase().findObjectWrapperFactory(projection.getDefinition());
WrapperContext context = new WrapperContext(task, result);
context.setCreateIfEmpty(true);
context.setDetailsPageTypeConfiguration(findShadowDetailsPageConfiguration(projection.asObjectable()));
ShadowWrapper wrapper = (ShadowWrapper) factory.createObjectWrapper(projection, ItemStatus.NOT_CHANGED, context);
wrapper.setProjectionStatus(UserDtoStatus.MODIFY);
return wrapper;
}
use of com.evolveum.midpoint.gui.api.factory.wrapper.WrapperContext 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;
}
use of com.evolveum.midpoint.gui.api.factory.wrapper.WrapperContext in project midpoint by Evolveum.
the class PageAdminFocus method loadShadowWrapper.
@NotNull
public ShadowWrapper loadShadowWrapper(PrismObject<ShadowType> projection, Task task, OperationResult result) throws SchemaException {
PrismObjectWrapperFactory<ShadowType> factory = getRegistry().getObjectWrapperFactory(projection.getDefinition());
WrapperContext context = new WrapperContext(task, result);
context.setCreateIfEmpty(false);
ShadowWrapper wrapper = (ShadowWrapper) factory.createObjectWrapper(projection, ItemStatus.NOT_CHANGED, context);
wrapper.setProjectionStatus(UserDtoStatus.MODIFY);
return wrapper;
}
use of com.evolveum.midpoint.gui.api.factory.wrapper.WrapperContext in project midpoint by Evolveum.
the class PageValuePolicy method loadValuePolicy.
private PrismObjectWrapper<ValuePolicyType> loadValuePolicy(String policyOid) {
Task task = createSimpleTask(OPERATION_LOAD_DEFINITION);
OperationResult result = task.getResult();
PrismObjectWrapper<ValuePolicyType> valuePolicyWrapper = null;
try {
PrismObject<ValuePolicyType> valuePolicyObject = WebModelServiceUtils.loadObject(ValuePolicyType.class, policyOid, PageValuePolicy.this, task, result);
PrismObjectWrapperFactory<ValuePolicyType> owf = getRegistry().getObjectWrapperFactory(valuePolicyObject.getDefinition());
WrapperContext context = new WrapperContext(task, result);
valuePolicyWrapper = owf.createObjectWrapper(valuePolicyObject, ItemStatus.NOT_CHANGED, context);
result.recordSuccessIfUnknown();
} catch (Exception ex) {
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't get definition", ex);
result.recordFatalError(getString("PageValuePolicy.message.loadValuePolicy.fatalError"), ex);
}
result.recomputeStatus();
if (!WebComponentUtil.isSuccessOrHandledError(result)) {
showResult(result);
}
return valuePolicyWrapper;
}
Aggregations