org.makumba.providers.datadefinition.makumba
Class RecordInfo

java.lang.Object
  extended by org.makumba.providers.datadefinition.makumba.RecordInfo
All Implemented Interfaces:
Serializable, DataDefinition, ValidationDefinition
Direct Known Subclasses:
FileRecordInfo

public class RecordInfo
extends Object
implements Serializable, DataDefinition, ValidationDefinition

This is the internal representation of the org.makumba. One can make RecordHandlers based on an instance of this class and do useful things with it (generate sql tables, html code, etc)

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.makumba.DataDefinition
DataDefinition.MultipleUniqueKeyDefinition, DataDefinition.QueryFragmentFunction
 
Field Summary
(package private) static String createName
           
(package private)  Vector<String> fieldOrder
           
(package private)  LinkedHashMap<String,FieldDefinition> fields
           
(package private)  QueryFragmentFunctions functions
           
(package private)  String indexName
           
static int infos
           
(package private)  String mainPtr
           
(package private) static String modifyName
           
(package private)  String name
           
(package private)  URL origin
           
(package private)  RecordInfo papa
           
(package private)  String ptrSubfield
           
(package private)  int relations
           
(package private)  String setField
           
(package private)  String subfield
           
(package private)  String subfieldPtr
           
(package private)  Properties templateValues
           
(package private)  String title
           
protected static String webappRoot
           
 
Constructor Summary
RecordInfo()
           
RecordInfo(RecordInfo ri, String subfield)
           
RecordInfo(String name)
          make a temporary recordInfo that is only used for query results
RecordInfo(URL origin, String path)
           
 
Method Summary
 void addField(FieldDefinition fi)
          only meant for building of temporary types
protected  void addField1(FieldDefinition fi)
           
 void addMultiUniqueKey(DataDefinition.MultipleUniqueKeyDefinition definition)
          Add a multiple-feld uniqueness definition.
 void addRule(String fieldName, Collection<ValidationRule> rules)
          Add several rules for the given field.
 void addRule(String fieldName, ValidationRule rule)
          Add a new rule for the given field.
(package private)  void addStandardFields(String name)
           
 void addValidationRule(ValidationRule rule)
           
 void checkFieldNames(Dictionary<String,Object> d)
          Checks whether all fieldnames exist in the database
 void checkUpdate(String fieldName, Dictionary<String,Object> d)
          Checks whether a record can be updated *
 String fieldPrefix()
          if this is a subtable, the field prefix is maintable-> TODO: see if this method is still needed, can't it be expressed in terms of the DataDefinition interface?
(package private)  String getBaseName()
           
 String getCreationDateFieldName()
          which is the name of the creation timestamp field, if any?
 DataDefinition getDataDefinition()
          Get the data definition associated with this validation definition.
 FieldDefinition getFieldDefinition(int n)
          the field with the respective index, null if such a field doesn't exist
 FieldDefinition getFieldDefinition(String nm)
          returns the field info associated with a name
 Vector<String> getFieldNames()
          returns all the field names
 FieldDefinition getFieldOrPointedFieldDefinition(String nm)
          returns the field info associated with a name
 DataDefinition.QueryFragmentFunction getFunctionOrPointedFunction(String nm)
          returns the field info associated with a name
 QueryFragmentFunctions getFunctions()
          returns all functions in this data definition.
 String getIndexPointerFieldName()
          which is the name of the index field, if any?
 String getLastModificationDateFieldName()
          which is the name of the modification timestamp field, if any?
 DataDefinition.MultipleUniqueKeyDefinition[] getMultiFieldUniqueKeys()
          Get all multiple-feld uniqueness definition.
 String getName()
          returns the path-like abstract-level name of this record info
 URL getOrigin()
           
 FieldDefinition getParentField()
          If this type is the data pointed by a 1-1 pointer or subset, return the type of the main record, otherwise return null
static DataDefinition getRecordInfo(String name)
          returns the record info with the given absolute name
 ArrayList<FieldDefinition> getReferenceFields()
          Gets all the fields that are references to other tables, i.e. pointers and some types of sets.
 String getSetMemberFieldName()
          which is the name of the set member (Pointer, Character or Integer), for set subtables
 String getSetOwnerFieldName()
          which is the name of the pointer to the main table, for set and internal set subtables
