public interface RelationalSchema
Modifier and Type | Method and Description |
---|---|
RelationalSchema |
addAttr(java.lang.String column,
SchemaAttr attr,
java.lang.String attrValue)
add an attribute to a column
|
RelationalSchema |
addColumn(java.lang.String column,
DataObject.ObjectType type)
add a column to the DataManager
|
RelationalSchema |
addColumn(java.lang.String column,
DataObject.ObjectType type,
java.util.Map<SchemaAttr,java.lang.String> attrs)
add a column with the attributes to the schema
|
DataManagerEventListener |
addEventListener(DataManagerEventSource.EventFireTime when,
DataManagerEventListener listener)
Adds an event listener using a default priority
|
DataManagerEventListener |
addEventListenerWithPriority(DataManagerEventSource.EventFireTime when,
DataManagerEventListener listener,
int priority)
Add an event listener with a specified execution priority.
|
RelationalSchema |
addForeignKey(SchemaForeignKey fk)
Set a foreign key in the schema
|
RelationalSchema |
addIndex(SchemaKey key)
Set a column as a key column in the schema
|
boolean |
containsAllColumns(java.util.Set<java.lang.String> columns)
returns whether the Schema contains the specified column, case insensitive
|
boolean |
containsColumn(java.lang.String column)
returns whether the Schema contains the specified column, case insensitive
|
DataObject |
convertToDataObject(java.lang.String column,
java.lang.Object o)
convert an Object to a DataObject.
|
void |
fireEvent(DataManagerEventSource.EventFireTime when,
DataManagerEvent evt)
Fires an event
|
java.lang.String |
getAttr(java.lang.String column,
SchemaAttr attr)
retrieve an attribute value from the schema
|
java.util.Map<SchemaAttr,java.lang.String> |
getAttrs(java.lang.String column)
retrieve all the attribute values for a specific column
|
java.util.Set<java.lang.String> |
getAutoGeneratedColumns()
retrieve the columns whose values are Auto-generated (don't need to be added via the DataManager.addData method)
|
java.util.Set<java.lang.String> |
getColumns()
retrieve all the columns in the Schema
|
java.util.Map<java.lang.String,DataObject> |
getDefaultValues()
retrieve a map with the default values of the columns
|
java.util.List<DataManagerEventListener> |
getEventListeners(DataManagerEventSource.EventFireTime when)
Returns all the event listeners for this schema that fire at the specified time
|
java.util.Set<SchemaForeignKey> |
getForeignKeys()
retrieve the foreign keys associated with this schema.
|
java.util.Set<SchemaForeignKey> |
getForeignKeys(java.lang.String parentTable)
Retrieve the column that points to the Foreign table
|
java.lang.String |
getName()
retrieves the name of the Schema
|
DataObject.ObjectType |
getObjectType(java.lang.String column)
Returns the ObjectType corresponding to the column.
|
SchemaKey |
getPrimaryKey()
retrieve the primary key associated with this schema.
|
java.util.Set<SchemaKey> |
getUniqueIndexes()
retrieve the non-primary key unique index's associated with the schema
|
RelationalSchema |
removeEventListener(DataManagerEventSource.EventFireTime when,
DataManagerEventListener listener)
Removes an event listener
|
void |
setDateFormat(java.lang.String column,
java.text.DateFormat dateFormat)
Sets the date format used for a column to parse strings to dates
|
void |
setDateFormat(java.lang.String column,
java.time.format.DateTimeFormatter dateFormat)
Sets the date format used for a column to parse strings to dates
|
RelationalSchema |
setObjectType(java.lang.String column,
DataObject.ObjectType type)
Sets the object type of the column.
|
void |
setParser(java.lang.String column,
DataObject.ValueParser parser)
Sets a custom parser used to parse the data for the specified column
|
RelationalSchema |
setPrimaryKey(SchemaKey primary)
Sets the primary key for this schema
|
DataObject.ObjectType getObjectType(java.lang.String column)
column
- The column to get information for@NotNull RelationalSchema setObjectType(@NotNull java.lang.String column, DataObject.ObjectType type)
column
- The column to set a type fortype
- The type to set as being in the column@Nullable java.lang.String getAttr(@NotNull java.lang.String column, SchemaAttr attr)
column
- The column to get information forattr
- The attribute to get the value forjava.util.Map<SchemaAttr,java.lang.String> getAttrs(java.lang.String column)
column
- The column to get information for@NotNull RelationalSchema addAttr(java.lang.String column, SchemaAttr attr, java.lang.String attrValue)
column
- The column to add the attribute toattr
- The attribute to addattrValue
- The value of the attribute to add@NotNull java.util.Set<java.lang.String> getColumns()
@NotNull RelationalSchema addColumn(java.lang.String column, DataObject.ObjectType type)
column
- The name of the column to addtype
- The type of data stored in the column@NotNull RelationalSchema addColumn(java.lang.String column, DataObject.ObjectType type, java.util.Map<SchemaAttr,java.lang.String> attrs)
column
- The name of the column to addtype
- The type of the data stored in the columnattrs
- The attributes of the column@Nullable DataObject convertToDataObject(java.lang.String column, java.lang.Object o)
column
- The column the object will be added too
- The object given that should be converted to the type of the columnjava.lang.String getName()
@NotNull RelationalSchema addIndex(SchemaKey key)
key
- The key to add as an index@NotNull RelationalSchema addForeignKey(SchemaForeignKey fk)
fk
- The foreign key to add@NotNull java.util.Map<java.lang.String,DataObject> getDefaultValues()
@NotNull java.util.Set<java.lang.String> getAutoGeneratedColumns()
@NotNull java.util.Set<SchemaForeignKey> getForeignKeys()
SchemaKey getPrimaryKey()
@NotNull java.util.Set<SchemaKey> getUniqueIndexes()
@NotNull java.util.Set<SchemaForeignKey> getForeignKeys(java.lang.String parentTable)
parentTable
- The name of the parent tableboolean containsColumn(java.lang.String column)
column
- The column to check forboolean containsAllColumns(java.util.Set<java.lang.String> columns)
columns
- The columns to check for@NotNull DataManagerEventListener addEventListener(DataManagerEventSource.EventFireTime when, DataManagerEventListener listener)
when
- The time when the event should firelistener
- The listener that will handle the event@NotNull DataManagerEventListener addEventListenerWithPriority(DataManagerEventSource.EventFireTime when, DataManagerEventListener listener, int priority)
when
- The time when the event should firelistener
- The listener that will handle the eventpriority
- The priority for the event, with lower numbers being higher priority. Should be greater than Integer.MIN_VALUE + 100 (the first 100 values are
reserved for internal use)@NotNull java.util.List<DataManagerEventListener> getEventListeners(DataManagerEventSource.EventFireTime when)
when
- The time the events fire@NotNull RelationalSchema removeEventListener(DataManagerEventSource.EventFireTime when, DataManagerEventListener listener)
when
- The time the event would firelistener
- The listener to removevoid fireEvent(DataManagerEventSource.EventFireTime when, DataManagerEvent evt)
when
- The time to fire all events forevt
- The data of the event that will be fired@NotNull RelationalSchema setPrimaryKey(SchemaKey primary)
primary
- The primary key for the schemavoid setDateFormat(@NotNull java.lang.String column, @NotNull java.text.DateFormat dateFormat)
column
- The column to set the format fordateFormat
- The date format used to convert strings to dates for this columnvoid setDateFormat(@NotNull java.lang.String column, @NotNull java.time.format.DateTimeFormatter dateFormat)
column
- The column to set the format fordateFormat
- The date format used to convert strings to dates for this columnvoid setParser(@NotNull java.lang.String column, @NotNull DataObject.ValueParser parser)
column
- The column to set a parser forparser
- The parser to use for converting extracted strings to the required type