org.apache.tapestry.record
Class RecordUtils

java.lang.Object
  extended by org.apache.tapestry.record.RecordUtils

public final class RecordUtils
extends Object

Utility methods to support implementations of PropertyPersistenceStrategy. This consists of code refactored out of SessionPropertyPersistenceStrategy to support other, similar, persistence types with different rules for how long values are stored in the session.

Since:
4.0
Author:
Howard M. Lewis Ship

Method Summary
static PropertyChange buildChange(String key, Object value)
          Builds a PropertyChange instance for the given key and value pulled from the WebSession.
static String buildChangeKey(String strategyId, String applicationId, String pageName, String idPath, String propertyName)
          Builds a change key, used to identify the change within the WebSession.
static void iterateOverMatchingAttributes(String strategyId, String applicationId, String pageName, WebSession session, WebSessionAttributeCallback callback)
          Iterates over the attributes stored in the session, invoking a callback on each one that matches the given prefix, applicationid and page name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

buildChange

public static PropertyChange buildChange(String key,
                                         Object value)
Builds a PropertyChange instance for the given key and value pulled from the WebSession.

Parameters:
key - a key, previously created by buildChangeKey(String, String, String, String, String), consisting of a strategy id, application id, page name, id path (optional), and a property name, all seperated by commas.
value - the value stored in the session with this key
Returns:
a PropertyChange storing the property name and id path (if any), and the value

iterateOverMatchingAttributes

public static void iterateOverMatchingAttributes(String strategyId,
                                                 String applicationId,
                                                 String pageName,
                                                 WebSession session,
                                                 WebSessionAttributeCallback callback)
Iterates over the attributes stored in the session, invoking a callback on each one that matches the given prefix, applicationid and page name. This is used to operate over all stored data for a particular combination of strategy, applicationId and page.

Parameters:
strategyId - a unique identifier for a particular implementation of PropertyPersistenceStrategy
applicationId - a unique id for the application
pageName - the name of the page
session - the session to search
callback - the callback to invoke on each matching attibute name

buildChangeKey

public static String buildChangeKey(String strategyId,
                                    String applicationId,
                                    String pageName,
                                    String idPath,
                                    String propertyName)
Builds a change key, used to identify the change within the WebSession. A change key can be used as a session attribute name, without reasonable fear of conflict.

Parameters:
strategyId - a unique identifier for a particular implementation of PropertyPersistenceStrategy
applicationId - a unique identifier for the application
pageName - the name of the page containing the change
idPath - the id path of the component within the page containing the page, possibly null
propertyName - the name of the property
Returns:
the above values, seperated by commas (well, no comma between the prefix and the application id)


Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.