Skip to content

Commit

Permalink
Add 'org:related' relation and RELATED kind
Browse files Browse the repository at this point in the history
It will be used for owner->dead link references (for now).

Related to MID-6862.
  • Loading branch information
mederly committed Mar 10, 2021
1 parent b38405b commit 75b99bc
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 2 deletions.
Expand Up @@ -32,7 +32,8 @@ public enum RelationTypes {
DEPUTY(SchemaConstants.ORG_DEPUTY, "Deputy", "", "", RelationKindType.DELEGATION, null /* no values */),
APPROVER(SchemaConstants.ORG_APPROVER, "Approver", "fe fe-approver-object", "green", RelationKindType.APPROVER, null, ADMINISTRATION, GOVERNANCE, ORGANIZATION, SELF_SERVICE),
OWNER(SchemaConstants.ORG_OWNER, "Owner", "fe fe-crown-object", "darkorange", RelationKindType.OWNER, null, ADMINISTRATION, GOVERNANCE, ORGANIZATION, SELF_SERVICE),
CONSENT(SchemaConstants.ORG_CONSENT, "Consent", "", "", RelationKindType.CONSENT, null, DATA_PROTECTION);
CONSENT(SchemaConstants.ORG_CONSENT, "Consent", "", "", RelationKindType.CONSENT, null, DATA_PROTECTION),
RELATED(SchemaConstants.ORG_RELATED, "Related", "", "", RelationKindType.RELATED, null);

private final QName relation;
private final String headerLabel;
Expand Down
Expand Up @@ -167,6 +167,12 @@ public abstract class SchemaConstants {
*/
public static final QName ORG_CONSENT = new QName(NS_ORG, "consent");

/**
* Default 'related' relation. Used as a relation value in object references.
* See RelationKind.RELATED for more details.
*/
public static final QName ORG_RELATED = new QName(NS_ORG, "related");

public static final ItemPath PATH_PASSWORD = ItemPath.create(C_CREDENTIALS, CredentialsType.F_PASSWORD);
public static final ItemPath PATH_PASSWORD_VALUE = ItemPath.create(C_CREDENTIALS, CredentialsType.F_PASSWORD,
PasswordType.F_VALUE);
Expand Down
Expand Up @@ -309,7 +309,7 @@ private Set<QName> computeRelationsProcessedOnRecompute() {
private boolean isProcessedOnRecomputeByDefault(QName relation) {
return isOfKind(relation, RelationKindType.MEMBER)
|| isOfKind(relation, RelationKindType.META)
|| isOfKind(relation, RelationKindType.MANAGER) // ok?
|| isOfKind(relation, RelationKindType.MANAGER) // ok?
|| isOfKind(relation, RelationKindType.DELEGATION);
}

Expand Down
Expand Up @@ -22272,6 +22272,24 @@
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="related">
<xsd:annotation>
<xsd:documentation>
Relation "is related to" kind.

Specifies that the subject is somewhat related to the owner, but this relation does not bring any
specific privileges or entitlements or whatever to it. It is just a descriptive information, with
no tangible effect.

Currently used to link shadow owners to their dead shadows. We want to maintain such link but
we do not want to show them e.g. in links counts etc.
</xsd:documentation>
<xsd:appinfo>
<jaxb:typesafeEnumMember name="RELATED"/>
<a:since>4.3</a:since>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
</xsd:restriction>
</xsd:simpleType>

Expand Down
Expand Up @@ -73,6 +73,7 @@ public void test100DefaultRelations() {
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(
Expand All @@ -81,6 +82,8 @@ public void test100DefaultRelations() {
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)));
Expand All @@ -97,33 +100,40 @@ public void test100DefaultRelations() {
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));
}

@Test
Expand Down

0 comments on commit 75b99bc

Please sign in to comment.