use of com.evolveum.midpoint.gui.api.prism.wrapper.ShadowWrapper in project midpoint by Evolveum.
the class PageAccount method loadAccount.
private ShadowWrapper loadAccount(PageParameters parameters) {
Task task = createSimpleTask(OPERATION_LOAD_ACCOUNT);
OperationResult result = task.getResult();
Collection<SelectorOptions<GetOperationOptions>> options = getOperationOptionsBuilder().item(ShadowType.F_RESOURCE_REF).resolve().build();
StringValue oid = parameters != null ? parameters.get(OnePageParameterEncoder.PARAMETER) : null;
if (oid == null) {
getSession().error(getString("pageAccount.message.cantEditAccount"));
showResult(result);
throw new RestartResponseException(PageResources.class);
}
PrismObject<ShadowType> account = WebModelServiceUtils.loadObject(ShadowType.class, oid.toString(), options, PageAccount.this, task, result);
if (account == null) {
getSession().error(getString("pageAccount.message.cantEditAccount"));
showResult(result);
throw new RestartResponseException(PageResources.class);
}
PrismObjectWrapperFactory<ShadowType> owf = getRegistry().getObjectWrapperFactory(account.getDefinition());
WrapperContext context = new WrapperContext(task, result);
context.setShowEmpty(false);
ShadowWrapper wrapper;
try {
wrapper = (ShadowWrapper) owf.createObjectWrapper(account, ItemStatus.NOT_CHANGED, context);
// TODO: fetch result???
} catch (SchemaException e) {
LOGGER.error("Cannot create wrapper for shadow {}", account);
result.recordFatalError(getString("PageAccount.message.loadAccount.fatalError"));
throw new RestartResponseException(PageResources.class);
}
return wrapper;
}
use of com.evolveum.midpoint.gui.api.prism.wrapper.ShadowWrapper in project midpoint by Evolveum.
the class FocusDetailsModels method getAdditionalModifyDeltas.
@Override
protected List<ObjectDelta<? extends ObjectType>> getAdditionalModifyDeltas(OperationResult result) {
List<ObjectDelta<? extends ObjectType>> deltas = new ArrayList<>();
List<ShadowWrapper> accounts = projectionModel.getObject();
for (ShadowWrapper account : accounts) {
try {
ObjectDelta<ShadowType> delta = account.getObjectDelta();
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Account delta computed from {} as:\n{}", account, delta.debugDump(3));
}
if (!UserDtoStatus.MODIFY.equals(account.getProjectionStatus())) {
continue;
}
if (delta == null || delta.isEmpty()) {
continue;
}
WebComponentUtil.encryptCredentials(delta, true, getPageBase());
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Modifying account:\n{}", delta.debugDump(3));
}
deltas.add(delta);
} catch (Exception ex) {
result.recordFatalError(getPageBase().getString("PageAdminFocus.message.getShadowModifyDeltas.fatalError"), ex);
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't compute account delta", ex);
}
}
return deltas;
}
use of com.evolveum.midpoint.gui.api.prism.wrapper.ShadowWrapper in project midpoint by Evolveum.
the class FocusDetailsModels method loadShadowWrapper.
@NotNull
public ShadowWrapper loadShadowWrapper(PrismObject<ShadowType> projection, boolean noFetch, Task task, OperationResult result) throws SchemaException {
PrismObjectWrapperFactory<ShadowType> factory = getPageBase().findObjectWrapperFactory(projection.getDefinition());
WrapperContext context = new WrapperContext(task, result);
context.setCreateIfEmpty(noFetch ? false : true);
ShadowWrapper wrapper = (ShadowWrapper) factory.createObjectWrapper(projection, ItemStatus.NOT_CHANGED, context);
wrapper.setProjectionStatus(UserDtoStatus.MODIFY);
return wrapper;
}
use of com.evolveum.midpoint.gui.api.prism.wrapper.ShadowWrapper in project midpoint by Evolveum.
the class ShadowWrapperFactoryImpl method createObjectWrapper.
@Override
public PrismObjectWrapper<ShadowType> createObjectWrapper(PrismObject<ShadowType> object, ItemStatus status) {
LOGGER.trace("create shadow wrapper");
ShadowWrapper shadowWrapper = new ShadowWrapperImpl(object, status);
LOGGER.trace("Shadow wrapper created: {}", shadowWrapper);
return shadowWrapper;
}
use of com.evolveum.midpoint.gui.api.prism.wrapper.ShadowWrapper in project midpoint by Evolveum.
the class PageMergeObjects method createMainPanel.
@Override
protected AbstractObjectMainPanel<UserType> createMainPanel(String id) {
// empty assignments model
CountableLoadableModel<AssignmentType> assignments = new CountableLoadableModel<>() {
private static final long serialVersionUID = 1L;
@Override
protected List<AssignmentType> load() {
return new ArrayList<>();
}
};
// empty policy rules model
CountableLoadableModel<AssignmentType> policyRules = new CountableLoadableModel<>() {
private static final long serialVersionUID = 1L;
@Override
protected List<AssignmentType> load() {
return new ArrayList<>();
}
};
// empty projections model
LoadableModel<List<ShadowWrapper>> shadows = new LoadableModel<>() {
private static final long serialVersionUID = 1L;
@Override
protected List<ShadowWrapper> load() {
return new ArrayList<>();
}
};
return new FocusMainPanel<UserType>(id, getObjectModel(), shadows, this) {
private static final long serialVersionUID = 1L;
@Override
protected List<ITab> createTabs(final PageAdminObjectDetails<UserType> parentPage) {
List<ITab> tabs = new ArrayList<>();
tabs.add(new PanelTab(parentPage.createStringResource("PageMergeObjects.tabTitle"), new VisibleEnableBehaviour()) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer createPanel(String panelId) {
mergeObjectsPanel = new MergeObjectsPanel<>(panelId, mergeObjectModel, mergeWithObjectModel, type, PageMergeObjects.this);
return mergeObjectsPanel;
}
});
return tabs;
}
@Override
protected boolean isPreviewButtonVisible() {
return false;
}
@Override
protected boolean getOptionsPanelVisibility() {
return false;
}
};
}
Aggregations