|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.seam.framework.Controller org.jboss.seam.framework.PersistenceController<T> org.jboss.seam.framework.MutableController<T> org.jboss.seam.framework.Home<T,E>
@Scope(value=CONVERSATION) public abstract class Home<T,E>
Base class for components which provide persistence operations to a managed entity instance. This class may be reused by either configuration or extension, and may be bound directly to a view, or accessed by some intermediate Seam component.
Field Summary | |
---|---|
protected E |
instance
|
protected Expressions.ValueExpression<T> |
newInstance
|
Constructor Summary | |
---|---|
Home()
|
Method Summary | |
---|---|
protected void |
assignId(Object id)
Set the id of entity being managed. |
void |
clearInstance()
Clear the managed entity (and id), allowing the EntityHome to be
reused. |
void |
create()
Run on Home instantiation to check the Home component is in a
valid state. |
protected void |
createdMessage()
Add a FacesMessage and log a message when
the entity instance is created. |
protected E |
createInstance()
Create a new instance of the entity. |
protected void |
deletedMessage()
Add a FacesMessage and log a message when
the entity instance is deleted. |
protected E |
find()
Hook method called by initInstance() to allow the implementation
to load the entity from the Persistence Context. |
Expressions.ValueExpression |
getCreatedMessage()
Message displayed to user when the managed entity is created. |
protected String |
getCreatedMessageKey()
The key to look up in the Seam managed resource bundle the message displayed when the managed entity is created. |
Expressions.ValueExpression |
getDeletedMessage()
Message displayed to user when the managed entity is deleted. |
protected String |
getDeletedMessageKey()
The key to look up in the Seam managed resource bundle the message displayed when the managed entity is deleted. |
Class<E> |
getEntityClass()
Get the class of the entity being managed. |
protected abstract String |
getEntityName()
Hook method to get the name of the managed entity |
Object |
getId()
Get the id of the object being managed. |
E |
getInstance()
Get the managed entity, using the id from getId() to load it from
the Persistence Context or creating a new instance if the id is not
defined. |
protected String |
getMessageKeyPrefix()
The prefix of the key to look up messages in the Seam managed resource bundle. |
Expressions.ValueExpression |
getNewInstance()
ValueExpression to execute to load a new instance. |
protected String |
getSimpleEntityName()
The simple name of the managed entity |
Expressions.ValueExpression |
getUpdatedMessage()
Message displayed to user when the managed entity is updated. |
protected String |
getUpdatedMessageKey()
The key to look up in the Seam managed resource bundle the message displayed when the managed entity is updated. |
protected E |
handleNotFound()
Utility method called by the framework when no entity is found in the Persistence Context. |
protected void |
initDefaultMessages()
|
protected void |
initInstance()
Load the instance if the id is defined otherwise create a new instance Utility method called by getInstance() to load the instance from
the Persistence Context if the id is defined. |
boolean |
isIdDefined()
Returns true if the id of the object managed is known. |
protected void |
joinTransaction()
Hook method called to allow the implementation to join the current transaction when necessary. |
protected void |
raiseAfterTransactionSuccessEvent()
Raise events when a CRUD operation succeeds. |
void |
setCreatedMessage(Expressions.ValueExpression createdMessage)
Message displayed to user when the managed entity is created. |
void |
setDeletedMessage(Expressions.ValueExpression deletedMessage)
Message displayed to user when the managed entity is deleted. |
void |
setEntityClass(Class<E> entityClass)
Set the class of the entity being managed. |
void |
setId(Object id)
Set/change the entity being managed by id. |
void |
setInstance(E instance)
Set/change the entity being managed. |
void |
setNewInstance(Expressions.ValueExpression newInstance)
ValueExpression to execute to load a new instance. |
void |
setUpdatedMessage(Expressions.ValueExpression updatedMessage)
Message displayed to user when the managed entity is updated. |
protected void |
updatedMessage()
Add a FacesMessage and log a message when
the entity instance is updated. |
Methods inherited from class org.jboss.seam.framework.MutableController |
---|
clearDirty, setDirty, setDirty |
Methods inherited from class org.jboss.seam.framework.PersistenceController |
---|
getPersistenceContext, getPersistenceContextName, setPersistenceContext |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected E instance
protected Expressions.ValueExpression<T> newInstance
Constructor Detail |
---|
public Home()
Method Detail |
---|
protected void updatedMessage()
FacesMessage
and log a message when
the entity instance is updated.
Utility method to add a FacesMessage
from
the Seam managed resource bundle or, if not specified in the resource
bundle, from getUpdatedMessage()
and log the entity when the
managed entity is updated.
getUpdatedMessage()
,
getUpdatedMessageKey()
protected void deletedMessage()
FacesMessage
and log a message when
the entity instance is deleted.
Utility method to add a FacesMessage
from
the Seam managed resource bundle or, if not specified in the resource
bundle, from getDeletedMessage()
and log the entity when the
managed entity is deleted.
getDeletedMessage()
,
getDeletedMessageKey()
protected void createdMessage()
FacesMessage
and log a message when
the entity instance is created.
Utility method to add a FacesMessage
from
the Seam managed resource bundle or, if not specified in the resource
bundle, from getUpdatedMessage()
and log the entity when the
managed entity is updated.
getCreatedMessage()
,
getCreatedMessageKey()
@Create public void create()
Home
instantiation to check the Home component is in a
valid state.
protected void initDefaultMessages()
@Transactional public E getInstance()
getId()
to load it from
the Persistence Context or creating a new instance if the id is not
defined.
getId()
public void clearInstance()
EntityHome
to be
reused.
protected void initInstance()
getInstance()
to load the instance from
the Persistence Context if the id is defined. Otherwise a new instance is
created.
find()
,
createInstance()
protected void joinTransaction()
protected E find()
initInstance()
to allow the implementation
to load the entity from the Persistence Context.
protected E handleNotFound()
protected E createInstance()
initInstance()
to create a new instance
of the entity.
public Class<E> getEntityClass()
public void setEntityClass(Class<E> entityClass)
Home
components from
components.xml
.
public Object getId()
public void setId(Object id)
assignId(Object)
protected void assignId(Object id)
setId(Object)
public boolean isIdDefined()
public void setInstance(E instance)
public Expressions.ValueExpression getNewInstance()
ValueExpression
to execute to load a new instance.
Home
components in
components.xml
.
public void setNewInstance(Expressions.ValueExpression newInstance)
ValueExpression
to execute to load a new instance.
Home
components in
components.xml
.
public Expressions.ValueExpression getCreatedMessage()
public void setCreatedMessage(Expressions.ValueExpression createdMessage)
public Expressions.ValueExpression getDeletedMessage()
public void setDeletedMessage(Expressions.ValueExpression deletedMessage)
public Expressions.ValueExpression getUpdatedMessage()
public void setUpdatedMessage(Expressions.ValueExpression updatedMessage)
protected String getMessageKeyPrefix()
protected String getCreatedMessageKey()
getMessageKeyPrefix()
suffixed with created.
protected String getUpdatedMessageKey()
getMessageKeyPrefix()
suffixed with updated.
protected String getDeletedMessageKey()
getMessageKeyPrefix()
suffixed with deleted.
protected void raiseAfterTransactionSuccessEvent()
org.jboss.seam.afterTransactionSuccess
is raised, along with
an event of type
org.jboss.seam.afterTransactionSuccess.<entityName>
.
protected String getSimpleEntityName()
protected abstract String getEntityName()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |