01: /*
02: * Bossa Workflow System
03: *
04: * $Id: BossaTransaction.java,v 1.2 2003/12/01 20:10:08 gdvieira Exp $
05: *
06: * Copyright (C) 2003 OpenBR Sistemas S/C Ltda.
07: *
08: * This file is part of Bossa.
09: *
10: * Bossa is free software; you can redistribute it and/or modify it
11: * under the terms of version 2 of the GNU General Public License as
12: * published by the Free Software Foundation.
13: *
14: * This program is distributed in the hope that it will be useful,
15: * but WITHOUT ANY WARRANTY; without even the implied warranty of
16: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17: * General Public License for more details.
18: *
19: * You should have received a copy of the GNU General Public
20: * License along with this program; if not, write to the
21: * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22: * Boston, MA 02111-1307, USA.
23: */
24:
25: package com.bigbross.bossa;
26:
27: import java.util.Date;
28:
29: import org.prevayler.TransactionWithQuery;
30:
31: import com.bigbross.bossa.Bossa;
32:
33: /**
34: * This class represents all transactions applied to a Bossa engine. <p>
35: *
36: * @author <a href="http://www.bigbross.com">BigBross Team</a>
37: */
38: public abstract class BossaTransaction implements TransactionWithQuery {
39:
40: /**
41: * Executes a transaction in a prevalent system. <p>
42: *
43: * This method sets the engine time source to the time
44: * provided. It should only be called by the prevayler instance
45: * providing persistence to the engine. <p>
46: *
47: * @see org.prevayler.TransactionWithQuery#executeAndQuery(Object, Date)
48: */
49: public Object executeAndQuery(Object system, Date time)
50: throws Exception {
51: Bossa bossa = (Bossa) system;
52: ((DeterministicTimeSource) bossa.getTimeSource()).setTime(time);
53: return execute(bossa);
54: }
55:
56: /**
57: * Executes a transaction in a Bossa engine. <p>
58: *
59: * This method uses the time currently set in the engine time source. <p>
60: *
61: * @param bossa the Bossa engine.
62: * @return the value returned by the transaction.
63: * @exception BossaException if a Bossa error occurs.
64: */
65: public abstract Object execute(Bossa bossa) throws BossaException;
66: }
|