Skip to content

Commit

Permalink
Override of "emphasized" flag in object template.
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Mar 29, 2016
1 parent d854304 commit f1f519f
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 1 deletion.
Expand Up @@ -276,6 +276,10 @@ public static void assertIndexed(PrismContainerDefinition<? extends Containerabl
assertEquals("Wrong value of 'indexed' in property '"+PrettyPrinter.prettyPrint(itemQName)+" in "+containerDef, expected, propertyDefinition.isIndexed());
}

public static void assertEmphasized(ItemDefinition itemDef, Boolean expected) {
assertEquals("Wrong value of 'emphasized' in "+itemDef, expected, itemDef.isEmphasized());
}

public static void assertEmphasized(PrismContainerDefinition<? extends Containerable> containerDef, QName itemQName,
Boolean expected) {
PrismPropertyDefinition propertyDefinition = containerDef.findPropertyDefinition(itemQName);
Expand Down
Expand Up @@ -3897,6 +3897,15 @@
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="emphasized" type="xsd:boolean" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Set true for definitions that are more important than others and that should be emphasized
during presentation. E.g. the emphasized definitions will always be displayed in the user
interfaces (even if they are empty), they will always be included in the dumps, etc.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>

Expand Down
Expand Up @@ -457,6 +457,11 @@ private <IV extends PrismValue,ID extends ItemDefinition> void applyObjectTempla
itemDef.setDisplayOrder(displayOrder);
}

Boolean emphasized = templateItemDefType.isEmphasized();
if (emphasized != null) {
itemDef.setEmphasized(emphasized);
}

List<PropertyLimitationsType> limitations = templateItemDefType.getLimitations();
if (limitations != null) {
PropertyLimitationsType limitationsType = MiscSchemaUtil.getLimitationsType(limitations, LayerType.PRESENTATION);
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2015 Evolveum
* Copyright (c) 2010-2016 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -1017,15 +1017,24 @@ public void test200EditSchemaUser() throws Exception {
// THEN
TestUtil.displayThen(TEST_NAME);


PrismAsserts.assertEmphasized(editDef, UserType.F_NAME, true);
PrismAsserts.assertEmphasized(editDef, UserType.F_GIVEN_NAME, false);
PrismAsserts.assertEmphasized(editDef, UserType.F_FAMILY_NAME, true);
PrismAsserts.assertEmphasized(editDef, UserType.F_FULL_NAME, true);
PrismAsserts.assertEmphasized(editDef, UserType.F_DESCRIPTION, false);

PrismPropertyDefinition<PolyString> additionalNameDef = editDef.findPropertyDefinition(UserType.F_ADDITIONAL_NAME);
assertNotNull("No definition for additionalName in user", additionalNameDef);
assertEquals("Wrong additionalName displayName", "Middle Name", additionalNameDef.getDisplayName());
assertTrue("additionalName not readable", additionalNameDef.canRead());
PrismAsserts.assertEmphasized(additionalNameDef, false);

PrismPropertyDefinition<String> costCenterDef = editDef.findPropertyDefinition(UserType.F_COST_CENTER);
assertNotNull("No definition for costCenter in user", costCenterDef);
assertEquals("Wrong costCenter displayOrder", (Integer)123, costCenterDef.getDisplayOrder());
assertTrue("costCenter not readable", costCenterDef.canRead());
PrismAsserts.assertEmphasized(costCenterDef, true);

PrismPropertyDefinition<String> preferredLanguageDef = editDef.findPropertyDefinition(UserType.F_PREFERRED_LANGUAGE);
assertNotNull("No definition for preferredLanguage in user", preferredLanguageDef);
Expand Down
Expand Up @@ -25,6 +25,11 @@

<includeRef oid="10000000-0000-0000-0000-000000000223"/>

<item>
<ref>givenName</ref>
<emphasized>false</emphasized>
</item>

<item>
<ref>additionalName</ref>
<displayName>Middle Name</displayName>
Expand All @@ -38,6 +43,7 @@
<item>
<ref>costCenter</ref>
<displayOrder>123</displayOrder>
<emphasized>true</emphasized>
<mapping>
<strength>weak</strength>
<expression>
Expand Down

0 comments on commit f1f519f

Please sign in to comment.