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.purap.document.authorization; 017 018 import java.util.Set; 019 020 import org.kuali.kfs.module.purap.PurapAuthorizationConstants; 021 import org.kuali.rice.kns.document.Document; 022 import org.kuali.rice.kns.workflow.service.KualiWorkflowDocument; 023 024 025 public class LineItemReceivingDocumentPresentationController extends PurchasingAccountsPayableDocumentPresentationController { 026 027 @Override 028 protected boolean canSave(Document document) { 029 KualiWorkflowDocument workflowDocument = document.getDocumentHeader().getWorkflowDocument(); 030 if (workflowDocument.stateIsInitiated()) { 031 return false; 032 } 033 return super.canSave(document); 034 } 035 036 @Override 037 protected boolean canCancel(Document document) { 038 KualiWorkflowDocument workflowDocument = document.getDocumentHeader().getWorkflowDocument(); 039 if (workflowDocument.stateIsInitiated()) { 040 return false; 041 } 042 return super.canCancel(document); 043 } 044 045 @Override 046 protected boolean canClose(Document document) { 047 KualiWorkflowDocument workflowDocument = document.getDocumentHeader().getWorkflowDocument(); 048 if (workflowDocument.stateIsInitiated()) { 049 return false; 050 } 051 return super.canClose(document); 052 } 053 054 @Override 055 public Set<String> getEditModes(Document document) { 056 Set<String> editModes = super.getEditModes(document); 057 KualiWorkflowDocument workflowDocument = document.getDocumentHeader().getWorkflowDocument(); 058 059 if (workflowDocument.stateIsInitiated()) { 060 editModes.add(PurapAuthorizationConstants.LineItemReceivingEditMode.DISPLAY_INIT_TAB); 061 } 062 063 return editModes; 064 } 065 066 }