static DataDefinition getSimpleRecordInfo(String path)
           
 String getStructure()
           
 String getTitleFieldName()
          the title field indicated, or the default one
 ArrayList<FieldDefinition> getUniqueFields()
          Gets all the fields that have the unique modifier.
 ValidationDefinition getValidationDefinition()
          Get the validation definition associated with this data definition.
 ValidationRule getValidationRule(String ruleName)
          Get the validation rule with the given rule name.
 Collection<ValidationRule> getValidationRules(String fieldName)
          Get all validation rules for the given field name.
 boolean hasMultiUniqueKey(String[] fieldNames)
          Check whether this data definition has a multi-field uniqe key defined with the given fields.
 boolean hasValidationRules()
           
 boolean isTemporary()
          tells whether this data definition was generated temporarily to depict a query result as opposed to being read from an MDD file
 long lastModified()
          Indicates when the data definition was modified the last time
(package private)  RecordInfo makeSubtable(String name)
           
static void setWebappRoot(String s)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

webappRoot

protected static String webappRoot

origin

URL origin

name

String name

templateValues

Properties templateValues

fieldOrder

Vector<String> fieldOrder

functions

QueryFragmentFunctions functions

title

String title

indexName

String indexName

createName

static final String createName
See Also:
Constant Field Values

modifyName

static final String modifyName
See Also:
Constant Field Values

mainPtr

String mainPtr

setField

String setField

relations

int relations

fields

LinkedHashMap<String,FieldDefinition> fields

subfield

String subfield

ptrSubfield

String ptrSubfield

subfieldPtr

String subfieldPtr

papa

RecordInfo papa

infos

public static int infos
Constructor Detail

RecordInfo

RecordInfo()

RecordInfo

public RecordInfo(String name)
make a temporary recordInfo that is only used for query results


RecordInfo

RecordInfo(URL origin,
           String path)

RecordInfo

RecordInfo(RecordInfo ri,
           String subfield)
Method Detail

setWebappRoot

public static void setWebappRoot(String s)

addStandardFields

void addStandardFields(String name)

isTemporary

public boolean isTemporary()
Description copied from interface: DataDefinition
tells whether this data definition was generated temporarily to depict a query result as opposed to being read from an MDD file

Specified by:
isTemporary in interface DataDefinition

addField1

protected void addField1(FieldDefinition fi)

addField

public void addField(FieldDefinition fi)
only meant for building of temporary types

Specified by:
addField in interface DataDefinition

getRecordInfo

public static DataDefinition getRecordInfo(String name)
returns the record info with the given absolute name

Throws:
DataDefinitionNotFoundError - if the name is not a valid record info name
DataDefinitionParseError - if the syntax is wrong or a referred resource can't be found

getSimpleRecordInfo

public static DataDefinition getSimpleRecordInfo(String path)

getFieldNames

public Vector<String> getFieldNames()
returns all the field names

Specified by:
getFieldNames in interface DataDefinition

getReferenceFields

public ArrayList<FieldDefinition> getReferenceFields()
Description copied from interface: DataDefinition
Gets all the fields that are references to other tables, i.e. pointers and some types of sets.

Specified by:
getReferenceFields in interface DataDefinition

getUniqueFields

public ArrayList<FieldDefinition> getUniqueFields()
Description copied from interface: DataDefinition
Gets all the fields that have the unique modifier.

Specified by:
getUniqueFields in interface DataDefinition

getFieldDefinition

public FieldDefinition getFieldDefinition(String nm)
returns the field info associated with a name

Specified by:
getFieldDefinition in interface DataDefinition

getFieldOrPointedFieldDefinition

public FieldDefinition getFieldOrPointedFieldDefinition(String nm)
returns the field info associated with a name

Specified by:
getFieldOrPointedFieldDefinition in interface DataDefinition

getFieldDefinition

public FieldDefinition getFieldDefinition(int n)
the field with the respective index, null if such a field doesn't exist

Specified by:
getFieldDefinition in interface DataDefinition

getName

public String getName()
returns the path-like abstract-level name of this record info

Specified by:
getName in interface DataDefinition
Specified by:
getName in interface ValidationDefinition

getBaseName

String getBaseName()

fieldPrefix

public String fieldPrefix()
if this is a subtable, the field prefix is maintable-> TODO: see if this method is still needed, can't it be expressed in terms of the DataDefinition interface?


makeSubtable

RecordInfo makeSubtable(String name)

getIndexPointerFieldName

public String getIndexPointerFieldName()
which is the name of the index field, if any?

Specified by:
getIndexPointerFieldName in interface DataDefinition

getSetOwnerFieldName

