org.kuali.rice.kns.workflow.service.impl
Class WorkflowAttributePropertyResolutionServiceImpl

java.lang.Object
  extended by org.kuali.rice.kns.workflow.service.impl.WorkflowAttributePropertyResolutionServiceImpl
All Implemented Interfaces:
WorkflowAttributePropertyResolutionService

public class WorkflowAttributePropertyResolutionServiceImpl
extends Object
implements WorkflowAttributePropertyResolutionService

The default implementation of the WorkflowAttributePropertyResolutionServiceImpl

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

Constructor Summary
WorkflowAttributePropertyResolutionServiceImpl()
           
 
Method Summary
protected  List<Object> aardvarkSearchValuesForPaths(Document document, List<String> paths)
          Pulls values as objects from the document for the given paths
protected  List<DocumentAttribute> aardvarkValuesForSearchingTypeDefinition(Document document, SearchingTypeDefinition searchingTypeDefinition)
          Pulls SearchableAttributeValue values from the given document for the given searchingTypeDefinition
protected  void addPathValuesToQualifier(Object businessObject, List<String> paths, org.kuali.rice.kns.workflow.service.impl.WorkflowAttributePropertyResolutionServiceImpl.RoutingAttributeTracker routingAttributes, Map<String,String> qualifier)
          Aardvarks values out of a business object and puts them into an Map, based on a List of paths
 DocumentAttribute buildSearchableAttribute(Class<? extends BusinessObject> businessObjectClass, String attributeKey, Object value)
          Using the type of the sent in value, determines what kind of SearchableAttributeValue implementation should be passed back
protected  DocumentAttributeDateTime buildSearchableDateTimeAttribute(String attributeKey, Object value)
          Builds a date time SearchableAttributeValue for the given key and value
protected  DocumentAttributeInteger buildSearchableFixnumAttribute(String attributeKey, Object value)
          Builds a "integer" SearchableAttributeValue for the given key and value
protected  DocumentAttributeDecimal buildSearchableRealAttribute(String attributeKey, Object value)
          Builds a "float" SearchableAttributeValue for the given key and value
protected  DocumentAttributeString buildSearchableStringAttribute(String attributeKey, Object value)
          Our last ditch attempt, this builds a String SearchableAttributeValue for the given key and value
protected  DocumentAttributeString buildSearchableYesNoAttribute(String attributeKey, Object value)
          This builds a String SearchableAttributeValue for the given key and value, correctly correlating booleans
protected  List<Map<String,String>> cleanCollectionQualifiers(List<Map<String,String>> qualifiers)
          Removes empty Maps from the given List of qualifiers
protected  void copyQualifications(Map<String,String> source, Map<String,String> target)
          Copies all the values from one qualifier to another
 String determineFieldDataType(Class<? extends BusinessObject> businessObjectClass, String attributeName)
          Determines the type of the field which is related to the given attribute name on instances of the given business object class
protected  void flatAdd(Collection c, Object o)
          Convenience method which makes sure that if the given object is a collection, it is added to the given collection flatly
protected  BusinessObjectMetaDataService getBusinessObjectMetaDataService()
           
protected  Collection getCollectionByPath(BusinessObject businessObject, String collectionPath)
          Returns a collection from a path on a business object
 PersistenceStructureService getPersistenceStructureService()
          Gets the persistenceStructureService attribute.
 Object getPropertyByPath(Object object, String path)
          Retrieves an object, the child of another given object passed in as a parameter, by the given path
 Collection getPropertyOfCollectionByPath(Collection collection, String path)
          Finds a child object, specified by the given path, on each object of the given collection
protected  String[] headAndTailPath(String path)
          Splits the first property off from a path, leaving the tail
 Collection makeNewCollectionOfSameType(Collection collection)
          Makes a new collection of exactly the same type of the collection that was handed to it
protected  List<Map<String,String>> resolveDocumentCollectionPath(BusinessObject businessObject, DocumentCollectionPath collectionPath, org.kuali.rice.kns.workflow.service.impl.WorkflowAttributePropertyResolutionServiceImpl.RoutingAttributeTracker routingAttributeTracker)
          Resolves document values from a collection path on a given business object
protected  List<Map<String,String>> resolveDocumentValuePath(BusinessObject businessObject, DocumentValuePathGroup group, org.kuali.rice.kns.workflow.service.impl.WorkflowAttributePropertyResolutionServiceImpl.RoutingAttributeTracker routingAttributeTracker)
          Resolves all of the values in the given DocumentValuePathGroup from the given BusinessObject
 List<Map<String,String>> resolveRoutingTypeQualifiers(Document document, RoutingTypeDefinition routingTypeDefinition)
          Using the proper RoutingTypeDefinition for the current routing node of the document, aardvarks out the proper routing type qualifiers
 List<DocumentAttribute> resolveSearchableAttributeValues(Document document, WorkflowAttributes workflowAttributes)
          Resolves all of the searching values to index for the given document, returning a list of SearchableAttributeValue implementations
 void setPersistenceStructureService(PersistenceStructureService persistenceStructureService)
          Sets the persistenceStructureService attribute value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WorkflowAttributePropertyResolutionServiceImpl

