org.kuali.rice.krms.impl.repository
Interface KrmsAttributeDefinitionService

All Known Implementing Classes:
KrmsAttributeDefinitionServiceImpl

public interface KrmsAttributeDefinitionService


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.
 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.
 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
 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 updateAttributeDefinition(KrmsAttributeDefinition attributeDefinition)
          This will update a KrmsAttributeDefinition.
 

Method Detail

createAttributeDefinition

KrmsAttributeDefinition createAttributeDefinition(KrmsAttributeDefinition attributeDefinition)
This will create a KrmsAttributeDefinition exactly like the parameter passed in.

Parameters:
attributeDefinition - - KrmsAttributeDefinition
Throws:
IllegalArgumentException - if the attribute definition is null
IllegalStateException - if the attribute definition already exists in the system

updateAttributeDefinition

void updateAttributeDefinition(KrmsAttributeDefinition attributeDefinition)
This will update a KrmsAttributeDefinition.

Parameters:
attributeDefinition - - KrmsAttributeDefinition
Throws:
IllegalArgumentException - if the attribute definition is null
IllegalStateException - if the attribute definition does not exist in the system

getAttributeDefinitionById

KrmsAttributeDefinition getAttributeDefinitionById(String id)
Lookup a KrmsAttributeDefinition based on the given id.

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

KrmsAttributeDefinition getAttributeDefinitionByNameAndNamespace(String name,
                                                                 String namespace)
Get a KrmsAttributeDefinition object based on name and namespace

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.
Throws:
IllegalStateException - if multiple KrmsAttributeDefinitions exist with the same name and namespace

findAttributeDefinitionsByNamespace

List<KrmsAttributeDefinition> findAttributeDefinitionsByNamespace(String namespace)
Returns all KrmsAttributeDefinition that for a given namespace.

Returns:
all KrmsAttributeDefinition for a namespace

findAllAttributeDefinitions

List<KrmsAttributeDefinition> findAllAttributeDefinitions()
Returns all KrmsAttributeDefinitions

Returns:
all KrmsAttributeDefinitions

convertAttributeKeys

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.

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.

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

String getKrmsAttributeId(String attributeName,
                          String namespace)
This method gets the attribute definition ID for a given attribute

Parameters:
attributeName - - the name of the attribute
namespace - - the namespace code of the attribute
Returns:
- the attribute definition id

getKrmsAttributeBo

org.kuali.rice.krms.impl.repository.KrmsAttributeDefinitionBo getKrmsAttributeBo(String attributeName,
                                                                                 String namespace)
This method gets a KrmsAttributeDefinitionBo object for a given attribute.

Parameters:
attributeName - - the name of the attribute
namespace - - the namespace code of the attribute
Returns:
- the attribute definition id

clearCache

void clearCache()
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.



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