canguru.descriptor
Class Descriptor

java.lang.Object
  |
  +--canguru.descriptor.Descriptor

public class Descriptor
extends java.lang.Object

Classe com definições para persistência de determinada entidade


Field Summary
private  java.util.Map elements
           
private  java.util.Map entityDefinition
           
private  java.lang.String entityName
           
private  Filtered filtered
           
private  ProxyDB proxyDB
           
 
Constructor Summary
Descriptor(java.lang.String entityName)
          Cria um descriptor definindo a entidade a ser tratada
 
Method Summary
 void addAttribute(java.lang.Long elementId, java.lang.String attributeName, java.lang.Long attributeId, java.lang.Object attributeValue)
          Adiciona um atributo a um elemento
 void addAttributeDefinition(java.lang.String attributeName, java.lang.Class javaType)
          Adiciona um atributo ao Map com a definição dos atributos a serem salvos
 void addElement(java.lang.Long id)
          Adiciona um elemento ao descriptor
 void addFilter(java.lang.String attributeName, java.lang.Object attributeValue)
           
 void addSerializedForm(java.lang.Long elementId, byte[] serializedForm)
          Registra forma serializada do elemento
 AttributeType getAttributeType(java.lang.String attributeName)
          Retorna o tipo de um atributo
 Element getElement(java.lang.Long id)
          Retorna o elemento com o id informado
 java.util.Map getElements()
          Retorna o Map com os elementos a serem salvos no formato (idElemento, elemento)
 java.util.Map getEntityDefinition()
          Retorna o Map com a definição dos atributos a serem salvos no formato (nomeAtributo, tipoAtributo)
 java.lang.String getEntityName()
          Retorna o nome da entidade a ser tratada
 Filtered getFiltered()
           
 ProxyDB getProxyDB()
           
 void load()
          Carrega todos os elementos no banco de dados no Map de elementos
 void loadFiltered()
           
 void removeAllElements()
          Remove todos os elementos do descriptor
 void removeFiltered()
           
 void save()
          Salva todos os elementos no banco de dados e limpa Map de elementos
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

elements

private java.util.Map elements

entityDefinition

private java.util.Map entityDefinition

entityName

private java.lang.String entityName

filtered

private Filtered filtered

proxyDB

private ProxyDB proxyDB
Constructor Detail

Descriptor

public Descriptor(java.lang.String entityName)
Cria um descriptor definindo a entidade a ser tratada

Parameters:
entityName - nome da entidade
Method Detail

addAttribute

public void addAttribute(java.lang.Long elementId,
                         java.lang.String attributeName,
                         java.lang.Long attributeId,
                         java.lang.Object attributeValue)
                  throws ElementNotFoundException,
                         AttributeDefinitionNotFoundException,
                         InvalidNameException,
                         InvalidAttributeException
Adiciona um atributo a um elemento

Parameters:
elementId - id do elemento
Throws:
ElementNotFoundException
AttributeDefinitionNotFoundException
InvalidNameException
InvalidAttributeException

addAttributeDefinition

public void addAttributeDefinition(java.lang.String attributeName,
                                   java.lang.Class javaType)
                            throws InvalidNameException,
                                   InvalidOperationException
Adiciona um atributo ao Map com a definição dos atributos a serem salvos

Parameters:
attributeName - Nome do atributo
javaType - Classe java do atributo
Throws:
InvalidNameException
InvalidOperationException

addElement

public void addElement(java.lang.Long id)
Adiciona um elemento ao descriptor


addFilter

public void addFilter(java.lang.String attributeName,
                      java.lang.Object attributeValue)
               throws AttributeDefinitionNotFoundException,
                      InvalidNameException,
                      InvalidAttributeException
AttributeDefinitionNotFoundException
InvalidNameException
InvalidAttributeException

addSerializedForm

public void addSerializedForm(java.lang.Long elementId,
                              byte[] serializedForm)
                       throws ElementNotFoundException
Registra forma serializada do elemento

Parameters:
elementId - id do elemento
serializedForm - forma serializada do elemento
Throws:
ElementNotFoundException

getAttributeType

public AttributeType getAttributeType(java.lang.String attributeName)
                               throws AttributeNotFoundException
Retorna o tipo de um atributo

Parameters:
attributeName - Nome do atributo
Returns:
tipo do atributo
AttributeNotFoundException

getElement

public Element getElement(java.lang.Long id)
                   throws ElementNotFoundException
Retorna o elemento com o id informado

Returns:
elemento
Throws:
ElementNotFoundException

getElements

public java.util.Map getElements()
Retorna o Map com os elementos a serem salvos no formato (idElemento, elemento)

Returns:
elements mapa com os elementos

getEntityDefinition

public java.util.Map getEntityDefinition()
Retorna o Map com a definição dos atributos a serem salvos no formato (nomeAtributo, tipoAtributo)

Returns:
entityDefinition mapa com definições

getEntityName

public java.lang.String getEntityName()
Retorna o nome da entidade a ser tratada

Returns:
entityName nome da entidade

getFiltered

public Filtered getFiltered()

getProxyDB

public ProxyDB getProxyDB()
                   throws java.lang.ClassNotFoundException,
                          java.sql.SQLException,
                          java.io.IOException
java.lang.ClassNotFoundException
java.sql.SQLException
java.io.IOException

load

public void load()
          throws java.lang.ClassNotFoundException,
                 java.sql.SQLException,
                 java.io.IOException
Carrega todos os elementos no banco de dados no Map de elementos

java.lang.ClassNotFoundException
java.sql.SQLException
java.io.IOException

loadFiltered

public void loadFiltered()
                  throws java.lang.ClassNotFoundException,
                         java.io.IOException,
                         java.sql.SQLException,
                         ElementNotFoundException
java.lang.ClassNotFoundException
java.io.IOException
java.sql.SQLException
ElementNotFoundException

removeAllElements

public void removeAllElements()
Remove todos os elementos do descriptor


removeFiltered

public void removeFiltered()

save

public void save()
          throws java.lang.ClassNotFoundException,
                 java.sql.SQLException,
                 java.io.IOException
Salva todos os elementos no banco de dados e limpa Map de elementos

java.lang.ClassNotFoundException
java.sql.SQLException
java.io.IOException