1 /*** $Id: MacroDAOAction.java,v 1.1.1.1 2004/05/18 10:50:13 mochoa Exp $ */
2 package org.j2ee.dao;
3
4 //test
5 import java.util.Collection;
6 import java.util.Iterator;
7
8 /***
9 * Last modified $Date: 2004/05/18 10:50:13 $
10 * @version $Revision: 1.1.1.1 $
11 * @author jvlio (jvlio@mail.com)*/
12 public class MacroDAOAction implements DAOAction {
13
14 /*** @todo sincronizar con este objeto */
15 public final Object executing = new Object();
16
17 /***
18 * Set the private attribute, the transfer object.
19 * Concrete implementation of this interface must be properly
20 * implement this method to provide an uniform interface for all the actions.
21 * @param to (The Transfer Object used by the action)
22 */
23 public void setTO(Object to) { // Not used by the macro action
24 } ;
25
26 /***
27 * The transfer object used or setted by the action.
28 * @return the transfer object-
29 */
30 public Object getTO() { // Not used by the macro action, every internal action has his own TO
31 return null;
32 };
33
34 /***
35 * This method allows to the action to set a class which manage application
36 * errors such as integrity constraint violated.
37 * @param handler a instance with the application code to manage the exception
38 * @see DAOErrorHandler interface for a list of the code passed to method
39 */
40 public void setErrorHandler(DAOErrorHandler handler) {};
41
42 public void execute(DAOActionProcessor processor) throws DAOException {
43 Iterator it = this.actions();
44 DAOAction action = null;
45
46 initialize();
47 for (int naction = 0; it.hasNext(); naction++) {
48 action = (DAOAction)it.next();
49 preExecute(naction,action);
50 action.execute(processor);
51 posExecute(naction,action);
52 }
53 finalize();
54 }
55
56 public void initialize() {}
57 public void preExecute(int naction, DAOAction action) {}
58 public void posExecute(int naction, DAOAction action) {}
59 public void finalize() {}
60
61 public void add(DAOAction action) { actions.add(action); }
62 public void remove(DAOAction action) { actions.remove(action); }
63 public void clear() { actions.clear(); }
64 public Iterator actions() { return actions.iterator(); }
65
66 /***
67 * @associates <{DAOAction}>
68 * @link aggregation
69 * @supplierCardinality 0..**/
70 private Collection actions = new java.util.ArrayList();
71
72
73 }
This page was automatically generated by Maven