org.kuali.rice.kns.kim.type
Class DataDictionaryTypeServiceBase

java.lang.Object
  extended by org.kuali.rice.kns.kim.type.DataDictionaryTypeServiceBase
All Implemented Interfaces:
KimTypeService
Direct Known Subclasses:
GroupTypeServiceBase, KimResponsibilityTypeServiceBase, PermissionTypeServiceBase, RoleTypeServiceBase

public class DataDictionaryTypeServiceBase
extends Object
implements KimTypeService

A base class for KimTypeService implementations which read attribute-related information from the Data Dictionary. This implementation is currently written against the KNS apis for Data Dictionary. Additionally, it supports the ability to read non-Data Dictionary attribute information from the KimTypeInfoService.

Author:
Kuali Rice Team (rice.collab@kuali.org)

Nested Class Summary
protected static class DataDictionaryTypeServiceBase.KimTypeAttributeException
           
protected static class DataDictionaryTypeServiceBase.KimTypeAttributeValidationException
           
 
Field Summary
protected static String COMMA_SEPARATOR
           
 
Constructor Summary
DataDictionaryTypeServiceBase()
           
 
Method Summary
protected  boolean areAttributesEqual(List<String> uniqueAttributeNames, Map<String,String> aSet1, Map<String,String> aSet2)
           
protected  List<String> extractErrorsFromGlobalVariablesErrorMap(String attributeName)
           
 List<KimAttributeField> getAttributeDefinitions(String kimTypeId)
          Gets a List of KimAttributeField for a kim type id.
protected  Formatter getAttributeFormatter(KimAttributeField definition)
           
protected  Double getAttributeMaxValue(KimAttributeField definition)
           
protected  Double getAttributeMinValue(KimAttributeField definition)
           
protected  Pattern getAttributeValidatingExpression(KimAttributeField definition)
           
protected  String getAttributeValue(Map<String,String> aSet, String attributeName)
           
protected  BusinessObjectService getBusinessObjectService()
           
protected  String getClosestParentDocumentTypeName(DocumentType documentType, Set<String> potentialParentDocumentTypeNames)
           
protected  KimAttributeField getDataDictionaryAttributeDefinition(String namespaceCode, String kimTypeId, KimTypeAttribute typeAttribute, List<String> uniqueAttributes)
           
protected  DataDictionaryService getDataDictionaryService()
           
protected  DictionaryValidationService getDictionaryValidationService()
           
protected  DocumentTypeService getDocumentTypeService()
           
protected  KimAttributeField getNonDataDictionaryAttributeDefinition(String namespaceCode, String kimTypeId, KimTypeAttribute typeAttribute, List<String> uniqueAttributes)
           
protected  List<String> getRequiredAttributes()
           
protected  KimTypeInfoService getTypeInfoService()
           
protected  List<String> getUniqueAttributes(String kimTypeId)
           
 String getWorkflowDocumentTypeName()
          Gets the name of a workflow document type that should be passed to kew when resolving responsibilities for routing.
 List<String> getWorkflowRoutingAttributes(String routeLevel)
          Gets an unmodifiable list of attribute names identifying the attribute qualifiers that are provided to the KIM responsibility service when resolving responsibility-based routing at the node with the given name.
protected  boolean isCheckRequiredAttributes()
           
protected  boolean performMatch(Map<String,String> inputAttributes, Map<String,String> storedAttributes)
          This method matches input attribute set entries and standard attribute set entries using literal string match.
protected  Map<String,String> translateInputAttributes(Map<String,String> qualification)
           
protected  List<RemotableAttributeError> validateAttributeFormat(String kimTypeId, String objectClassName, String attributeName, String attributeValue, String errorKey)
           
protected  List<RemotableAttributeError> validateAttributeRequired(String kimTypeId, String objectClassName, String attributeName, Object attributeValue, String errorKey)
           
 List<RemotableAttributeError> validateAttributes(String kimTypeId, Map<String,String> attributes)
          This is the default implementation.
 List<RemotableAttributeError> validateAttributesAgainstExisting(String kimTypeId, Map<String,String> newAttributes, Map<String,String> oldAttributes)
          This method validates the passed in attributes for a kimTypeId generating a List of RemotableAttributeError.
protected  List<RemotableAttributeError> validateDataDictionaryAttribute(KimTypeAttribute attr, String key, String value)
           
protected  List<RemotableAttributeError> validateDataDictionaryAttribute(String kimTypeId, String entryName, Object object, PropertyDescriptor propertyDescriptor)
           
protected  List<RemotableAttributeError> validateNonDataDictionaryAttribute(KimTypeAttribute attr, String key, String value)
           
protected  List<RemotableAttributeError> validatePrimitiveFromDescriptor(String kimTypeId, String entryName, Object object, PropertyDescriptor propertyDescriptor)
           
protected  List<RemotableAttributeError> validateReferencesExistAndActive(KimType kimType, Map<String,String> attributes, List<RemotableAttributeError> previousValidationErrors)
           
