/*
 * Copyright 2009 The Kuali Foundation.
 * 
 * Licensed under the Educational Community License, Version 1.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.opensource.org/licenses/ecl1.php
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.kuali.kfs.fp.document.authorization;

import java.util.Set;

import org.kuali.kfs.sys.KfsAuthorizationConstants;
import org.kuali.kfs.sys.document.authorization.AccountingDocumentPresentationControllerBase;
import org.kuali.rice.kns.document.Document;

public class DisbursementVoucherDocumentPresentationController extends AccountingDocumentPresentationControllerBase {

    /**
     * @see org.kuali.kfs.sys.document.authorization.FinancialSystemTransactionalDocumentPresentationControllerBase#getEditModes(org.kuali.rice.kns.document.Document)
     */
    @Override
    public Set<String> getEditModes(Document document) {
        Set<String> editModes = super.getEditModes(document);

        editModes.add(KfsAuthorizationConstants.DisbursementVoucherEditMode.TAX_ENTRY);
        editModes.add(KfsAuthorizationConstants.DisbursementVoucherEditMode.FRN_ENTRY);

        editModes.add(KfsAuthorizationConstants.DisbursementVoucherEditMode.TRAVEL_ENTRY);
        editModes.add(KfsAuthorizationConstants.DisbursementVoucherEditMode.WIRE_ENTRY);

        editModes.add(KfsAuthorizationConstants.DisbursementVoucherEditMode.ADMIN_ENTRY);
        editModes.add(KfsAuthorizationConstants.DisbursementVoucherEditMode.EXPENSE_SPECIAL_ENTRY);

        return editModes;
    }
}

@@ -676,24 +676,74 @@
 ization;%0D%0A%0D%0A
+import java.util.Arrays;%0D%0Aimport java.util.List;%0D%0A
 import java.
@@ -920,34 +920,237 @@
 g.kuali.
-rice.kns.document.
+kfs.sys.document.workflow.KualiWorkflowUtils.RouteLevelNames;%0D%0Aimport org.kuali.rice.kew.exception.WorkflowException;%0D%0Aimport org.kuali.rice.kns.document.Document;%0D%0Aimport org.kuali.rice.kns.workflow.service.KualiWorkflow
 Document
@@ -2169,25 +2169,1381 @@
     
-return editModes;
+this.addPayeeEditEntry(document, editModes);%0D%0A%0D%0A        return editModes;%0D%0A    %7D%0D%0A%0D%0A    private void addPayeeEditEntry(Document document, Set%3CString%3E editModes) %7B%0D%0A        KualiWorkflowDocument workflowDocument = document.getDocumentHeader().getWorkflowDocument();%0D%0A%0D%0A        if ((workflowDocument.stateIsInitiated() %7C%7C workflowDocument.stateIsSaved())) %7B%0D%0A            editModes.add(KfsAuthorizationConstants.DisbursementVoucherEditMode.PAYEE_EDIT_MODE);%0D%0A        %7D%0D%0A        else if (workflowDocument.stateIsEnroute()) %7B%0D%0A            if (editModes.contains(KfsAuthorizationConstants.TransactionalEditMode.EXPENSE_ENTRY)) %7B%0D%0A                editModes.add(KfsAuthorizationConstants.DisbursementVoucherEditMode.PAYEE_EDIT_MODE);%0D%0A            %7D%0D%0A            else %7B%0D%0A                List%3CString%3E currentRouteLevels = getCurrentRouteLevels(workflowDocument);%0D%0A                if (currentRouteLevels.contains(RouteLevelNames.ORG_REVIEW)) %7B%0D%0A                    editModes.add(KfsAuthorizationConstants.DisbursementVoucherEditMode.PAYEE_EDIT_MODE);%0D%0A                %7D%0D%0A            %7D%0D%0A        %7D%0D%0A%0D%0A    %7D%0D%0A%0D%0A    private List%3CString%3E getCurrentRouteLevels(KualiWorkflowDocument workflowDocument) %7B%0D%0A        try %7B%0D%0A            return Arrays.asList(workflowDocument.getNodeNames());%0D%0A        %7D%0D%0A        catch (WorkflowException e) %7B%0D%0A            throw new RuntimeException(e);%0D%0A        %7D
 %0D%0A  

Complete KIM Integration for all financial documents