Search in sources :

Example 1 with ArchetypePolicyType

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

the class AssignmentCollector method createAuthenticationLensContext.

private <AH extends AssignmentHolderType> LensContext<AH> createAuthenticationLensContext(PrismObject<AH> user, OperationResult result) throws SchemaException {
    LensContext<AH> lensContext = new LensContextPlaceholder<>(user);
    ArchetypePolicyType policyConfigurationType = determineObjectPolicyConfiguration(user, result);
    lensContext.getFocusContext().setArchetypePolicy(policyConfigurationType);
    return lensContext;
}
Also used : ArchetypePolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.ArchetypePolicyType)

Example 2 with ArchetypePolicyType

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

the class AssignmentHolderDetailsModel method applyArchetypePolicy.

protected GuiObjectDetailsPageType applyArchetypePolicy(GuiObjectDetailsPageType defaultPageConfig) {
    OperationResult result = new OperationResult("mergeArchetypeConfig");
    PrismObject<AH> assignmentHolder = getPrismObject();
    try {
        ArchetypePolicyType archetypePolicyType = getModelServiceLocator().getModelInteractionService().determineArchetypePolicy(assignmentHolder, result);
        return getAdminGuiConfigurationMergeManager().mergeObjectDetailsPageConfiguration(defaultPageConfig, archetypePolicyType, result);
    } catch (SchemaException | ConfigurationException e) {
        LOGGER.error("Cannot merge details page configuration from archetype policy, {}", e.getMessage(), e);
        return defaultPageConfig;
    }
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) ConfigurationException(com.evolveum.midpoint.util.exception.ConfigurationException) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ArchetypePolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.ArchetypePolicyType)

Example 3 with ArchetypePolicyType

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

the class PageArchetype method createMainPanel.

@Override
protected AbstractObjectMainPanel<ArchetypeType> createMainPanel(String id) {
    return new AbstractRoleMainPanel<>(id, getObjectModel(), getProjectionModel(), this) {

        private static final long serialVersionUID = 1L;

        @Override
        public AbstractRoleMemberPanel<ArchetypeType> createMemberPanel(String panelId, PageBase pageBase) {
            return new ArchetypeMembersPanel(panelId, new Model<>(getObject().asObjectable()), pageBase);
        }

        @Override
        protected List<ITab> createTabs(PageAdminObjectDetails<ArchetypeType> parentPage) {
            List<ITab> tabs = super.createTabs(parentPage);
            tabs.add(new PanelTab(parentPage.createStringResource("PageArchetype.archetypePolicy"), getTabVisibility(ComponentConstants.UI_ARCHTYPE_TAB_ARCHETYPE_POLICY_URL, false, parentPage)) {

                private static final long serialVersionUID = 1L;

                @Override
                public WebMarkupContainer createPanel(String panelId) {
                    return new ContainerOfSystemConfigurationPanel<ArchetypePolicyType>(panelId, PrismContainerWrapperModel.fromContainerWrapper(getObjectModel(), ArchetypeType.F_ARCHETYPE_POLICY), ArchetypePolicyType.COMPLEX_TYPE);
                }
            });
            return tabs;
        }
    };
}
Also used : PanelTab(com.evolveum.midpoint.gui.api.component.tabs.PanelTab) PageBase(com.evolveum.midpoint.gui.api.page.PageBase) PageAdminObjectDetails(com.evolveum.midpoint.web.page.admin.PageAdminObjectDetails) ITab(org.apache.wicket.extensions.markup.html.tabs.ITab) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) ArchetypeType(com.evolveum.midpoint.xml.ns._public.common.common_3.ArchetypeType) AbstractRoleMainPanel(com.evolveum.midpoint.web.component.objectdetails.AbstractRoleMainPanel) ArchetypePolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.ArchetypePolicyType)

Example 4 with ArchetypePolicyType

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

the class SchemaTransformer method getVisibilityPolicy.

@NotNull
private <O extends ObjectType> List<VisibilityPolicyEntry> getVisibilityPolicy(ArchetypePolicyType archetypePolicy, Object contextDesc) throws SchemaException {
    List<VisibilityPolicyEntry> visibilityPolicy = new ArrayList<>();
    for (ItemConstraintType itemConstraint : archetypePolicy.getItemConstraint()) {
        UserInterfaceElementVisibilityType visibility = itemConstraint.getVisibility();
        if (visibility != null) {
            ItemPathType itemPathType = itemConstraint.getPath();
            if (itemPathType == null) {
                throw new SchemaException("No 'path' in item definition in archetype policy for " + contextDesc);
            }
            UniformItemPath itemPath = prismContext.toUniformPath(itemPathType);
            visibilityPolicy.add(new VisibilityPolicyEntry(itemPath, visibility));
        }
    }
    return visibilityPolicy;
}
Also used : ItemPathType(com.evolveum.prism.xml.ns._public.types_3.ItemPathType) UniformItemPath(com.evolveum.midpoint.prism.path.UniformItemPath) UserInterfaceElementVisibilityType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserInterfaceElementVisibilityType) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

ArchetypePolicyType (com.evolveum.midpoint.xml.ns._public.common.common_3.ArchetypePolicyType)3 PanelTab (com.evolveum.midpoint.gui.api.component.tabs.PanelTab)1 PageBase (com.evolveum.midpoint.gui.api.page.PageBase)1 UniformItemPath (com.evolveum.midpoint.prism.path.UniformItemPath)1 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1 ConfigurationException (com.evolveum.midpoint.util.exception.ConfigurationException)1 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)1 AbstractRoleMainPanel (com.evolveum.midpoint.web.component.objectdetails.AbstractRoleMainPanel)1 PageAdminObjectDetails (com.evolveum.midpoint.web.page.admin.PageAdminObjectDetails)1 ArchetypeType (com.evolveum.midpoint.xml.ns._public.common.common_3.ArchetypeType)1 UserInterfaceElementVisibilityType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserInterfaceElementVisibilityType)1 ItemPathType (com.evolveum.prism.xml.ns._public.types_3.ItemPathType)1 ITab (org.apache.wicket.extensions.markup.html.tabs.ITab)1 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)1 NotNull (org.jetbrains.annotations.NotNull)1