View Javadoc

1   /* ===================================================================
2    * Copyright 2002-04 SRI International.
3    * Released under the MOZILLA PUBLIC LICENSE Version 1.1
4    * which can be obtained at http://www.mozilla.org/MPL/MPL-1.1.html
5    * This software is distributed on an "AS IS"
6    * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
7    * See the License for the specific language governing rights and
8    * limitations under the License.
9    * =================================================================== */
10  package com.sri.emo.dbobj;
11  
12  import com.jcorporate.expresso.core.controller.ControllerException;
13  import com.jcorporate.expresso.core.controller.ControllerRequest;
14  import com.jcorporate.expresso.core.controller.ControllerResponse;
15  import com.jcorporate.expresso.core.controller.Transition;
16  import com.jcorporate.expresso.core.db.DBException;
17  import com.sri.common.controller.AbstractDBController;
18  
19  
20  /***
21   * Special handling for nodes.
22   *
23   * @author Larry Hamel
24   */
25  public interface INodeHandler {
26      /***
27       * Add special initialization for this type of object;
28       * called after a Node object of this type is added.
29       *
30       * @param node is a fully constructed node, with ID
31       * @throws DBException upon database related error.
32       */
33      void init(Node node) throws DBException;
34  
35      /***
36       * Supply list transition suitable for this type of object.
37       *
38       * @param request supply current request
39       * @return transition which can be used to list nodes of subclass type
40       * @throws DBException upon database related error.
41       */
42      Transition getListTransition(ControllerRequest request)
43              throws DBException;
44  
45      /***
46       * View the node.
47       *
48       * @param node          The Node we're viewing.
49       * @param defaultaction The default action.
50       * @param request       The ControllerRequest object.
51       * @param response      The ControllerResponse object.
52       * @throws DBException         upon database related error.
53       * @throws ControllerException upon controller related error.
54       */
55      void view(Node node, AbstractDBController defaultaction,
56                ControllerRequest request, ControllerResponse response)
57              throws DBException, ControllerException;
58  
59      /***
60       * List all nodes of type indicated by samplenode.
61       * Handled here to permit customization of listing.
62       *
63       * @param samplenode has given type, but may NOT have an ID--it is just a sample
64       * @param action     The action invoking this.
65       * @param request    The ControllerRequest object.
66       * @param response   The ControllerResponse object.
67       * @throws DBException         upon database related error.
68       * @throws ControllerException upon controller related error.
69       */
70      void list(Node samplenode, AbstractDBController action,
71                ControllerRequest request, ControllerResponse response)
72              throws DBException, ControllerException;
73  }