org.kuali.rice.krms.impl.type
Class KrmsTypeServiceBase

java.lang.Object
  extended by org.kuali.rice.kns.datadictionary.validation.AttributeValidatingTypeServiceBase
      extended by org.kuali.rice.krms.impl.type.KrmsTypeServiceBase
All Implemented Interfaces:
RemotableAttributeOwner
Direct Known Subclasses:
ActionTypeServiceBase, AgendaTypeServiceBase, PeopleFlowActionTypeService, RuleTypeServiceBase, ValidationActionTypeServiceImpl, ValidationRuleTypeServiceImpl

public abstract class KrmsTypeServiceBase
extends AttributeValidatingTypeServiceBase
implements RemotableAttributeOwner

KrmsTypeServiceBase is an abstract class providing default implementation and hooks for provisioning and validating the custom attributes of a krms type. Is should probably be mentioned that the default validation methods don't actually check anything, they just return empty error lists.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.kuali.rice.kns.datadictionary.validation.AttributeValidatingTypeServiceBase
AttributeValidatingTypeServiceBase.TypeAttributeDefinition, AttributeValidatingTypeServiceBase.TypeAttributeValidationException
 
Constructor Summary
KrmsTypeServiceBase()
           
 
Method Summary
 List<RemotableAttributeField> getAttributeFields(String krmsTypeId)
          get the RemotableAttributeFields for the custom attributes of this krms type.
 DataDictionaryRemoteFieldService getDataDictionaryRemoteFieldService()
           
protected  List<AttributeValidatingTypeServiceBase.TypeAttributeDefinition> getTypeAttributeDefinitions(String krmsTypeId)
          Gets an ordered List of TypeAttributeDefinitions for the attributes on the KRMS type specified by the given krmsTypeId.
protected  void sortFields(List<AttributeValidatingTypeServiceBase.TypeAttributeDefinition> results, Map<String,Integer> sortCodeMap)
           
 RemotableAttributeField translateTypeAttribute(KrmsTypeAttribute inputAttribute, KrmsAttributeDefinition attributeDefinition)
          Translate a KrmsTypeAttribute into a RemotableAttributeField.
 List<RemotableAttributeError> validateAttributes(String krmsTypeId, Map<String,String> attributes)
          This is the default implementation.
 List<RemotableAttributeError> validateAttributesAgainstExisting(String krmsTypeId, Map<String,String> newAttributes, Map<String,String> oldAttributes)
          This method validates the passed in attributes for a krmsTypeId generating a List of RemotableAttributeErrors.
protected  List<RemotableAttributeError> validateNonDataDictionaryAttribute(RemotableAttributeField attr, String key, String value)
          Validates an attribute that is *not* mapped to a data dictionary component via AttributeValidatingTypeServiceBase.TypeAttributeDefinition.componentName and AttributeValidatingTypeServiceBase.TypeAttributeDefinition.name.
 
Methods inherited from class org.kuali.rice.kns.datadictionary.validation.AttributeValidatingTypeServiceBase
createErrorString, extractErrorsFromGlobalVariablesErrorMap, getAttributeErrorLabel, getAttributeFormatter, getAttributeValidatingExpression, getConfigurationService, getDataDictionaryService, getDictionaryValidationService, validateAttributeFormat, validateAttributeRequired, validateDataDictionaryAttribute, validatePrimitiveAttributeFromDescriptor, validateReferencesExistAndActive
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KrmsTypeServiceBase

public KrmsTypeServiceBase()
Method Detail

getAttributeFields

public List<RemotableAttributeField> getAttributeFields(String krmsTypeId)
                                                 throws RiceIllegalArgumentException

get the RemotableAttributeFields for the custom attributes of this krms type. This implementation will (by default) return any attributes mapped to the type via KrmsTypeAttributeBo. If there is is a component name defined on the related KrmsAttributeDefinitionBo then that will be used to generate the RemotableAttributeField. If not, then a simple text input will be produced.

An extending class can also override the translateTypeAttribute(org.kuali.rice.krms.api.repository.type.KrmsTypeAttribute, org.kuali.rice.krms.api.repository.type.KrmsAttributeDefinition) method which is called from here, and within it hand create the RemotableAttributeField for a certain attribute.

Also handy for extenders to know, this method delegates to getTypeAttributeDefinitions(String) and then pulls out the RemotableAttributeFields from the returned TypeAttributeDefinitions

Specified by:
getAttributeFields in interface RemotableAttributeOwner
Parameters:
krmsTypeId - the people flow type identifier. Must not be null or blank.
Returns:
Throws:
RiceIllegalArgumentException

