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.cab.document.service; 017 018 import java.util.List; 019 import java.util.Set; 020 021 import org.kuali.kfs.module.cab.businessobject.Pretag; 022 import org.kuali.kfs.module.cab.businessobject.PurchasingAccountsPayableActionHistory; 023 import org.kuali.kfs.module.cab.businessobject.PurchasingAccountsPayableDocument; 024 import org.kuali.kfs.module.cab.businessobject.PurchasingAccountsPayableItemAsset; 025 import org.kuali.kfs.module.cab.document.web.PurApLineSession; 026 027 028 /** 029 * This class declares methods used by CAB PurAp Line process 030 */ 031 public interface PurApLineService { 032 033 /** 034 * Check the payments in given asset lines have different object sub types. 035 * 036 * @param selectedLines 037 * @return 038 */ 039 boolean allocateLinesHasDifferentObjectSubTypes(List<PurchasingAccountsPayableItemAsset> targetLines, PurchasingAccountsPayableItemAsset sourceLine); 040 041 /** 042 * Check the payments in given asset lines have different object sub types. 043 * 044 * @param selectedLines 045 * @return 046 */ 047 boolean mergeLinesHasDifferentObjectSubTypes(List<PurchasingAccountsPayableItemAsset> mergeLines); 048 049 /** 050 * Changes percent quantities to a quantity of 1 for selected line item. 051 * 052 * @param itemAsset Selected line item. 053 * @param actionsTake Action taken history. 054 */ 055 void processPercentPayment(PurchasingAccountsPayableItemAsset itemAsset, List<PurchasingAccountsPayableActionHistory> actionsTaken); 056 057 /** 058 * Split the selected line item quantity and create a new line item. 059 * 060 * @param itemAsset Selected line item. 061 * @param actionsTaken Action taken history. 062 * @return 063 */ 064 void processSplit(PurchasingAccountsPayableItemAsset splitItemAsset, List<PurchasingAccountsPayableActionHistory> actionsTakeHistory); 065 066 /** 067 * Save purApDoc, item assets and account lines for persistence 068 * 069 * @param purApDocs 070 * @param purApLineSession 071 */ 072 void processSaveBusinessObjects(List<PurchasingAccountsPayableDocument> purApDocs, PurApLineSession purApLineSession); 073 074 /** 075 * Build PurAp document collection and line item collection. 076 * 077 * @param purApDocs 078 */ 079 void buildPurApItemAssetList(List<PurchasingAccountsPayableDocument> purApDocs); 080 081 /** 082 * Handle additional charge allocate in the same document. 083 * 084 * @param selectedLineItem 085 * @param allocateTargetLines 086 * @param purApLineSession 087 * @param purApDocs 088 * @return 089 */ 090 boolean processAllocate(PurchasingAccountsPayableItemAsset selectedLineItem, List<PurchasingAccountsPayableItemAsset> allocateTargetLines, List<PurchasingAccountsPayableActionHistory> actionsTakeHistory, List<PurchasingAccountsPayableDocument> purApDocs, boolean initiateFromBatch); 091 092 /** 093 * Get the target lines based on allocation line type 094 * 095 * @param selectedLineItem 096 * @param purApDocs 097 * @return 098 */ 099 List<PurchasingAccountsPayableItemAsset> getAllocateTargetLines(PurchasingAccountsPayableItemAsset selectedLineItem, List<PurchasingAccountsPayableDocument> purApDocs); 100 101 /** 102 * Get the selected merge lines. 103 * 104 * @param isMergeAll 105 * @param purApDocs 106 * @return 107 */ 108 List<PurchasingAccountsPayableItemAsset> getSelectedMergeLines(boolean isMergeAll, List<PurchasingAccountsPayableDocument> purApDocs); 109 110 /** 111 * Reset selectedValue for all line items 112 * 113 * @param purApDocs 114 */ 115 void resetSelectedValue(List<PurchasingAccountsPayableDocument> purApDocs); 116 117 /** 118 * Merge line items. 119 * 120 * @param mergeLines 121 * @param purApLineSession 122 * @param isMergeAll 123 */ 124 void processMerge(List<PurchasingAccountsPayableItemAsset> mergeLines, List<PurchasingAccountsPayableActionHistory> actionsTakeHistory, boolean isMergeAll); 125 126 /** 127 * Check if the merge action is merge all. 128 * 129 * @param purApDocs 130 * @return 131 */ 132 boolean isMergeAllAction(List<PurchasingAccountsPayableDocument> purApDocs); 133 134 /** 135 * For line items in itemAssets if they are not in the same PurAp document, check if there is pending additional charges 136 * allocation. 137 * 138 * @param itemAssets 139 * @return 140 */ 141 boolean isAdditionalChargePending(List<PurchasingAccountsPayableItemAsset> itemAssets); 142 143 /** 144 * Check if there is TI indicator exists in the given itemAssets List. 145 * 146 * @param itemAssets 147 * @return 148 */ 149 boolean isTradeInIndExistInSelectedLines(List<PurchasingAccountsPayableItemAsset> itemAssets); 150 151 /** 152 * Check if there is trade-in allowance not allocated yet. 153 * 154 * @param purApDocs 155 * @return 156 */ 157 boolean isTradeInAllowanceExist(List<PurchasingAccountsPayableDocument> purApDocs); 158 159 /** 160 * Check if there is additional charge line exist in all lines. 161 * 162 * @param purApDocs 163 * @return 164 */ 165 boolean isAdditionalChargeExistInAllLines(List<PurchasingAccountsPayableDocument> purApDocs); 166 167 /** 168 * Get preTag if exists for give line item. 169 * 170 * @param purchaseOrderIdentifier 171 * @param lineItemNumber 172 * @return 173 */ 174 Pretag getPreTagLineItem(Integer purchaseOrderIdentifier, Integer lineItemNumber); 175 176 /** 177 * In-activate document when all the associated items are inactive. 178 * 179 * @param selectedDoc 180 */ 181 void conditionallyUpdateDocumentStatusAsProcessed(PurchasingAccountsPayableDocument selectedDoc); 182 183 /** 184 * Check if more than one pre-tagging exists for given itemLineNumber and PO_ID. 185 * 186 * @param purchaseOrderIdentifier 187 * @param itemLineNumbers 188 * @return 189 */ 190 boolean isMultipleTagExisting(Integer purchaseOrderIdentifier, Set<Integer> itemLineNumbers); 191 192 /** 193 * Check pretag existing 194 * 195 * @param newTag 196 * @return 197 */ 198 boolean isPretaggingExisting(Pretag newTag); 199 }