Clover coverage report - Code Coverage for tapestry release 4.0-beta-6
Coverage timestamp: Wed Sep 7 2005 18:41:34 EDT
file stats: LOC: 118   Methods: 8
NCLOC: 58   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
StaleLinkException.java - 7.1% 12.5% 9.1%
coverage coverage
 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 it discovers that
 21    * the an action link was for an out-of-date version of the page.
 22    *
 23    * <p>The application should redirect to the StaleLink page.
 24    *
 25    *
 26    * @author Howard Lewis Ship
 27    *
 28    **/
 29   
 30    public class StaleLinkException extends ApplicationRuntimeException
 31    {
 32    private static final long serialVersionUID = -1266992401198999606L;
 33   
 34    private transient IPage _page;
 35    private String _pageName;
 36    private String _targetIdPath;
 37    private String _targetActionId;
 38   
 39  0 public StaleLinkException()
 40    {
 41  0 super(null, null, null, null);
 42    }
 43   
 44    /**
 45    * Constructor used when the action id is found, but the target id path
 46    * did not match the actual id path.
 47    *
 48    **/
 49   
 50  0 public StaleLinkException(IComponent component, String targetActionId, String targetIdPath)
 51    {
 52  0 super(
 53    Tapestry.format(
 54    "StaleLinkException.action-mismatch",
 55    new String[] { targetActionId, component.getIdPath(), targetIdPath }),
 56    component,
 57    null,
 58    null);
 59   
 60  0 _page = component.getPage();
 61  0 _pageName = _page.getPageName();
 62   
 63  0 _targetActionId = targetActionId;
 64  0 _targetIdPath = targetIdPath;
 65    }
 66   
 67    /**
 68    * Constructor used when the target action id is not found.
 69    *
 70    **/
 71   
 72  0 public StaleLinkException(IPage page, String targetActionId, String targetIdPath)
 73    {
 74  0 this(
 75    Tapestry.format(
 76    "StaleLinkException.component-mismatch",
 77    targetActionId,
 78    targetIdPath),
 79    page);
 80   
 81  0 _targetActionId = targetActionId;
 82  0 _targetIdPath = targetIdPath;
 83    }
 84   
 85  4 public StaleLinkException(String message, IComponent component)
 86    {
 87  4 super(message, component, null, null);
 88    }
 89   
 90   
 91   
 92  0 public String getPageName()
 93    {
 94  0 return _pageName;
 95    }
 96   
 97    /**
 98    * Returns the page referenced by the service URL, if known,
 99    * or null otherwise.
 100    *
 101    **/
 102   
 103  0 public IPage getPage()
 104    {
 105  0 return _page;
 106    }
 107   
 108  0 public String getTargetActionId()
 109    {
 110  0 return _targetActionId;
 111    }
 112   
 113  0 public String getTargetIdPath()
 114    {
 115  0 return _targetIdPath;
 116    }
 117   
 118    }