View Javadoc
1   /*
2    * Copyright 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.fp.document.authorization;
17  
18  import org.apache.commons.lang.StringUtils;
19  import org.kuali.ole.sys.OLEConstants;
20  import org.kuali.ole.sys.businessobject.FinancialSystemDocumentHeader;
21  import org.kuali.ole.sys.document.authorization.AccountingDocumentPresentationControllerBase;
22  import org.kuali.rice.kew.api.WorkflowDocument;
23  import org.kuali.rice.krad.document.Document;
24  
25  public class ProcurementCardDocumentPresentationController extends AccountingDocumentPresentationControllerBase {
26  
27      /**
28       * @see org.kuali.rice.krad.document.authorization.DocumentPresentationControllerBase#canCancel(org.kuali.rice.krad.document.Document)
29       */
30      @Override
31      public boolean canCancel(Document document) {
32          return false;
33      }
34  
35      /**
36       * @see org.kuali.rice.krad.document.authorization.DocumentPresentationControllerBase#canCopy(org.kuali.rice.krad.document.Document)
37       */
38      @Override
39      public boolean canCopy(Document document) {
40          return false;
41      }
42  
43      /**
44       * @see org.kuali.rice.krad.document.authorization.DocumentPresentationControllerBase#canDisapprove(org.kuali.rice.krad.document.Document)
45       */
46      @Override
47      public boolean canDisapprove(Document document) {
48          return false;
49      }
50  
51      /**
52       * @see org.kuali.rice.krad.document.authorization.DocumentPresentationControllerBase#canEdit(org.kuali.rice.krad.document.Document)
53       */
54      @Override
55      public boolean canEdit(Document document) {
56          WorkflowDocument workflowDocument = document.getDocumentHeader().getWorkflowDocument();
57          //DocumentType
58          boolean canRouteReviewFullEdit = false;
59          for (String routeNode : workflowDocument.getCurrentNodeNames() ) {
60              if ( StringUtils.equalsIgnoreCase(routeNode, OLEConstants.RouteLevelNames.ACCOUNT_REVIEW_FULL_EDIT ) ) {
61                  canRouteReviewFullEdit = true;
62                  break;
63              }
64          }
65  
66          // FULL_ENTRY only if: a) person has an approval request, b) we are at the correct level, c) it's not a correction document,
67          // d) it is not an ADHOC request (important so that ADHOC don't get full entry).
68          if (canRouteReviewFullEdit
69                  && (((FinancialSystemDocumentHeader) document.getDocumentHeader()).getFinancialDocumentInErrorNumber() == null)
70                  && workflowDocument.isApprovalRequested()
71                  && !workflowDocument.isAcknowledgeRequested()) {
72              return true;
73          }
74  
75          return super.canEdit(document);
76      }
77  }