public WorkflowAttributePropertyResolutionServiceImpl()
Method Detail

resolveRoutingTypeQualifiers

public List<Map<String,String>> resolveRoutingTypeQualifiers(Document document,
                                                             RoutingTypeDefinition routingTypeDefinition)
Using the proper RoutingTypeDefinition for the current routing node of the document, aardvarks out the proper routing type qualifiers

Specified by:
resolveRoutingTypeQualifiers in interface WorkflowAttributePropertyResolutionService
Parameters:
document - the document to gather data from
Returns:
a List of populated Map data

resolveDocumentValuePath

protected List<Map<String,String>> resolveDocumentValuePath(BusinessObject businessObject,
                                                            DocumentValuePathGroup group,
                                                            org.kuali.rice.kns.workflow.service.impl.WorkflowAttributePropertyResolutionServiceImpl.RoutingAttributeTracker routingAttributeTracker)
Resolves all of the values in the given DocumentValuePathGroup from the given BusinessObject

Parameters:
businessObject - the business object which is the source of values
group - the DocumentValuePathGroup which tells us which values we want
Returns:
a List of Maps

resolveDocumentCollectionPath

protected List<Map<String,String>> resolveDocumentCollectionPath(BusinessObject businessObject,
                                                                 DocumentCollectionPath collectionPath,
                                                                 org.kuali.rice.kns.workflow.service.impl.WorkflowAttributePropertyResolutionServiceImpl.RoutingAttributeTracker routingAttributeTracker)
Resolves document values from a collection path on a given business object

Parameters:
businessObject - the business object which has a collection, each element of which is a source of values
collectionPath - the information about what values to pull from each element of the collection
Returns:
a List of Maps

getCollectionByPath

protected Collection getCollectionByPath(BusinessObject businessObject,
                                         String collectionPath)
Returns a collection from a path on a business object

Parameters:
businessObject - the business object to get values from
collectionPath - the path to that collection
Returns:
hopefully, a collection of objects

addPathValuesToQualifier

protected void addPathValuesToQualifier(Object businessObject,
                                        List<String> paths,
                                        org.kuali.rice.kns.workflow.service.impl.WorkflowAttributePropertyResolutionServiceImpl.RoutingAttributeTracker routingAttributes,
                                        Map<String,String> qualifier)
Aardvarks values out of a business object and puts them into an Map, based on a List of paths

Parameters:
businessObject - the business object to get values from
paths - the paths of values to get from the qualifier
routingAttributes - the RoutingAttribute associated with this qualifier's document value
qualifier - the qualifier to put values into

copyQualifications

protected void copyQualifications(Map<String,String> source,
                                  Map<String,String> target)
Copies all the values from one qualifier to another

Parameters:
source - the source of values
target - the place to write all the values to

resolveSearchableAttributeValues

public List<DocumentAttribute> resolveSearchableAttributeValues(Document document,
                                                                WorkflowAttributes workflowAttributes)
Resolves all of the searching values to index for the given document, returning a list of SearchableAttributeValue implementations

Specified by:
resolveSearchableAttributeValues in interface WorkflowAttributePropertyResolutionService
Parameters:
document - the document to find indexable searchable attribute values for
workflowAttributes - the WorkflowAttributes data dictionary metadata which contains the searchable attributes to index
Returns:
a List of SearchableAttributeValue objects for index

aardvarkValuesForSearchingTypeDefinition

protected List<DocumentAttribute> aardvarkValuesForSearchingTypeDefinition(Document document,
                                                                           SearchingTypeDefinition searchingTypeDefinition)
Pulls SearchableAttributeValue values from the given document for the given searchingTypeDefinition

Parameters:
document - the document to get search values from
searchingTypeDefinition - the current SearchingTypeDefinition to find values for
Returns:
a List of SearchableAttributeValue implementations

aardvarkSearchValuesForPaths

protected List<Object> aardvarkSearchValuesForPaths(Document document,
                                                    List<String> paths)
Pulls values as objects from the document for the given paths

Parameters:
document - the document to pull values from
paths - the property paths to pull values
Returns:
a List of values as Objects

cleanCollectionQualifiers

protected List<Map<String,String>> cleanCollectionQualifiers(List<Map<String,String>> qualifiers)
Removes empty Maps from the given List of qualifiers

Parameters:
qualifiers - a List of Maps holding qualifiers for responsibilities
Returns:
a cleaned up list of qualifiers

