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.document.service;
017    
018    import java.util.List;
019    
020    import org.kuali.kfs.coa.businessobject.ObjectCode;
021    import org.kuali.kfs.module.cam.businessobject.Asset;
022    import org.kuali.kfs.module.cam.businessobject.AssetRetirementGlobal;
023    import org.kuali.kfs.module.cam.document.gl.CamsGeneralLedgerPendingEntrySourceBase;
024    import org.kuali.rice.kns.bo.PersistableBusinessObject;
025    import org.kuali.rice.kns.document.MaintenanceDocument;
026    import org.kuali.rice.kns.util.KualiDecimal;
027    
028    
029    /**
030     * The interface defines methods for Asset Document
031     */
032    public interface AssetRetirementService {
033        boolean isAssetRetiredBySold(AssetRetirementGlobal assetRetirementGlobal);
034    
035        boolean isAssetRetiredByAuction(AssetRetirementGlobal assetRetirementGlobal);
036    
037        boolean isAssetRetiredByExternalTransferOrGift(AssetRetirementGlobal assetRetirementGlobal);
038    
039        boolean isAssetRetiredByTheft(AssetRetirementGlobal assetRetirementGlobal);
040    
041        boolean isAssetRetiredByMerged(AssetRetirementGlobal assetRetirementGlobal);
042    
043        String getAssetRetirementReasonName(AssetRetirementGlobal assetRetirementGlobal);
044    
045        /**
046         * This method generates offset payments for each sourceAsset.
047         * 
048         * @param sourceAsset
049         * @param persistables
050         * @param documentNumber
051         */
052        void generateOffsetPaymentsForEachSource(Asset sourceAsset, List<PersistableBusinessObject> persistables, String documentNumber);
053    
054        /**
055         * This method generates new payments from sourceAsset for targetAsset.
056         * 
057         * @param targetAsset
058         * @param sourceAsset
059         * @param persistables
060         * @param maxSequenceNo
061         * @param documentNumber
062         * @return
063         */
064        Integer generateNewPaymentForTarget(Asset targetAsset, Asset sourceAsset, List<PersistableBusinessObject> persistables, Integer maxSequenceNo, String documentNumber);
065    
066        /**
067         * Check if reasonCode is in reasonCodeGroup
068         * 
069         * @param reasonCodeGroup
070         * @param reasonCode
071         * @return
072         */
073        boolean isRetirementReasonCodeInGroup(String reasonCodeGroup, String reasonCode);
074    
075        /**
076         * Check if the retirement reason code allows to retire multiple assets
077         * 
078         * @param assetDetails
079         * @return
080         */
081        boolean isAllowedRetireMultipleAssets(MaintenanceDocument maintenanceDocument);
082    
083        /**
084         * Creates GL Postables
085         */
086        void createGLPostables(AssetRetirementGlobal assetRetirementGlobal, CamsGeneralLedgerPendingEntrySourceBase assetRetirementGlPoster);
087    
088        /**
089         * Get the offset Object Code
090         * 
091         * @param asset
092         * @return
093         */
094        ObjectCode getOffsetFinancialObject(String chartOfAccountsCode);
095    
096        /**
097         * This method generates the calculatedTotal amount based on salePrice + handlingFeeAmount + preventiveMaintenanceAmount.
098         * 
099         * @param salePrice
100         * @param handlingFeeAmount
101         * @param preventiveMaintenanceAmount
102         * @return
103         */
104    //    String generateCalculatedTotal(KualiDecimal salePrice, KualiDecimal handlingFeeAmount, KualiDecimal preventiveMaintenanceAmount);
105        String generateCalculatedTotal(String salePrice, String handlingFeeAmount, String preventiveMaintenanceAmount);
106        
107    }