org.kuali.rice.krms.impl.repository
Class KrmsAttributeDefinitionServiceImpl

java.lang.Object
  extended by org.kuali.rice.krms.impl.repository.KrmsAttributeDefinitionServiceImpl
All Implemented Interfaces:
KrmsAttributeDefinitionService

public final class KrmsAttributeDefinitionServiceImpl
extends Object
implements KrmsAttributeDefinitionService


Constructor Summary
KrmsAttributeDefinitionServiceImpl()
           
 
Method Summary
 void clearCache()
          This method clears the cache of AttributeDefinitionBo objects.
 Map<String,String> convertAttributeKeys(Map<String,String> attributesByName, String namespace)
          This method converts a collection of name/value attribute pairs to id/value attribute pairs.
 List<KrmsAttributeDefinition> convertListOfBosToImmutables(Collection<org.kuali.rice.krms.impl.repository.KrmsAttributeDefinitionBo> krmsAttributeDefinitionBos)
          Converts a List to an Unmodifiable List
 KrmsAttributeDefinition createAttributeDefinition(KrmsAttributeDefinition attributeDefinition)
          This will create a KrmsAttributeDefinition exactly like the parameter passed in.
 List<KrmsAttributeDefinition> findAllAttributeDefinitions()
          Returns all KrmsAttributeDefinitions
 List<KrmsAttributeDefinition> findAttributeDefinitionsByNamespace(String namespace)
          Returns all KrmsAttributeDefinition that for a given namespace.
 List<KrmsAttributeDefinition> findAttributeDefinitionsByType(String typeId)
          Returns all KrmsAttributeDefinition that for a given type.
 KrmsAttributeDefinition getAttributeDefinitionById(String id)
          Lookup a KrmsAttributeDefinition based on the given id.
 KrmsAttributeDefinition getAttributeDefinitionByNameAndNamespace(String name, String namespace)
          Get a KrmsAttributeDefinition object based on name and namespace
protected  BusinessObjectService getBusinessObjectService()
          This method returns a reference to the businessObjectService.
protected  CriteriaLookupService getCriteriaLookupService()
           
 org.kuali.rice.krms.impl.repository.KrmsAttributeDefinitionBo getKrmsAttributeBo(String attributeName, String namespace)
          This method gets a KrmsAttributeDefinitionBo object for a given attribute.
 String getKrmsAttributeId(String attributeName, String namespace)
          This method gets the attribute definition ID for a given attribute
 void setBusinessObjectService(BusinessObjectService businessObjectService)
          Sets the businessObjectService attribute value.
 void setCriteriaLookupService(CriteriaLookupService criteriaLookupService)
          Sets the criteriaLookupService attribute value.
 void updateAttributeDefinition(KrmsAttributeDefinition attributeDefinition)
          This will update a KrmsAttributeDefinition.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KrmsAttributeDefinitionServiceImpl

public KrmsAttributeDefinitionServiceImpl()
Method Detail

convertAttributeKeys

public Map<String,String> convertAttributeKeys(Map<String,String> attributesByName,
                                               String namespace)
Description copied from interface: KrmsAttributeDefinitionService
This method converts a collection of name/value attribute pairs to id/value attribute pairs.

At the api layer, attributes are represented as name/value pairs. However, in the database, the names of the attribute and the values are stored separately. The attribute definitions contain the attribute names. All defined attributes(for the various krms entity types) are stored together in a single table. The attribute values themselves are stored in separate tables for each entity type, and then reference the attribute definitions by the attribute definition id.

This method converts the name/value pairs to id/value pairs so they can be searched from a single table. This simplifies the queries for attributes.

Specified by:
convertAttributeKeys in interface KrmsAttributeDefinitionService
Parameters:
attributesByName - - a Map containing the name/value pairs for the set of attributes.
namespace - - the namespace code of the set of attributes
Returns:
a Map containing the id/value pairs for the set of attributes.

getKrmsAttributeId

public String getKrmsAttributeId(String attributeName,
                                 String namespace)
Description copied from interface: KrmsAttributeDefinitionService
This method gets the attribute definition ID for a given attribute

Specified by:
getKrmsAttributeId in interface KrmsAttributeDefinitionService
Parameters:
attributeName - - the name of the attribute
namespace - - the namespace code of the attribute
Returns:
- the attribute definition id

getKrmsAttributeBo

public org.kuali.rice.krms.impl.repository.KrmsAttributeDefinitionBo getKrmsAttributeBo(String attributeName,
                                                                                        String namespace)
Description copied from interface: KrmsAttributeDefinitionService
This method gets a KrmsAttributeDefinitionBo object for a given attribute.

