protected Control getControlInstance( AttributeDefinition attrDef, DataObjectAttribute dataObjectAttribute) { Control c = null; // Check for the hidden hint - if present - then use that control type if (dataObjectAttribute != null && hasHintOfType(dataObjectAttribute, UifDisplayHintType.HIDDEN)) { c = ComponentFactory.getHiddenControl(); } else if (attrDef.getOptionsFinder() != null) { // if a values finder has been established, use a radio button group or drop-down list if (dataObjectAttribute != null && hasHintOfType(dataObjectAttribute, UifDisplayHintType.RADIO)) { c = ComponentFactory.getRadioGroupControl(); } else { c = ComponentFactory.getSelectControl(); } } else if (attrDef.getName().endsWith(".principalName") && dataObjectAttribute != null) { // FIXME: JHK: Yes, I know this is a *HORRIBLE* hack - but the alternative // would look even more "hacky" and error-prone c = ComponentFactory.getUserControl(); // Need to find the relationship information // get the relationship ID by removing .principalName from the attribute name String relationshipName = StringUtils.removeEnd(attrDef.getName(), ".principalName"); DataObjectMetadata metadata = dataObjectService .getMetadataRepository() .getMetadata(dataObjectAttribute.getOwningType()); if (metadata != null) { DataObjectRelationship relationship = metadata.getRelationship(relationshipName); if (relationship != null && CollectionUtils.isNotEmpty(relationship.getAttributeRelationships())) { ((UserControl) c) .setPrincipalIdPropertyName( relationship.getAttributeRelationships().get(0).getParentAttributeName()); ((UserControl) c) .setPersonNamePropertyName( relationshipName + "." + KimConstants.AttributeConstants.NAME); ((UserControl) c).setPersonObjectPropertyName(relationshipName); } } else { LOG.warn( "Attempt to pull relationship name: " + relationshipName + " resulted in missing metadata when looking for: " + dataObjectAttribute.getOwningType()); } } else { switch (attrDef.getDataType()) { case STRING: // TODO: Determine better way to store the "200" metric below if (attrDef.getMaxLength() != null && attrDef.getMaxLength().intValue() > 200) { c = ComponentFactory.getTextAreaControl(); } else { c = ComponentFactory.getTextControl(); } break; case BOOLEAN: c = ComponentFactory.getCheckboxControl(); break; case DATE: case DATETIME: case TRUNCATED_DATE: c = ComponentFactory.getDateControl(); break; case CURRENCY: case DOUBLE: case FLOAT: case INTEGER: case LARGE_INTEGER: case LONG: case PRECISE_DECIMAL: c = ComponentFactory.getTextControl(); break; case MARKUP: c = ComponentFactory.getTextAreaControl(); break; default: c = ComponentFactory.getTextControl(); break; } } return c; }