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.List;
019
020 import org.kuali.kfs.module.purap.PurapConstants;
021 import org.kuali.kfs.module.purap.PurapWorkflowConstants.RequisitionDocument.NodeDetailEnum;
022 import org.kuali.kfs.module.purap.document.RequisitionDocument;
023 import org.kuali.kfs.sys.document.validation.event.AttributedDocumentEvent;
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 RequisitionAccountingLineAccessibleValidation extends PurchasingAccountsPayableAccountingLineAccessibleValidation {
030
031 /**
032 * Validates that the given accounting line is accessible for editing by the current user.
033 * <strong>This method expects a document as the first parameter and an accounting line as the second</strong>
034 * @see org.kuali.kfs.sys.document.validation.Validation#validate(java.lang.Object[])
035 */
036 public boolean validate(AttributedDocumentEvent event) {
037 KualiWorkflowDocument workflowDocument = event.getDocument().getDocumentHeader().getWorkflowDocument();
038 List currentRouteLevels = getCurrentRouteLevels(workflowDocument);
039 RequisitionDocument requisitionDocument = (RequisitionDocument) event.getDocument();
040 if (requisitionDocument.isDocumentStoppedInRouteNode(NodeDetailEnum.CONTENT_REVIEW) ||
041 requisitionDocument.getStatusCode().equals(PurapConstants.RequisitionStatuses.IN_PROCESS)) {
042 // DO NOTHING: do not check that user owns acct lines; at this level, approvers can edit all detail on REQ
043
044 return true;
045 }
046 else {
047
048 return super.validate(event);
049 }
050 }
051
052 }
053