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.cam.service;
017    
018    import java.util.List;
019    
020    import org.kuali.kfs.module.cam.businessobject.AssetLock;
021    
022    public interface AssetLockService {
023        /**
024         * Check and Lock for AssetLock.
025         * 
026         * @param locks
027         * @return
028         */
029        boolean checkAndSetAssetLocks(List<AssetLock> locks);
030    
031        /**
032         * Delete all locks holding by documentNumber.
033         * 
034         * @param documentNumber
035         * @param additionalInformation
036         */
037        void deleteAssetLocks(String documentNumber, String lockingInformation);
038    
039        /**
040         * Helper method to generate AssetLock instances.
041         * 
042         * @param capitalAssetNumber
043         * @param documentNumber
044         * @param documentType
045         * @param additionalInformation
046         * @return
047         */
048        List<AssetLock> buildAssetLockHelper(List<Long> capitalAssetNumbers, String documentNumber, String documentType, String lockingInformation);
049    
050        /**
051         * Check if document has any asset locks
052         * 
053         * @param documentNumber
054         * @param lockingInformation
055         * @return
056         */
057        boolean isAssetLockedByCurrentDocument(String documentNumber, String lockingInformation);
058    
059        /**
060         * Check if assets are locked by other document. 
061         * 
062         * @param assetNumbers
063         * @param documentTypeName
064         * @param excludingDocumentNumber
065         * @return
066         */
067        boolean isAssetLocked(List<Long> assetNumbers, String documentTypeName, String excludingDocumentNumber);
068        
069        List<String> getAssetLockingDocuments(List<Long> assetNumbers, String documentTypeName, String excludingDocumentNumber);
070    }