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.Collection;
019    import java.util.List;
020    
021    import org.kuali.kfs.module.cam.businessobject.Asset;
022    import org.kuali.rice.kns.document.Document;
023    import org.kuali.rice.kns.document.MaintenanceDocument;
024    import org.kuali.rice.kns.document.MaintenanceLock;
025    import org.kuali.rice.kns.workflow.service.KualiWorkflowDocument;
026    
027    
028    /**
029     * The interface defines methods for Asset Document
030     */
031    public interface AssetService {
032        /**
033         * Check if asset has started depreciation already.
034         * 
035         * @param asset
036         * @return
037         */
038        boolean isAssetDepreciationStarted(Asset asset);
039    
040        /**
041         * Checks if given mainenanceDocument has started routing.
042         * 
043         * @param document
044         * @return
045         */
046        boolean isDocumentEnrouting(Document document);
047    
048        /**
049         * A helper method for determining the route levels for a given document.
050         * 
051         * @param workflowDocument
052         * @return List
053         */
054        public List<String> getCurrentRouteLevels(KualiWorkflowDocument workflowDocument);
055    
056        boolean isAssetMovableCheckByAsset(Asset asset);
057    
058        boolean isCapitalAsset(Asset asset);
059    
060        boolean isAssetRetired(Asset asset);
061    
062        boolean isInServiceDateChanged(Asset oldAsset, Asset newAsset);
063    
064        /**
065         * @return if MaintenanceDocument is an asset fabrication or not
066         */
067        public boolean isAssetFabrication(MaintenanceDocument maintenanceDocument);
068    
069        /**
070         * @return if the asset is on loan or not
071         */
072        boolean isAssetLoaned(Asset asset);
073    
074        /**
075         * The Asset Type Code is allowed to be changed only: (1)If the tag number has not been assigned or (2)The asset is tagged, and
076         * the asset created in the current fiscal year
077         * 
078         * @return
079         */
080        boolean isAssetTaggedInPriorFiscalYear(Asset asset);
081    
082        /**
083         * The Tag Number check excludes value of "N" and retired assets.
084         * 
085         * @return
086         */
087        boolean isTagNumberCheckExclude(Asset asset);
088    
089        /**
090         * Test if any of the off campus location field is entered.
091         * 
092         * @param asset
093         * @return
094         */
095        boolean isOffCampusLocationEntered(Asset asset);
096    
097        /**
098         * Test if financialObjectSubTypeCode is changed.
099         * 
100         * @param oldAsset
101         * @param newAsset
102         * @return
103         */
104        boolean isFinancialObjectSubTypeCodeChanged(Asset oldAsset, Asset newAsset);
105    
106        /**
107         * Test if assetTypeCode is changed.
108         * 
109         * @param oldAsset
110         * @param newAsset
111         * @return
112         */
113        boolean isAssetTypeCodeChanged(Asset oldAsset, Asset newAsset);
114    
115        /**
116         * Test if Depreciable Life Limit is "0" This method...
117         * 
118         * @param asset
119         * @return
120         */
121        boolean isAssetDepreciableLifeLimitZero(Asset asset);
122    
123        /**
124         * Test two capitalAssetNumber equal.
125         * 
126         * @param capitalAssetNumber1
127         * @param capitalAssetNumber2
128         * @return
129         */
130        boolean isCapitalAssetNumberDuplicate(Long capitalAssetNumber1, Long capitalAssetNumber2);
131    
132        /**
133         * This method calls the service codes to calculate the summary fields for each asset
134         * 
135         * @param asset
136         */
137        void setAssetSummaryFields(Asset asset);
138    
139        /**
140         * This will check the financial object sub type code in system parameters
141         * <li>return TRUE if found in MOVABLE_EQUIPMENT_OBJECT_SUB_TYPE_CODES</li>
142         * <li>return FALSE if found in NON_MOVABLE_EQUIPMENT_OBJECT_SUB_TYPE_CODES</li>
143         * <li>throw ValidationException if not defined in neither one of them</li>
144         * 
145         * @param financialObjectSubType
146         * @return boolean
147         */
148        public boolean isAssetMovableCheckByPayment(String financialObjectSubTypeCode);
149    
150        /**
151         * This will check if the list of financial object sub type code are compatible with each other.
152         * <li> return TRUE if all Object sub type code are compatible with each other.
153         * <li> return FALSE if any non copatible object sub type code are found.
154         * 
155         * @param financialObjectSubTypeCode
156         * @return
157         */
158        boolean isObjectSubTypeCompatible(List<String> financialObjectSubTypeCode);
159    
160        /**
161         * This method returns all active assets found matching this tab number
162         * 
163         * @param campusTagNumber Campus Tag Number
164         * @return List of assets found matching tag number
165         */
166        public List<Asset> findActiveAssetsMatchingTagNumber(String campusTagNumber);
167    
168        /**
169         * This method returns all active and not active assets found matching this tab number
170         * 
171         * @param campusTagNumber Campus Tag Number
172         * @return List of assets found matching tag number
173         */
174        public Collection<Asset> findAssetsMatchingTagNumber(String campusTagNumber);
175    
176        /**
177         * For the given Asset sets the separateHistory.
178         * 
179         * @param asset for which to set the separateHistory
180         */
181        public void setSeparateHistory(Asset asset);
182    
183        /**
184         * @param capitalAssetNumber to check whether it got separated
185         * @return the list of document numbers that separated the particular asset
186         */
187        public List<String> getDocumentNumbersThatSeparatedThisAsset(Long capitalAssetNumber);
188    
189        /**
190         * Sets the fiscal year and month in the asset object based on the creation date of the asset
191         * 
192         * @param asset
193         */
194        public void setFiscalPeriod(Asset asset);
195    }