View Javadoc
1   /*
2    * Copyright 2008-2009 The Kuali Foundation
3    * 
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    * http://www.opensource.org/licenses/ecl2.php
9    * 
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.ole.module.purap.document.authorization;
17  
18  import org.kuali.ole.module.purap.PurapAuthorizationConstants;
19  import org.kuali.ole.module.purap.document.ReceivingDocumentBase;
20  import org.kuali.rice.krad.document.Document;
21  
22  import java.util.Set;
23  
24  public class LineItemReceivingDocumentPresentationController extends PurchasingAccountsPayableDocumentPresentationController {
25  
26      @Override
27      public boolean canSave(Document document) {
28          if (((ReceivingDocumentBase) document).getFinancialSystemDocumentHeader().getWorkflowDocument().isInitiated()) {
29              return false;
30          }
31          return super.canSave(document);
32      }
33  
34      @Override
35      public boolean canCancel(Document document) {
36          if (((ReceivingDocumentBase) document).getFinancialSystemDocumentHeader().getWorkflowDocument().isInitiated()) {
37              return false;
38          }
39          return super.canCancel(document);
40      }
41  
42      @Override
43      public boolean canClose(Document document) {
44          if (((ReceivingDocumentBase) document).getFinancialSystemDocumentHeader().getWorkflowDocument().isInitiated()) {
45              return false;
46          }
47          return super.canClose(document);
48      }
49  
50      @Override
51      public Set<String> getEditModes(Document document) {
52          Set<String> editModes = super.getEditModes(document);
53  
54          if (((ReceivingDocumentBase) document).getFinancialSystemDocumentHeader().getWorkflowDocument().isInitiated()) {
55              editModes.add(PurapAuthorizationConstants.LineItemReceivingEditMode.DISPLAY_INIT_TAB);
56          }
57  
58          return editModes;
59      }
60  }