Coverage Report - org.apache.tapestry.record.ClientPropertyPersistenceScope
 
Classes in this File Line Coverage Branch Coverage Complexity
ClientPropertyPersistenceScope
N/A
N/A
1
 
 1  
 // Copyright 2005 The Apache Software Foundation
 2  
 //
 3  
 // Licensed under the Apache License, Version 2.0 (the "License");
 4  
 // you may not use this file except in compliance with the License.
 5  
 // You may obtain a copy of the License at
 6  
 //
 7  
 //     http://www.apache.org/licenses/LICENSE-2.0
 8  
 //
 9  
 // Unless required by applicable law or agreed to in writing, software
 10  
 // distributed under the License is distributed on an "AS IS" BASIS,
 11  
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12  
 // See the License for the specific language governing permissions and
 13  
 // limitations under the License.
 14  
 
 15  
 package org.apache.tapestry.record;
 16  
 
 17  
 import org.apache.tapestry.engine.ServiceEncoding;
 18  
 
 19  
 /**
 20  
  * Service tapestry.persist.ClientPropertyPersistenceScope. Determines whether a particular property
 21  
  * needs to be persisted or not.
 22  
  *
 23  
  * @author Mindbridge
 24  
  * @since 4.0
 25  
  * @see org.apache.tapestry.record.ClientPropertyPersistenceStrategy
 26  
  */
 27  
 public interface ClientPropertyPersistenceScope
 28  
 {
 29  
     /**
 30  
      * Determines whether state should be encoded for the request.
 31  
      *
 32  
      * @param encoding
 33  
      *            identifies the service, URL and base set of parameters
 34  
      * @param pageName
 35  
      *            the page for which data is potentially to be encoded
 36  
      * @param data
 37  
      *              The data to check.
 38  
      * @return true if state should be encoded into the encoding, false otherwise
 39  
      */
 40  
 
 41  
     boolean shouldEncodeState(ServiceEncoding encoding, String pageName, PersistentPropertyData data);
 42  
 
 43  
     /**
 44  
      * Constructs a parameter name for a particular page name. The parameter name can be recognized
 45  
      * (in a later request) by the {@link #isParameterForScope(String)} method.
 46  
      *
 47  
      * @param pageName
 48  
      *            the name of the page for which a corresponding parameter name should be generated.
 49  
      * @return a query parameter name that identifies the page and this client persistence scope.
 50  
      */
 51  
 
 52  
     String constructParameterName(String pageName);
 53  
 
 54  
     /**
 55  
      * Checks a parameter to see if it was the result of {@link #constructParameterName(String)} for
 56  
      * this persistence scope.
 57  
      *
 58  
      * @param parameterName
 59  
      *            a query parameter name
 60  
      * @return true if the parameterName was genereted (i.e., is properly prefixed) by this scope,
 61  
      *         false otherwise.
 62  
      */
 63  
 
 64  
     boolean isParameterForScope(String parameterName);
 65  
 
 66  
     /**
 67  
      * Extracts a page name from a query parameter name.
 68  
      *
 69  
      * @param parameterName
 70  
      *            the paramter name, for which {@link #isParameterForScope(String)} must return true
 71  
      * @return the name of the page
 72  
      */
 73  
     String extractPageName(String parameterName);
 74  
 }