sf.net.kayestry.pages
Class AbstractCRUD<MODEL_OBJECT>

java.lang.Object
  extended by org.apache.tapestry.spec.BaseLocatable
      extended by org.apache.tapestry.AbstractComponent
          extended by org.apache.tapestry.BaseComponent
              extended by org.apache.tapestry.AbstractPage
                  extended by org.apache.tapestry.html.BasePage
                      extended by sf.net.kayestry.pages.KayaBasePage
                          extended by sf.net.kayestry.pages.AbstractCRUD<MODEL_OBJECT>
All Implemented Interfaces:
java.util.EventListener, org.apache.tapestry.event.PageValidateListener, org.apache.tapestry.IComponent, org.apache.tapestry.ILocatable, org.apache.tapestry.ILocationHolder, org.apache.tapestry.IPage, org.apache.tapestry.IRender

public abstract class AbstractCRUD<MODEL_OBJECT>
extends KayaBasePage

Clase base generica para los abm y listados. Cada subclase debe definir cual es la clase del modelo que va a manipular. TODO: como esta todo junto, si queremos agregar un property a la pagina de edit o a la de browse, debemos agregarla en las dos. Convendria separar el listado y las otras operaciones en diferentes clases. TODO: el objeto se crea de cero al recibir el submit, si hay datos que no se mostraron en la pagina para editar, entonces quedan en null y se pierden o falla el save si es not null. El arreglo seria solo tomar en otro objeto los datos editados y luego con el id (en el facade) hacer un load y setear los cambios.

Version:
$Revision$ $Date$
Author:
lparra

Field Summary
 MODEL_OBJECT currentModelObject
           
 MODEL_OBJECT modelObject
           
 MODEL_OBJECT modelObjectSelected
           
 java.util.Set<MODEL_OBJECT> selectedObjects
           
 
Constructor Summary
AbstractCRUD()
           
 
Method Summary
 void editObject(org.apache.tapestry.IRequestCycle objCycle)
           
protected  void editObject(org.apache.tapestry.IRequestCycle objCycle, MODEL_OBJECT obj)
           
protected  void editObject(MODEL_OBJECT curObject)
          Metodo llamado por el browse para la edicion del objeto.
protected  java.lang.String getBrowsePage()
           
 MODEL_OBJECT getCurrentModelObject()
           
protected  ar.com.jiji.kaya.dao.PageableTableDAO getDAO()
          Devuelve el dao que se usa para mostrar la lista paginable.
 org.apache.tapestry.contrib.table.model.IBasicTableModel getDataPage()
           
protected  java.lang.String getEditPage()
          Devuelve el nombre de la pagina que se usa para editar el objeto.
protected  java.lang.Class<MODEL_OBJECT> getModelClass()
           
protected  MODEL_OBJECT getModelObject()
           
protected abstract  ar.com.jiji.kaya.query.Query getQuery()
           
 java.util.Set<MODEL_OBJECT> getSelectedObjects()
           
protected  void initialize()
           
 boolean isObjectSelected()
           
protected  void onAfterSave(boolean wasSuccessfull)
          Se llama luego de guardar un objeto.
protected  boolean onBeforeSave(MODEL_OBJECT curObject)
          TODO documentar
 void removeObjects(org.apache.tapestry.IRequestCycle objCycle)
           
protected  void removeObjects(java.util.Set<MODEL_OBJECT> selectedObjs)
          Elimina los objetos seleccionados.
 void saveObject(org.apache.tapestry.IRequestCycle objCycle)
           
protected  void saveObject(MODEL_OBJECT curObject)
          Crea o actualiza en la base el objeto pasado como parametro.
protected  void setModelClass(java.lang.Class<MODEL_OBJECT> modelClass)
           
protected  void setModelObject(MODEL_OBJECT obj)
           
 void setModelObjectSelected(boolean bSelected)
           
 void setSelectedObjects(java.util.Set<MODEL_OBJECT> set)
           
 
Methods inherited from class sf.net.kayestry.pages.KayaBasePage
addMessage, addMessage, addMessage, addMessage, getDelegate, getFacade, getKayaVisit, getService, pageValidate, restart
 
Methods inherited from class org.apache.tapestry.html.BasePage
getResponseWriter
 
Methods inherited from class org.apache.tapestry.AbstractPage
addPageDetachListener, addPageRenderListener, addPageValidateListener, attach, beginPageRender, beginResponse, detach, endPageRender, firePageBeginRender, firePageDetached, firePageEndRender, firePageValidate, getChangeObserver, getEngine, getExtendedId, getGlobal, getIdPath, getLocale, getNestedComponent, getOutputEncoding, getPageName, getRequestCycle, getVisit, removePageDetachListener, removePageRenderListener, removePageValidateListener, renderPage, setChangeObserver, setLocale, setPageName, setRequestCycle, validate
 