public String getSetOwnerFieldName()
which is the name of the pointer to the main table, for set and internal set subtables

Specified by:
getSetOwnerFieldName in interface DataDefinition

getTitleFieldName

public String getTitleFieldName()
the title field indicated, or the default one

Specified by:
getTitleFieldName in interface DataDefinition

getCreationDateFieldName

public String getCreationDateFieldName()
which is the name of the creation timestamp field, if any?

Specified by:
getCreationDateFieldName in interface DataDefinition

getLastModificationDateFieldName

public String getLastModificationDateFieldName()
which is the name of the modification timestamp field, if any?

Specified by:
getLastModificationDateFieldName in interface DataDefinition

getParentField

public FieldDefinition getParentField()
If this type is the data pointed by a 1-1 pointer or subset, return the type of the main record, otherwise return null

Specified by:
getParentField in interface DataDefinition

getSetMemberFieldName

public String getSetMemberFieldName()
which is the name of the set member (Pointer, Character or Integer), for set subtables

Specified by:
getSetMemberFieldName in interface DataDefinition

checkFieldNames

public void checkFieldNames(Dictionary<String,Object> d)
Description copied from interface: DataDefinition
Checks whether all fieldnames exist in the database

Specified by:
checkFieldNames in interface DataDefinition

toString

public String toString()
Overrides:
toString in class Object

getOrigin

public URL getOrigin()

lastModified

public long lastModified()
Description copied from interface: DataDefinition
Indicates when the data definition was modified the last time

Specified by:
lastModified in interface DataDefinition

getDataDefinition

public DataDefinition getDataDefinition()
Description copied from interface: ValidationDefinition
Get the data definition associated with this validation definition.

Specified by:
getDataDefinition in interface ValidationDefinition

addValidationRule

public void addValidationRule(ValidationRule rule)

getValidationRule

public ValidationRule getValidationRule(String ruleName)
Description copied from interface: ValidationDefinition
Get the validation rule with the given rule name.

Specified by:
getValidationRule in interface ValidationDefinition

addRule

public void addRule(String fieldName,
                    Collection<ValidationRule> rules)
Description copied from interface: ValidationDefinition
Add several rules for the given field.

Specified by:
addRule in interface ValidationDefinition

addRule

public void addRule(String fieldName,
                    ValidationRule rule)
Description copied from interface: ValidationDefinition
Add a new rule for the given field.

Specified by:
addRule in interface ValidationDefinition

getValidationRules

public Collection<ValidationRule> getValidationRules(String fieldName)
Description copied from interface: ValidationDefinition
Get all validation rules for the given field name.

Specified by:
getValidationRules in interface ValidationDefinition

getValidationDefinition

public ValidationDefinition getValidationDefinition()
Description copied from interface: DataDefinition
Get the validation definition associated with this data definition.

Specified by:
getValidationDefinition in interface DataDefinition

hasValidationRules

public boolean hasValidationRules()
Specified by:
hasValidationRules in interface ValidationDefinition

getMultiFieldUniqueKeys

public DataDefinition.MultipleUniqueKeyDefinition[] getMultiFieldUniqueKeys()
Description copied from interface: DataDefinition
Get all multiple-feld uniqueness definition.

Specified by:
getMultiFieldUniqueKeys in interface DataDefinition

addMultiUniqueKey

public void addMultiUniqueKey(DataDefinition.MultipleUniqueKeyDefinition definition)
Description copied from interface: DataDefinition
Add a multiple-feld uniqueness definition.

Specified by:
addMultiUniqueKey in interface DataDefinition

hasMultiUniqueKey

public boolean hasMultiUniqueKey(String[] fieldNames)
Description copied from interface: DataDefinition
Check whether this data definition has a multi-field uniqe key defined with the given fields.

Specified by:
hasMultiUniqueKey in interface DataDefinition

checkUpdate

public void checkUpdate(String fieldName,
                        Dictionary<String,Object> d)
Description copied from interface: DataDefinition
Checks whether a record can be updated *

Specified by:
checkUpdate in interface DataDefinition

getFunctions

public QueryFragmentFunctions getFunctions()
Description copied from interface: DataDefinition
returns all functions in this data definition.

Specified by:
getFunctions in interface DataDefinition

getFunctionOrPointedFunction

public DataDefinition.QueryFragmentFunction getFunctionOrPointedFunction(String nm)
returns the field info associated with a name

Specified by:
getFunctionOrPointedFunction in interface DataDefinition

getStructure

public String getStructure()