01: /*
02: * Copyright 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.module.purap.document.authorization;
17:
18: import org.kuali.core.bo.user.UniversalUser;
19: import org.kuali.core.document.Document;
20: import org.kuali.core.document.authorization.DocumentActionFlags;
21: import org.kuali.core.workflow.service.KualiWorkflowDocument;
22:
23: /**
24: * Document Authorizer for the PO document.
25: */
26: public class PurchaseOrderVoidDocumentAuthorizer extends
27: PurchaseOrderDocumentAuthorizer {
28:
29: /**
30: * @see org.kuali.core.document.authorization.DocumentAuthorizer#getDocumentActionFlags(org.kuali.core.document.Document,
31: * org.kuali.core.bo.user.UniversalUser)
32: */
33: @Override
34: public DocumentActionFlags getDocumentActionFlags(
35: Document document, UniversalUser user) {
36: DocumentActionFlags flags = super .getDocumentActionFlags(
37: document, user);
38: KualiWorkflowDocument workflowDocument = document
39: .getDocumentHeader().getWorkflowDocument();
40:
41: if (workflowDocument.stateIsInitiated()
42: || workflowDocument.stateIsSaved()) {
43: // do not allow this document to be saved; once initiated, it must be routed or canceled
44: flags.setCanSave(false);
45: }
46:
47: // NEED TO REDO ANNOTATE CHECK SINCE CHANGED THE VALUE OF FLAGS
48: this.setAnnotateFlag(flags);
49:
50: return flags;
51: }
52:
53: }
|