Specified by:
getKrmsAttributeBo in interface KrmsAttributeDefinitionService
Parameters:
attributeName - - the name of the attribute
namespace - - the namespace code of the attribute
Returns:
- the attribute definition id

createAttributeDefinition

public KrmsAttributeDefinition createAttributeDefinition(KrmsAttributeDefinition attributeDefinition)
Description copied from interface: KrmsAttributeDefinitionService
This will create a KrmsAttributeDefinition exactly like the parameter passed in.

Specified by:
createAttributeDefinition in interface KrmsAttributeDefinitionService
Parameters:
attributeDefinition - - KrmsAttributeDefinition

updateAttributeDefinition

public void updateAttributeDefinition(KrmsAttributeDefinition attributeDefinition)
Description copied from interface: KrmsAttributeDefinitionService
This will update a KrmsAttributeDefinition.

Specified by:
updateAttributeDefinition in interface KrmsAttributeDefinitionService
Parameters:
attributeDefinition - - KrmsAttributeDefinition

getAttributeDefinitionById

public KrmsAttributeDefinition getAttributeDefinitionById(String id)
Description copied from interface: KrmsAttributeDefinitionService
Lookup a KrmsAttributeDefinition based on the given id.

Specified by:
getAttributeDefinitionById in interface KrmsAttributeDefinitionService
Parameters:
id - the given KrmsAttributeDefinition id
Returns:
a KrmsAttributeDefinition object with the given id. A null reference is returned if an invalid or non-existant id is supplied.

getAttributeDefinitionByNameAndNamespace

public KrmsAttributeDefinition getAttributeDefinitionByNameAndNamespace(String name,
                                                                        String namespace)
Description copied from interface: KrmsAttributeDefinitionService
Get a KrmsAttributeDefinition object based on name and namespace

Specified by:
getAttributeDefinitionByNameAndNamespace in interface KrmsAttributeDefinitionService
Parameters:
name - the given name
namespace - the given type namespace
Returns:
A KrmsAttributeDefinition object with the given namespace and name if one with that name and namespace exists. Otherwise, null is returned.

findAttributeDefinitionsByNamespace

public List<KrmsAttributeDefinition> findAttributeDefinitionsByNamespace(String namespace)
Description copied from interface: KrmsAttributeDefinitionService
Returns all KrmsAttributeDefinition that for a given namespace.

Specified by:
findAttributeDefinitionsByNamespace in interface KrmsAttributeDefinitionService
Returns:
all KrmsAttributeDefinition for a namespace

findAttributeDefinitionsByType

public List<KrmsAttributeDefinition> findAttributeDefinitionsByType(String typeId)
Description copied from interface: KrmsAttributeDefinitionService
Returns all KrmsAttributeDefinition that for a given type.

Specified by:
findAttributeDefinitionsByType in interface KrmsAttributeDefinitionService
Returns:
all KrmsAttributeDefinition for a type. May be empty, will not be null;

findAllAttributeDefinitions

public List<KrmsAttributeDefinition> findAllAttributeDefinitions()
Description copied from interface: KrmsAttributeDefinitionService
Returns all KrmsAttributeDefinitions

Specified by:
findAllAttributeDefinitions in interface KrmsAttributeDefinitionService
Returns:
all KrmsAttributeDefinitions

setBusinessObjectService

public void setBusinessObjectService(BusinessObjectService businessObjectService)
Sets the businessObjectService attribute value.

Parameters:
businessObjectService - The businessObjectService to set.

getBusinessObjectService

protected BusinessObjectService getBusinessObjectService()
This method returns a reference to the businessObjectService. If the businessObjectService is not set, get it from the KRADServiceLocator.

Returns:
businessObjectService

convertListOfBosToImmutables

public List<KrmsAttributeDefinition> convertListOfBosToImmutables(Collection<org.kuali.rice.krms.impl.repository.KrmsAttributeDefinitionBo> krmsAttributeDefinitionBos)
Converts a List to an Unmodifiable List

Parameters:
krmsAttributeDefinitionBos - a mutable List to made completely immutable.
Returns:
An unmodifiable List

clearCache

public void clearCache()
Description copied from interface: KrmsAttributeDefinitionService
This method clears the cache of AttributeDefinitionBo objects.

Since searching for attribute definitions is a common operation, the attribute definitions fetched from the database are cached to improve performance.

Specified by:
clearCache in interface KrmsAttributeDefinitionService

setCriteriaLookupService

public void setCriteriaLookupService(CriteriaLookupService criteriaLookupService)
Sets the criteriaLookupService attribute value.

Parameters:
criteriaLookupService - The criteriaLookupService to set.

getCriteriaLookupService

protected CriteriaLookupService getCriteriaLookupService()


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