You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Prakash Udupa <pr...@oracle.com> on 2013/12/24 20:25:40 UTC

[TRINIDAD] [API] (TRINIDAD-2438) Need ability to filter the scope of change storage based on attribute type

Hi,

There is a new API proposed to solve a requirement for the customization feature (ChangeManager).
The details of the API and usecase is as noted below, please review and discuss here if you have any feedback or issues 
with it.

Thanks,
Prakash


-------- Original Message --------
Subject: 	[jira] [Created] (TRINIDAD-2438) Need ability to filter the scope of change storage based on attribute type
Date: 	Tue, 24 Dec 2013 19:17:50 +0000 (UTC)
From: 	Prakash Udupa (JIRA) <de...@myfaces.apache.org>
Reply-To: 	MyFaces Development <de...@myfaces.apache.org>
To: 	dev@myfaces.apache.org



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)