1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.module.purap.document.authorization;
17
18 import org.kuali.ole.module.purap.PurapAuthorizationConstants;
19 import org.kuali.ole.module.purap.document.BulkReceivingDocument;
20 import org.kuali.ole.module.purap.document.PurchasingAccountsPayableDocument;
21 import org.kuali.rice.krad.document.Document;
22 import org.kuali.rice.krad.util.ObjectUtils;
23
24 import java.util.Set;
25
26
27 public class BulkReceivingDocumentPresentationController extends PurchasingAccountsPayableDocumentPresentationController {
28
29 @Override
30 public boolean canSave(Document document) {
31 if (((PurchasingAccountsPayableDocument) document).getFinancialSystemDocumentHeader().getWorkflowDocument().isInitiated()) {
32 return false;
33 }
34 return super.canSave(document);
35 }
36
37 @Override
38 public boolean canCancel(Document document) {
39 if (((PurchasingAccountsPayableDocument) document).getFinancialSystemDocumentHeader().getWorkflowDocument().isInitiated()) {
40 return false;
41 }
42 return super.canCancel(document);
43 }
44
45 @Override
46 public boolean canClose(Document document) {
47 if (((PurchasingAccountsPayableDocument) document).getFinancialSystemDocumentHeader().getWorkflowDocument().isInitiated()) {
48 return false;
49 }
50 return super.canClose(document);
51 }
52
53 @Override
54 public Set<String> getEditModes(Document document) {
55 Set<String> editModes = super.getEditModes(document);
56 BulkReceivingDocument bulkReceivingDocument = (BulkReceivingDocument) document;
57
58
59 if (ObjectUtils.isNotNull(bulkReceivingDocument.getVendorHeaderGeneratedIdentifier())) {
60 editModes.add(PurapAuthorizationConstants.BulkReceivingEditMode.LOCK_VENDOR_ENTRY);
61 }
62
63 if (((PurchasingAccountsPayableDocument) document).getFinancialSystemDocumentHeader().getWorkflowDocument().isInitiated()) {
64 editModes.add(PurapAuthorizationConstants.BulkReceivingEditMode.DISPLAY_INIT_TAB);
65 }
66
67 return editModes;
68 }
69 }