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.validation.impl;
017
018 import java.util.Arrays;
019 import java.util.List;
020
021 import org.kuali.kfs.sys.document.validation.event.AttributedDocumentEvent;
022 import org.kuali.kfs.sys.document.validation.impl.AccountingLineAccessibleValidation;
023 import org.kuali.rice.kew.exception.WorkflowException;
024 import org.kuali.rice.kns.workflow.service.KualiWorkflowDocument;
025
026 /**
027 * A validation that checks whether the given accounting line is accessible to the given user or not
028 */
029 public class PurchasingAccountsPayableAccountingLineAccessibleValidation extends AccountingLineAccessibleValidation {
030
031 /**
032 * Determines the route levels for a given document.
033 *
034 * @param workflowDocument The workflow document from which the current route levels are to be obtained.
035 * @return List The List of current route levels of the given document.
036 */
037 protected static List getCurrentRouteLevels(KualiWorkflowDocument workflowDocument) {
038 try {
039 return Arrays.asList(workflowDocument.getNodeNames());
040 }
041 catch (WorkflowException e) {
042 throw new RuntimeException(e);
043 }
044 }
045
046 @Override
047 protected String getGroupName() {
048 return "source";
049 }
050
051 @Override
052 protected String getAccountingLineCollectionProperty() {
053 return "items.sourceAccountingLines";
054 }
055
056 }
057