2009/05/20 - Apache Shale has been retired.

For more information, please explore the Attic.

Coverage Report - org.apache.shale.dialog.scxml.action.RedirectAction
 
Classes in this File Line Coverage Branch Coverage Complexity
RedirectAction
0%
0/10
0%
0/3
2
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 3  
  * contributor license agreements.  See the NOTICE file distributed with
 4  
  * this work for additional information regarding copyright ownership.
 5  
  * The ASF licenses this file to you under the Apache License, Version 2.0
 6  
  * (the "License"); you may not use this file except in compliance with
 7  
  * the License.  You may obtain a copy of the License at
 8  
  *
 9  
  *      http://www.apache.org/licenses/LICENSE-2.0
 10  
  *
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  */
 17  
 
 18  
 package org.apache.shale.dialog.scxml.action;
 19  
 
 20  
 import java.util.Collection;
 21  
 
 22  
 import org.apache.commons.logging.Log;
 23  
 import org.apache.commons.logging.LogFactory;
 24  
 import org.apache.commons.scxml.ErrorReporter;
 25  
 import org.apache.commons.scxml.EventDispatcher;
 26  
 import org.apache.commons.scxml.SCInstance;
 27  
 import org.apache.commons.scxml.SCXMLExpressionException;
 28  
 import org.apache.commons.scxml.model.Action;
 29  
 import org.apache.commons.scxml.model.ModelException;
 30  
 import org.apache.shale.dialog.scxml.DialogProperties;
 31  
 import org.apache.shale.dialog.scxml.Globals;
 32  
 
 33  
 /**
 34  
  * <p>Custom Commons SCXML action to signal that the next rendered view
 35  
  * in this dialog should use a <i>redirect</i>.</p>
 36  
  *
 37  
  * @since 1.0.4
 38  
  *
 39  
  * $Id: RedirectAction.java 486006 2006-12-12 03:46:29Z rahul $
 40  
  */
 41  0
 public class RedirectAction extends Action {
 42  
 
 43  
     /**
 44  
      * <p>Set redirection flag in dialog properties so the next rendered
 45  
      * dialog view is issued as a redirect.</p>
 46  
      *
 47  
      * @param evtDispatcher The EventDispatcher for this execution instance
 48  
      * @param errRep        The ErrorReporter
 49  
      * @param scInstance    The state machine execution instance information
 50  
      * @param appLog        The application log
 51  
      * @param derivedEvents The collection of internal events
 52  
      * @throws ModelException If execution causes a non-deterministic state
 53  
      * @throws SCXMLExpressionException Bad expression
 54  
      */
 55  
     public void execute(EventDispatcher evtDispatcher, ErrorReporter errRep,
 56  
             SCInstance scInstance, Log appLog, Collection derivedEvents)
 57  
     throws ModelException, SCXMLExpressionException {
 58  
 
 59  0
         DialogProperties dp = (DialogProperties) scInstance.getRootContext().
 60  
             get(Globals.DIALOG_PROPERTIES);
 61  0
         dp.setNextRedirect(true);
 62  
 
 63  0
         if (log().isDebugEnabled()) {
 64  0
             log().debug("<redirect>: Next view will be issued via a redirect");
 65  
         }
 66  
 
 67  0
     }
 68  
 
 69  
 
 70  
     // --------------------------------------------------------------- Logging
 71  
 
 72  
     /**
 73  
      * <p>The <code>Log</code> instance for this class.  This value is lazily
 74  
      * instantiated, and is also transient and may need to be regenerated.</p>
 75  
      */
 76  0
     private transient Log log = null;
 77  
 
 78  
 
 79  
     /**
 80  
      * <p>Return the <code>Log</code> instance for this instance.</p>
 81  
      *
 82  
      * @return The {@link Log} instance used by this manager
 83  
      */
 84  
     private Log log() {
 85  0
         if (this.log == null) {
 86  0
             this.log = LogFactory.getLog(RedirectAction.class);
 87  
         }
 88  0
         return this.log;
 89  
     }
 90  
 
 91  
 }