01: /*
02: * Bossa Workflow System
03: *
04: * $Id: OpenWorkItem.java,v 1.13 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: import com.bigbross.bossa.BossaException;
28: import com.bigbross.bossa.resource.Resource;
29:
30: /**
31: * This class implements the open operation of <code>WorkItem</code>
32: * through the prevalence subsystem. <p>
33: *
34: * @author <a href="http://www.bigbross.com">BigBross Team</a>
35: * @see WorkItem#open(Resource)
36: */
37: class OpenWorkItem extends WFNetTransaction {
38:
39: private String caseTypeId;
40: private int caseId;
41: private String workItemId;
42: private String resourceId;
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: OpenWorkItem(WorkItem workItem, Resource resource) {
51: this .workItemId = workItem.getId();
52: this .caseId = workItem.getCase().getId();
53: this .caseTypeId = workItem.getCaseType().getId();
54: this .resourceId = resource.getId();
55: }
56:
57: /**
58: * Executes the operation. <p>
59: *
60: * @exception SetAttributeException if the underlying expression
61: * evaluation system has problems setting an attribute.
62: * @exception EvaluationException if an expression evaluation error
63: * occurs. If this exception is thrown the state of the case
64: * may be left inconsistent.
65: * @see WFNetTransaction#execute(CaseTypeManager)
66: */
67: protected Object execute(CaseTypeManager caseTypeManager)
68: throws BossaException {
69: Resource resource = caseTypeManager.getBossa()
70: .getResourceManager().getResource(resourceId);
71: Case caze = caseTypeManager.getCaseType(caseTypeId).getCase(
72: caseId);
73: WorkItem workItem = caze.getWorkItem(workItemId);
74:
75: return caze.open(workItem, resource);
76: }
77: }
|