Search in sources :

Example 6 with RelationDefinitionType

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

the class RelationSearchItem method createSpecialSearchPanel.

@Override
public SearchSpecialItemPanel createSpecialSearchPanel(String id) {
    return new SearchSpecialItemPanel(id, new PropertyModel<>(searchBoxConfiguration, SearchBoxConfigurationHelper.F_RELATION_ITEM)) {

        @Override
        protected WebMarkupContainer initSearchItemField(String id) {
            ReadOnlyModel<List<QName>> availableRelations = new ReadOnlyModel<>(() -> {
                List<QName> choices = new ArrayList();
                IModel<RelationSearchItemConfigurationType> relationItem = getModelValue();
                List<QName> relations = relationItem.getObject().getSupportedRelations();
                if (relations != null && relations.size() > 1) {
                    choices.add(PrismConstants.Q_ANY);
                }
                choices.addAll(relations);
                return choices;
            });
            DropDownChoicePanel inputPanel = new DropDownChoicePanel(id, new PropertyModel(getModelValue(), RelationSearchItemConfigurationType.F_DEFAULT_VALUE.getLocalPart()), availableRelations, new QNameIChoiceRenderer() {

                private static final long serialVersionUID = 1L;

                @Override
                public Object getDisplayValue(QName relation) {
                    RelationDefinitionType relationDef = WebComponentUtil.getRelationDefinition(relation);
                    if (relationDef != null) {
                        DisplayType display = relationDef.getDisplay();
                        if (display != null) {
                            PolyStringType label = display.getLabel();
                            if (PolyStringUtils.isNotEmpty(label)) {
                                return WebComponentUtil.getTranslatedPolyString(label);
                            }
                        }
                    }
                    if (QNameUtil.match(PrismConstants.Q_ANY, relation)) {
                        return new ResourceModel("RelationTypes.ANY", relation.getLocalPart()).getObject();
                    }
                    return super.getDisplayValue(relation);
                }
            }, false);
            inputPanel.getBaseFormComponent().add(WebComponentUtil.getSubmitOnEnterKeyDownBehavior("searchSimple"));
            inputPanel.getBaseFormComponent().add(AttributeAppender.append("style", "width: 100px; max-width: 400px !important;"));
            inputPanel.getBaseFormComponent().add(new EnableBehaviour(() -> availableRelations.getObject().size() > 1));
            inputPanel.setOutputMarkupId(true);
            return inputPanel;
        }

        @Override
        protected IModel<String> createLabelModel() {
            return Model.of(WebComponentUtil.getTranslatedPolyString(getReltaionConfig().getDisplay().getLabel()));
        }

        @Override
        protected IModel<String> createHelpModel() {
            return Model.of(WebComponentUtil.getTranslatedPolyString(getReltaionConfig().getDisplay().getHelp()));
        }
    };
}
Also used : PolyStringType(com.evolveum.prism.xml.ns._public.types_3.PolyStringType) DropDownChoicePanel(com.evolveum.midpoint.web.component.input.DropDownChoicePanel) QNameIChoiceRenderer(com.evolveum.midpoint.gui.impl.component.input.QNameIChoiceRenderer) DisplayType(com.evolveum.midpoint.xml.ns._public.common.common_3.DisplayType) QName(javax.xml.namespace.QName) ArrayList(java.util.ArrayList) PropertyModel(org.apache.wicket.model.PropertyModel) RelationDefinitionType(com.evolveum.midpoint.xml.ns._public.common.common_3.RelationDefinitionType) ReadOnlyModel(com.evolveum.midpoint.gui.api.model.ReadOnlyModel) ResourceModel(org.apache.wicket.model.ResourceModel) ArrayList(java.util.ArrayList) List(java.util.List) RelationSearchItemConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.RelationSearchItemConfigurationType) SearchSpecialItemPanel(com.evolveum.midpoint.web.component.search.SearchSpecialItemPanel) EnableBehaviour(com.evolveum.midpoint.web.component.util.EnableBehaviour)

Example 7 with RelationDefinitionType

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

the class TestRelationRegistry method test100DefaultRelations.

