@NotNull public CompiledUserProfile getCompiledUserProfile() { if (compiledUserProfile == null) { compiledUserProfile = new CompiledUserProfile(); } return compiledUserProfile; }
private void mergeFeature(CompiledUserProfile composite, UserInterfaceFeatureType newFeature) { String newIdentifier = newFeature.getIdentifier(); UserInterfaceFeatureType compositeFeature = composite.findFeature(newIdentifier); if (compositeFeature == null) { composite.getFeatures().add(newFeature.clone()); } else { mergeFeature(compositeFeature, newFeature, UserInterfaceElementVisibilityType.AUTOMATIC); } }
private CompiledObjectCollectionView findOrCreateMatchingView(CompiledUserProfile composite, GuiObjectListViewType objectListViewType) { QName objectType = objectListViewType.getType(); String viewIdentifier = determineViewIdentifier(objectListViewType); CompiledObjectCollectionView existingView = composite.findObjectCollectionView(objectType, viewIdentifier); if (existingView == null) { existingView = new CompiledObjectCollectionView(objectType, viewIdentifier); composite.getObjectCollectionViews().add(existingView); } return existingView; }
private void mergeWidget(CompiledUserProfile composite, DashboardWidgetType newWidget) { String newWidgetIdentifier = newWidget.getIdentifier(); DashboardWidgetType compositeWidget = composite.findUserDashboardWidget(newWidgetIdentifier); if (compositeWidget == null) { composite.getUserDashboard().getWidget().add(newWidget.clone()); } else { mergeWidget(compositeWidget, newWidget); } }
adminGuiConfiguration.getAdditionalMenuLink().forEach(additionalMenuLink -> composite.getAdditionalMenuLink().add(additionalMenuLink.clone())); adminGuiConfiguration.getUserDashboardLink().forEach(userDashboardLink -> composite.getUserDashboardLink().add(userDashboardLink.clone())); if (adminGuiConfiguration.getDefaultTimezone() != null) { composite.setDefaultTimezone(adminGuiConfiguration.getDefaultTimezone()); composite.setPreferredDataLanguage(adminGuiConfiguration.getPreferredDataLanguage()); composite.setEnableExperimentalFeatures(adminGuiConfiguration.isEnableExperimentalFeatures()); composite.setDefaultExportSettings(adminGuiConfiguration.getDefaultExportSettings().clone()); composite.setDisplayFormats(adminGuiConfiguration.getDisplayFormats().clone()); if (composite.getObjectForms() == null) { composite.setObjectForms(adminGuiConfiguration.getObjectForms().clone()); } else { for (ObjectFormType objectForm: adminGuiConfiguration.getObjectForms().getObjectForm()) { joinForms(composite.getObjectForms(), objectForm.clone()); if (composite.getObjectDetails() == null) { composite.setObjectDetails(adminGuiConfiguration.getObjectDetails().clone()); } else { for (GuiObjectDetailsPageType objectDetails: adminGuiConfiguration.getObjectDetails().getObjectDetailsPage()) { joinObjectDetails(composite.getObjectDetails(), objectDetails); if (composite.getUserDashboard() == null) { composite.setUserDashboard(adminGuiConfiguration.getUserDashboard().clone()); } else { for (DashboardWidgetType widget: adminGuiConfiguration.getUserDashboard().getWidget()) {
@Test public void test130GetCompiledUserProfile() throws Exception { final String TEST_NAME = "test130GetCompiledUserProfile"; displayTestTitle(TEST_NAME); // GIVEN Task task = createTask(TEST_NAME); OperationResult result = task.getResult(); // WHEN CompiledUserProfile compiledUserProfile = modelInteractionService.getCompiledUserProfile(task, result); // THEN assertSuccess(result); assertCompiledUserProfile(compiledUserProfile) .assertAdditionalMenuLinks(0) .assertUserDashboardLinks(1) .assertObjectForms(1) .assertUserDashboardWidgets(0) .assertObjectCollectionViews(3); RichHyperlinkType link = compiledUserProfile.getUserDashboardLink().get(0); assertEquals("Bad link label", "Foo", link.getLabel()); assertEquals("Bad link targetUrl", "/foo", link.getTargetUrl()); assertEquals("Bad timezone targetUrl", "Jamaica", compiledUserProfile.getDefaultTimezone()); }
public CompiledUserProfileAsserter<RA> assertUserDashboardLinks(int expectedLinks) { assertEquals("Wrong number of userDashboardLinks in " + desc(), expectedLinks, getCompiledUserProfile().getUserDashboardLink().size()); return this; }
public UserInterfaceFeatureType findFeature(String identifier) { return findFeature(features, identifier); }
public CompiledUserProfileAsserter<RA> assertObjectCollectionViews(int expectedViews) { assertEquals("Wrong number of object collection views in " + desc(), expectedViews, getCompiledUserProfile().getObjectCollectionViews().size()); return this; }
public CompiledUserProfileAsserter<RA> assertUserDashboardWidgets(int expectedWidgetws) { if ( compiledUserProfile.getUserDashboard() == null) { if (expectedWidgetws != 0) { fail("Wrong number of widgets in user dashboard admin GUI configuration, expected " + expectedWidgetws + " but there was none"); } } else { assertEquals("Wrong number of user dashboard widgets in " + desc(), expectedWidgetws, getCompiledUserProfile().getUserDashboard().getWidget().size()); } return this; }
public CompiledUserProfileAsserter<RA> assertAdditionalMenuLinks(int expectedMenuLinks) { assertEquals("Wrong number of additionalMenuLinks in " + desc(), expectedMenuLinks, getCompiledUserProfile().getAdditionalMenuLink().size()); return this; }
public CompiledUserProfileAsserter<RA> assertObjectForms(int expectedForms) { if (getCompiledUserProfile().getObjectForms() == null) { assertTrue("Wrong number of object forms in " + desc() + "; exected " + expectedForms + " but was null", expectedForms == 0); } else { assertEquals("Wrong number of object forms in " + desc(), expectedForms, getCompiledUserProfile().getObjectForms().getObjectForm().size()); } return this; }
throw new SystemException(e.getMessage(), e); Integer limit = adminGuiConfiguration.getRoleManagement() != null ? adminGuiConfiguration.getRoleManagement().getAssignmentApprovalRequestLimit() : null; LOGGER.trace("Allowed approval instructions: {}", limit); if (limit != null && instructionsAdded > limit) {
public <O extends ObjectType> CompiledObjectCollectionView findObjectViewByViewName(Class<O> compileTimeClass, String viewName){ if (compileTimeClass == null || StringUtils.isEmpty(viewName)){ return null; } List<CompiledObjectCollectionView> objectViews = findAllApplicableObjectCollectionViews(compileTimeClass); if (objectViews == null) { return null; } for (CompiledObjectCollectionView view : objectViews){ if (viewName.equals(view.getViewIdentifier())){ return view; } } return null; }
public UserInterfaceElementVisibilityType getFeatureVisibility(String identifier) { UserInterfaceFeatureType feature = findFeature(identifier); if (feature == null) { return UserInterfaceElementVisibilityType.AUTOMATIC; } UserInterfaceElementVisibilityType visibility = feature.getVisibility(); if (visibility == null) { return UserInterfaceElementVisibilityType.AUTOMATIC; } return visibility; }
public ObjectCollectionViewsAsserter<CompiledUserProfileAsserter<RA>> objectCollectionViews() { ObjectCollectionViewsAsserter<CompiledUserProfileAsserter<RA>> asserter = new ObjectCollectionViewsAsserter<>(getCompiledUserProfile().getObjectCollectionViews(), this, desc()); copySetupTo(asserter); return asserter; }
/** * Find all views that are applicable for a particular object type. Returns views for all collections * and archetypes that are applicable for that type. Ideal to be used in costructing menus. */ @NotNull public <O extends ObjectType> List<CompiledObjectCollectionView> findAllApplicableObjectCollectionViews(Class<O> compileTimeClass) { return findAllApplicableObjectCollectionViews(ObjectTypes.getObjectType(compileTimeClass).getTypeQName()); }
@Experimental public DashboardWidgetType findUserDashboardWidget(String widgetIdentifier) { if (userDashboard == null) { return null; } return findFeature(userDashboard.getWidget(), widgetIdentifier); }
public CompiledUserProfile compileUserProfile(@NotNull List<AdminGuiConfigurationType> adminGuiConfigurations, PrismObject<SystemConfigurationType> systemConfiguration, Task task, OperationResult result) throws SchemaException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException { AdminGuiConfigurationType globalAdminGuiConfig = null; if (systemConfiguration != null) { globalAdminGuiConfig = systemConfiguration.asObjectable().getAdminGuiConfiguration(); } // if there's no admin config at all, return null (to preserve original behavior) if (adminGuiConfigurations.isEmpty() && globalAdminGuiConfig == null) { return null; } CompiledUserProfile composite = new CompiledUserProfile(); if (globalAdminGuiConfig != null) { applyAdminGuiConfiguration(composite, globalAdminGuiConfig, task, result); } for (AdminGuiConfigurationType adminGuiConfiguration: adminGuiConfigurations) { applyAdminGuiConfiguration(composite, adminGuiConfiguration, task, result); } return composite; }