01: /*
02: * Bossa Workflow System
03: *
04: * $Id: SetState.java,v 1.2 2004/02/12 21:35:14 gdvieira Exp $
05: *
06: * Copyright (C) 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: import java.util.Map;
28:
29: import com.bigbross.bossa.BossaException;
30:
31: /**
32: * This class implements the set state operation of <code>Case</code>
33: * through the prevalence subsystem. <p>
34: *
35: * @author <a href="http://www.bigbross.com">BigBross Team</a>
36: * @see Case#setState(Map)
37: */
38: class SetState extends WFNetTransaction {
39:
40: private String caseTypeId;
41: private int caseId;
42: private Map newState;
43:
44: /**
45: * Creates a new open operation. <p>
46: *
47: * @param workItem the work item to be opened.
48: * @param resource the resource opening it.
49: */
50: SetState(Case caze, Map newState) {
51: this .caseId = caze.getId();
52: this .caseTypeId = caze.getCaseType().getId();
53: this .newState = newState;
54: }
55:
56: /**
57: * Executes the operation. <p>
58: *
59: * @exception EvaluationException if an expression evaluation error
60: * occurs. If this exception is thrown the state of the case
61: * may be left inconsistent.
62: * @see WFNetTransaction#execute(CaseTypeManager)
63: */
64: protected Object execute(CaseTypeManager caseTypeManager)
65: throws BossaException {
66: Case caze = caseTypeManager.getCaseType(caseTypeId).getCase(
67: caseId);
68: caze.setStateImpl(newState);
69: return null;
70: }
71: }
|