@Test
public void test100DefaultRelations() {
    assertEquals("Wrong # of default relations", RelationTypes.values().length, relationRegistry.getRelationDefinitions().size());
    RelationDefinitionType orgDefaultDef = relationRegistry.getRelationDefinition(SchemaConstants.ORG_DEFAULT);
    RelationDefinitionType defaultDef = relationRegistry.getRelationDefinition(unqualify(SchemaConstants.ORG_DEFAULT));
    RelationDefinitionType nullDef = relationRegistry.getRelationDefinition(null);
    assertNotNull("No definition for null relation", nullDef);
    assertEquals("null and 'org:default' definitions differ", nullDef, orgDefaultDef);
    assertEquals("null and 'default' definitions differ", nullDef, defaultDef);
    assertTrue("'org:manager' is not of MANAGER kind", relationRegistry.isManager(SchemaConstants.ORG_MANAGER));
    assertTrue("'manager' is not of MANAGER kind", relationRegistry.isManager(unqualify(SchemaConstants.ORG_MANAGER)));
    assertFalse("'org:approver' is of MANAGER kind", relationRegistry.isManager(SchemaConstants.ORG_APPROVER));
    assertFalse("'approver' is of MANAGER kind", relationRegistry.isManager(unqualify(SchemaConstants.ORG_APPROVER)));
    assertFalse("'org:default' is of MANAGER kind", relationRegistry.isManager(SchemaConstants.ORG_DEFAULT));
    assertFalse("'default' is of MANAGER kind", relationRegistry.isManager(unqualify(SchemaConstants.ORG_DEFAULT)));
    assertFalse("'null' is of MANAGER kind", relationRegistry.isManager(null));
    assertTrue("'org:default' is not of MEMBER kind", relationRegistry.isMember(SchemaConstants.ORG_DEFAULT));
    assertTrue("'default' is not of MEMBER kind", relationRegistry.isMember(unqualify(SchemaConstants.ORG_DEFAULT)));
    assertTrue("'null' is not of MEMBER kind", relationRegistry.isMember(null));
    assertTrue("'org:manager' is not of MEMBER kind", relationRegistry.isMember(SchemaConstants.ORG_MANAGER));
    assertTrue("'manager' is not of MEMBER kind", relationRegistry.isMember(unqualify(SchemaConstants.ORG_MANAGER)));
    assertFalse("'org:approver' is of MEMBER kind", relationRegistry.isMember(SchemaConstants.ORG_APPROVER));
    assertFalse("'approver' is of MEMBER kind", relationRegistry.isMember(unqualify(SchemaConstants.ORG_APPROVER)));
    assertFalse("'related' is of MEMBER kind", relationRegistry.isMember(unqualify(SchemaConstants.ORG_RELATED)));
    assertEquals("Wrong default relation", SchemaConstants.ORG_DEFAULT, relationRegistry.getDefaultRelation());
    assertEquals("Wrong default MEMBER relation", SchemaConstants.ORG_DEFAULT, relationRegistry.getDefaultRelationFor(RelationKindType.MEMBER));
    assertEquals("Wrong default MANAGER relation", SchemaConstants.ORG_MANAGER, relationRegistry.getDefaultRelationFor(RelationKindType.MANAGER));
    assertEquals("Wrong default META relation", SchemaConstants.ORG_META, relationRegistry.getDefaultRelationFor(RelationKindType.META));
    assertEquals("Wrong default RELATED relation", SchemaConstants.ORG_RELATED, relationRegistry.getDefaultRelationFor(RelationKindType.RELATED));
    Set<QName> ALIASES_FOR_DEFAULT = new HashSet<>(Arrays.asList(SchemaConstants.ORG_DEFAULT, unqualify(SchemaConstants.ORG_DEFAULT), null));
    assertEquals("Wrong aliases for 'org:default'", ALIASES_FOR_DEFAULT, new HashSet<>(relationRegistry.getAliases(SchemaConstants.ORG_DEFAULT)));
    assertEquals("Wrong aliases for 'default'", ALIASES_FOR_DEFAULT, new HashSet<>(relationRegistry.getAliases(unqualify(SchemaConstants.ORG_DEFAULT))));
    assertEquals("Wrong aliases for 'null'", ALIASES_FOR_DEFAULT, new HashSet<>(relationRegistry.getAliases(null)));
    Set<QName> ALIASES_FOR_MANAGER = new HashSet<>(Arrays.asList(SchemaConstants.ORG_MANAGER, unqualify(SchemaConstants.ORG_MANAGER)));
    assertEquals("Wrong aliases for 'org:manager'", ALIASES_FOR_MANAGER, new HashSet<>(relationRegistry.getAliases(SchemaConstants.ORG_MANAGER)));
    assertEquals("Wrong aliases for 'manager'", ALIASES_FOR_MANAGER, new HashSet<>(relationRegistry.getAliases(unqualify(SchemaConstants.ORG_MANAGER))));
    Set<QName> RELATIONS_FOR_MEMBER = new HashSet<>(Arrays.asList(SchemaConstants.ORG_DEFAULT, SchemaConstants.ORG_MANAGER));
    assertEquals("Wrong relations for MEMBER kind", RELATIONS_FOR_MEMBER, new HashSet<>(relationRegistry.getAllRelationsFor(RelationKindType.MEMBER)));
    Set<QName> RELATIONS_FOR_MANAGER = new HashSet<>(singleton(SchemaConstants.ORG_MANAGER));
    assertEquals("Wrong relations for MANAGER kind", RELATIONS_FOR_MANAGER, new HashSet<>(relationRegistry.getAllRelationsFor(RelationKindType.MANAGER)));
    Set<QName> RELATIONS_FOR_RELATED = new HashSet<>(singleton(SchemaConstants.ORG_RELATED));
    assertEquals("Wrong relations for RELATED kind", RELATIONS_FOR_RELATED, new HashSet<>(relationRegistry.getAllRelationsFor(RelationKindType.RELATED)));
    assertTrue("'org:default' is not processed on login", relationRegistry.isProcessedOnLogin(SchemaConstants.ORG_DEFAULT));
    assertTrue("'default' is not processed on login", relationRegistry.isProcessedOnLogin(unqualify(SchemaConstants.ORG_DEFAULT)));
    assertTrue("'null' is not processed on login", relationRegistry.isProcessedOnLogin(null));
    assertTrue("'org:manager' is not processed on login", relationRegistry.isProcessedOnLogin(SchemaConstants.ORG_MANAGER));
    assertTrue("'org:meta' is not processed on login", relationRegistry.isProcessedOnLogin(SchemaConstants.ORG_META));
    assertFalse("'org:approver' is processed on login", relationRegistry.isProcessedOnLogin(SchemaConstants.ORG_APPROVER));
    assertFalse("'org:related' is processed on login", relationRegistry.isProcessedOnLogin(SchemaConstants.ORG_RELATED));
    assertTrue("'org:default' is not processed on recompute", relationRegistry.isProcessedOnRecompute(SchemaConstants.ORG_DEFAULT));
    assertTrue("'default' is not processed on recompute", relationRegistry.isProcessedOnRecompute(unqualify(SchemaConstants.ORG_DEFAULT)));
    assertTrue("'null' is not processed on recompute", relationRegistry.isProcessedOnRecompute(null));
    assertTrue("'org:manager' is not processed on recompute", relationRegistry.isProcessedOnRecompute(SchemaConstants.ORG_MANAGER));
    assertTrue("'org:meta' is not processed on recompute", relationRegistry.isProcessedOnRecompute(SchemaConstants.ORG_META));
    assertFalse("'org:approver' is processed on recompute", relationRegistry.isProcessedOnRecompute(SchemaConstants.ORG_APPROVER));
    assertFalse("'org:related' is processed on recompute", relationRegistry.isProcessedOnRecompute(SchemaConstants.ORG_RELATED));
    assertTrue("'org:default' is not stored into parentOrgRef", relationRegistry.isStoredIntoParentOrgRef(SchemaConstants.ORG_DEFAULT));
    assertTrue("'default' is not stored into parentOrgRef", relationRegistry.isStoredIntoParentOrgRef(unqualify(SchemaConstants.ORG_DEFAULT)));
    assertTrue("'null' is not stored into parentOrgRef", relationRegistry.isStoredIntoParentOrgRef(null));
    assertTrue("'org:manager' is not stored into parentOrgRef", relationRegistry.isStoredIntoParentOrgRef(SchemaConstants.ORG_MANAGER));
    assertFalse("'org:meta' is stored into parentOrgRef", relationRegistry.isStoredIntoParentOrgRef(SchemaConstants.ORG_META));
    assertFalse("'org:approver' is stored into parentOrgRef", relationRegistry.isStoredIntoParentOrgRef(SchemaConstants.ORG_APPROVER));
    assertFalse("'org:related' is stored into parentOrgRef", relationRegistry.isStoredIntoParentOrgRef(SchemaConstants.ORG_RELATED));
    assertTrue("'org:default' is not automatically matched", relationRegistry.isAutomaticallyMatched(SchemaConstants.ORG_DEFAULT));
    assertTrue("'default' is not automatically matched", relationRegistry.isAutomaticallyMatched(unqualify(SchemaConstants.ORG_DEFAULT)));
    assertTrue("'null' is not automatically matched", relationRegistry.isAutomaticallyMatched(null));
    assertTrue("'org:manager' is not automatically matched", relationRegistry.isAutomaticallyMatched(SchemaConstants.ORG_MANAGER));
    assertTrue("'org:meta' is not automatically matched", relationRegistry.isAutomaticallyMatched(SchemaConstants.ORG_META));
    assertFalse("'org:approver' is automatically matched", relationRegistry.isAutomaticallyMatched(SchemaConstants.ORG_APPROVER));
    assertFalse("'org:related' is automatically matched", relationRegistry.isAutomaticallyMatched(SchemaConstants.ORG_RELATED));
}
Also used : RelationDefinitionType(com.evolveum.midpoint.xml.ns._public.common.common_3.RelationDefinitionType) QName(javax.xml.namespace.QName) Test(org.testng.annotations.Test) AbstractInternalModelIntegrationTest(com.evolveum.midpoint.model.impl.AbstractInternalModelIntegrationTest)

