Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Evolveum/midpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Suta committed Feb 11, 2015
2 parents 7c80a3c + c8a0d9a commit b2b2a05
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 8 deletions.
Expand Up @@ -478,6 +478,10 @@ private void addCommonDefinitionAnnotations(Definition definition, Element appin
addAnnotation(A_DISPLAY_NAME, definition.getDisplayName(), appinfoElement);
}

if (definition.getDisplayOrder() != null) {
addAnnotation(A_DISPLAY_ORDER, definition.getDisplayOrder().toString(), appinfoElement);
}

if (definition.getHelp() != null) {
addAnnotation(A_HELP, definition.getHelp(), appinfoElement);
}
Expand Down
Expand Up @@ -222,12 +222,12 @@ public void test030FormatAccount() throws Exception {

// THEN

assertTrue("account name is not shown", jackFormattedHideNone.contains("name: jack"));
assertTrue("account name is not shown", jackFormattedHideNone.contains("Name: jack"));
assertTrue("account password is not shown", jackFormattedHideNone.contains("(protected string)"));
assertTrue("administrative status is not shown", jackFormattedHideNone.contains("Administrative Status: ENABLED"));
assertTrue("effective status is not shown", jackFormattedHideNone.contains("Effective Status: ENABLED"));

assertTrue("account name is not shown", jackFormattedHideAux.contains("name: jack"));
assertTrue("account name is not shown", jackFormattedHideAux.contains("Name: jack"));
assertTrue("account password is not shown", jackFormattedHideAux.contains("(protected string)"));
assertTrue("administrative status is not shown", jackFormattedHideAux.contains("Administrative Status: ENABLED"));
assertTrue("effective status is shown although it should be hidden", !jackFormattedHideAux.contains("Effective Status: ENABLED"));
Expand Down
Expand Up @@ -108,7 +108,11 @@ public class ConnectorFactoryIcfImpl implements ConnectorFactory {
public static final String NS_ICF_SCHEMA_PREFIX = "icfs";
public static final String NS_ICF_RESOURCE_INSTANCE_PREFIX = "ri";
public static final QName ICFS_NAME = new QName(NS_ICF_SCHEMA, "name");
public static final String ICFS_NAME_DISPLAY_NAME = "ConnId Name";
public static final int ICFS_NAME_DISPLAY_ORDER = 110;
public static final QName ICFS_UID = new QName(NS_ICF_SCHEMA, "uid");
public static final String ICFS_UID_DISPLAY_NAME = "ConnId UID";
public static final int ICFS_UID_DISPLAY_ORDER = 100;
public static final QName ICFS_ACCOUNT = new QName(NS_ICF_SCHEMA, "account");
public static final String ACCOUNT_OBJECT_CLASS_LOCAL_NAME = "AccountObjectClass";
public static final String GROUP_OBJECT_CLASS_LOCAL_NAME = "GroupObjectClass";
Expand Down Expand Up @@ -157,12 +161,16 @@ public class ConnectorFactoryIcfImpl implements ConnectorFactory {

private static final String ICF_CONFIGURATION_NAMESPACE_PREFIX = ICF_FRAMEWORK_URI + "/bundle/";
private static final String CONNECTOR_IDENTIFIER_SEPARATOR = "/";

public static final int ATTR_DISPLAY_ORDER_START = 120;
public static final int ATTR_DISPLAY_ORDER_INCREMENT = 10;

private static final Trace LOGGER = TraceManager.getTrace(ConnectorFactoryIcfImpl.class);

// This is not really used in the code. It is here just to make sure that the JUL logger is loaded
// by the parent classloader so we can correctly adjust the log levels from the main code
static final java.util.logging.Logger JUL_LOGGER = java.util.logging.Logger.getLogger(ConnectorFactoryIcfImpl.class.getName());


private ConnectorInfoManagerFactory connectorInfoManagerFactory;
private ConnectorInfoManager localConnectorInfoManager;
Expand Down
Expand Up @@ -651,10 +651,12 @@ private void parseResourceSchema(org.identityconnectors.framework.common.objects
// Make it read-only
uidDefinition.setReadOnly();
// Set a default display name
uidDefinition.setDisplayName("ICF UID");
uidDefinition.setDisplayName(ConnectorFactoryIcfImpl.ICFS_UID_DISPLAY_NAME);
uidDefinition.setDisplayOrder(ConnectorFactoryIcfImpl.ICFS_UID_DISPLAY_ORDER);
// Uid is a primary identifier of every object (this is the ICF way)
((Collection<ResourceAttributeDefinition>)roDefinition.getIdentifiers()).add(uidDefinition);

int displayOrder = ConnectorFactoryIcfImpl.ATTR_DISPLAY_ORDER_START;
// Let's iterate over all attributes in this object class ...
Set<AttributeInfo> attributeInfoSet = objectClassInfo.getAttributeInfo();
for (AttributeInfo attributeInfo : attributeInfoSet) {
Expand Down Expand Up @@ -710,8 +712,12 @@ private void parseResourceSchema(org.identityconnectors.framework.common.objects
// Set a better display name for __NAME__. The "name" is s very
// overloaded term, so let's try to make things
// a bit clearer
attrDef.setDisplayName("ICF NAME");
attrDef.setDisplayName(ConnectorFactoryIcfImpl.ICFS_NAME_DISPLAY_NAME);
attrDef.setDisplayOrder(ConnectorFactoryIcfImpl.ICFS_NAME_DISPLAY_ORDER);
((Collection<ResourceAttributeDefinition>)roDefinition.getSecondaryIdentifiers()).add(attrDef);
} else {
attrDef.setDisplayOrder(displayOrder);
displayOrder += ConnectorFactoryIcfImpl.ATTR_DISPLAY_ORDER_INCREMENT;
}

// Now we are going to process flags such as optional and
Expand Down
Expand Up @@ -237,6 +237,7 @@ public void assertDummyResourceSchemaSanity(ResourceSchema resourceSchema, Resou
assertTrue("No fullname create", fullnameDef.canAdd());
assertTrue("No fullname update", fullnameDef.canModify());
assertTrue("No fullname read", fullnameDef.canRead());
assertEquals("Wrong displayOrder for attribute fullName", (Integer)200, fullnameDef.getDisplayOrder());

// GROUP
ObjectClassComplexTypeDefinition groupObjectClass = resourceSchema.findObjectClassDefinition(SchemaTestConstants.GROUP_OBJECT_CLASS_LOCAL_NAME);
Expand Down
Expand Up @@ -757,10 +757,12 @@ public static void assertIcfResourceSchemaSanity(ResourceSchema resourceSchema,
assertFalse("Empty identifiers for " + objectClassQname, identifiers.isEmpty());


ResourceAttributeDefinition icfAttributeDefinition = accountDefinition.findAttributeDefinition(SchemaTestConstants.ICFS_UID);
assertNotNull("No definition for attribute "+SchemaTestConstants.ICFS_UID, icfAttributeDefinition);
assertTrue("Attribute "+SchemaTestConstants.ICFS_UID+" in not an identifier",icfAttributeDefinition.isIdentifier(accountDefinition));
assertTrue("Attribute "+SchemaTestConstants.ICFS_UID+" in not in identifiers list",identifiers.contains(icfAttributeDefinition));
ResourceAttributeDefinition uidAttributeDefinition = accountDefinition.findAttributeDefinition(SchemaTestConstants.ICFS_UID);
assertNotNull("No definition for attribute "+SchemaTestConstants.ICFS_UID, uidAttributeDefinition);
assertTrue("Attribute "+SchemaTestConstants.ICFS_UID+" in not an identifier",uidAttributeDefinition.isIdentifier(accountDefinition));
assertTrue("Attribute "+SchemaTestConstants.ICFS_UID+" in not in identifiers list",identifiers.contains(uidAttributeDefinition));
assertEquals("Wrong displayName for attribute "+SchemaTestConstants.ICFS_UID, "ConnId UID", uidAttributeDefinition.getDisplayName());
assertEquals("Wrong displayOrder for attribute "+SchemaTestConstants.ICFS_UID, (Integer)100, uidAttributeDefinition.getDisplayOrder());

Collection<? extends ResourceAttributeDefinition> secondaryIdentifiers = accountDefinition.getSecondaryIdentifiers();
assertNotNull("Null secondary identifiers for " + objectClassQname, secondaryIdentifiers);
Expand All @@ -770,6 +772,8 @@ public static void assertIcfResourceSchemaSanity(ResourceSchema resourceSchema,
assertNotNull("No definition for attribute "+SchemaTestConstants.ICFS_NAME, nameAttributeDefinition);
assertTrue("Attribute "+SchemaTestConstants.ICFS_NAME+" in not an identifier",nameAttributeDefinition.isSecondaryIdentifier(accountDefinition));
assertTrue("Attribute "+SchemaTestConstants.ICFS_NAME+" in not in identifiers list",secondaryIdentifiers.contains(nameAttributeDefinition));
assertEquals("Wrong displayName for attribute "+SchemaTestConstants.ICFS_NAME, "ConnId Name", nameAttributeDefinition.getDisplayName());
assertEquals("Wrong displayOrder for attribute "+SchemaTestConstants.ICFS_NAME, (Integer)110, nameAttributeDefinition.getDisplayOrder());

assertNotNull("Null identifiers in account", accountDef.getIdentifiers());
assertFalse("Empty identifiers in account", accountDef.getIdentifiers().isEmpty());
Expand All @@ -787,6 +791,8 @@ public static void assertIcfResourceSchemaSanity(ResourceSchema resourceSchema,
assertFalse("UID has update",uidDef.canModify());
assertTrue("No UID read",uidDef.canRead());
assertTrue("UID definition not in identifiers", accountDef.getIdentifiers().contains(uidDef));
assertEquals("Wrong refined displayName for attribute "+SchemaTestConstants.ICFS_UID, "ConnId UID", uidDef.getDisplayName());
assertEquals("Wrong refined displayOrder for attribute "+SchemaTestConstants.ICFS_UID, (Integer)100, uidDef.getDisplayOrder());

ResourceAttributeDefinition nameDef = accountDef
.findAttributeDefinition(SchemaTestConstants.ICFS_NAME);
Expand All @@ -797,6 +803,8 @@ public static void assertIcfResourceSchemaSanity(ResourceSchema resourceSchema,
assertTrue("No NAME update",nameDef.canModify());
assertTrue("No NAME read",nameDef.canRead());
assertTrue("NAME definition not in identifiers", accountDef.getSecondaryIdentifiers().contains(nameDef));
assertEquals("Wrong refined displayName for attribute "+SchemaTestConstants.ICFS_NAME, "ConnId Name", nameDef.getDisplayName());
assertEquals("Wrong refined displayOrder for attribute "+SchemaTestConstants.ICFS_NAME, (Integer)110, nameDef.getDisplayOrder());

assertNull("The _PASSSWORD_ attribute sneaked into schema", accountDef.findAttributeDefinition(new QName(SchemaTestConstants.NS_ICFS,"password")));
}
Expand Down

0 comments on commit b2b2a05

Please sign in to comment.