getTypeAttributeDefinitions

protected List<AttributeValidatingTypeServiceBase.TypeAttributeDefinition> getTypeAttributeDefinitions(String krmsTypeId)
Gets an ordered List of TypeAttributeDefinitions for the attributes on the KRMS type specified by the given krmsTypeId.

Specified by:
getTypeAttributeDefinitions in class AttributeValidatingTypeServiceBase
Parameters:
krmsTypeId - the ID of the KRMS Type whose attributes we are getting.
Returns:
a List of type-agnostic TypeAttributeDefinitions
See Also:
AttributeValidatingTypeServiceBase

sortFields

protected void sortFields(List<AttributeValidatingTypeServiceBase.TypeAttributeDefinition> results,
                          Map<String,Integer> sortCodeMap)

validateAttributes

public List<RemotableAttributeError> validateAttributes(String krmsTypeId,
                                                        Map<String,String> attributes)
                                                 throws RiceIllegalArgumentException
Description copied from class: AttributeValidatingTypeServiceBase

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.

This implementation calls AttributeValidatingTypeServiceBase.getTypeAttributeDefinitions(String) to retrieve module-agnostic representations. It then iterates through the entry set of attributes, and calls AttributeValidatingTypeServiceBase.validateNonDataDictionaryAttribute(org.kuali.rice.core.api.uif.RemotableAttributeField, String, String) or AttributeValidatingTypeServiceBase.validateDataDictionaryAttribute(org.kuali.rice.kns.datadictionary.validation.AttributeValidatingTypeServiceBase.TypeAttributeDefinition, String, String) as appropriate. Lastly it calls AttributeValidatingTypeServiceBase.validateReferencesExistAndActive(java.util.Map, java.util.Map, java.util.List).

Specified by:
validateAttributes in interface RemotableAttributeOwner
Overrides:
validateAttributes in class AttributeValidatingTypeServiceBase
Parameters:
krmsTypeId - the identifier for the type
attributes - the Map of attribute names to values
Returns:
the List of errors (RemotableAttributeErrors) encountered during validation.
Throws:
RiceIllegalArgumentException

validateAttributesAgainstExisting

public List<RemotableAttributeError> validateAttributesAgainstExisting(String krmsTypeId,
                                                                       Map<String,String> newAttributes,
                                                                       Map<String,String> oldAttributes)
                                                                throws RiceIllegalArgumentException
Description copied from interface: RemotableAttributeOwner

This method validates the passed in attributes for a krmsTypeId generating a List of RemotableAttributeErrors. This method used the oldAttributes to aid in validation. This is useful for validating "new" or "updated" attributes.

Specified by:
validateAttributesAgainstExisting in interface RemotableAttributeOwner
Parameters:
krmsTypeId - the people flow type identifier. Must not be null or blank.
newAttributes - the kim type attributes to validate. Cannot be null.
oldAttributes - the old attributes to use for validation. Cannot be null.
Returns:
any errors that are discovered during validation. Will not return null.
Throws:
RiceIllegalArgumentException

translateTypeAttribute

public RemotableAttributeField translateTypeAttribute(KrmsTypeAttribute inputAttribute,
                                                      KrmsAttributeDefinition attributeDefinition)
Translate a KrmsTypeAttribute into a RemotableAttributeField. Override this method to provide custom translation of certain attributes.

Parameters:
inputAttribute - the KrmsTypeAttribute to translate
attributeDefinition - the KrmsAttributeDefinition for the given inputAttribute
Returns:
a RemotableAttributeField for the given inputAttribute

getDataDictionaryRemoteFieldService

public DataDictionaryRemoteFieldService getDataDictionaryRemoteFieldService()
Overrides:
getDataDictionaryRemoteFieldService in class AttributeValidatingTypeServiceBase

validateNonDataDictionaryAttribute

protected List<RemotableAttributeError> validateNonDataDictionaryAttribute(RemotableAttributeField attr,
                                                                           String key,
                                                                           String value)
Description copied from class: AttributeValidatingTypeServiceBase
Validates an attribute that is *not* mapped to a data dictionary component via AttributeValidatingTypeServiceBase.TypeAttributeDefinition.componentName and AttributeValidatingTypeServiceBase.TypeAttributeDefinition.name.

Specified by:
validateNonDataDictionaryAttribute in class AttributeValidatingTypeServiceBase
Parameters:
attr - the RemotableAttributeField for which to validate.
key - the attribute name
value - the attribute value
Returns:
a List of RemotableAttributeErrors with fully resolved error messages (not error keys). May return null or an empty List if no errors are encountered.


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