Coverage Report - org.apache.commons.scaffold.util.ProcessBean
 
Classes in this File Line Coverage Branch Coverage Complexity
ProcessBean
N/A
N/A
1
 
 1  
 /*
 2  
  * Copyright 2001,2004 The Apache Software Foundation.
 3  
  * 
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  * 
 8  
  *      http://www.apache.org/licenses/LICENSE-2.0
 9  
  * 
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 
 17  
 package org.apache.commons.scaffold.util;
 18  
 
 19  
 
 20  
 import java.util.Locale;
 21  
 
 22  
 
 23  
 /**
 24  
  * Simple helper bean that can be used to encapsulate a method
 25  
  * representing a business process.
 26  
  * <p>
 27  
  * The business logic should be implemented in one of the supplied
 28  
  * execute methods, or by another method called by one of these.
 29  
  * A concrete subclass may return a default scope and attribute
 30  
  * name to use when storing the bean (if applicable).
 31  
  * <p>
 32  
  * The preferred approach is to implement the <code>Object
 33  
  * execute(Object)</code> signature, and use execute() to pass
 34  
  * null, some other default value. If a default value is not
 35  
  * possible, it is recommended that <code>execute() throw an
 36  
  * or throw a UnsupportedOperationException.
 37  
  * <p>
 38  
  * Known implementations: BusinessBeanBase.
 39  
  * @author Ted Husted
 40  
  * @version $Revision: 155464 $ $Date: 2005-02-26 13:26:54 +0000 (Sat, 26 Feb 2005) $
 41  
  */
 42  
 public interface ProcessBean {
 43  
 
 44  
 // --------------------------------------------------------- Properties
 45  
 
 46  
     /**
 47  
      * The session attribute key for our user profile bean ["userProfile"].
 48  
      */
 49  
     public static String USER_PROFILE_KEY = "userProfile";
 50  
 
 51  
 
 52  
     /**
 53  
      * Return the locale for this bean instance.
 54  
      *
 55  
      * @return the locale
 56  
      */
 57  
     public Locale getLocale();
 58  
 
 59  
 
 60  
     /**
 61  
      * Set the locale for this bean instance.
 62  
      *
 63  
      * @param locale The new locale
 64  
      */
 65  
     public void setLocale(Locale locale);
 66  
 
 67  
 
 68  
     /**
 69  
      * Return the network address of the client for this bean instance.
 70  
      * <p>
 71  
      * @return the network address.
 72  
      */
 73  
     public Integer getRemoteNode();
 74  
 
 75  
 
 76  
     /**
 77  
      * Set the network address of the client for this bean instance.
 78  
      * @param remoteNode The new remoteNode.
 79  
      */
 80  
     public void setRemoteNode(Integer remoteNode);
 81  
 
 82  
 
 83  
     /**
 84  
      * The remote server object for this bean instance, if any.
 85  
      * <p>
 86  
      * This is often an application-scope object that can be used
 87  
      * to process a JDBC query or equivalent.
 88  
      * By default, the <code>ProcessAction</code> will set this to any
 89  
      * application scope object found under the key
 90  
      * <code>BaseAction.REMOTE_SERVER</code> or to null.
 91  
      *
 92  
      * @return the remote server
 93  
      */
 94  
     public Object getRemoteServer();
 95  
 
 96  
 
 97  
     /**
 98  
      * Set the remote server
 99  
      *
 100  
      * @param server The new server
 101  
      */
 102  
     public void setRemoteServer(Object server);
 103  
 
 104  
 
 105  
     /**
 106  
      * Return the parameter.
 107  
      */
 108  
     public String getParameter();
 109  
 
 110  
 
 111  
     /**
 112  
      * Set the parameter.
 113  
      * @param parameter The new parameter
 114  
      */
 115  
     public void setParameter(String parameter);
 116  
     
 117  
 
 118  
 // ------------------------------------------------------- Public Methods
 119  
 
 120  
 
 121  
     /**
 122  
      * Perform business logic for this bean, often by passing default
 123  
      * values to the <code>Object execute(Object)</code> signature.
 124  
      * If there is no default, it is recommended that a subclass throw
 125  
      * an UnsupportedOperationException instead.
 126  
      *
 127  
      * @exception Throws Exception on any error. A subclass of
 128  
      * ChainedException is recommended.
 129  
      */
 130  
     public Object execute() throws Exception;
 131  
 
 132  
 
 133  
     /**
 134  
      * Perform business logic for this, by retrieving any settings from
 135  
      * the parameters object and returning a result object.
 136  
      *
 137  
      * @exception Throws Exception on any error. A subclass of
 138  
      * <code>ChainedException</code> is recommended.
 139  
      * @param parameters The map or other object to use with this operation
 140  
      */
 141  
     public Object execute(Object parameters) throws Exception;
 142  
 
 143  
 } // end ProcessBean