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.integration.cam;
017    
018    import java.util.List;
019    
020    import org.kuali.kfs.sys.document.AccountingDocument;
021    import org.kuali.rice.kns.document.Document;
022    
023    public interface CapitalAssetManagementModuleService {
024        /**
025         * FP document eligible for asset lock when any of its accounting line is taken into CAB during CAB batch.
026         * 
027         * @param accountingDocument
028         * @return
029         */
030        boolean isFpDocumentEligibleForAssetLock(AccountingDocument accountingDocument, String documentType);
031    
032        /**
033         * Check and store AssetLocks if they are not locked by other blocking documents. Either store all of the asset locks or none of
034         * them being stored in case of dead lock. If any of the asset is blocked, the error message will be built including link(s) to
035         * the blocking document(s).
036         * 
037         * @param capitalAssetNumbers
038         * @param documentNumber
039         * @param documentType
040         * @param additionalInformation
041         * @return return true if all of the asset locks can be granted.
042         */
043        boolean storeAssetLocks(List<Long> capitalAssetNumbers, String documentNumber, String documentType, String lockingInformation);
044    
045        /**
046         * Delete AssetLocks by document number and lockingInfomation for PurAp doc only.
047         * 
048         * @param documentNumber
049         * @param lockingInformation
050         */
051        void deleteAssetLocks(String documentNumber, String lockingInformation);
052    
053    
054        /**
055         * Check if the given document hold any asset locks.
056         * 
057         * @param documentNumber
058         * @param lockingInformation
059         * @return
060         */
061        boolean isAssetLockedByCurrentDocument(String blockingDocumentNumber, String lockingInformation);
062    
063        /**
064         * Check if the given asset Numbers are locked by other documents already.
065         * 
066         * @param assetNumbers
067         * @param documentTypeName
068         * @param excludingDocumentNumber
069         * @return
070         */
071        boolean isAssetLocked(List<Long> assetNumbers, String documentTypeName, String excludingDocumentNumber);
072    
073    
074        /**
075         * Creates the locks for each asset on a documents
076         * 
077         * @param document
078         */
079        public void generateCapitalAssetLock(Document document, String documentTypeNames);
080    
081        /**
082         * Deletes the asset locks associated with a particular document
083         * 
084         * @param document
085         */
086        public void deleteDocumentAssetLocks(Document document);
087    
088    }