public abstract class AbstractPluginObject extends AbstractPluginTable
isMapped() and action(...). i.e.
SpecRunner-Hibernate3 extends the object manipulation to save/update/delete
data using Hibernate3 infra-structure.| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractPluginObject.Field
Hold column information.
|
| Modifier and Type | Field and Description |
|---|---|
protected String |
creator
Object creator name.
|
protected IObjectCreator |
creatorInstance
Object creator instance.
|
protected List<AbstractPluginObject.Field> |
fields
List of fields.
|
protected Map<String,AbstractPluginObject.Field> |
fieldToFields
List of field definition fields.
|
protected Map<String,AbstractPluginObject.Field> |
headerToFields
List of header definition fields.
|
protected Map<String,Object> |
instances
Mapping of identifiers to object instances.
|
protected Map<String,String> |
keysBefore
Mapping of key before processing to the ones after processing.
|
protected boolean |
mapped
Flag if the created objects are expected to be mapped in memory by
default.
|
protected String |
mapping
The map of generic fields to be used as reference.
|
protected String |
reference
The identification fields.
|
protected List<String> |
references
The identification fields list.
|
protected String |
separator
Separator of identification attributes.
|
protected String |
supermapping
Super type of object.
|
protected String |
type
Object class name.
|
protected Class<?> |
typeInstance
Object class.
|
scopenameFEATURE_CONDITION, FEATURE_NORMALIZED, FEATURE_NORMALIZER, FEATURE_SLEEP, FEATURE_THREADSAFE, FEATURE_TIMEOUT, FEATURE_WAITparameters| Constructor and Description |
|---|
AbstractPluginObject() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
action(IContext context,
Object instance,
RowAdapter row,
IResultSet result)
This method can be and should be overridden to perform save, comparison,
etc for updates.
|
protected Object |
create(IContext context,
TableAdapter table,
RowAdapter row)
Create the object based on a row.
|
void |
doEnd(IContext context,
IResultSet result,
TableAdapter table)
Perform an ending action.
|
String |
getCreator()
Returns the object creator of embeddable objects.
|
IObjectCreator |
getCreatorInstance()
Object creator type.
|
String |
getMapping()
Return the map of field information.
|
Object |
getObject(String key)
Given a key, returns the corresponding object instance.
|
List<Object> |
getObjects()
Set of handled objects.
|
String |
getReference()
Sets the attribute which represents the keys of the entity.
|
String |
getSeparator()
Gets the string used to separate fields of reference.
|
String |
getSupermapping()
Get super class mapping.
|
String |
getType()
The object type of the plugin.
|
Class<?> |
getTypeInstance()
Gets the corresponding class to type.
|
void |
initialize(IContext context,
TableAdapter table)
Initialize helper.
|
boolean |
isMapped()
Says if the instance show be mapped or not.
|
protected boolean |
isSpecial()
Checks if the instance is primitive, enum or string.
|
protected void |
loadFields(IContext context,
RowAdapter row,
List<AbstractPluginObject.Field> list)
Load fields based on
th tags. |
protected void |
loadMapping(IContext context,
TableAdapter table,
String map)
Load mapping with predefined values.
|
String |
makeKey(Object instance)
Creates the key to be used for storing/recovering object information.
|
void |
mapObject(Object instance,
String keyBefore,
String keyAfter)
Maps the object using the keys before and after Hibernate saving.
|
AbstractPluginObject |
merge(AbstractPluginObject old)
Merge to equivalent plugins.
|
protected boolean |
populate(IContext context,
TableAdapter table,
RowAdapter row,
IResultSet result,
Object instance)
Populate the object instance with row information.
|
protected Object |
processLine(IContext context,
TableAdapter table,
RowAdapter row,
IResultSet result)
Process a given row.
|
protected void |
readData(IContext context,
IResultSet result,
TableAdapter table)
Read data information.
|
protected void |
readHeader(IContext context,
IResultSet result,
TableAdapter table)
Read header information.
|
Object |
removeObject(String key)
Remove an object from mapping.
|
protected void |
setBoolean(Object instance,
AbstractPluginObject.Field f,
Object value)
Sets a boolean to a field.
|
protected void |
setChar(Object instance,
AbstractPluginObject.Field f,
Object value)
Sets a char to a field.
|
void |
setCreator(String creator)
Sets the creator class.
|
void |
setCreatorInstance(IObjectCreator creatorInstance)
Sets the creator.
|
protected void |
setDouble(Object instance,
AbstractPluginObject.Field f,
Object value)
Sets a double to a field.
|
protected void |
setEntity(Object instance,
AbstractPluginObject.Field f,
Object value)
If there is some plugin of the object type specified in field, use the
plugin object version.
|
protected void |
setFloat(Object instance,
AbstractPluginObject.Field f,
Object value)
Sets a float to a field.
|
protected void |
setInteger(Object instance,
AbstractPluginObject.Field f,
Object value)
Sets an integer to a field.
|
protected void |
setLong(Object instance,
AbstractPluginObject.Field f,
Object value)
Sets a long to a field.
|
void |
setMapped(boolean mapped)
Flag is an object is mapped or not.
|
void |
setMapping(String mapping)
Sets the object mapping.
|
protected void |
setObject(Object instance,
AbstractPluginObject.Field f,
Object value)
Sets an object to a field.
|
protected void |
setObjectInformation()
Set object and/or creator information.
|
void |
setReference(String reference)
Sets the references.
|
void |
setSeparator(String separator)
Sets identifier separator.
|
protected void |
setShort(Object instance,
AbstractPluginObject.Field f,
Object value)
Sets a short to a field.
|
void |
setSupermapping(String supermapping)
Set mapping for superclass object.
|
void |
setType(String type)
Set the type.
|
void |
setTypeInstance(Class<?> typeInstance)
Sets the instance type.
|
protected void |
setValue(IContext context,
TableAdapter table,
RowAdapter row,
Object instance,
AbstractPluginObject.Field f,
Object value)
Set the field with the given value.
|
doEnd, doStart, doStart, getTableAdapter, initialize, toStringgetScope, saveGlobal, saveLocal, saveStrict, setScopegetName, setNamecopy, getCondition, getConditionModel, getNormalized, getNormalized, getNormalizer, getParent, getSleep, getSleepModel, getThreadsafe, getTimeout, getTimeoutModel, getWait, getWaitModel, setCondition, setConditionModel, setNormalized, setNormalizer, setParent, setSleep, setSleepModel, setThreadsafe, setTimeout, setTimeoutModel, setWait, setWaitModelgetParameters, setParametersclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetParameters, setParametersgetActionTypeprotected String supermapping
protected String type
protected Class<?> typeInstance
protected String creator
protected IObjectCreator creatorInstance
protected String reference
protected String separator
protected String mapping
protected Map<String,AbstractPluginObject.Field> headerToFields
protected Map<String,AbstractPluginObject.Field> fieldToFields
protected List<AbstractPluginObject.Field> fields
protected boolean mapped
protected Map<String,String> keysBefore
public String getSupermapping()
public void setSupermapping(String supermapping)
supermapping - A super mapping.public String getType()
type='system.entity.Person'.public void setType(String type)
type - A new type.public Class<?> getTypeInstance()
public void setTypeInstance(Class<?> typeInstance)
typeInstance - A new type.public String getCreator()
public void setCreator(String creator)
creator - A new creator class name.public IObjectCreator getCreatorInstance()
public void setCreatorInstance(IObjectCreator creatorInstance)
creatorInstance - A new creator instance.public String getReference()
reference='id,name' is used, the 'id' attribute and 'name'
attribute are used as the object key, separated by 'separator' field.public void setReference(String reference)
reference - A new reference list.public String getSeparator()
reference='id,name' and separator='/', the
object instance corresponding to a given line will be 'id/name'.public void setSeparator(String separator)
separator - The separator.public String getMapping()
public void setMapping(String mapping)
mapping - The mapping.public void initialize(IContext context, TableAdapter table) throws PluginException
AbstractPluginTableinitialize in class AbstractPluginTablecontext - The context.table - The adapter.PluginException - On initialization errors.protected void loadMapping(IContext context, TableAdapter table, String map) throws PluginException
context - The context.table - The table.PluginException - On mapping errors.protected void setObjectInformation()
throws PluginException
PluginException - On setting errors.protected boolean isSpecial()
public void doEnd(IContext context, IResultSet result, TableAdapter table) throws PluginException
AbstractPluginTabledoEnd in class AbstractPluginTablecontext - The context.result - The result set.table - The adapter.PluginException - On plugin errors.protected void readHeader(IContext context, IResultSet result, TableAdapter table) throws PluginException
context - A context.result - A result.table - The table.PluginException - On read errors.protected void readData(IContext context, IResultSet result, TableAdapter table) throws PluginException
context - A context.result - A result.table - The table.PluginException - On read errors.protected void loadFields(IContext context, RowAdapter row, List<AbstractPluginObject.Field> list) throws PluginException
th tags.context - The context.row - The row.list - List of fields.PluginException - On load errors.public void setMapped(boolean mapped)
mapped - true, to be mapped, false, otherwise.public boolean isMapped()
protected Object processLine(IContext context, TableAdapter table, RowAdapter row, IResultSet result) throws Exception
context - The context.table - The table.row - The row.result - The result set.Exception - On processing errors.protected Object create(IContext context, TableAdapter table, RowAdapter row) throws Exception
context - The test context.table - The table.row - The row.Exception - On creation errors.protected boolean populate(IContext context, TableAdapter table, RowAdapter row, IResultSet result, Object instance) throws Exception
instance - The object instance.context - The test context.header - The table header.row - The row with attribute informations.result - The result set.Exception - On population errors.protected void setValue(IContext context, TableAdapter table, RowAdapter row, Object instance, AbstractPluginObject.Field f, Object value) throws Exception
context - The test context.table - The table.row - The row corresponding to the object.instance - The object instance.f - The field information.value - The value to be set in instance for field 'f'.Exception - On set value errors.protected void setBoolean(Object instance, AbstractPluginObject.Field f, Object value) throws Exception
instance - The object instance.f - The field information.value - The value to be set.Exception - On setting errors.protected void setChar(Object instance, AbstractPluginObject.Field f, Object value) throws Exception
instance - The object instance.f - The field information.value - The value to be set.Exception - On setting errors.protected void setShort(Object instance, AbstractPluginObject.Field f, Object value) throws Exception
instance - The object instance.f - The field information.value - The value to be set.Exception - On setting errors.protected void setInteger(Object instance, AbstractPluginObject.Field f, Object value) throws Exception
instance - The object instance.f - The field information.value - The value to be set.Exception - On setting errors.protected void setLong(Object instance, AbstractPluginObject.Field f, Object value) throws Exception
instance - The object instance.f - The field information.value - The value to be set.Exception - On setting errors.protected void setFloat(Object instance, AbstractPluginObject.Field f, Object value) throws Exception
instance - The object instance.f - The field information.value - The value to be set.Exception - On setting errors.protected void setDouble(Object instance, AbstractPluginObject.Field f, Object value) throws Exception
instance - The object instance.f - The field information.value - The value to be set.Exception - On setting errors.protected void setEntity(Object instance, AbstractPluginObject.Field f, Object value) throws Exception
instance - The object instance.f - The field metadata.value - The value to be set.Exception - On set errors.protected void setObject(Object instance, AbstractPluginObject.Field f, Object value) throws Exception
instance - The object instance.f - The field information.value - The value to be set.Exception - On setting errors.protected abstract void action(IContext context, Object instance, RowAdapter row, IResultSet result) throws Exception
context - Test context.instance - The object instance.row - The row adapter.result - The result set.Exception - On action errors.public String makeKey(Object instance) throws Exception
instance - The object instance.Exception - On key generation errors.public void mapObject(Object instance, String keyBefore, String keyAfter)
instance - The object instance.keyBefore - The key before saving.keyAfter - The key after saving.public AbstractPluginObject merge(AbstractPluginObject old)
old - Source of copy.public Object getObject(String key) throws PluginException
key - The object key.PluginException - If object with the given key is not present in plugin.public List<Object> getObjects()
public Object removeObject(String key) throws PluginException
key - The key.PluginException - On lookup errors.Copyright © 2016. All rights reserved.