01: /*
02: * Bossa Workflow System
03: *
04: * $Id: CancelActivity.java,v 1.7 2004/03/03 20:54:49 gdvieira Exp $
05: *
06: * Copyright (C) 2003,2004 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.wfnet;
26:
27: /**
28: * This class implements the cancel operation of <code>Activity</code>
29: * through the prevalence subsystem. <p>
30: *
31: * @author <a href="http://www.bigbross.com">BigBross Team</a>
32: * @see Activity#cancel()
33: */
34: class CancelActivity extends WFNetTransaction {
35:
36: private String caseTypeId;
37: private int caseId;
38: private int activityId;
39:
40: /**
41: * Creates a new cancel operation. <p>
42: *
43: * @param activity the activity to be canceled.
44: */
45: CancelActivity(Activity activity) {
46: this .activityId = activity.getId();
47: this .caseId = activity.getCase().getId();
48: this .caseTypeId = activity.getCaseType().getId();
49: }
50:
51: /**
52: * Executes the operation. <p>
53: *
54: * @exception EvaluationException if an expression evaluation error
55: * occurs. If this exception is thrown the state of the case
56: * may be left inconsistent.
57: * @see WFNetTransaction#execute(CaseTypeManager)
58: */
59: protected Object execute(CaseTypeManager caseTypeManager)
60: throws EvaluationException {
61: Case caze = caseTypeManager.getCaseType(caseTypeId).getCase(
62: caseId);
63: Activity activity = caze.getActivity(activityId);
64: return new Boolean(caze.cancel(activity));
65: }
66: }
|