View Javadoc
1   /*
2    * Copyright 2008 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.PurapConstants.PurchaseOrderStatuses;
20  import org.kuali.ole.module.purap.document.PurchaseOrderDocument;
21  import org.kuali.ole.module.purap.document.PurchaseOrderRetransmitDocument;
22  import org.kuali.rice.krad.document.Document;
23  
24  import java.util.Set;
25  
26  
27  public class PurchaseOrderRetransmitDocumentPresentationController extends PurchaseOrderDocumentPresentationController {
28  
29      @Override
30      public boolean canSave(Document document) {
31          return false;
32      }
33  
34      @Override
35      public Set<String> getEditModes(Document document) {
36          Set<String> editModes = super.getEditModes(document);
37          PurchaseOrderRetransmitDocument poDocument = (PurchaseOrderRetransmitDocument) document;
38          if (poDocument.isShouldDisplayRetransmitTab()) {
39              editModes.add(PurapAuthorizationConstants.PurchaseOrderEditMode.DISPLAY_RETRANSMIT_TAB);
40          }
41          return editModes;
42      }
43  
44      // MSU Contribution OLEMI-8595 DTT-2396 OLECNTRB-946
45      @Override
46      protected boolean canPreviewPrintPo(PurchaseOrderDocument poDocument) {
47          boolean canPreviewPrintPo = super.canPreviewPrintPo(poDocument);
48          if (canPreviewPrintPo) {
49              return !(poDocument.getDocumentHeader().getWorkflowDocument().isEnroute() && PurchaseOrderStatuses.APPDOC_CHANGE_IN_PROCESS
50                      .equals(poDocument.getApplicationDocumentStatus()));
51          }
52          return canPreviewPrintPo;
53      }
54  }