001 /* 002 * Copyright 2011 The Kuali Foundation. 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package org.kuali.kfs.module.ec.document.authorization; 017 018 import java.util.Set; 019 020 import org.kuali.kfs.module.ec.EffortConstants.EffortCertificationEditMode; 021 import org.kuali.kfs.sys.document.authorization.FinancialSystemTransactionalDocumentPresentationControllerBase; 022 import org.kuali.rice.kns.document.Document; 023 024 /** 025 * Document Presentation Controller for the Effort Certification document. allowsErrorCorrection property has been set to false in 026 * data dictionary entry setHasAmountTotal property has been set to true in data dictionary entry 027 */ 028 029 public class EffortDocumentPresentationController extends FinancialSystemTransactionalDocumentPresentationControllerBase { 030 031 /** 032 * @see org.kuali.rice.kns.document.authorization.DocumentPresentationControllerBase#canCancel(org.kuali.rice.kns.document.Document) 033 */ 034 @Override 035 public boolean canCancel(Document document) { 036 return false; 037 } 038 039 /** 040 * @see org.kuali.rice.kns.document.authorization.DocumentPresentationControllerBase#canSave(org.kuali.rice.kns.document.Document) 041 */ 042 @Override 043 public boolean canSave(Document document) { 044 return true; 045 } 046 047 /** 048 * @see org.kuali.rice.kns.document.authorization.DocumentPresentationControllerBase#canCopy(org.kuali.rice.kns.document.Document) 049 */ 050 @Override 051 public boolean canCopy(Document document) { 052 return false; 053 } 054 055 /** 056 * @see org.kuali.rice.kns.document.authorization.DocumentPresentationControllerBase#canBlanketApprove(org.kuali.rice.kns.document.Document) 057 */ 058 @Override 059 public boolean canBlanketApprove(Document document) { 060 boolean initiated = document.getDocumentHeader().getWorkflowDocument().stateIsInitiated(); 061 if (initiated) { 062 return false; 063 } 064 065 return super.canBlanketApprove(document); 066 } 067 068 /** 069 * @see org.kuali.rice.kns.document.authorization.DocumentPresentationControllerBase#canDisapprove(org.kuali.rice.kns.document.Document) 070 */ 071 @Override 072 public boolean canDisapprove(Document document) { 073 boolean enroute = document.getDocumentHeader().getWorkflowDocument().stateIsEnroute(); 074 if (enroute) { 075 return false; 076 } 077 078 return super.canDisapprove(document); 079 } 080 081 /** 082 * @see org.kuali.kfs.sys.document.authorization.FinancialSystemTransactionalDocumentPresentationControllerBase#getEditModes(org.kuali.rice.kns.document.Document) 083 */ 084 @Override 085 public Set<String> getEditModes(Document document) { 086 Set<String> editModes = super.getEditModes(document); 087 editModes.add(EffortCertificationEditMode.DETAIL_TAB_ENTRY); 088 editModes.add(EffortCertificationEditMode.SUMMARY_TAB_ENTRY); 089 090 return editModes; 091 } 092 }