org.apache.myfaces.trinidad.change

## Class SessionChangeManager

- java.lang.Object
- - org.apache.myfaces.trinidad.change.ChangeManager
  - - org.apache.myfaces.trinidad.change.SessionChangeManager

-     public class SessionChangeManager
      extends ChangeManager

  A ChangeManager implementation that manages persisting the added Changes at the session. This means the lifetime of Changes added such is within the session scope. If any of the changes are managed as state changes and restored by JSF state saving mechanism, the SessionChangeManager will not re-apply such changes. For example: AttributeComponentChanges are not applied during a postback unless its target component happened to be a result of any move/add operation, this is because attribute changes are handled by state manager during postback for common cases.
  Version:
    $Name: $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/change/SessionChangeManager.java#0 $) $Date: 10-nov-2005.19:06:35 $

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.myfaces.trinidad.change.ChangeManager

      `ChangeManager.ChangeOutcome, ChangeManager.NotificationOutcome`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SessionChangeManager()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addComponentChange(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent uiComponent, ComponentChange change)` Adds a ComponentChange to the current request for a specified component.
    `protected void` | `addComponentChangeImpl(javax.faces.context.FacesContext context, javax.faces.component.UIComponent targetComponent, ComponentChange componentChange)` Adds a ComponentChange and registers against the supplied component.
    `void` | `addDocumentChange(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent uiComponent, DocumentChange change)` Add a DocumentChange to this current request for a specified component.
    `ChangeManager.ChangeOutcome` | `addDocumentChangeWithOutcome(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent uiComponent, DocumentChange change)` Add a DocumentChange for a specified component, and return the outcome of adding the change.
    `void` | `applyComponentChangesForCurrentView(javax.faces.context.FacesContext context)` Applies all the ComponentChanges added so far for the current view.
    `void` | `applyComponentChangesForSubtree(javax.faces.context.FacesContext context, javax.faces.component.NamingContainer root)` Applies the ComponentChanges added so far for components underneath the specified NamingContainer.
    `void` | `applySimpleComponentChanges(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)` Apply non-cross-component changes to a component in its original location.
    `ChangeManager.NotificationOutcome` | `documentChangeApplied(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component, ComponentChange componentChange)` In this implementation, if a simple attribute document change was applied, we will remove previously added component change on the same component and attribute, if any.
    `protected Document` | `getDocument(javax.faces.context.FacesContext context)` We don't support DocumentChange persistence
    `protected void` | `persistDocumentChanges(javax.faces.context.FacesContext facesContext)`
    `AttributeComponentChange` | `replaceAttributeChangeIfPresent(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, AttributeComponentChange attributeComponentChange)` Replace an AttributeComponentChange if it's present.
    `protected boolean` | `supportsDocumentPersistence(javax.faces.context.FacesContext context)` Returns true if we can support Document-based Persistence in this ChangeManager.

    - ### Methods inherited from class org.apache.myfaces.trinidad.change.ChangeManager

      `createDocumentChange, registerDocumentFactory`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SessionChangeManager

          public SessionChangeManager()

  - ### Method Detail

    - #### applyComponentChangesForCurrentView

          public void applyComponentChangesForCurrentView(javax.faces.context.FacesContext context)

      Applies all the ComponentChanges added so far for the current view. Developers should not need to call this method. Internal implementation will call it as the component tree is built and is ready to take changes.
      Overrides:
        `applyComponentChangesForCurrentView` in class `ChangeManager`
      Parameters:
        `context` - The FacesContext instance for the current request.

    - #### applyComponentChangesForSubtree

          public void applyComponentChangesForSubtree(javax.faces.context.FacesContext context,
                                             javax.faces.component.NamingContainer root)

      Applies the ComponentChanges added so far for components underneath the specified NamingContainer. Developers should not need to call this method. Internal implementation will call it as the component tree is built and is ready to take changes.
      Overrides:
        `applyComponentChangesForSubtree` in class `ChangeManager`
      Parameters:
        `context` - The FacesContext instance for the current request.
        `root` - The NamingContainer that contains the component subtree to which ComponentChanges should be applied. If null, all changes are applied.

    - #### applySimpleComponentChanges

          public void applySimpleComponentChanges(javax.faces.context.FacesContext context,
                                         javax.faces.component.UIComponent component)

      Apply non-cross-component changes to a component in its original location. This is typically only called by tags that need to ensure that a newly created component instance is as up-to-date as possible.
      Overrides:
        `applySimpleComponentChanges` in class `ChangeManager`
        `component` - Component to apply the simple changes to

    - #### addDocumentChange

          public void addDocumentChange(javax.faces.context.FacesContext facesContext,
                               javax.faces.component.UIComponent uiComponent,
                               DocumentChange change)

      Description copied from class: `ChangeManager`
      Add a DocumentChange to this current request for a specified component. When called we will allow changes even if the component or its any ancestor is a stamped component by UIXIterator.
      Overrides:
        `addDocumentChange` in class `ChangeManager`

    - #### addDocumentChangeWithOutcome

          public ChangeManager.ChangeOutcome addDocumentChangeWithOutcome(javax.faces.context.FacesContext facesContext,
                                                                 javax.faces.component.UIComponent uiComponent,
                                                                 DocumentChange change)

      Description copied from class: `ChangeManager`
      Add a DocumentChange for a specified component, and return the outcome of adding the change.
      Overrides:
        `addDocumentChangeWithOutcome` in class `ChangeManager`
      Parameters:
        `facesContext` - The FacesContext instance for the current request
        `uiComponent` - The UIComponent instance for which the DocumentChange is to be added
        `change` - The DocumentChange to be added
      Returns:
        The outcome of adding the document change
      See Also:
        `ChangeManager.ChangeOutcome`

    - #### documentChangeApplied

          public ChangeManager.NotificationOutcome documentChangeApplied(javax.faces.context.FacesContext facesContext,
                                                                javax.faces.component.UIComponent component,
                                                                ComponentChange componentChange)

      In this implementation, if a simple attribute document change was applied, we will remove previously added component change on the same component and attribute, if any.
      Overrides:
        `documentChangeApplied` in class `ChangeManager`
        `component` - The target UIComponent instance for which the DocumentChange was applied
        `componentChange` - The ComponentChange for which an equivalent DocumentChange was applied
      Returns:
        The outcome of handling this notification

    - #### addComponentChangeImpl

          protected void addComponentChangeImpl(javax.faces.context.FacesContext context,
                                    javax.faces.component.UIComponent targetComponent,
                                    ComponentChange componentChange)

      Adds a ComponentChange and registers against the supplied component. Changes added thus live at Session scope. Use applyComponentChangesForCurrentView() to apply these changes.
      Parameters:
        `context` - The FacesContext instance for the current request.
        `targetComponent` - The target component against which this change needs to be registered and applied later on.
        `componentChange` - The ComponentChange to add.

    - #### replaceAttributeChangeIfPresent

          public AttributeComponentChange replaceAttributeChangeIfPresent(javax.faces.context.FacesContext context,
                                                                 javax.faces.component.UIComponent component,
                                                                 AttributeComponentChange attributeComponentChange)

      Description copied from class: `ChangeManager`
      Replace an AttributeComponentChange if it's present.
      Overrides:
        `replaceAttributeChangeIfPresent` in class `ChangeManager`
      Returns:
        the old change instance

    - #### getDocument

          protected Document getDocument(javax.faces.context.FacesContext context)

      We don't support DocumentChange persistence

    - #### addComponentChange

          public void addComponentChange(javax.faces.context.FacesContext facesContext,
                                javax.faces.component.UIComponent uiComponent,
                                ComponentChange change)

      Adds a ComponentChange to the current request for a specified component. Component changes cannot be added for stamped children of an UIXIterator. A DocumentChange will be automatically created and applied on the ChangeManager registered for this application if the following conditions are met: 1. The ChangeManager registered for the application supports document change persistence 2. DocumentChange corresponding to the supplied ComponentChange can be created with the help of any registered DocumentChangeFactory When such a DocumentChange is added, the ChangeManager registered for the application is notified by means of calling its documentChangeApplied() method. This is to give the registered ChangeManager an opportunity to take any necessary action. For example, Session based ChangeManager implementations may choose to remove the ComponentChange, if any added earlier. Custom ChangeManager implementations should notify likewise if it automatically creates and adds a DocumentChange.
      Specified by:
        `addComponentChange` in class `ChangeManager`
      See Also:
        `DocumentChangeFactory`, `#documentChangeApplied(FacesContext, UIComponent, ComponentChange`

    - #### persistDocumentChanges

          protected void persistDocumentChanges(javax.faces.context.FacesContext facesContext)

    - #### supportsDocumentPersistence

          protected boolean supportsDocumentPersistence(javax.faces.context.FacesContext context)

      Returns true if we can support Document-based Persistence in this ChangeManager. Subclassers adding Document-based Persistence should override this method and must override `getDocument` in order to enable Document-based Persistence.
      Parameters:
        `context` -
      Returns:
        true if we can support Document-based Persistence

Copyright © 2001-2017 The Apache Software Foundation. All Rights Reserved.