protected  void validateRequiredAttributesAgainstReceived(Map<String,String> receivedAttributes)
           
 List<RemotableAttributeError> validateUniqueAttributes(String kimTypeId, Map<String,String> newAttributes, Map<String,String> oldAttributes)
          This method validates the passed in attributes for a kimTypeId generating a List of RemotableAttributeError.
 List<RemotableAttributeError> validateUnmodifiableAttributes(String kimTypeId, Map<String,String> originalAttributes, Map<String,String> newAttributes)
          This method validates the passed in attributes for a kimTypeId generating a List of RemotableAttributeError.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMMA_SEPARATOR

protected static final String COMMA_SEPARATOR
See Also:
Constant Field Values
Constructor Detail

DataDictionaryTypeServiceBase

public DataDictionaryTypeServiceBase()
Method Detail

getWorkflowDocumentTypeName

public String getWorkflowDocumentTypeName()
Description copied from interface: KimTypeService
Gets the name of a workflow document type that should be passed to kew when resolving responsibilities for routing. This name will be passed as a qualifier with the "documentTypeName" key. return null to indicate that there is no custom workflow document needed for this type.

Specified by:
getWorkflowDocumentTypeName in interface KimTypeService
Returns:
the doc type name or null.

getWorkflowRoutingAttributes

public List<String> getWorkflowRoutingAttributes(String routeLevel)
Description copied from interface: KimTypeService
Gets an unmodifiable list of attribute names identifying the attribute qualifiers that are provided to the KIM responsibility service when resolving responsibility-based routing at the node with the given name. Returns an empty list, indicating that no attributes from this type should be passed to workflow.

Specified by:
getWorkflowRoutingAttributes in interface KimTypeService
Parameters:
routeLevel - the name of the node to retrieve attribute names for. Cannot be null or blank.
Returns:
an unmodifiable list should not return null.

getAttributeDefinitions

public List<KimAttributeField> getAttributeDefinitions(String kimTypeId)
Description copied from interface: KimTypeService
Gets a List of KimAttributeField for a kim type id. The order of the attribute fields in the list can be used as a hint to a ui framework consuming these attributes as to how to organize these fields.

Specified by:
getAttributeDefinitions in interface KimTypeService
Parameters:
kimTypeId - the kimTypeId to retrieve fields for. Cannot be null or blank.
Returns:
an immutable list of KimAttributeField. Will not return null.

validateAttributes

public List<RemotableAttributeError> validateAttributes(String kimTypeId,
                                                        Map<String,String> attributes)
This is the default implementation. It calls into the service for each attribute to validate it there. No combination validation is done. That should be done by overriding this method.

Specified by:
validateAttributes in interface KimTypeService
Parameters:
kimTypeId - the kimTypeId that is associated with the attributes. Cannot be null or blank.
attributes - the kim type attributes to validate. Cannot be null.
Returns:
an immutable list of RemotableAttributeError. Will not return null.

validateAttributesAgainstExisting

public List<RemotableAttributeError> validateAttributesAgainstExisting(String kimTypeId,
                                                                       Map<String,String> newAttributes,
                                                                       Map<String,String> oldAttributes)
Description copied from interface: KimTypeService
This method validates the passed in attributes for a kimTypeId generating a List of RemotableAttributeError. This method used the oldAttributes to aid in validation. This is useful for validating "new" or "updated" attributes. The order of the attribute errors in the list can be used as a hint to a ui framework consuming these errors as to how to organize these errors.

Specified by:
validateAttributesAgainstExisting in interface KimTypeService
Parameters:
kimTypeId - the kimTypeId that is associated with the attributes. Cannot be null or blank.
newAttributes - the kim type attributes to validate. Cannot be null.
oldAttributes - the old kim type attributes to use for validation. Cannot be null.
Returns:
an immutable list of RemotableAttributeError. Will not return null.

performMatch

protected boolean performMatch(Map<String,String> inputAttributes,
                               Map<String,String> storedAttributes)
This method matches input attribute set entries and standard attribute set entries using literal string match.


translateInputAttributes

protected Map<String,String> translateInputAttributes(Map<String,String> qualification)

validateReferencesExistAndActive

protected List<RemotableAttributeError> validateReferencesExistAndActive(KimType kimType,
                                                                         Map<String,String> attributes,
                                                                         List<RemotableAttributeError> previousValidationErrors)

validateAttributeRequired

protected List<RemotableAttributeError> validateAttributeRequired(String kimTypeId,
                                                                  String objectClassName,
                                                                  String attributeName,
                                                                  Object attributeValue,
                                                                  String errorKey)

validateDataDictionaryAttribute

protected List<RemotableAttributeError> validateDataDictionaryAttribute(String kimTypeId,
                                                                        String entryName,
                                                                        Object object,
                                                                        PropertyDescriptor propertyDescriptor)

validatePrimitiveFromDescriptor

protected List<RemotableAttributeError> validatePrimitiveFromDescriptor(String kimTypeId,
                                                                        String entryName,
                                                                        Object object,
                                                                        PropertyDescriptor propertyDescriptor)

getAttributeValidatingExpression

