use of com.evolveum.midpoint.gui.api.prism.wrapper.PrismObjectWrapper in project midpoint by Evolveum.
the class TestWrapperDelta method test301ModifyProfilingClassLoggerOfSystemConfig.
@Test
public void test301ModifyProfilingClassLoggerOfSystemConfig() throws Exception {
Task task = getTestTask();
OperationResult result = task.getResult();
SystemConfigurationType systemConfigBefore = getSystemConfiguration();
WrapperContext ctx = new WrapperContext(task, result);
PrismObjectWrapper objectWrapper = createObjectWrapper(systemConfigBefore.asPrismContainer(), ItemStatus.NOT_CHANGED, ctx);
PrismContainerWrapper<LoggingConfigurationType> loggingConfig = objectWrapper.findContainer(SystemConfigurationType.F_LOGGING);
PrismContainerWrapper<Containerable> profilingClassLogger = loggingConfig.findContainer(ItemName.fromQName(ProfilingClassLoggerWrapperFactoryImpl.PROFILING_LOGGER_PATH));
PrismPropertyWrapper<LoggingLevelType> loggerLevel = profilingClassLogger.getValue().findProperty(ClassLoggerConfigurationType.F_LEVEL);
PrismPropertyWrapper<String> appenderLevel = profilingClassLogger.getValue().findProperty(ClassLoggerConfigurationType.F_APPENDER);
loggerLevel.getValue().setRealValue(LoggingLevelType.DEBUG);
appenderLevel.getValues().get(0).setRealValue("MIDPOINT_PROFILE_LOG");
// GIVEN
ObjectDelta<UserType> systemConfigDelta = objectWrapper.getObjectDelta();
assertModificationsSize(systemConfigDelta, 1);
assertModification(systemConfigDelta, ItemPath.create(SystemConfigurationType.F_LOGGING, LoggingConfigurationType.F_CLASS_LOGGER, ClassLoggerConfigurationType.F_LEVEL), ModificationTypeType.ADD, LoggingLevelType.DEBUG);
assertModification(systemConfigDelta, ItemPath.create(SystemConfigurationType.F_LOGGING, LoggingConfigurationType.F_CLASS_LOGGER, ClassLoggerConfigurationType.F_APPENDER), ModificationTypeType.ADD, "MIDPOINT_PROFILE_LOG");
// WHEN
executeChanges(systemConfigDelta, null, task, result);
// THEN
SystemConfigurationType systemConfigAfter = getSystemConfiguration();
loggingConfig = objectWrapper.findContainer(SystemConfigurationType.F_LOGGING);
profilingClassLogger = loggingConfig.findContainer(ItemName.fromQName(ProfilingClassLoggerWrapperFactoryImpl.PROFILING_LOGGER_PATH));
loggerLevel = profilingClassLogger.getValue().findProperty(ClassLoggerConfigurationType.F_LEVEL);
appenderLevel = profilingClassLogger.getValue().findProperty(ClassLoggerConfigurationType.F_APPENDER);
if (!loggerLevel.getValue().getRealValue().equals(LoggingLevelType.DEBUG)) {
AssertJUnit.fail("Expected value: " + LoggingLevelType.DEBUG + " after executing of changes. Values present: " + loggerLevel.getValue().getRealValue());
}
if (!appenderLevel.getValues().get(0).getRealValue().equals("MIDPOINT_PROFILE_LOG")) {
AssertJUnit.fail("Expected value: " + "MIDPOINT_PROFILE_LOG" + " after executing of changes. Values present: " + appenderLevel.getValues().get(0).getRealValue());
}
}
use of com.evolveum.midpoint.gui.api.prism.wrapper.PrismObjectWrapper in project midpoint by Evolveum.
the class TestWrapperDelta method test310modifySystemConfigurationAddCollectionView.
@Test
public void test310modifySystemConfigurationAddCollectionView() throws Exception {
Task task = getTestTask();
OperationResult result = task.getResult();
ModelServiceLocator locator = getServiceLocator(task);
SystemConfigurationType systemConfigBefore = getSystemConfiguration();
WrapperContext ctx = new WrapperContext(task, result);
PrismObjectWrapper objectWrapper = createObjectWrapper(systemConfigBefore.asPrismContainer(), ItemStatus.NOT_CHANGED, ctx);
ItemPath guiObjectViewPath = ItemPath.create(SystemConfigurationType.F_ADMIN_GUI_CONFIGURATION, AdminGuiConfigurationType.F_OBJECT_COLLECTION_VIEWS, GuiObjectListViewsType.F_OBJECT_COLLECTION_VIEW);
PrismContainerWrapper<GuiObjectListViewType> collections = objectWrapper.findContainer(guiObjectViewPath);
// GIVEN
PrismContainerValue<GuiObjectListViewType> newCollection = collections.getItem().createNewValue();
ctx.setShowEmpty(true);
PrismContainerValueWrapper<GuiObjectListViewType> newCollectionValueWrapper = locator.createValueWrapper(collections, newCollection, ValueStatus.ADDED, ctx);
collections.getValues().add(newCollectionValueWrapper);
PrismPropertyWrapper<QName> type = newCollectionValueWrapper.findProperty(GuiObjectListViewType.F_TYPE);
type.getValue().setRealValue(new QName("RoleType"));
PrismPropertyWrapper<String> identifier = newCollectionValueWrapper.findProperty(GuiObjectListViewType.F_IDENTIFIER);
identifier.getValue().setRealValue("my-roles-collection");
// WHEN
ObjectDelta<SystemConfigurationType> delta = objectWrapper.getObjectDelta();
GuiObjectListViewType expectedValue = new GuiObjectListViewType(prismContext);
expectedValue.setIdentifier("my-roles-collection");
expectedValue.setType(new QName("RoleType"));
assertModification(delta, guiObjectViewPath, ModificationTypeType.ADD, expectedValue);
executeChanges(delta, null, task, result);
// THEN
SystemConfigurationType systemConfigAfter = getSystemConfiguration();
AdminGuiConfigurationType adminGuiConfig = systemConfigAfter.getAdminGuiConfiguration();
assertNotNull("Unexpected empty admin gui configuration.", adminGuiConfig);
GuiObjectListViewsType collectionViews = adminGuiConfig.getObjectCollectionViews();
assertNotNull("Unexpected empty gui object collection views", collectionViews);
GuiObjectListViewType myRolesCollection = null;
for (GuiObjectListViewType collectionView : collectionViews.getObjectCollectionView()) {
if ("my-roles-collection".equals(collectionView.getIdentifier())) {
myRolesCollection = collectionView;
}
}
assertNotNull("Newly added collection view not present in system configuration, something strange", myRolesCollection);
assertFalse("c:RoleType should not be equals to RoleType", RoleType.COMPLEX_TYPE.equals(myRolesCollection.getType()));
assertTrue("c:RoleType should match RoleType", QNameUtil.match(RoleType.COMPLEX_TYPE, myRolesCollection.getType()));
}
use of com.evolveum.midpoint.gui.api.prism.wrapper.PrismObjectWrapper in project midpoint by Evolveum.
the class PageResource method createTabsPanel.
private AjaxTabbedPanel<ITab> createTabsPanel() {
List<ITab> tabs = new ArrayList<>();
tabs.add(new PanelTab(createStringResource("PageResource.tab.details")) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer createPanel(String panelId) {
return new ResourceDetailsTabPanel(panelId, resourceModel);
}
});
tabs.add(new PanelTab(createStringResource("PageResource.tab.content.tasks")) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer createPanel(String panelId) {
return new ResourceTasksPanel(panelId, resourceModel);
}
});
tabs.add(new PanelTab(createStringResource("PageResource.tab.content.account")) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer createPanel(String panelId) {
return new ResourceContentTabPanel(panelId, ShadowKindType.ACCOUNT, resourceModel);
}
});
tabs.add(new PanelTab(createStringResource("PageResource.tab.content.entitlement")) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer createPanel(String panelId) {
return new ResourceContentTabPanel(panelId, ShadowKindType.ENTITLEMENT, resourceModel);
}
});
tabs.add(new PanelTab(createStringResource("PageResource.tab.content.generic")) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer createPanel(String panelId) {
return new ResourceContentTabPanel(panelId, ShadowKindType.GENERIC, resourceModel);
}
});
tabs.add(new PanelTab(createStringResource("PageResource.tab.content.others")) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer createPanel(String panelId) {
return new ResourceContentTabPanel(panelId, null, resourceModel);
}
});
tabs.add(new PanelTab(createStringResource("PageResource.tab.connector")) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer createPanel(String panelId) {
return new ResourceConnectorPanel(panelId, loadWrapperModel(resourceModel));
}
});
tabs.add(new PanelTab(createStringResource("PageResource.tab.schemaHandling")) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer createPanel(String panelId) {
PrismObjectWrapperFactory<ResourceType> resourceFactory = PageResource.this.findObjectWrapperFactory(resourceModel.getObject().getDefinition());
Task task = createSimpleTask("Create resource wrapper");
OperationResult result = task.getResult();
WrapperContext ctx = new WrapperContext(task, result);
PrismObjectWrapper<ResourceType> resourceWrapper;
try {
resourceWrapper = resourceFactory.createObjectWrapper(resourceModel.getObject(), ItemStatus.NOT_CHANGED, ctx);
} catch (SchemaException e) {
resourceWrapper = null;
}
if (resourceWrapper == null) {
return new WebMarkupContainer(panelId);
}
return new ResourceSchemaHandlingTabPanel(panelId, PrismContainerWrapperModel.fromContainerWrapper(Model.of(resourceWrapper), ResourceType.F_SCHEMA_HANDLING));
}
});
AjaxTabbedPanel<ITab> resourceTabs = new AjaxTabbedPanel<ITab>(ID_TAB_PANEL, tabs) {
private static final long serialVersionUID = 1L;
@Override
protected void onTabChange(int index) {
updateBreadcrumbParameters(PARAMETER_SELECTED_TAB, index);
}
};
resourceTabs.setOutputMarkupId(true);
return resourceTabs;
}
use of com.evolveum.midpoint.gui.api.prism.wrapper.PrismObjectWrapper in project midpoint by Evolveum.
the class GenericSingleContainerPanel method initLayout.
@Override
protected void initLayout() {
IModel model = () -> {
PrismObjectWrapper wrapper = getObjectWrapperModel().getObject();
wrapper.setShowEmpty(true, true);
return wrapper;
};
add(new SingleContainerPanel<C>(ID_DETAILS, model, getPanelConfiguration()));
}
use of com.evolveum.midpoint.gui.api.prism.wrapper.PrismObjectWrapper in project midpoint by Evolveum.
the class TestWrapperDelta method test311modifySystemConfigurationModifyCollectionType.
@Test
public void test311modifySystemConfigurationModifyCollectionType() throws Exception {
Task task = getTestTask();
OperationResult result = task.getResult();
ModelServiceLocator locator = getServiceLocator(task);
SystemConfigurationType systemConfigBefore = getSystemConfiguration();
WrapperContext ctx = new WrapperContext(task, result);
PrismObjectWrapper objectWrapper = createObjectWrapper(systemConfigBefore.asPrismContainer(), ItemStatus.NOT_CHANGED, ctx);
ItemPath guiObjectViewPath = ItemPath.create(SystemConfigurationType.F_ADMIN_GUI_CONFIGURATION, AdminGuiConfigurationType.F_OBJECT_COLLECTION_VIEWS, GuiObjectListViewsType.F_OBJECT_COLLECTION_VIEW);
PrismContainerWrapper<GuiObjectListViewType> collections = objectWrapper.findContainer(guiObjectViewPath);
PrismContainerValueWrapper<GuiObjectListViewType> foundCollection = null;
for (PrismContainerValueWrapper<GuiObjectListViewType> collection : collections.getValues()) {
GuiObjectListViewType collectionRealValue = collection.getRealValue();
if ("my-roles-collection".equals(collectionRealValue.getIdentifier())) {
foundCollection = collection;
break;
}
}
// GIVEN
PrismPropertyWrapper<QName> collectionType = foundCollection.findProperty(GuiObjectListViewType.F_TYPE);
collectionType.getValue().setRealValue(RoleType.COMPLEX_TYPE);
// WHEN
ObjectDelta<SystemConfigurationType> systemConfigDelta = objectWrapper.getObjectDelta();
assertTrue("Delta should be empty!", systemConfigDelta.isEmpty());
}
Aggregations