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

All Known Implementing Classes:
KrmsAttributeDefinitionServiceImpl

public interface KrmsAttributeDefinitionService


Method Summary
 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.
 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
 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

@CacheEvict(value="http://rice.kuali.org/krms/v2_0/KrmsAttributionDefinitionType",
            allEntries=true)
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

@CacheEvict(value="http://rice.kuali.org/krms/v2_0/KrmsAttributionDefinitionType",
            allEntries=true)
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

@Cacheable(value="http://rice.kuali.org/krms/v2_0/KrmsAttributionDefinitionType",
           key="\'attributeDefinitionId=\' + #p0")
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

@Cacheable(value="http://rice.kuali.org/krms/v2_0/KrmsAttributionDefinitionType",
           key="\'namespaceCode=\' + #p0 + \'|\' + \'name=\' + #p1")
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

@Cacheable(value="http://rice.kuali.org/krms/v2_0/KrmsAttributionDefinitionType",
           key="\'namespace=\' + #p0")
List<KrmsAttributeDefinition> findAttributeDefinitionsByNamespace(String namespace)
Returns all KrmsAttributeDefinition that for a given namespace.

Returns:
all KrmsAttributeDefinition for a namespace

findAttributeDefinitionsByType

@Cacheable(value="http://rice.kuali.org/krms/v2_0/KrmsAttributionDefinitionType",
           key="\'typeId=\' + #p0")
List<KrmsAttributeDefinition> findAttributeDefinitionsByType(String typeId)
Returns all KrmsAttributeDefinition that for a given type.

Returns:
all KrmsAttributeDefinition for a type. May be empty, will not be null;

findAllAttributeDefinitions

@Cacheable(value="http://rice.kuali.org/krms/v2_0/KrmsAttributionDefinitionType",
           key="\'all\'")
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

@Cacheable(value="http://rice.kuali.org/krms/v2_0/KrmsAttributionDefinitionType",
           key="\'{ID}namespaceCode=\' + #p0 + \'|\' + \'name=\' + #p1")
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


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