protected Pattern getAttributeValidatingExpression(KimAttributeField definition)

getAttributeFormatter

protected Formatter getAttributeFormatter(KimAttributeField definition)

getAttributeMinValue

protected Double getAttributeMinValue(KimAttributeField definition)

getAttributeMaxValue

protected Double getAttributeMaxValue(KimAttributeField definition)

validateAttributeFormat

protected List<RemotableAttributeError> validateAttributeFormat(String kimTypeId,
                                                                String objectClassName,
                                                                String attributeName,
                                                                String attributeValue,
                                                                String errorKey)

extractErrorsFromGlobalVariablesErrorMap

protected List<String> extractErrorsFromGlobalVariablesErrorMap(String attributeName)

validateNonDataDictionaryAttribute

protected List<RemotableAttributeError> validateNonDataDictionaryAttribute(KimTypeAttribute attr,
                                                                           String key,
                                                                           String value)

validateDataDictionaryAttribute

protected List<RemotableAttributeError> validateDataDictionaryAttribute(KimTypeAttribute attr,
                                                                        String key,
                                                                        String value)

getDataDictionaryAttributeDefinition

protected KimAttributeField getDataDictionaryAttributeDefinition(String namespaceCode,
                                                                 String kimTypeId,
                                                                 KimTypeAttribute typeAttribute,
                                                                 List<String> uniqueAttributes)
Parameters:
namespaceCode -
typeAttribute -
Returns:
an AttributeDefinition for the given KimTypeAttribute, or null no base AttributeDefinition matches the typeAttribute parameter's attributeName.

getNonDataDictionaryAttributeDefinition

protected KimAttributeField getNonDataDictionaryAttributeDefinition(String namespaceCode,
                                                                    String kimTypeId,
                                                                    KimTypeAttribute typeAttribute,
                                                                    List<String> uniqueAttributes)

validateRequiredAttributesAgainstReceived

protected void validateRequiredAttributesAgainstReceived(Map<String,String> receivedAttributes)

validateUniqueAttributes

public List<RemotableAttributeError> validateUniqueAttributes(String kimTypeId,
                                                              Map<String,String> newAttributes,
                                                              Map<String,String> oldAttributes)
Description copied from interface: KimTypeService
This method validates the passed in attributes for a kimTypeId generating a List of RemotableAttributeError. This method used the oldAttributes to aid in validation. This method specifically determines if attributes should be unique and verifying them against other attributes that have been set to determine uniqueness The order of the attribute errors in the list can be used as a hint to a ui framework consuming these errors as to how to organize these errors.

Specified by:
validateUniqueAttributes in interface KimTypeService
Parameters:
kimTypeId - the kimTypeId that is associated with the attributes. Cannot be null or blank.
newAttributes - the kim type attributes to validate. Cannot be null.
oldAttributes - the old kim type attributes to use for validation. Cannot be null.
Returns:
an immutable list of RemotableAttributeError. Will not return null.

areAttributesEqual

protected boolean areAttributesEqual(List<String> uniqueAttributeNames,
                                     Map<String,String> aSet1,
                                     Map<String,String> aSet2)

getAttributeValue

protected String getAttributeValue(Map<String,String> aSet,
                                   String attributeName)

getUniqueAttributes

protected List<String> getUniqueAttributes(String kimTypeId)

validateUnmodifiableAttributes

public List<RemotableAttributeError> validateUnmodifiableAttributes(String kimTypeId,
                                                                    Map<String,String> originalAttributes,
                                                                    Map<String,String> newAttributes)
Description copied from interface: KimTypeService
This method validates the passed in attributes for a kimTypeId generating a List of RemotableAttributeError. This method used the oldAttributes to aid in validation. This method specifically validates that the new attribute values have not been changed if they are unmodifiable. The order of the attribute errors in the list can be used as a hint to a ui framework consuming these errors as to how to organize these errors.

Specified by:
validateUnmodifiableAttributes in interface KimTypeService
Parameters:
kimTypeId - the kimTypeId that is associated with the attributes. Cannot be null or blank.
originalAttributes - the old kim type attributes to use for validation. Cannot be null.
newAttributes - the kim type attributes to validate. Cannot be null.
Returns:
an immutable list of RemotableAttributeError. Will not return null.

getRequiredAttributes

protected List<String> getRequiredAttributes()

isCheckRequiredAttributes

protected boolean isCheckRequiredAttributes()

getClosestParentDocumentTypeName

protected String getClosestParentDocumentTypeName(DocumentType documentType,
                                                  Set<String> potentialParentDocumentTypeNames)

getTypeInfoService

protected KimTypeInfoService getTypeInfoService()

getBusinessObjectService

protected BusinessObjectService getBusinessObjectService()

getDictionaryValidationService

protected DictionaryValidationService getDictionaryValidationService()

getDataDictionaryService

protected DataDictionaryService getDataDictionaryService()

getDocumentTypeService

protected DocumentTypeService getDocumentTypeService()


Copyright © 2005-2013 The Kuali Foundation. All Rights Reserved.