Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Seam Core JSF2 2.3.0.Final
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.seam.framework
Class Home<T,E>

    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>

All Implemented Interfaces:
  Serializable, Mutable

Direct Known Subclasses:
  EntityHome, HibernateEntityHome

    @Scope(value=CONVERSATION)
    public abstract class Home<T,E>

extends MutableController<T>

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.

Author:
  Gavin King
See Also:
  Serialized Form

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 org.jboss.seam.framework.Controller
`addCookie, addFacesMessage, addFacesMessageFromResourceBundle, createValueExpression, createValueExpression, debug, debug, error, error, evaluateValueExpression, evaluateValueExpression, failValidation, fatal, fatal, getApplicationContext, getBusinessProcessContext, getComponentInstance, getComponentInstance, getConversation, getConversationContext, getCookie, getEventContext, getEvents, getFacesContext, getFacesMessages, getIdentity, getLog, getMessages, getMethodContext, getPageContext, getRedirect, getSessionContext, getStatusMessages, getValidator, getValidator, info, info, interpolate, invalidateSession, isTransactionMarkedRollback, raiseAsynchronousEvent, raiseEvent, raiseTransactionSuccessEvent, render, sendHttpError, sendHttpError, trace, trace, validationFailed, validationSucceeded, warn, warn`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### instance

    protected E instance

### newInstance

    protected Expressions.ValueExpression<T> newInstance

Constructor Detail

### Home

    public Home()

Method Detail

### updatedMessage

    protected void updatedMessage()

  Add a `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.

  See Also:
    `getUpdatedMessage()`, `getUpdatedMessageKey()`

### deletedMessage

    protected void deletedMessage()

  Add a `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.

  See Also:
    `getDeletedMessage()`, `getDeletedMessageKey()`

### createdMessage

    protected void createdMessage()

  Add a `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.

  See Also:
    `getCreatedMessage()`, `getCreatedMessageKey()`

### create

    @Create
    public void create()

  Run on `Home` instantiation to check the Home component is in a valid state.
  Validates that the class of the entity to be managed has been specified.

### initDefaultMessages

    protected void initDefaultMessages()

### getInstance

    @Transactional
    public 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.

  See Also:
    `getId()`

### clearInstance

    public void clearInstance()

  Clear the managed entity (and id), allowing the `EntityHome` to be reused.

### initInstance

    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. Otherwise a new instance is created.

  See Also:
    `find()`, `createInstance()`

### joinTransaction

    protected void joinTransaction()

  Hook method called to allow the implementation to join the current transaction when necessary.

### find

    protected E find()

  Hook method called by `initInstance()` to allow the implementation to load the entity from the Persistence Context.

### handleNotFound

    protected E handleNotFound()

  Utility method called by the framework when no entity is found in the Persistence Context.

### createInstance

    protected E createInstance()

  Create a new instance of the entity.
  Utility method called by `initInstance()` to create a new instance of the entity.

### getEntityClass

    public Class<E> getEntityClass()

  Get the class of the entity being managed.
  If not explicitly specified, the generic type of implementation is used.

### setEntityClass

    public void setEntityClass(Class<E> entityClass)

  Set the class of the entity being managed.
  Useful for configuring `Home` components from `components.xml`.

### getId

    public Object getId()

  Get the id of the object being managed.

### setId

    public void setId(Object id)

  Set/change the entity being managed by id.

  See Also:
    `assignId(Object)`

### assignId

    protected void assignId(Object id)

  Set the id of entity being managed.
  Does not alter the instance so used if the id of the managed object is changed.

  See Also:
    `setId(Object)`

### isIdDefined

    public boolean isIdDefined()

  Returns true if the id of the object managed is known.

### setInstance

    public void setInstance(E instance)

  Set/change the entity being managed.

### getNewInstance

    public Expressions.ValueExpression getNewInstance()

  `ValueExpression` to execute to load a new instance.
  Mainly used when configuring the `Home` components in `components.xml`.

### setNewInstance

    public void setNewInstance(Expressions.ValueExpression newInstance)

  `ValueExpression` to execute to load a new instance.
  Mainly used when configuring the `Home` components in `components.xml`.

### getCreatedMessage

    public Expressions.ValueExpression getCreatedMessage()

  Message displayed to user when the managed entity is created.

### setCreatedMessage

    public void setCreatedMessage(Expressions.ValueExpression createdMessage)

  Message displayed to user when the managed entity is created.

### getDeletedMessage

    public Expressions.ValueExpression getDeletedMessage()

  Message displayed to user when the managed entity is deleted.

### setDeletedMessage

    public void setDeletedMessage(Expressions.ValueExpression deletedMessage)

  Message displayed to user when the managed entity is deleted.

### getUpdatedMessage

    public Expressions.ValueExpression getUpdatedMessage()

  Message displayed to user when the managed entity is updated.

### setUpdatedMessage

    public void setUpdatedMessage(Expressions.ValueExpression updatedMessage)

  Message displayed to user when the managed entity is updated.

### getMessageKeyPrefix

    protected String getMessageKeyPrefix()

  The prefix of the key to look up messages in the Seam managed resource bundle.
  By default the simple name of the class suffixed with an underscore.

### getCreatedMessageKey

    protected String getCreatedMessageKey()

  The key to look up in the Seam managed resource bundle the message displayed when the managed entity is created.
  By default the `getMessageKeyPrefix()` suffixed with created.

### getUpdatedMessageKey

    protected String getUpdatedMessageKey()

  The key to look up in the Seam managed resource bundle the message displayed when the managed entity is updated.
  By default the `getMessageKeyPrefix()` suffixed with updated.

### getDeletedMessageKey

    protected String getDeletedMessageKey()

  The key to look up in the Seam managed resource bundle the message displayed when the managed entity is deleted.
  By default the `getMessageKeyPrefix()` suffixed with deleted.

### raiseAfterTransactionSuccessEvent

    protected void raiseAfterTransactionSuccessEvent()

  Raise events when a CRUD operation succeeds.
  Utility method to raise two events: an event of type `org.jboss.seam.afterTransactionSuccess` is raised, along with an event of type `org.jboss.seam.afterTransactionSuccess.<entityName>`.

### getSimpleEntityName

    protected String getSimpleEntityName()

  The simple name of the managed entity

### getEntityName

    protected abstract String getEntityName()

  Hook method to get the name of the managed entity

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Seam Core JSF2 2.3.0.Final
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2012 Seam Framework. All Rights Reserved.