Example 8 with RelationDefinitionType

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

the class TestRelationRegistry method test110AddedCustomRelations.

@Test
public void test110AddedCustomRelations() throws SchemaException, IOException {
    PrismObject<SystemConfigurationType> sysconfigObject = prismContext.parseObject(SYSCONFIG_ADDED_CUSTOM_RELATIONS_FILE);
    relationRegistry.applyRelationsConfiguration(sysconfigObject.asObjectable());
    assertEquals("Wrong # of relations", RelationTypes.values().length + 3, relationRegistry.getRelationDefinitions().size());
    RelationDefinitionType orgDefaultDef = relationRegistry.getRelationDefinition(SchemaConstants.ORG_DEFAULT);
    RelationDefinitionType defaultDef = relationRegistry.getRelationDefinition(unqualify(SchemaConstants.ORG_DEFAULT));
    RelationDefinitionType nullDef = relationRegistry.getRelationDefinition(null);
    assertNotNull("No definition for null relation", nullDef);
    assertEquals("null and 'org:default' definitions differ", nullDef, orgDefaultDef);
    assertEquals("null and 'default' definitions differ", nullDef, defaultDef);
    RelationDefinitionType testKinderManagerDef = relationRegistry.getRelationDefinition(TEST_KINDER_MANAGER);
    RelationDefinitionType kinderManagerDef = relationRegistry.getRelationDefinition(unqualify(TEST_KINDER_MANAGER));
    RelationDefinitionType testExtraDef = relationRegistry.getRelationDefinition(TEST_EXTRA);
    RelationDefinitionType extraDef = relationRegistry.getRelationDefinition(unqualify(TEST_EXTRA));
    RelationDefinitionType testApproverDef = relationRegistry.getRelationDefinition(TEST_APPROVER);
    RelationDefinitionType approverDef = relationRegistry.getRelationDefinition(unqualify(TEST_APPROVER));
    assertNotNull("No definition for 'test:kinderManager' relation", testKinderManagerDef);
    assertEquals("'test:kinderManager' and 'kinderManager' definitions differ", testKinderManagerDef, kinderManagerDef);
    assertNotNull("No definition for 'test:extra' relation", testExtraDef);
    assertEquals("'test:extra' and 'extra' definitions differ", testExtraDef, extraDef);
    assertNotNull("No definition for 'test:approverDef' relation", testApproverDef);
    assertNotEquals("'test:approver' and 'approver' definitions are the same!", testApproverDef, approverDef);
    assertTrue("'org:manager' is not of MANAGER kind", relationRegistry.isManager(SchemaConstants.ORG_MANAGER));
    assertTrue("'manager' is not of MANAGER kind", relationRegistry.isManager(unqualify(SchemaConstants.ORG_MANAGER)));
    assertTrue("'test:kinderManager' is not of MANAGER kind", relationRegistry.isManager(TEST_KINDER_MANAGER));
    assertTrue("'kinderManager' is not of MANAGER kind", relationRegistry.isManager(unqualify(TEST_KINDER_MANAGER)));
    assertFalse("'org:approver' is of MANAGER kind", relationRegistry.isManager(SchemaConstants.ORG_APPROVER));
    assertFalse("'approver' is of MANAGER kind", relationRegistry.isManager(unqualify(SchemaConstants.ORG_APPROVER)));
    assertFalse("'org:default' is of MANAGER kind", relationRegistry.isManager(SchemaConstants.ORG_DEFAULT));
    assertFalse("'default' is of MANAGER kind", relationRegistry.isManager(unqualify(SchemaConstants.ORG_DEFAULT)));
    assertFalse("'null' is of MANAGER kind", relationRegistry.isManager(null));
    assertFalse("'test:extra' is of MANAGER kind", relationRegistry.isManager(TEST_EXTRA));
    assertFalse("'test:approver' is of MANAGER kind", relationRegistry.isManager(TEST_APPROVER));
    assertTrue("'org:default' is not of MEMBER kind", relationRegistry.isMember(SchemaConstants.ORG_DEFAULT));
    assertTrue("'default' is not of MEMBER kind", relationRegistry.isMember(unqualify(SchemaConstants.ORG_DEFAULT)));
    assertTrue("'null' is not of MEMBER kind", relationRegistry.isMember(null));
    assertTrue("'org:manager' is not of MEMBER kind", relationRegistry.isMember(SchemaConstants.ORG_MANAGER));
    assertTrue("'manager' is not of MEMBER kind", relationRegistry.isMember(unqualify(SchemaConstants.ORG_MANAGER)));
    assertFalse("'org:approver' is of MEMBER kind", relationRegistry.isMember(SchemaConstants.ORG_APPROVER));
    assertFalse("'approver' is of MEMBER kind", relationRegistry.isMember(unqualify(SchemaConstants.ORG_APPROVER)));
    assertFalse("'test:kinderManager' is of MEMBER kind", relationRegistry.isMember(TEST_KINDER_MANAGER));
    assertFalse("'kinderManager' is of MEMBER kind", relationRegistry.isMember(unqualify(TEST_KINDER_MANAGER)));
    assertFalse("'test:extra' is of MEMBER kind", relationRegistry.isMember(TEST_EXTRA));
    assertFalse("'test:approver' is of MEMBER kind", relationRegistry.isMember(TEST_APPROVER));
    assertFalse("'test:approver' is of APPROVER kind", relationRegistry.isApprover(TEST_APPROVER));
    assertTrue("'approver' is not of APPROVER kind", relationRegistry.isApprover(unqualify(TEST_APPROVER)));
    assertEquals("Wrong default relation", SchemaConstants.ORG_DEFAULT, relationRegistry.getDefaultRelation());
    assertEquals("Wrong default MEMBER relation", SchemaConstants.ORG_DEFAULT, relationRegistry.getDefaultRelationFor(RelationKindType.MEMBER));
    assertEquals("Wrong default MANAGER relation", TEST_KINDER_MANAGER, relationRegistry.getDefaultRelationFor(RelationKindType.MANAGER));
    assertEquals("Wrong default META relation", SchemaConstants.ORG_META, relationRegistry.getDefaultRelationFor(RelationKindType.META));
    Set<QName> ALIASES_FOR_DEFAULT = new HashSet<>(Arrays.asList(SchemaConstants.ORG_DEFAULT, unqualify(SchemaConstants.ORG_DEFAULT), null));
    assertEquals("Wrong aliases for 'org:default'", ALIASES_FOR_DEFAULT, new HashSet<>(relationRegistry.getAliases(SchemaConstants.ORG_DEFAULT)));
    assertEquals("Wrong aliases for 'default'", ALIASES_FOR_DEFAULT, new HashSet<>(relationRegistry.getAliases(unqualify(SchemaConstants.ORG_DEFAULT))));
    assertEquals("Wrong aliases for 'null'", ALIASES_FOR_DEFAULT, new HashSet<>(relationRegistry.getAliases(null)));
    Set<QName> ALIASES_FOR_MANAGER = new HashSet<>(Arrays.asList(SchemaConstants.ORG_MANAGER, unqualify(SchemaConstants.ORG_MANAGER)));
    assertEquals("Wrong aliases for 'org:manager'", ALIASES_FOR_MANAGER, new HashSet<>(relationRegistry.getAliases(SchemaConstants.ORG_MANAGER)));
    assertEquals("Wrong aliases for 'manager'", ALIASES_FOR_MANAGER, new HashSet<>(relationRegistry.getAliases(unqualify(SchemaConstants.ORG_MANAGER))));
    Set<QName> ALIASES_FOR_KINDER_MANAGER = new HashSet<>(Arrays.asList(TEST_KINDER_MANAGER, unqualify(TEST_KINDER_MANAGER)));
    assertEquals("Wrong aliases for 'test:kinderManager'", ALIASES_FOR_KINDER_MANAGER, new HashSet<>(relationRegistry.getAliases(TEST_KINDER_MANAGER)));
    assertEquals("Wrong aliases for 'manager'", ALIASES_FOR_KINDER_MANAGER, new HashSet<>(relationRegistry.getAliases(unqualify(TEST_KINDER_MANAGER))));
    Set<QName> ALIASES_FOR_TEST_APPROVER = new HashSet<>(singleton(TEST_APPROVER));
    assertEquals("Wrong aliases for 'test:approver'", ALIASES_FOR_TEST_APPROVER, new HashSet<>(relationRegistry.getAliases(TEST_APPROVER)));
    Set<QName> ALIASES_FOR_APPROVER = new HashSet<>(Arrays.asList(SchemaConstants.ORG_APPROVER, unqualify(SchemaConstants.ORG_APPROVER)));
    assertEquals("Wrong aliases for 'approver'", ALIASES_FOR_APPROVER, new HashSet<>(relationRegistry.getAliases(unqualify(TEST_APPROVER))));
    Set<QName> RELATIONS_FOR_MEMBER = new HashSet<>(Arrays.asList(SchemaConstants.ORG_DEFAULT, SchemaConstants.ORG_MANAGER));
    assertEquals("Wrong relations for MEMBER kind", RELATIONS_FOR_MEMBER, new HashSet<>(relationRegistry.getAllRelationsFor(RelationKindType.MEMBER)));
    Set<QName> RELATIONS_FOR_MANAGER = new HashSet<>(Arrays.asList(SchemaConstants.ORG_MANAGER, TEST_KINDER_MANAGER));
    assertEquals("Wrong relations for MANAGER kind", RELATIONS_FOR_MANAGER, new HashSet<>(relationRegistry.getAllRelationsFor(RelationKindType.MANAGER)));
    assertTrue("'org:default' is not processed on login", relationRegistry.isProcessedOnLogin(SchemaConstants.ORG_DEFAULT));
    assertTrue("'default' is not processed on login", relationRegistry.isProcessedOnLogin(unqualify(SchemaConstants.ORG_DEFAULT)));
    assertTrue("'null' is not processed on login", relationRegistry.isProcessedOnLogin(null));
    assertTrue("'org:manager' is not processed on login", relationRegistry.isProcessedOnLogin(SchemaConstants.ORG_MANAGER));
    assertTrue("'org:meta' is not processed on login", relationRegistry.isProcessedOnLogin(SchemaConstants.ORG_META));
    assertFalse("'org:approver' is processed on login", relationRegistry.isProcessedOnLogin(SchemaConstants.ORG_APPROVER));
    assertTrue("'org:default' is not processed on recompute", relationRegistry.isProcessedOnRecompute(SchemaConstants.ORG_DEFAULT));
    assertTrue("'default' is not processed on recompute", relationRegistry.isProcessedOnRecompute(unqualify(SchemaConstants.ORG_DEFAULT)));
    assertTrue("'null' is not processed on recompute", relationRegistry.isProcessedOnRecompute(null));
    assertTrue("'org:manager' is not processed on recompute", relationRegistry.isProcessedOnRecompute(SchemaConstants.ORG_MANAGER));
    assertTrue("'org:meta' is not processed on recompute", relationRegistry.isProcessedOnRecompute(SchemaConstants.ORG_META));
    assertFalse("'org:approver' is processed on recompute", relationRegistry.isProcessedOnRecompute(SchemaConstants.ORG_APPROVER));
    assertTrue("'org:default' is not stored into parentOrgRef", relationRegistry.isStoredIntoParentOrgRef(SchemaConstants.ORG_DEFAULT));
    assertTrue("'default' is not stored into parentOrgRef", relationRegistry.isStoredIntoParentOrgRef(unqualify(SchemaConstants.ORG_DEFAULT)));
    assertTrue("'null' is not stored into parentOrgRef", relationRegistry.isStoredIntoParentOrgRef(null));
    assertTrue("'org:manager' is not stored into parentOrgRef", relationRegistry.isStoredIntoParentOrgRef(SchemaConstants.ORG_MANAGER));
    assertFalse("'org:meta' is stored into parentOrgRef", relationRegistry.isStoredIntoParentOrgRef(SchemaConstants.ORG_META));
    assertFalse("'org:approver' is stored into parentOrgRef", relationRegistry.isStoredIntoParentOrgRef(SchemaConstants.ORG_APPROVER));
    assertTrue("'org:default' is not automatically matched", relationRegistry.isAutomaticallyMatched(SchemaConstants.ORG_DEFAULT));
    assertTrue("'default' is not automatically matched", relationRegistry.isAutomaticallyMatched(unqualify(SchemaConstants.ORG_DEFAULT)));
    assertTrue("'null' is not automatically matched", relationRegistry.isAutomaticallyMatched(null));
    assertTrue("'org:manager' is not automatically matched", relationRegistry.isAutomaticallyMatched(SchemaConstants.ORG_MANAGER));
    // overridden
    assertFalse("'org:meta' is automatically matched", relationRegistry.isAutomaticallyMatched(SchemaConstants.ORG_META));
    // overridden
    assertFalse("'meta' is automatically matched", relationRegistry.isAutomaticallyMatched(unqualify(SchemaConstants.ORG_META)));
    assertTrue("'test:kinderManager' is not automatically matched", relationRegistry.isAutomaticallyMatched(TEST_KINDER_MANAGER));
    assertTrue("'kinderManager' is not automatically matched", relationRegistry.isAutomaticallyMatched(unqualify(TEST_KINDER_MANAGER)));
    assertFalse("'org:approver' is automatically matched", relationRegistry.isAutomaticallyMatched(SchemaConstants.ORG_APPROVER));
    String metaLabel = Objects.requireNonNull(relationRegistry.getRelationDefinition(SchemaConstants.ORG_META)).getDisplay().getLabel().getOrig();
    assertEquals("Wrong label for org:meta", "Meta-relation", metaLabel);
}
Also used : RelationDefinitionType(com.evolveum.midpoint.xml.ns._public.common.common_3.RelationDefinitionType) QName(javax.xml.namespace.QName) SystemConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType) Test(org.testng.annotations.Test) AbstractInternalModelIntegrationTest(com.evolveum.midpoint.model.impl.AbstractInternalModelIntegrationTest)

Aggregations

RelationDefinitionType (com.evolveum.midpoint.xml.ns._public.common.common_3.RelationDefinitionType)7 QName (javax.xml.namespace.QName)7 AbstractInternalModelIntegrationTest (com.evolveum.midpoint.model.impl.AbstractInternalModelIntegrationTest)3 Test (org.testng.annotations.Test)3 SystemConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType)2 ArrayListValuedHashMap (org.apache.commons.collections4.multimap.ArrayListValuedHashMap)2 HashSetValuedHashMap (org.apache.commons.collections4.multimap.HashSetValuedHashMap)2 ReadOnlyModel (com.evolveum.midpoint.gui.api.model.ReadOnlyModel)1 QNameIChoiceRenderer (com.evolveum.midpoint.gui.impl.component.input.QNameIChoiceRenderer)1 Task (com.evolveum.midpoint.task.api.Task)1 QNameUtil (com.evolveum.midpoint.util.QNameUtil)1 DropDownChoicePanel (com.evolveum.midpoint.web.component.input.DropDownChoicePanel)1 SearchSpecialItemPanel (com.evolveum.midpoint.web.component.search.SearchSpecialItemPanel)1 EnableBehaviour (com.evolveum.midpoint.web.component.util.EnableBehaviour)1 DisplayType (com.evolveum.midpoint.xml.ns._public.common.common_3.DisplayType)1 RelationKindType (com.evolveum.midpoint.xml.ns._public.common.common_3.RelationKindType)1 RelationSearchItemConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.RelationSearchItemConfigurationType)1 AssignActionExpressionType (com.evolveum.midpoint.xml.ns._public.model.scripting_3.AssignActionExpressionType)1 PolyStringType (com.evolveum.prism.xml.ns._public.types_3.PolyStringType)1 ArrayList (java.util.ArrayList)1