V - The class name of the view component from which data is read.M - The class name of the model object that is to be updated.public class JDOModelUpdater<V,M extends JDOObject> extends ModelUpdater<V,M>
updater used to update JavaBean objects from
their associated UI containers. Adds JDO specific
actions such as making modifications within the
bounds of a transaction.
The following shows sample use of this updater:
import com.sptci.echo2.binding.JDOModelUpdater;
...
// If persisting new instances to data store
Bean bean = new Bean();
bean.setName( "name" );
bean.setDescription( "my name" );
View<Bean> view = new View<>( bean );
// bind view from model and let user interact
JDOModelUpdater<View,Bean> updater = new JDOModeUpdater<>( view, bean );
updater.update();
...
// If updating persistent instances.
Bean bean = BeanFactory.fetch( "name", pm );
Viewlt;Bean> view = new View<>( bean );
// bind view from model and let user interact
JDOModelUpdater<View,Bean> updater = new JDOModelUpdater<>( view, bean );
updater.update();
Copyright 2006 Sans Pareil Technologies, Inc.
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
active
A flag used to indicate whether a transaction is active or not with
the
pm. |
protected NonTransactionalJDOApplication |
app
The global application instance for the user session.
|
| Constructor and Description |
|---|
JDOModelUpdater(V view,
M bean)
Create a new instance with the specified UI container and java
bean.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
begin()
Initialise
pm and start a transaction if
necessary. |
protected void |
commit()
Commit an existing trasaction associated with the
pm if appropriate. |
protected Object |
getRepository()
Fetch the repository instance to use to manage
Updater.bean. |
protected void |
persist()
Persist the
Updater.bean to the data store. |
protected void |
rollback()
Rollback the current transaction in case errors were encountered while
interacting with the data store.
|
void |
update()
Over-ridden to conduct the updates with the bounds of a transaction
as mandated by JDO.
|
getFieldName, processCollection, updateFieldbeanValues, getBean, getView, setBean, setView, viewValuesprotected final NonTransactionalJDOApplication app
protected boolean active
pm.public JDOModelUpdater(V view, M bean)
view - The Updater.view to use.bean - The Updater.bean to use.public void update()
update in class ModelUpdater<V,M extends JDOObject>BindingException - If errors are encountered while
accessing or setting the fields.begin(),
ModelUpdater.update(),
persist()protected void begin()
pm and start a transaction if
necessary.protected void persist()
throws BindingException
Updater.bean to the data store. Invokes the
save method on an associated repository class for Updater.bean or directly on pm.BindingException - If errors are encountered while introspecting
the repository.getRepository()protected void commit()
pm if appropriate.protected void rollback()
protected Object getRepository() throws ClassNotFoundException, Throwable
Updater.bean.ClassNotFoundException - If the repository does not existThrowable - If other reflection errors are encountered.