Prakash Udupa created TRINIDAD-2438:
---------------------------------------

             Summary: Need ability to filter the scope of change storage based 
on attribute type
                 Key: TRINIDAD-2438
                 URL: https://issues.apache.org/jira/browse/TRINIDAD-2438
             Project: MyFaces Trinidad
          Issue Type: Improvement
          Components: Archetype
    Affects Versions: 2.1.0-core
            Reporter: Prakash Udupa



The requirement is to be able to tell based on the attribute value type if the 
change involving that attribute should be preserved or not, and if it were to 
be preserved, should it be scoped to session or to the document (persisted 
change).

For example:

Consider implementations of org.apache.myfaces.trinidad.model.RowKeySet being 
used as value types for current-row attribute in table and treeTable 
components. While the row currency may not change for table between two 
requests for the same page, it could change in case of treeTable as it really 
depends on the node that is expanded. In this case, the treeTable component may 
choose to restrict saving attribute changes for row currency (not choose to 
preserve the change at all) by implementing this interface in the RowKeySet 
type it uses.

To solve this requirement, the proposal is to introduce an interface that the  
complex objects (custom data types of the attribute values) can implement to 
indicate the scope. ChangeManager implementations can consult this scope to 
decide where to persist the change. The proposed interface is as follows:

----------------------------------------
package org.apache.myfaces.trinidad.change;

/**
 * Defines the restricted scope in which ChangeManager should preserve the 
attribute change involving values of this
 * type. This scope restriction applies only when changes are added via. calls 
to addComponentChange()method of the
 * ChangeManager and not when changes are added via. calls to its 
addDocumentChange() or addDocumentChangeWithOutcome()
 * methods.
 */
public interface ScopedChangePersistence
{
  /**
   * Returns the scope in which the ChangeManager can preserve the change 
involving this attribute type
   * @return PersistenceScope the scope
   */
  public Scope getPersistenceScope();

  /**
   * Defines the scope in which the ChangeManager can preserve the change
   * 1. NONE                - Do not add the change at all
   * 2. SESSION             - Preserve the change for the session lifetime only
   * 3. LONGER_THEN_SESSION - Preserve the change beyond session. If this is 
the value, any equivalent document change
   *                          will be added if the ChangeManager supports 
document change persistence.
   * 4. DONT_CARE           - The implementation does not care what scope the 
change is preserved in. This value can be
   *                          used to let ChangeManager decide the scope.
   */
  public static enum Scope
  {
    NONE,
    SESSION,
    LONGER_THAN_SESSION,
    DONT_CARE;
  }
}




--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to