Coverage Report - org.apache.tapestry.StaleLinkException
 
Classes in this File Line Coverage Branch Coverage Complexity
StaleLinkException
0%
0/24
N/A
1
 
 1  
 // Copyright 2004, 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;
 16  
 
 17  
 import org.apache.hivemind.ApplicationRuntimeException;
 18  
 
 19  
 /**
 20  
  * Exception thrown by an {@link org.apache.tapestry.engine.IEngineService} when
 21  
  * it discovers that the an action link was for an out-of-date version of the
 22  
  * page.
 23  
  * <p>
 24  
  * The application should redirect to the StaleLink page.
 25  
  * 
 26  
  * @author Howard Lewis Ship
 27  
  */
 28  
 
 29  
 public class StaleLinkException extends ApplicationRuntimeException
 30  
 {
 31  
 
 32  
     private static final long serialVersionUID = -1266992401198999606L;
 33  
 
 34  
     private final transient IPage _page;
 35  
     private final String _pageName;
 36  
     private final String _targetIdPath;
 37  
     private final String _targetActionId;
 38  
 
 39  
     public StaleLinkException()
 40  
     {
 41  0
         super(null, null, null, null);
 42  
         
 43  0
         _targetIdPath = null;
 44  0
         _page = null;
 45  0
         _pageName = null;
 46  0
         _targetActionId = null;
 47  0
     }
 48  
 
 49  
     /**
 50  
      * Constructor used when the action id is found, but the target id path did
 51  
      * not match the actual id path.
 52  
      */
 53  
 
 54  
     public StaleLinkException(IComponent component, String targetActionId,
 55  
             String targetIdPath)
 56  
     {
 57  0
         super(Tapestry.format("StaleLinkException.action-mismatch",
 58  
                 new String[] { targetActionId, component.getIdPath(),
 59  
                         targetIdPath }), component, null, null);
 60  
 
 61  0
         _page = component.getPage();
 62  0
         _pageName = _page.getPageName();
 63  
 
 64  0
         _targetActionId = targetActionId;
 65  0
         _targetIdPath = targetIdPath;
 66  0
     }
 67  
 
 68  
     /**
 69  
      * Constructor used when the target action id is not found.
 70  
      */
 71  
 
 72  
     public StaleLinkException(IPage page, String targetActionId,
 73  
             String targetIdPath)
 74  
     {
 75  0
         this(Tapestry.format("StaleLinkException.component-mismatch",
 76  
                 targetActionId, targetIdPath), page);
 77  0
     }
 78  
 
 79  
     public StaleLinkException(String message, IComponent component)
 80  
     {
 81  0
         super(message, component, null, null);
 82  
         
 83  0
         _targetIdPath = null;
 84  0
         _page = null;
 85  0
         _pageName = null;
 86  0
         _targetActionId = null;
 87  0
     }
 88  
 
 89  
     public String getPageName()
 90  
     {
 91  0
         return _pageName;
 92  
     }
 93  
 
 94  
     /**
 95  
      * Returns the page referenced by the service URL, if known, or null
 96  
      * otherwise.
 97  
      */
 98  
 
 99  
     public IPage getPage()
 100  
     {
 101  0
         return _page;
 102  
     }
 103  
 
 104  
     public String getTargetActionId()
 105  
     {
 106  0
         return _targetActionId;
 107  
     }
 108  
 
 109  
     public String getTargetIdPath()
 110  
     {
 111  0
         return _targetIdPath;
 112  
     }
 113  
 
 114  
 }