Methods inherited from class org.apache.tapestry.BaseComponent
addOuter, finishLoad, renderComponent
 
Methods inherited from class org.apache.tapestry.AbstractComponent
addAsset, addBody, addComponent, cleanupAfterRender, finishLoad, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, format, format, format, format, formatString, formatString, formatString, formatString, generateAttributes, getAsset, getAssets, getBeans, getBinding, getBindingNames, getBindings, getBody, getBodyCount, getComponent, getComponents, getContainer, getId, getListeners, getMessage, getMessages, getNamespace, getPage, getProperty, getSpecification, getString, pageEndRender, prepareForRender, render, renderBody, renderInformalParameters, setBinding, setContainer, setId, setNamespace, setPage, setProperty, setSpecification, toString
 
Methods inherited from class org.apache.tapestry.spec.BaseLocatable
getLocation, setLocation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.tapestry.IComponent
addAsset, addBody, addComponent, finishLoad, getAsset, getAssets, getBinding, getBindingNames, getBindings, getComponent, getComponents, getContainer, getId, getMessage, getMessages, getNamespace, getPage, getProperty, getSpecification, getString, renderBody, setBinding, setContainer, setId, setNamespace, setPage, setProperty, setSpecification
 
Methods inherited from interface org.apache.tapestry.IRender
render
 
Methods inherited from interface org.apache.tapestry.ILocationHolder
setLocation
 
Methods inherited from interface org.apache.tapestry.ILocatable
getLocation
 

Field Detail

modelObject

public MODEL_OBJECT modelObject

selectedObjects

public java.util.Set<MODEL_OBJECT> selectedObjects

currentModelObject

public MODEL_OBJECT currentModelObject

modelObjectSelected

public MODEL_OBJECT modelObjectSelected
Constructor Detail

AbstractCRUD

public AbstractCRUD()
Method Detail

getModelObject

protected MODEL_OBJECT getModelObject()

initialize

protected void initialize()
Overrides:
initialize in class org.apache.tapestry.AbstractPage

setModelObject

protected void setModelObject(MODEL_OBJECT obj)

getDAO

protected ar.com.jiji.kaya.dao.PageableTableDAO getDAO()
Devuelve el dao que se usa para mostrar la lista paginable.

Returns:
Nunca debe devolver null.

getQuery

protected abstract ar.com.jiji.kaya.query.Query getQuery()

getDataPage

public org.apache.tapestry.contrib.table.model.IBasicTableModel getDataPage()

isObjectSelected

public boolean isObjectSelected()

setModelObjectSelected

public void setModelObjectSelected(boolean bSelected)

removeObjects

protected void removeObjects(java.util.Set<MODEL_OBJECT> selectedObjs)
Elimina los objetos seleccionados.

Parameters:
selectedObjs - Los objetos a eliminar. Nunca es null.

removeObjects

public void removeObjects(org.apache.tapestry.IRequestCycle objCycle)

saveObject

protected void saveObject(MODEL_OBJECT curObject)
Crea o actualiza en la base el objeto pasado como parametro.

Parameters:
curObject - El objeto a crear/actualizar. Nunca es null.

onAfterSave

protected void onAfterSave(boolean wasSuccessfull)
Se llama luego de guardar un objeto. El parametro pasado es verdadero si se logro guardar exitosamente. Y falso en el caso que no se haya podido.

Parameters:
wasSuccessfull -

onBeforeSave

protected boolean onBeforeSave(MODEL_OBJECT curObject)
TODO documentar

Parameters:
curObject -
Returns:

saveObject

public void saveObject(org.apache.tapestry.IRequestCycle objCycle)

getEditPage

protected java.lang.String getEditPage()
Devuelve el nombre de la pagina que se usa para editar el objeto.


editObject

protected void editObject(MODEL_OBJECT curObject)
Metodo llamado por el browse para la edicion del objeto. Puede ser sobreescrito

Parameters:
curObject -

getBrowsePage

protected java.lang.String getBrowsePage()

editObject

protected void editObject(org.apache.tapestry.IRequestCycle objCycle,
                          MODEL_OBJECT obj)

editObject

public void editObject(org.apache.tapestry.IRequestCycle objCycle)

setSelectedObjects

public void setSelectedObjects(java.util.Set<MODEL_OBJECT> set)

getSelectedObjects

public java.util.Set<MODEL_OBJECT> getSelectedObjects()

getCurrentModelObject

public MODEL_OBJECT getCurrentModelObject()

getModelClass

protected java.lang.Class<MODEL_OBJECT> getModelClass()

setModelClass

protected void setModelClass(java.lang.Class<MODEL_OBJECT> modelClass)


Copyright © 2006 Kaya. All Rights Reserved.