it.biobytes.ammentos
Class Metadata

java.lang.Object
  extended by it.biobytes.ammentos.Metadata

public class Metadata
extends java.lang.Object

Contains metadata information about an Entity

Author:
Davide Deidda

Constructor Summary
Metadata(java.lang.Class c)
           
 
Method Summary
 void addField(Field field)
           
protected  java.util.Iterator<java.lang.String> fieldNamesIterator()
           
protected  java.util.Iterator fieldsIterator()
           
 java.lang.String getCollectiveName()
           
 Field getField(java.lang.String fieldName)
           
 java.lang.String[] getFieldNames()
           
 Field[] getFields()
           
 Field[] getInsertableFields()
          Returns the list of insertable fields in the object, which are not external nor dynamic fields.
 Field[] getLoadableFields()
          Returns the list of loadable fields, which are not dynamic fields.
 Persistor getPersistor()
           
 Field getPrimaryKeyField()
          Gets the primary key field for this persistent object, if it has one.
 java.lang.String getSourceDomain()
          Returns the source table.The source table is the table where the items of this class are loaded.
 Field getSuperKeyField()
          Returns the field containing the primary key of the super class.
 java.lang.String getTargetDomain()
          Returns the target table.
 Field[] getUpdatableFields()
          Returns the list of updatable fields in the object, which are not external nor dynamic nor automatic fields.
 Validator getValidator()
           
 Field[] getVisibleFields()
           
 java.lang.Class[] inheritancePath()
          Returns the inheritance path for the objects of the persistence class.
 boolean isCreatingSupported()
           
 boolean isDeletingSupported()
           
 boolean isEditingSupported()
           
 void setCollectiveName(java.lang.String string)
           
 void setCreatingSupported(boolean supported)
           
 void setDeletingSupported(boolean supported)
           
 void setEditingSupported(boolean supported)
           
 void setFieldVisible(java.lang.String fieldName, boolean visible)
          Sets the visibility for the field "fieldName"
 void setPersistenceMode(PersistenceMode mode)
           
 void setPrimaryKey(java.lang.String fieldName, boolean isExternallyGenerated)
          Sets the field "fieldName" as the primary key field.
 void setSourceDomain(java.lang.String sourceDomain)
          Sets the source table.
 void setSuperKey(java.lang.String fieldName)
          Sets the field which contains the primary key of the superclass.
 void setTargetDomain(java.lang.String targetDomain)
          Sets the target table.
 void setValidator(Validator validator)
          Adds a validator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Metadata

public Metadata(java.lang.Class c)
Method Detail

addField

public void addField(Field field)

getInsertableFields

public Field[] getInsertableFields()
Returns the list of insertable fields in the object, which are not external nor dynamic fields.


getUpdatableFields

public Field[] getUpdatableFields()
Returns the list of updatable fields in the object, which are not external nor dynamic nor automatic fields.


getLoadableFields

public Field[] getLoadableFields()
Returns the list of loadable fields, which are not dynamic fields.

Returns:

setFieldVisible

public void setFieldVisible(java.lang.String fieldName,
                            boolean visible)
Sets the visibility for the field "fieldName"


getFields

public Field[] getFields()

getVisibleFields

public Field[] getVisibleFields()

getFieldNames

public java.lang.String[] getFieldNames()

getField

public Field getField(java.lang.String fieldName)

setEditingSupported

public void setEditingSupported(boolean supported)

setDeletingSupported

public void setDeletingSupported(boolean supported)

setCreatingSupported

public void setCreatingSupported(boolean supported)

isEditingSupported

public boolean isEditingSupported()

isDeletingSupported

public boolean isDeletingSupported()

isCreatingSupported

public boolean isCreatingSupported()

fieldsIterator

protected java.util.Iterator fieldsIterator()

fieldNamesIterator

protected java.util.Iterator<java.lang.String> fieldNamesIterator()

setValidator

public void setValidator(Validator validator)
Adds a validator


getValidator

public Validator getValidator()

getSourceDomain

public java.lang.String getSourceDomain()
Returns the source table.The source table is the table where the items of this class are loaded. It can be different from the target table, which is instead the table where the items are saved. This difference is allowed to support composed items which are for example the result of a join of more tables. In this case the application must know where exactly to save items.


setSourceDomain

public void setSourceDomain(java.lang.String sourceDomain)
Sets the source table. The source table is the table where the items of this class are loaded. It can be different from the target table, which is instead the table where the items are saved. This difference is allowed to support composed items which are for example the result of a join of different tables. In this case the application must know where exactly save items.


setTargetDomain

public void setTargetDomain(java.lang.String targetDomain)
Sets the target table. The target table is the table where the items are saved. Normally the target table and the source table are the same. They can be made different to support special cases (for example when an item is loaded from a join of several tables or from a view). WARNING: If the source table and the target table are different you must pay attention that all the updatable item fields are contained into the target table.


getTargetDomain

public java.lang.String getTargetDomain()
Returns the target table.


setPrimaryKey

public void setPrimaryKey(java.lang.String fieldName,
                          boolean isExternallyGenerated)
Sets the field "fieldName" as the primary key field. A primary key field is mandatory for update operations

Parameters:
fieldName - The name of the field to use as primary key
isExternallyGenerated - Indicates if the generation of the primary key value is externally managed ( f.e. from a database sequence )

setSuperKey

public void setSuperKey(java.lang.String fieldName)
Sets the field which contains the primary key of the superclass. By default this field is the same as the primary key, what means that the annotated class has the same primary key as the parent class


getPrimaryKeyField

public Field getPrimaryKeyField()
Gets the primary key field for this persistent object, if it has one.


getSuperKeyField

public Field getSuperKeyField()
Returns the field containing the primary key of the super class. If not differently specified this field will be the same as the primary key field, what means that this class will have the same primary key as its superclass.


setCollectiveName

public void setCollectiveName(java.lang.String string)
Parameters:
string -

getCollectiveName

public java.lang.String getCollectiveName()
Returns:

setPersistenceMode

public void setPersistenceMode(PersistenceMode mode)

getPersistor

public Persistor getPersistor()

inheritancePath

public java.lang.Class[] inheritancePath()
Returns the inheritance path for the objects of the persistence class. The path starts from the class which owns this Metadata to Object, including only persistent casses (classes whith related metadata)