01: /*
02: * Copyright 2006-2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.kuali.test.monitor;
17:
18: import org.kuali.core.bo.user.UniversalUser;
19: import org.kuali.core.workflow.service.KualiWorkflowDocument;
20: import org.kuali.core.workflow.service.WorkflowDocumentService;
21: import org.kuali.kfs.context.SpringContext;
22:
23: import edu.iu.uis.eden.EdenConstants;
24: import edu.iu.uis.eden.exception.WorkflowException;
25:
26: public class DocumentWorkflowRequestMonitor extends ChangeMonitor {
27:
28: private final Long docHeaderId;
29: private final UniversalUser user;
30: private final String actionRequestedCode;
31:
32: public DocumentWorkflowRequestMonitor(Long docHeaderId,
33: UniversalUser user, String actionRequestedCode) {
34: this .docHeaderId = docHeaderId;
35: this .user = user;
36: this .actionRequestedCode = actionRequestedCode;
37: }
38:
39: public boolean valueChanged() throws WorkflowException {
40: KualiWorkflowDocument document = SpringContext.getBean(
41: WorkflowDocumentService.class).createWorkflowDocument(
42: docHeaderId, user);
43: if (EdenConstants.ACTION_REQUEST_COMPLETE_REQ
44: .equals(actionRequestedCode)) {
45: return document.isCompletionRequested();
46: } else if (EdenConstants.ACTION_REQUEST_APPROVE_REQ
47: .equals(actionRequestedCode)) {
48: return document.isApprovalRequested();
49: } else if (EdenConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ
50: .equals(actionRequestedCode)) {
51: return document.isAcknowledgeRequested();
52: } else if (EdenConstants.ACTION_REQUEST_FYI_REQ
53: .equals(actionRequestedCode)) {
54: return document.isFYIRequested();
55: }
56: return false;
57: }
58: }
|