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  
19  import org.kuali.ole.fp.document.DistributionOfIncomeExpenseDocument;
20  import org.kuali.ole.sys.OLEPropertyConstants;
21  import org.kuali.ole.sys.OleAuthorizationConstants;
22  import org.kuali.ole.sys.businessobject.ElectronicPaymentClaim;
23  import org.kuali.ole.sys.document.authorization.OLEAccountingDocumentPresentationControllerBase;
24  import org.kuali.rice.kim.api.identity.Person;
25  import org.kuali.rice.krad.document.Document;
26  import org.kuali.rice.krad.uif.lifecycle.ViewLifecycle;
27  import org.kuali.rice.krad.uif.view.View;
28  import org.kuali.rice.krad.uif.view.ViewModel;
29  import org.kuali.rice.krad.uif.view.ViewPresentationController;
30  import org.kuali.rice.krad.web.form.DocumentFormBase;
31  import org.kuali.rice.krad.web.form.UifFormBase;
32  
33  import java.util.List;
34  import java.util.Set;
35  
36  public class OLEDistributionOfIncomeAndExpenseDocumentPresentationController extends OLEAccountingDocumentPresentationControllerBase {
37  
38      /**
39       * @see org.kuali.ole.sys.document.authorization.FinancialSystemTransactionalDocumentPresentationControllerBase#getEditModes(org.kuali.rice.krad.document.Document)
40       */
41      @Override
42      public Set<String> getEditModes(View view, UifFormBase model) {
43          Set<String> editModes = super.getEditModes(view, model);
44          Document document = ((DocumentFormBase) model).getDocument();
45          //Set<String> editModes = super.getEditModes(document);
46  
47          DistributionOfIncomeExpenseDocument distributionOfIncomeAndExpenseDocument = (DistributionOfIncomeExpenseDocument) document;
48          List<ElectronicPaymentClaim> electronicPaymentClaims = distributionOfIncomeAndExpenseDocument.getElectronicPaymentClaims();
49  
50          if (electronicPaymentClaims == null) {
51              distributionOfIncomeAndExpenseDocument.refreshReferenceObject(OLEPropertyConstants.ELECTRONIC_PAYMENT_CLAIMS);
52              electronicPaymentClaims = distributionOfIncomeAndExpenseDocument.getElectronicPaymentClaims();
53          }
54  
55          if (electronicPaymentClaims != null && electronicPaymentClaims.size() > 0) {
56              editModes.add(OleAuthorizationConstants.DistributionOfIncomeAndExpenseEditMode.SOURCE_LINE_READ_ONLY_MODE);
57          }
58  
59          return editModes;
60      }
61  
62  }