info.informatica.data
Class MetaData

java.lang.Object
  extended by info.informatica.data.MetaData
Direct Known Subclasses:
AuthenticationMetaData, MapMetaData, RoleMetaData, StatementMetaData, TableMetaData

public class MetaData
extends Object

Metadata.

Author:
amengual at informatica dot info

Constructor Summary
MetaData(String name)
          Builds a MetaData object with name name
MetaData(String schemaName, String name)
          Builds a MetaData object with name name in the schema schemaName
 
Method Summary
 void addDataEntity(DataField data)
          Adds the given entity to this metadata
 int count()
          Gets the number of entities described by this metadata.
static void fillStatement(Map<FieldName,? extends Object> m, PreparedStatement stmt, Iterator<FieldName> data_names)
           
 void fillStatement(Valueset view, PreparedStatement stmt, Iterator<FieldName> data_names)
          Fills the parameters of a given statement.
 int findColumn(FieldName name)
          Find the column position of the given entity.
 Set<Map.Entry<FieldName,DataField>> getData()
          Gets a entry set with the data entities described by this metadata.
 DataField getDataEntity(FieldName name)
          Gets the entity of name name
 DataField getDataEntity(int i)
           
 Collection<DataField> getDataFields()
          Gets a Collection with the data entities
 Iterator<FieldName> getInsertFieldNames()
           
 Collection<FieldName> getKeyNames()
           
 String getLabel(FieldName name)
          Gets the description for name in the current locale.
 LocalLabels getLocalLabels()
          Gets the localized labels for this metadata.
 String getName()
          Gets the name of this table/view
 Iterator<FieldName> getNames()
          Gets an iterator with the names of the data parameters.
 Dataset getSampleDataset(int sz)
           
 String getSchemaName()
          Get the name of the schema where this metadata belongs.
 Iterator<FieldName> getUpdateFieldNames()
           
 void rename(FieldName newname, DataField data)
          Add the given data object with the given name.
 boolean replace(DataField newEntity)
           
 void setLocalLabels(LocalLabels labels)
           
 String toCreateTableString()
           
 String toString()
           
 void validate(Valueset view)
           
 Map<FieldName,Object> validate(Valueset view, Iterator<FieldName> fieldnames)
           
 Map<FieldName,Object> validate(Valueset view, Iterator<FieldName> fieldnames, boolean checkauto)
           
 Map<FieldName,Object> validate(Valueset view, Iterator<FieldName> fieldnames, boolean checkauto, Object helper)
           
 void validate(Valueset view, Iterator<FieldName> fieldnames, Object helper)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MetaData

public MetaData(String schemaName,
                String name)
Builds a MetaData object with name name in the schema schemaName

Parameters:
name - the Catalog name of this metadata
schemaName - the name of the schema, or null if none or not known.

MetaData

public MetaData(String name)
Builds a MetaData object with name name

Parameters:
name - the Catalog name of this metadata
Method Detail

getSchemaName

public String getSchemaName()
Get the name of the schema where this metadata belongs.

Returns:
the name of the schema, or null if there is no schema or is nor known.

rename

public void rename(FieldName newname,
                   DataField data)
Add the given data object with the given name. NOTE: Is the only authorized method of changing the internal name of a DataField

Parameters:
newname - the new name of the entity
data - the data entity to be renamed

replace

public boolean replace(DataField newEntity)

getNames

public Iterator<FieldName> getNames()
Gets an iterator with the names of the data parameters.

Returns:
an iterator with the names of the parameters.

getInsertFieldNames

public Iterator<FieldName> getInsertFieldNames()

getUpdateFieldNames

public Iterator<FieldName> getUpdateFieldNames()

getDataFields

public Collection<DataField> getDataFields()
Gets a Collection with the data entities

Returns:
a Collection with the data entities

getData

public Set<Map.Entry<FieldName,DataField>> getData()
Gets a entry set with the data entities described by this metadata.

Returns:
an entry set with the data entities

count

public int count()
Gets the number of entities described by this metadata.

Returns:
the number of entities

addDataEntity

public void addDataEntity(DataField data)
Adds the given entity to this metadata


getDataEntity

public DataField getDataEntity(FieldName name)
Gets the entity of name name


getLabel

public String getLabel(FieldName name)
Gets the description for name in the current locale.

Parameters:
name - the name of the label
Returns:
the label, or capitalized label name in order of availability

setLocalLabels

public void setLocalLabels(LocalLabels labels)

getLocalLabels

public LocalLabels getLocalLabels()
Gets the localized labels for this metadata.

Returns:
the localized labels for this metadata, or null if not available.

getName

public String getName()
Gets the name of this table/view

Returns:
the name of this table/view

getSampleDataset

public Dataset getSampleDataset(int sz)

getKeyNames

public Collection<FieldName> getKeyNames()

findColumn

public int findColumn(FieldName name)
Find the column position of the given entity.

Parameters:
name - the name of the DataField that we want to find.
Returns:
the integer index position of the field, or -1 if not found.

getDataEntity

public DataField getDataEntity(int i)

toCreateTableString

public String toCreateTableString()

validate

public void validate(Valueset view)
              throws DataException
Throws:
DataException

validate

public Map<FieldName,Object> validate(Valueset view,
                                      Iterator<FieldName> fieldnames)
                               throws DataException
Throws:
DataException

validate

public Map<FieldName,Object> validate(Valueset view,
                                      Iterator<FieldName> fieldnames,
                                      boolean checkauto)
                               throws DataException
Throws:
DataException

validate

public void validate(Valueset view,
                     Iterator<FieldName> fieldnames,
                     Object helper)
              throws DataException
Throws:
DataException

validate

public Map<FieldName,Object> validate(Valueset view,
                                      Iterator<FieldName> fieldnames,
                                      boolean checkauto,
                                      Object helper)
                               throws DataException
Throws:
DataException

fillStatement

public void fillStatement(Valueset view,
                          PreparedStatement stmt,
                          Iterator<FieldName> data_names)
                   throws SQLException,
                          DataException
Fills the parameters of a given statement. Parameter i of the Statement is filled with the value of the i-th field name given.

You do not need to validate the fields first.

Parameters:
stmt - the statement
data_names - the dictionary data names (not the UI names) of the fields
Throws:
DataException - TODO
SQLException

fillStatement

public static void fillStatement(Map<FieldName,? extends Object> m,
                                 PreparedStatement stmt,
                                 Iterator<FieldName> data_names)
                          throws SQLException,
                                 DataFieldException
Throws:
SQLException
DataFieldException

toString

public String toString()
Overrides:
toString in class Object