determineFieldDataType

public String determineFieldDataType(Class<? extends BusinessObject> businessObjectClass,
                                     String attributeName)
Description copied from interface: WorkflowAttributePropertyResolutionService
Determines the type of the field which is related to the given attribute name on instances of the given business object class

Specified by:
determineFieldDataType in interface WorkflowAttributePropertyResolutionService
Parameters:
businessObjectClass - the class of the business object which has an attribute
attributeName - the name of the attribute
Returns:
the String constrant representing what Field#fieldDataType this represents

buildSearchableAttribute

public DocumentAttribute buildSearchableAttribute(Class<? extends BusinessObject> businessObjectClass,
                                                  String attributeKey,
                                                  Object value)
Using the type of the sent in value, determines what kind of SearchableAttributeValue implementation should be passed back

Specified by:
buildSearchableAttribute in interface WorkflowAttributePropertyResolutionService
Parameters:
attributeKey -
value -
Returns:

buildSearchableDateTimeAttribute

protected DocumentAttributeDateTime buildSearchableDateTimeAttribute(String attributeKey,
                                                                     Object value)
Builds a date time SearchableAttributeValue for the given key and value

Parameters:
attributeKey - the key for the searchable attribute
value - the value that will be coerced to date/time data
Returns:
the generated SearchableAttributeDateTimeValue

buildSearchableRealAttribute

protected DocumentAttributeDecimal buildSearchableRealAttribute(String attributeKey,
                                                                Object value)
Builds a "float" SearchableAttributeValue for the given key and value

Parameters:
attributeKey - the key for the searchable attribute
value - the value that will be coerced to "float" data
Returns:
the generated SearchableAttributeFloatValue

buildSearchableFixnumAttribute

protected DocumentAttributeInteger buildSearchableFixnumAttribute(String attributeKey,
                                                                  Object value)
Builds a "integer" SearchableAttributeValue for the given key and value

Parameters:
attributeKey - the key for the searchable attribute
value - the value that will be coerced to "integer" type data
Returns:
the generated SearchableAttributeLongValue

buildSearchableStringAttribute

protected DocumentAttributeString buildSearchableStringAttribute(String attributeKey,
                                                                 Object value)
Our last ditch attempt, this builds a String SearchableAttributeValue for the given key and value

Parameters:
attributeKey - the key for the searchable attribute
value - the value that will be coerced to a String
Returns:
the generated SearchableAttributeStringValue

buildSearchableYesNoAttribute

protected DocumentAttributeString buildSearchableYesNoAttribute(String attributeKey,
                                                                Object value)
This builds a String SearchableAttributeValue for the given key and value, correctly correlating booleans

Parameters:
attributeKey - the key for the searchable attribute
value - the value that will be coerced to a String
Returns:
the generated SearchableAttributeStringValue

getPropertyByPath

public Object getPropertyByPath(Object object,
                                String path)
Description copied from interface: WorkflowAttributePropertyResolutionService
Retrieves an object, the child of another given object passed in as a parameter, by the given path

Specified by:
getPropertyByPath in interface WorkflowAttributePropertyResolutionService
Parameters:
object - an object to find a child object of
path - the path to that child object
Returns:
the child object

getPropertyOfCollectionByPath

public Collection getPropertyOfCollectionByPath(Collection collection,
                                                String path)
Finds a child object, specified by the given path, on each object of the given collection

Parameters:
collection - the collection of objects
path - the path of the property to retrieve
Returns:
a Collection of the values culled from each child

makeNewCollectionOfSameType

public Collection makeNewCollectionOfSameType(Collection collection)
Makes a new collection of exactly the same type of the collection that was handed to it

Parameters:
collection - the collection to make a new collection of the same type as
Returns:
a new collection. Of the same type.

headAndTailPath

protected String[] headAndTailPath(String path)
Splits the first property off from a path, leaving the tail

Parameters:
path - the path to split
Returns:
an array; if the path is nested, the first element will be the first part of the path up to a "." and second element is the rest of the path while if the path is simple, returns the path as the first element and a null as the second element

flatAdd

protected void flatAdd(Collection c,
                       Object o)
Convenience method which makes sure that if the given object is a collection, it is added to the given collection flatly

Parameters:
c - a collection, ready to be added to
o - an object of dubious type

getPersistenceStructureService

public PersistenceStructureService getPersistenceStructureService()
Gets the persistenceStructureService attribute.

Returns:
Returns the persistenceStructureService.

setPersistenceStructureService

public void setPersistenceStructureService(PersistenceStructureService persistenceStructureService)
Sets the persistenceStructureService attribute value.

Parameters:
persistenceStructureService - The persistenceStructureService to set.

getBusinessObjectMetaDataService

protected BusinessObjectMetaDataService getBusinessObjectMetaDataService()


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