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 Close document
25: */
26: public class PurchaseOrderCloseDocumentAuthorizer extends
27: PurchaseOrderDocumentAuthorizer {
28:
29: /**
30: * @see org.kuali.core.document.authorization.DocumentAuthorizerBase#hasInitiateAuthorization(org.kuali.core.document.Document,
31: * org.kuali.core.bo.user.UniversalUser)
32: */
33: @Override
34: public boolean hasInitiateAuthorization(Document document,
35: UniversalUser user) {
36: return true;
37: }
38:
39: /**
40: * @see org.kuali.core.document.authorization.DocumentAuthorizer#getDocumentActionFlags(org.kuali.core.document.Document,
41: * org.kuali.core.bo.user.UniversalUser)
42: */
43: @Override
44: public DocumentActionFlags getDocumentActionFlags(
45: Document document, UniversalUser user) {
46: DocumentActionFlags flags = super .getDocumentActionFlags(
47: document, user);
48: KualiWorkflowDocument workflowDocument = document
49: .getDocumentHeader().getWorkflowDocument();
50:
51: if (workflowDocument.stateIsInitiated()
52: || workflowDocument.stateIsSaved()) {
53: // do not allow this document to be saved; once initiated, it must be routed or cancelled
54: flags.setCanSave(false);
55: }
56:
57: // NEED TO REDO ANNOTATE CHECK SINCE CHANGED THE VALUE OF FLAGS
58: this.setAnnotateFlag(flags);
59:
60: return flags;
61: }
62:
63: }
|