|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.davesag.jsf.AbstractContextAwareBean
com.davesag.jsf.AbstractHandler
com.davesag.jsf.AbstractReadWriteHandler
The AbstractReadWriteHandler is a base class for you to develop your own
handler Managed Beans. To implement a specific ReadWriteHandler for your
own data types simply fill in the methods to do the following:
loadById(Object id) - returns an object, given some
unique id.instantiateItem- returns a new objectsaveItem - write the object to some underlying
persistent store.
viewToModel - map data from the form fields to
the actual object
modelToView - map data from the handled object
to the form fields
ReadWriteHandlers correspond to the
controller component of the MVC pattern.
| Field Summary |
| Fields inherited from class com.davesag.jsf.AbstractHandler |
CANCEL, ERROR, SUCCESS, theFields, theItem |
| Constructor Summary | |
AbstractReadWriteHandler()
|
|
| Method Summary | |
String |
create()
Makes a new instance of the bean to be handled. |
String |
delete()
deletes the current item. |
protected abstract void |
deleteItem(Object model)
deletes the item from a persistent store. |
protected abstract Object |
instantiateItem()
If permitted, this method should create a new default item. |
String |
release()
releases the current item without saving. |
String |
save()
Saves the item. |
protected abstract Object |
saveItem(Object model)
saves the item to a persistent store. |
protected abstract Object |
viewToModel(Map view,
Object model)
populate the supplied object with data from the view's fields map. |
| Methods inherited from class com.davesag.jsf.AbstractHandler |
clear, getFields, getItem, isActive, load, loadById, modelToView, view |
| Methods inherited from class com.davesag.jsf.AbstractContextAwareBean |
addMessage, getContext, getMessageBundleName, getRequestParameter, getServletContext, getSession |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.davesag.jsf.Handler |
getFields, getItem, isActive, load |
| Constructor Detail |
public AbstractReadWriteHandler()
| Method Detail |
protected abstract Object instantiateItem()
throws Exception
viewToModel(java.util.Map, java.lang.Object) and AbstractHandler.modelToView(java.lang.Object, java.util.Map).
Exception - if anything bad happens.protected abstract Object saveItem(Object model)
model - The object you wish to save.
protected abstract void deleteItem(Object model)
throws Exception
model - The object you wish to delete.
Exception - if anything went wrong.
protected abstract Object viewToModel(Map view,
Object model)
javax.faces.ConverterException?
view - The map of properties captured from the user interface.model - The object to populate based on values in the view.
public String create()
create in interface ReadWriteHandlerpublic String save()
save in interface ReadWriteHandlerpublic String release()
release in interface ReadWriteHandlerpublic String delete()
delete in interface ReadWriteHandler
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||