View Javadoc
1   /*
2    * Copyright 2006 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.ole.fp.batch.service.impl;
17  
18  import static org.kuali.ole.fp.document.validation.impl.ProcurementCardDocumentRuleConstants.AUTO_APPROVE_DOCUMENTS_IND;
19  import static org.kuali.ole.fp.document.validation.impl.ProcurementCardDocumentRuleConstants.AUTO_APPROVE_NUMBER_OF_DAYS;
20  import static org.kuali.ole.fp.document.validation.impl.ProcurementCardDocumentRuleConstants.DEFAULT_TRANS_ACCOUNT_PARM_NM;
21  import static org.kuali.ole.fp.document.validation.impl.ProcurementCardDocumentRuleConstants.DEFAULT_TRANS_CHART_CODE_PARM_NM;
22  import static org.kuali.ole.fp.document.validation.impl.ProcurementCardDocumentRuleConstants.DEFAULT_TRANS_OBJECT_CODE_PARM_NM;
23  import static org.kuali.ole.fp.document.validation.impl.ProcurementCardDocumentRuleConstants.ERROR_TRANS_ACCOUNT_PARM_NM;
24  import static org.kuali.ole.fp.document.validation.impl.ProcurementCardDocumentRuleConstants.SINGLE_TRANSACTION_IND_PARM_NM;
25  import static org.kuali.ole.sys.OLEConstants.GL_CREDIT_CODE;
26  import static org.kuali.ole.sys.OLEConstants.FinancialDocumentTypeCodes.PROCUREMENT_CARD;
27  
28  import java.sql.Timestamp;
29  import java.util.ArrayList;
30  import java.util.Collections;
31  import java.util.HashMap;
32  import java.util.Iterator;
33  import java.util.List;
34  import java.util.Map;
35  
36  import org.apache.commons.lang.StringUtils;
37  import org.kuali.ole.coa.businessobject.ProjectCode;
38  import org.kuali.ole.coa.businessobject.SubAccount;
39  import org.kuali.ole.coa.businessobject.SubObjectCode;
40  import org.kuali.ole.coa.service.AccountService;
41  import org.kuali.ole.coa.service.ChartService;
42  import org.kuali.ole.coa.service.ObjectCodeService;
43  import org.kuali.ole.coa.service.ProjectCodeService;
44  import org.kuali.ole.coa.service.SubAccountService;
45  import org.kuali.ole.coa.service.SubObjectCodeService;
46  import org.kuali.ole.fp.batch.ProcurementCardAutoApproveDocumentsStep;
47  import org.kuali.ole.fp.batch.ProcurementCardCreateDocumentsStep;
48  import org.kuali.ole.fp.batch.ProcurementCardLoadStep;
49  import org.kuali.ole.fp.batch.service.ProcurementCardCreateDocumentService;
50  import org.kuali.ole.fp.businessobject.CapitalAssetInformation;
51  import org.kuali.ole.fp.businessobject.ProcurementCardDefault;
52  import org.kuali.ole.fp.businessobject.ProcurementCardHolder;
53  import org.kuali.ole.fp.businessobject.ProcurementCardSourceAccountingLine;
54  import org.kuali.ole.fp.businessobject.ProcurementCardTargetAccountingLine;
55  import org.kuali.ole.fp.businessobject.ProcurementCardTransaction;
56  import org.kuali.ole.fp.businessobject.ProcurementCardTransactionDetail;
57  import org.kuali.ole.fp.businessobject.ProcurementCardVendor;
58  import org.kuali.ole.fp.document.ProcurementCardDocument;
59  import org.kuali.ole.fp.document.validation.impl.ProcurementCardDocumentRuleConstants;
60  import org.kuali.ole.integration.cab.CapitalAssetBuilderModuleService;
61  import org.kuali.ole.sys.OLEConstants;
62  import org.kuali.ole.sys.OLEPropertyConstants;
63  import org.kuali.ole.sys.context.SpringContext;
64  import org.kuali.ole.sys.document.service.AccountingLineRuleHelperService;
65  import org.kuali.ole.sys.document.validation.event.DocumentSystemSaveEvent;
66  import org.kuali.ole.sys.service.UniversityDateService;
67  import org.kuali.ole.sys.util.KfsDateUtils;
68  import org.kuali.rice.core.api.datetime.DateTimeService;
69  import org.kuali.rice.core.api.util.type.KualiDecimal;
70  import org.kuali.rice.coreservice.framework.parameter.ParameterService;
71  import org.kuali.rice.kew.api.KewApiConstants;
72  import org.kuali.rice.kew.api.KewApiServiceLocator;
73  import org.kuali.rice.kew.api.document.DocumentStatus;
74  import org.kuali.rice.kew.api.document.search.DocumentSearchCriteria;
75  import org.kuali.rice.kew.api.document.search.DocumentSearchResult;
76  import org.kuali.rice.kew.api.document.search.DocumentSearchResults;
77  import org.kuali.rice.kew.api.exception.WorkflowException;
78  import org.kuali.rice.kns.service.DataDictionaryService;
79  import org.kuali.rice.krad.bo.DocumentHeader;
80  import org.kuali.rice.krad.service.BusinessObjectService;
81  import org.kuali.rice.krad.service.DocumentService;
82  import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
83  import org.kuali.rice.krad.util.GlobalVariables;
84  import org.kuali.rice.krad.util.MessageMap;
85  import org.kuali.rice.krad.util.ObjectUtils;
86  import org.kuali.rice.krad.workflow.service.WorkflowDocumentService;
87  import org.springframework.transaction.annotation.Transactional;
88  
89  
90  /**
91   * This is the default implementation of the ProcurementCardCreateDocumentService interface.
92   *
93   * @see org.kuali.ole.fp.batch.service.ProcurementCardCreateDocumentService
94   */
95  public class ProcurementCardCreateDocumentServiceImpl implements ProcurementCardCreateDocumentService {
96      private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(ProcurementCardCreateDocumentServiceImpl.class);
97  
98      protected static final String WORKFLOW_SEARCH_RESULT_KEY = "routeHeaderId";
99  
100     protected ParameterService parameterService;
101     protected BusinessObjectService businessObjectService;
102     protected DocumentService documentService;
103     protected WorkflowDocumentService workflowDocumentService;
104     protected DataDictionaryService dataDictionaryService;
105     protected DateTimeService dateTimeService;
106     protected AccountingLineRuleHelperService accountingLineRuleUtil;
107     protected CapitalAssetBuilderModuleService capitalAssetBuilderModuleService;
108 
109 
110     /**
111      * This method retrieves a collection of credit card transactions and traverses through this list, creating
112      * ProcurementCardDocuments for each card.
113      *
114      * @return True if the procurement card documents were created successfully.  If any problem occur while creating the
115      * documents, a runtime exception will be thrown.
116      *
117      * @see org.kuali.ole.fp.batch.service.ProcurementCardCreateDocumentService#createProcurementCardDocuments()
118      */
119     @Override
120     @SuppressWarnings("rawtypes")
121     @Transactional
122     public boolean createProcurementCardDocuments() {
123         List documents = new ArrayList();
124         List cardTransactions = retrieveTransactions();
125 
126         // iterate through card transaction list and create documents
127         for (Iterator iter = cardTransactions.iterator(); iter.hasNext();) {
128             documents.add(createProcurementCardDocument((List) iter.next()));
129         }
130 
131         // now store all the documents
132         for (Iterator iter = documents.iterator(); iter.hasNext();) {
133             ProcurementCardDocument pcardDocument = (ProcurementCardDocument) iter.next();
134             try {
135                 documentService.saveDocument(pcardDocument, DocumentSystemSaveEvent.class);
136                 if ( LOG.isInfoEnabled() ) {
137                     LOG.info("Saved Procurement Card document: "+pcardDocument.getDocumentNumber());
138                 }
139             }
140             catch (Exception e) {
141                 LOG.error("Error persisting document # " + pcardDocument.getDocumentHeader().getDocumentNumber() + " " + e.getMessage(), e);
142                 throw new RuntimeException("Error persisting document # " + pcardDocument.getDocumentHeader().getDocumentNumber() + " " + e.getMessage(), e);
143             }
144         }
145 
146         return true;
147     }
148 
149     /**
150      * This method retrieves all the procurement card documents with a status of 'I' and routes them to the next step in the
151      * routing path.
152      *
153      * @return True if the routing was performed successfully.  A runtime exception will be thrown if any errors occur while routing.
154      *
155      * @see org.kuali.ole.fp.batch.service.ProcurementCardCreateDocumentService#routeProcurementCardDocuments(java.util.List)
156      */
157     @Override
158     public boolean routeProcurementCardDocuments() {
159 
160         List<String> documentIdList = retrieveProcurementCardDocumentsToRoute(KewApiConstants.ROUTE_HEADER_SAVED_CD);
161 
162         //Collections.reverse(documentIdList);
163         if ( LOG.isInfoEnabled() ) {
164             LOG.info("PCards to Route: "+documentIdList);
165         }
166 
167         for (String pcardDocumentId: documentIdList) {
168             try {
169                 ProcurementCardDocument pcardDocument = (ProcurementCardDocument)documentService.getByDocumentHeaderId(pcardDocumentId);
170                 if ( LOG.isInfoEnabled() ) {
171                     LOG.info("Routing PCDO document # " + pcardDocumentId + ".");
172                 }
173                 documentService.prepareWorkflowDocument(pcardDocument);
174 
175                 //** NOTE
176                 //
177                 //     Calling workflow service to BYPASS business rule checks
178                 //
179                 //** NOTE
180                 workflowDocumentService.route( pcardDocument.getDocumentHeader().getWorkflowDocument(), "", null);
181             }
182             catch (WorkflowException e) {
183                 LOG.error("Error routing document # " + pcardDocumentId + " " + e.getMessage());
184                 throw new RuntimeException(e.getMessage(),e);
185             }
186         }
187 
188         return true;
189     }
190 
191     /**
192      * Returns a list of all initiated but not yet routed procurement card documents, using the KualiWorkflowInfo service.
193      * @return a list of procurement card documents to route
194      */
195     protected List<String> retrieveProcurementCardDocumentsToRoute(String statusCode){
196         List<String> documentIds = new ArrayList<String>();
197 
198         DocumentSearchCriteria.Builder criteria = DocumentSearchCriteria.Builder.create();
199         criteria.setDocumentTypeName(OLEConstants.FinancialDocumentTypeCodes.PROCUREMENT_CARD);
200         criteria.setDocumentStatuses(Collections.singletonList(DocumentStatus.fromCode(statusCode)));
201         DocumentSearchResults results = KewApiServiceLocator.getWorkflowDocumentService().documentSearch(
202                 GlobalVariables.getUserSession().getPrincipalId(), criteria.build());
203 
204         for (DocumentSearchResult resultRow: results.getSearchResults()) {
205             documentIds.add(resultRow.getDocument().getDocumentId());
206     }
207 
208         return documentIds;
209     }
210 
211     /**
212      * This method determines if procurement card documents can be auto approved.  A document can be auto approved if
213      * the grace period for allowing auto approval of a procurement card document has passed.  The grace period is defined
214      * by a parameter in the parameters table.  The create date of the document is then compared against the current date and
215      * if the difference is larger than the grace period defined, then the document is auto approved.
216      *
217      * @return This method always returns true.
218      *
219      * @see org.kuali.ole.fp.batch.service.ProcurementCardCreateDocumentService#autoApproveProcurementCardDocuments()
220      */
221     @Override
222     public boolean autoApproveProcurementCardDocuments() {
223         // check if auto approve is turned on
224         boolean autoApproveOn = parameterService.getParameterValueAsBoolean(ProcurementCardAutoApproveDocumentsStep.class, AUTO_APPROVE_DOCUMENTS_IND);
225 
226         if (!autoApproveOn) { // no auto approve?  then skip out of here...
227             return true;
228         }
229 
230         List<String> documentIdList = retrieveProcurementCardDocumentsToRoute(KewApiConstants.ROUTE_HEADER_ENROUTE_CD);
231 
232         // get number of days and type for auto approve
233         int autoApproveNumberDays = Integer.parseInt(parameterService.getParameterValueAsString(ProcurementCardAutoApproveDocumentsStep.class, AUTO_APPROVE_NUMBER_OF_DAYS));
234 
235         Timestamp currentDate = dateTimeService.getCurrentTimestamp();
236         for (String pcardDocumentId: documentIdList) {
237             try {
238                 ProcurementCardDocument pcardDocument = (ProcurementCardDocument)documentService.getByDocumentHeaderId(pcardDocumentId);
239 
240                 // prevent PCard documents from auto approving if they have capital asset info to collect
241                 if(capitalAssetBuilderModuleService.hasCapitalAssetObjectSubType(pcardDocument)) {
242                     continue;
243                 }
244 
245                 // if number of days in route is passed the allowed number, call doc service for super user approve
246                 Timestamp docCreateDate = new Timestamp( pcardDocument.getDocumentHeader().getWorkflowDocument().getDateCreated().getMillis() );
247                 if (KfsDateUtils.getDifferenceInDays(docCreateDate, currentDate) > autoApproveNumberDays) {
248                     // update document description to reflect the auto approval
249                     pcardDocument.getDocumentHeader().setDocumentDescription("Auto Approved On " + dateTimeService.toDateTimeString(currentDate) + ".");
250 
251                     if ( LOG.isInfoEnabled() ) {
252                         LOG.info("Auto approving document # " + pcardDocument.getDocumentHeader().getDocumentNumber());
253                     }
254                     documentService.superUserApproveDocument(pcardDocument, "");
255                 }
256             } catch (WorkflowException e) {
257                 LOG.error("Error auto approving document # " + pcardDocumentId + " " + e.getMessage(),e);
258                 throw new RuntimeException(e.getMessage(),e);
259             }
260         }
261 
262         return true;
263     }
264 
265 
266     /**
267      * This method retrieves a list of transactions from a temporary table, and groups them into document lists, based on
268      * single transaction indicator or a grouping by card.
269      *
270      * @return List containing transactions for document.
271      */
272     @SuppressWarnings("rawtypes")
273     protected List retrieveTransactions() {
274         List groupedTransactions = new ArrayList();
275 
276         // retrieve records from transaction table order by card number
277         List transactions = (List) KRADServiceLocatorWeb.getLegacyDataAdapter().findMatchingOrderBy(ProcurementCardTransaction.class, new HashMap(), OLEPropertyConstants.TRANSACTION_CREDIT_CARD_NUMBER, true);
278 
279         // check apc for single transaction documents or multiple by card
280         boolean singleTransaction = parameterService.getParameterValueAsBoolean(ProcurementCardCreateDocumentsStep.class, SINGLE_TRANSACTION_IND_PARM_NM);
281 
282         List documentTransactions = new ArrayList();
283         if (singleTransaction) {
284             for (Iterator iter = transactions.iterator(); iter.hasNext();) {
285                 documentTransactions.add(iter.next());
286                 groupedTransactions.add(documentTransactions);
287                 documentTransactions = new ArrayList();
288             }
289         }
290         else {
291             Map cardTransactionsMap = new HashMap();
292             for (Iterator iter = transactions.iterator(); iter.hasNext();) {
293                 ProcurementCardTransaction transaction = (ProcurementCardTransaction) iter.next();
294                 if (!cardTransactionsMap.containsKey(transaction.getTransactionCreditCardNumber())) {
295                     cardTransactionsMap.put(transaction.getTransactionCreditCardNumber(), new ArrayList());
296                 }
297                 ((List) cardTransactionsMap.get(transaction.getTransactionCreditCardNumber())).add(transaction);
298             }
299 
300             for (Iterator iter = cardTransactionsMap.values().iterator(); iter.hasNext();) {
301                 groupedTransactions.add(iter.next());
302 
303             }
304         }
305 
306         return groupedTransactions;
307     }
308 
309 
310     /**
311      * Creates a ProcurementCardDocument from the List of transactions given.
312      *
313      * @param transactions List of ProcurementCardTransaction objects to be used for creating the document.
314      * @return A ProcurementCardDocument populated with the transactions provided.
315      */
316     protected ProcurementCardDocument createProcurementCardDocument(List transactions) {
317         ProcurementCardDocument pcardDocument = null;
318 
319         try {
320             // get new document from doc service
321             pcardDocument = (ProcurementCardDocument) SpringContext.getBean(DocumentService.class).getNewDocument(PROCUREMENT_CARD);
322 
323             List<CapitalAssetInformation> capitalAssets = pcardDocument.getCapitalAssetInformation();
324             for (CapitalAssetInformation capitalAsset : capitalAssets) {
325                 if (ObjectUtils.isNotNull(capitalAsset) && ObjectUtils.isNotNull(capitalAsset.getCapitalAssetInformationDetails())) {
326                     capitalAsset.setDocumentNumber(pcardDocument.getDocumentNumber());
327                 }
328             }
329 
330             ProcurementCardTransaction trans = (ProcurementCardTransaction) transactions.get(0);
331             String errors = validateTransaction(trans);
332             createCardHolderRecord(pcardDocument, trans);
333 
334             // for each transaction, create transaction detail object and then acct lines for the detail
335             int transactionLineNumber = 1;
336             KualiDecimal documentTotalAmount = KualiDecimal.ZERO;
337             String errorText = "";
338             for (Iterator iter = transactions.iterator(); iter.hasNext();) {
339                 ProcurementCardTransaction transaction = (ProcurementCardTransaction) iter.next();
340 
341                 // create transaction detail record with accounting lines
342                 errorText += createTransactionDetailRecord(pcardDocument, transaction, transactionLineNumber);
343 
344                 // update document total
345                 documentTotalAmount = documentTotalAmount.add(transaction.getFinancialDocumentTotalAmount());
346 
347                 transactionLineNumber++;
348             }
349 
350             pcardDocument.getFinancialSystemDocumentHeader().setFinancialDocumentTotalAmount(documentTotalAmount);
351             pcardDocument.getDocumentHeader().setDocumentDescription("SYSTEM Generated");
352 
353             // Remove duplicate messages from errorText
354             String messages[] = StringUtils.split(errorText, ".");
355             for (int i = 0; i < messages.length; i++) {
356                 int countMatches = StringUtils.countMatches(errorText, messages[i]) - 1;
357                 errorText = StringUtils.replace(errorText, messages[i] + ".", "", countMatches);
358             }
359             // In case errorText is still too long, truncate it and indicate so.
360             Integer documentExplanationMaxLength = dataDictionaryService.getAttributeMaxLength(DocumentHeader.class.getName(), OLEPropertyConstants.EXPLANATION);
361             if (documentExplanationMaxLength != null && errorText.length() > documentExplanationMaxLength.intValue()) {
362                 String truncatedMessage = " ... TRUNCATED.";
363                 errorText = errorText.substring(0, documentExplanationMaxLength - truncatedMessage.length()) + truncatedMessage;
364             }
365             pcardDocument.getDocumentHeader().setExplanation(errorText);
366         }
367         catch (WorkflowException e) {
368             LOG.error("Error creating pcdo documents: " + e.getMessage(),e);
369             throw new RuntimeException("Error creating pcdo documents: " + e.getMessage(),e);
370         }
371 
372         return pcardDocument;
373     }
374 
375     /**
376      * Creates card holder record and sets that record to the document given.
377      *
378      * @param pcardDocument Procurement card document to place the record in.
379      * @param transaction The transaction to set the card holder record fields from.
380      */
381     protected void createCardHolderRecord(ProcurementCardDocument pcardDocument, ProcurementCardTransaction transaction) {
382         ProcurementCardHolder cardHolder = new ProcurementCardHolder();
383 
384         cardHolder.setDocumentNumber(pcardDocument.getDocumentNumber());
385         cardHolder.setTransactionCreditCardNumber(transaction.getTransactionCreditCardNumber());
386         cardHolder.setChartOfAccountsCode(transaction.getChartOfAccountsCode());
387         cardHolder.setAccountNumber(transaction.getAccountNumber());
388         cardHolder.setSubAccountNumber(transaction.getSubAccountNumber());
389 
390         if (getParameterService().getParameterValueAsBoolean(ProcurementCardCreateDocumentsStep.class, ProcurementCardCreateDocumentsStep.USE_CARD_HOLDER_DEFAULT_PARAMETER_NAME)) {
391             final ProcurementCardDefault procurementCardDefault = retrieveProcurementCardDefault(transaction.getTransactionCreditCardNumber());
392             if (procurementCardDefault != null) {
393                 cardHolder.setCardCycleAmountLimit(procurementCardDefault.getCardCycleAmountLimit());
394                 cardHolder.setCardCycleVolumeLimit(procurementCardDefault.getCardCycleVolumeLimit());
395                 cardHolder.setCardHolderAlternateName(procurementCardDefault.getCardHolderAlternateName());
396                 cardHolder.setCardHolderCityName(procurementCardDefault.getCardHolderCityName());
397                 cardHolder.setCardHolderLine1Address(procurementCardDefault.getCardHolderLine1Address());
398                 cardHolder.setCardHolderLine2Address(procurementCardDefault.getCardHolderLine2Address());
399                 cardHolder.setCardHolderName(procurementCardDefault.getCardHolderName());
400                 cardHolder.setCardHolderStateCode(procurementCardDefault.getCardHolderStateCode());
401                 cardHolder.setCardHolderWorkPhoneNumber(procurementCardDefault.getCardHolderWorkPhoneNumber());
402                 cardHolder.setCardHolderZipCode(procurementCardDefault.getCardHolderZipCode());
403                 cardHolder.setCardLimit(procurementCardDefault.getCardLimit());
404                 cardHolder.setCardNoteText(procurementCardDefault.getCardNoteText());
405                 cardHolder.setCardStatusCode(procurementCardDefault.getCardStatusCode());
406 
407                 if (getParameterService().getParameterValueAsBoolean(ProcurementCardCreateDocumentsStep.class, ProcurementCardCreateDocumentsStep.USE_ACCOUNTING_DEFAULT_PARAMETER_NAME)) {
408                     cardHolder.setChartOfAccountsCode(procurementCardDefault.getChartOfAccountsCode());
409                     cardHolder.setAccountNumber(procurementCardDefault.getAccountNumber());
410                     cardHolder.setSubAccountNumber(procurementCardDefault.getSubAccountNumber());
411                 }
412             }
413         }
414         if (StringUtils.isEmpty(cardHolder.getCardHolderName())) {
415         cardHolder.setCardCycleAmountLimit(transaction.getCardCycleAmountLimit());
416         cardHolder.setCardCycleVolumeLimit(transaction.getCardCycleVolumeLimit());
417         cardHolder.setCardHolderAlternateName(transaction.getCardHolderAlternateName());
418         cardHolder.setCardHolderCityName(transaction.getCardHolderCityName());
419         cardHolder.setCardHolderLine1Address(transaction.getCardHolderLine1Address());
420         cardHolder.setCardHolderLine2Address(transaction.getCardHolderLine2Address());
421         cardHolder.setCardHolderName(transaction.getCardHolderName());
422         cardHolder.setCardHolderStateCode(transaction.getCardHolderStateCode());
423         cardHolder.setCardHolderWorkPhoneNumber(transaction.getCardHolderWorkPhoneNumber());
424         cardHolder.setCardHolderZipCode(transaction.getCardHolderZipCode());
425         cardHolder.setCardLimit(transaction.getCardLimit());
426         cardHolder.setCardNoteText(transaction.getCardNoteText());
427         cardHolder.setCardStatusCode(transaction.getCardStatusCode());
428         }
429 
430         pcardDocument.setProcurementCardHolder(cardHolder);
431     }
432 
433     /**
434      * Creates a transaction detail record and adds that record to the document provided.
435      *
436      * @param pcardDocument Document to place record in.
437      * @param transaction Transaction to set fields from.
438      * @param transactionLineNumber Line number of the new transaction detail record within the procurement card document.
439      * @return The error text that was generated from the creation of the detail records.  If the text is empty, no errors were encountered.
440      */
441     protected String createTransactionDetailRecord(ProcurementCardDocument pcardDocument, ProcurementCardTransaction transaction, Integer transactionLineNumber) {
442         ProcurementCardTransactionDetail transactionDetail = new ProcurementCardTransactionDetail();
443 
444         // set the document transaction detail fields from the loaded transaction record
445         transactionDetail.setDocumentNumber(pcardDocument.getDocumentNumber());
446         transactionDetail.setFinancialDocumentTransactionLineNumber(transactionLineNumber);
447         transactionDetail.setTransactionDate(transaction.getTransactionDate());
448         transactionDetail.setTransactionReferenceNumber(transaction.getTransactionReferenceNumber());
449         transactionDetail.setTransactionBillingCurrencyCode(transaction.getTransactionBillingCurrencyCode());
450         transactionDetail.setTransactionCurrencyExchangeRate(transaction.getTransactionCurrencyExchangeRate());
451         transactionDetail.setTransactionDate(transaction.getTransactionDate());
452         transactionDetail.setTransactionOriginalCurrencyAmount(transaction.getTransactionOriginalCurrencyAmount());
453         transactionDetail.setTransactionOriginalCurrencyCode(transaction.getTransactionOriginalCurrencyCode());
454         transactionDetail.setTransactionPointOfSaleCode(transaction.getTransactionPointOfSaleCode());
455         transactionDetail.setTransactionPostingDate(transaction.getTransactionPostingDate());
456         transactionDetail.setTransactionPurchaseIdentifierDescription(transaction.getTransactionPurchaseIdentifierDescription());
457         transactionDetail.setTransactionPurchaseIdentifierIndicator(transaction.getTransactionPurchaseIdentifierIndicator());
458         transactionDetail.setTransactionSalesTaxAmount(transaction.getTransactionSalesTaxAmount());
459         transactionDetail.setTransactionSettlementAmount(transaction.getTransactionSettlementAmount());
460         transactionDetail.setTransactionTaxExemptIndicator(transaction.getTransactionTaxExemptIndicator());
461         transactionDetail.setTransactionTravelAuthorizationCode(transaction.getTransactionTravelAuthorizationCode());
462         transactionDetail.setTransactionUnitContactName(transaction.getTransactionUnitContactName());
463 
464         if (GL_CREDIT_CODE.equals(transaction.getTransactionDebitCreditCode())) {
465             transactionDetail.setTransactionTotalAmount(transaction.getFinancialDocumentTotalAmount().negated());
466         }
467         else {
468             transactionDetail.setTransactionTotalAmount(transaction.getFinancialDocumentTotalAmount());
469         }
470 
471         // create transaction vendor record
472         createTransactionVendorRecord(pcardDocument, transaction, transactionDetail);
473 
474         // add transaction detail to document
475         pcardDocument.getTransactionEntries().add(transactionDetail);
476 
477         // now create the initial source and target lines for this transaction
478         return createAndValidateAccountingLines(pcardDocument, transaction, transactionDetail);
479     }
480 
481 
482     /**
483      * Creates a transaction vendor detail record and adds it to the transaction detail.
484      *
485      * @param pcardDocument The procurement card document to retrieve values from.
486      * @param transaction Transaction to set fields from.
487      * @param transactionDetail The transaction detail to set the vendor record on.
488      */
489     protected void createTransactionVendorRecord(ProcurementCardDocument pcardDocument, ProcurementCardTransaction transaction, ProcurementCardTransactionDetail transactionDetail) {
490         ProcurementCardVendor transactionVendor = new ProcurementCardVendor();
491 
492         transactionVendor.setDocumentNumber(pcardDocument.getDocumentNumber());
493         transactionVendor.setFinancialDocumentTransactionLineNumber(transactionDetail.getFinancialDocumentTransactionLineNumber());
494         transactionVendor.setTransactionMerchantCategoryCode(transaction.getTransactionMerchantCategoryCode());
495         transactionVendor.setVendorCityName(transaction.getVendorCityName());
496         transactionVendor.setVendorLine1Address(transaction.getVendorLine1Address());
497         transactionVendor.setVendorLine2Address(transaction.getVendorLine2Address());
498         transactionVendor.setVendorName(transaction.getVendorName());
499         transactionVendor.setVendorOrderNumber(transaction.getVendorOrderNumber());
500         transactionVendor.setVendorStateCode(transaction.getVendorStateCode());
501         transactionVendor.setVendorZipCode(transaction.getVendorZipCode());
502         transactionVendor.setVisaVendorIdentifier(transaction.getVisaVendorIdentifier());
503 
504         transactionDetail.setProcurementCardVendor(transactionVendor);
505     }
506 
507     /**
508      * From the transaction accounting attributes, creates source and target accounting lines. Attributes are validated first, and
509      * replaced with default and error values if needed. There will be 1 source and 1 target line generated.
510      *
511      * @param pcardDocument The procurement card document to add the new accounting lines to.
512      * @param transaction The transaction to process into account lines.
513      * @param docTransactionDetail The transaction detail to create source and target accounting lines from.
514      * @return String containing any error messages.
515      */
516     protected String createAndValidateAccountingLines(ProcurementCardDocument pcardDocument, ProcurementCardTransaction transaction, ProcurementCardTransactionDetail docTransactionDetail) {
517         // build source lines
518         ProcurementCardSourceAccountingLine sourceLine = createSourceAccountingLine(transaction, docTransactionDetail);
519         sourceLine.setPostingYear(pcardDocument.getPostingYear());
520 
521         // add line to transaction through document since document contains the next sequence number fields
522         pcardDocument.addSourceAccountingLine(sourceLine);
523 
524         // build target lines
525         ProcurementCardTargetAccountingLine targetLine = createTargetAccountingLine(transaction, docTransactionDetail);
526         targetLine.setPostingYear(pcardDocument.getPostingYear());
527 
528         // add line to transaction through document since document contains the next sequence number fields
529         pcardDocument.addTargetAccountingLine(targetLine);
530 
531         return validateTargetAccountingLine(targetLine);
532     }
533 
534     /**
535      * Creates the to record for the transaction. The chart of account attributes from the transaction are used to create
536      * the accounting line.
537      *
538      * @param transaction The transaction to pull information from to create the accounting line.
539      * @param docTransactionDetail The transaction detail to pull information from to populate the accounting line.
540      * @return The target accounting line fully populated with values from the parameters passed in.
541      */
542     protected ProcurementCardTargetAccountingLine createTargetAccountingLine(ProcurementCardTransaction transaction, ProcurementCardTransactionDetail docTransactionDetail) {
543         ProcurementCardTargetAccountingLine targetLine = new ProcurementCardTargetAccountingLine();
544         targetLine.setDocumentNumber(docTransactionDetail.getDocumentNumber());
545         targetLine.setFinancialDocumentTransactionLineNumber(docTransactionDetail.getFinancialDocumentTransactionLineNumber());
546         targetLine.setChartOfAccountsCode(transaction.getChartOfAccountsCode());
547         targetLine.setAccountNumber(transaction.getAccountNumber());
548         targetLine.setFinancialObjectCode(transaction.getFinancialObjectCode());
549         targetLine.setSubAccountNumber(transaction.getSubAccountNumber());
550         targetLine.setFinancialSubObjectCode(transaction.getFinancialSubObjectCode());
551         targetLine.setProjectCode(transaction.getProjectCode());
552 
553         if (getParameterService().getParameterValueAsBoolean(ProcurementCardCreateDocumentsStep.class, ProcurementCardCreateDocumentsStep.USE_ACCOUNTING_DEFAULT_PARAMETER_NAME)) {
554             final ProcurementCardDefault procurementCardDefault = retrieveProcurementCardDefault(transaction.getTransactionCreditCardNumber());
555             if (procurementCardDefault != null) {
556                     targetLine.setChartOfAccountsCode(procurementCardDefault.getChartOfAccountsCode());
557                     targetLine.setAccountNumber(procurementCardDefault.getAccountNumber());
558                     targetLine.setFinancialObjectCode(procurementCardDefault.getFinancialObjectCode());
559                     targetLine.setSubAccountNumber(procurementCardDefault.getSubAccountNumber());
560                     targetLine.setFinancialSubObjectCode(procurementCardDefault.getFinancialSubObjectCode());
561                     targetLine.setProjectCode(procurementCardDefault.getProjectCode());
562             }
563         }
564 
565         if (GL_CREDIT_CODE.equals(transaction.getTransactionDebitCreditCode())) {
566             targetLine.setAmount(transaction.getFinancialDocumentTotalAmount().negated());
567         }
568         else {
569             targetLine.setAmount(transaction.getFinancialDocumentTotalAmount());
570         }
571 
572         return targetLine;
573     }
574 
575     /**
576      * Creates the from record for the transaction. The clearing chart, account, and object code is used for creating the line.
577      *
578      * @param transaction The transaction to pull information from to create the accounting line.
579      * @param docTransactionDetail The transaction detail to pull information from to populate the accounting line.
580      * @return The source accounting line fully populated with values from the parameters passed in.
581      */
582     protected ProcurementCardSourceAccountingLine createSourceAccountingLine(ProcurementCardTransaction transaction, ProcurementCardTransactionDetail docTransactionDetail) {
583         ProcurementCardSourceAccountingLine sourceLine = new ProcurementCardSourceAccountingLine();
584 
585         sourceLine.setDocumentNumber(docTransactionDetail.getDocumentNumber());
586         sourceLine.setFinancialDocumentTransactionLineNumber(docTransactionDetail.getFinancialDocumentTransactionLineNumber());
587         sourceLine.setChartOfAccountsCode(getDefaultChartCode());
588         sourceLine.setAccountNumber(getDefaultAccountNumber());
589         sourceLine.setFinancialObjectCode(getDefaultObjectCode());
590 
591         if (GL_CREDIT_CODE.equals(transaction.getTransactionDebitCreditCode())) {
592             sourceLine.setAmount(transaction.getFinancialDocumentTotalAmount().negated());
593         }
594         else {
595             sourceLine.setAmount(transaction.getFinancialDocumentTotalAmount());
596         }
597 
598         return sourceLine;
599     }
600 
601     /**
602      * Validates the chart of account attributes for existence and active indicator. Will substitute for defined
603      * default parameters or set fields to empty that if they have errors.
604      *
605      * @param targetLine The target accounting line to be validated.
606      * @return String with error messages discovered during validation.  An empty string indicates no validation errors were found.
607      */
608     protected String validateTargetAccountingLine(ProcurementCardTargetAccountingLine targetLine) {
609         String errorText = "";
610 
611         targetLine.refresh();
612 
613         if (!accountingLineRuleUtil.isValidChart("", targetLine.getChart(), dataDictionaryService.getDataDictionary())) {
614             String tempErrorText = "Chart " + targetLine.getChartOfAccountsCode() + " is invalid; using error Chart Code.";
615             if ( LOG.isInfoEnabled() ) {
616                 LOG.info(tempErrorText);
617             }
618             errorText += " " + tempErrorText;
619 
620             targetLine.setChartOfAccountsCode(getErrorChartCode());
621             targetLine.refresh();
622         }
623 
624         if (!accountingLineRuleUtil.isValidAccount("", targetLine.getAccount(), dataDictionaryService.getDataDictionary()) || targetLine.getAccount().isExpired()) {
625             String tempErrorText = "Chart " + targetLine.getChartOfAccountsCode() + " Account " + targetLine.getAccountNumber() + " is invalid; using error account.";
626             if ( LOG.isInfoEnabled() ) {
627                 LOG.info(tempErrorText);
628             }
629             errorText += " " + tempErrorText;
630 
631             targetLine.setChartOfAccountsCode(getErrorChartCode());
632             targetLine.setAccountNumber(getErrorAccountNumber());
633             targetLine.refresh();
634         }
635 
636         if (!accountingLineRuleUtil.isValidObjectCode("", targetLine.getObjectCode(), dataDictionaryService.getDataDictionary())) {
637             String tempErrorText = "Chart " + targetLine.getChartOfAccountsCode() + " Object Code " + targetLine.getFinancialObjectCode() + " is invalid; using default Object Code.";
638             if ( LOG.isInfoEnabled() ) {
639                 LOG.info(tempErrorText);
640             }
641             errorText += " " + tempErrorText;
642 
643             targetLine.setFinancialObjectCode(getDefaultObjectCode());
644             targetLine.refresh();
645         }
646 
647         if (StringUtils.isNotBlank(targetLine.getSubAccountNumber()) && !accountingLineRuleUtil.isValidSubAccount("", targetLine.getSubAccount(), dataDictionaryService.getDataDictionary())) {
648             String tempErrorText = "Chart " + targetLine.getChartOfAccountsCode() + " Account " + targetLine.getAccountNumber() + " Sub Account " + targetLine.getSubAccountNumber() + " is invalid; Setting Sub Account to blank.";
649             if ( LOG.isInfoEnabled() ) {
650                 LOG.info(tempErrorText);
651             }
652             errorText += " " + tempErrorText;
653 
654             targetLine.setSubAccountNumber("");
655         }
656 
657         if (StringUtils.isNotBlank(targetLine.getFinancialSubObjectCode()) && !accountingLineRuleUtil.isValidSubObjectCode("", targetLine.getSubObjectCode(), dataDictionaryService.getDataDictionary())) {
658             String tempErrorText = "Chart " + targetLine.getChartOfAccountsCode() + " Account " + targetLine.getAccountNumber() + " Object Code " + targetLine.getFinancialObjectCode() + " Sub Object Code " + targetLine.getFinancialSubObjectCode() + " is invalid; setting Sub Object to blank.";
659             if ( LOG.isInfoEnabled() ) {
660                 LOG.info(tempErrorText);
661             }
662             errorText += " " + tempErrorText;
663 
664             targetLine.setFinancialSubObjectCode("");
665         }
666 
667         if (StringUtils.isNotBlank(targetLine.getProjectCode()) && !accountingLineRuleUtil.isValidProjectCode("", targetLine.getProject(), dataDictionaryService.getDataDictionary())) {
668             if ( LOG.isInfoEnabled() ) {
669                 LOG.info("Project Code " + targetLine.getProjectCode() + " is invalid; setting to blank.");
670             }
671             errorText += " Project Code " + targetLine.getProjectCode() + " is invalid; setting to blank.";
672 
673             targetLine.setProjectCode("");
674         }
675 
676         // clear out GlobalVariable message map, since we have taken care of the errors
677         GlobalVariables.setMessageMap(new MessageMap());
678 
679         return errorText;
680     }
681 
682 
683     /**
684      * Validates the chart of account attributes for existence and active indicator. Will substitute for defined
685      * default parameters or set fields to empty that if they have errors.
686      *
687      * @param transaction The transaction to be validated.
688      * @return String with error messages discovered during validation.  An empty string indicates no validation errors were found.
689      */
690     protected String validateTransaction(ProcurementCardTransaction transaction) {
691         String errorText = "";
692 
693         if (getParameterService().getParameterValueAsBoolean(ProcurementCardCreateDocumentsStep.class, ProcurementCardCreateDocumentsStep.USE_ACCOUNTING_DEFAULT_PARAMETER_NAME)) {
694             final ProcurementCardDefault procurementCardDefault = retrieveProcurementCardDefault(transaction.getTransactionCreditCardNumber());
695             if (ObjectUtils.isNull(procurementCardDefault)) {
696                 final String tempErrorText = "Procurement Card Accounting Line Defaults are turned on but no Procurement Card Default record could be retrieved for transaction: "+transaction.getTransactionReferenceNumber() + " by card number.";
697                 if ( LOG.isInfoEnabled() ) {
698                     LOG.info(tempErrorText);
699                 }
700                 errorText += " " + tempErrorText;
701             }
702         }
703         else {
704             transaction.refresh();
705 
706             final ChartService chartService = SpringContext.getBean(ChartService.class);
707             if (transaction.getChartOfAccountsCode() == null || ObjectUtils.isNull(chartService.getByPrimaryId(transaction.getChartOfAccountsCode()))) {
708                 String tempErrorText = "Chart " + transaction.getChartOfAccountsCode() + " is invalid; using error Chart Code.";
709                 if ( LOG.isInfoEnabled() ) {
710                     LOG.info(tempErrorText);
711                 }
712                 errorText += " " + tempErrorText;
713                 transaction.setChartOfAccountsCode(getErrorChartCode());
714                 transaction.refresh();
715             }
716 
717             final AccountService accountService = SpringContext.getBean(AccountService.class);
718             if (transaction.getAccountNumber() == null || ObjectUtils.isNull(accountService.getByPrimaryIdWithCaching(transaction.getChartOfAccountsCode(), transaction.getAccountNumber())) || accountService.getByPrimaryIdWithCaching(transaction.getChartOfAccountsCode(), transaction.getAccountNumber()).isExpired()) {
719                 String tempErrorText = "Chart " + transaction.getChartOfAccountsCode() + " Account " + transaction.getAccountNumber() + " is invalid; using error account.";
720                 if ( LOG.isInfoEnabled() ) {
721                     LOG.info(tempErrorText);
722                 }
723                 errorText += " " + tempErrorText;
724                 transaction.setChartOfAccountsCode(getErrorChartCode());
725                 transaction.setAccountNumber(getErrorAccountNumber());
726                 transaction.refresh();
727             }
728 
729             final UniversityDateService uds = SpringContext.getBean(UniversityDateService.class);
730             final ObjectCodeService ocs = SpringContext.getBean(ObjectCodeService.class);
731             if (transaction.getFinancialObjectCode() == null || ObjectUtils.isNull(ocs.getByPrimaryIdWithCaching(uds.getCurrentFiscalYear(), transaction.getChartOfAccountsCode(), transaction.getFinancialObjectCode()))) {
732                 String tempErrorText = "Chart " + transaction.getChartOfAccountsCode() + " Object Code " + transaction.getFinancialObjectCode() + " is invalid; using default Object Code.";
733                 if ( LOG.isInfoEnabled() ) {
734                     LOG.info(tempErrorText);
735                 }
736                 errorText += " " + tempErrorText;
737 
738                 transaction.setFinancialObjectCode(getDefaultObjectCode());
739                 transaction.refresh();
740             }
741 
742             if (StringUtils.isNotBlank(transaction.getSubAccountNumber())) {
743                 SubAccountService sas = SpringContext.getBean(SubAccountService.class);
744                 SubAccount subAccount = sas.getByPrimaryIdWithCaching(transaction.getChartOfAccountsCode(), transaction.getAccountNumber(), transaction.getSubAccountNumber());
745 
746                 if (ObjectUtils.isNull(subAccount)) {
747                     String tempErrorText = "Chart " + transaction.getChartOfAccountsCode() + " Account " + transaction.getAccountNumber() + " Sub Account " + transaction.getSubAccountNumber() + " is invalid; Setting Sub Account to blank.";
748                     if ( LOG.isInfoEnabled() ) {
749                         LOG.info(tempErrorText);
750                     }
751                     errorText += " " + tempErrorText;
752 
753                     transaction.setSubAccountNumber("");
754                 }
755             }
756 
757             if (StringUtils.isNotBlank(transaction.getFinancialSubObjectCode())) {
758 
759                 SubObjectCodeService socs = SpringContext.getBean(SubObjectCodeService.class);
760                 SubObjectCode soc = socs.getByPrimaryIdForCurrentYear(transaction.getChartOfAccountsCode(), transaction.getAccountNumber(), transaction.getFinancialObjectCode(), transaction.getFinancialSubObjectCode());
761 
762                 if (ObjectUtils.isNull(soc)) {
763                     String tempErrorText = "Chart " + transaction.getChartOfAccountsCode() + " Account " + transaction.getAccountNumber() + " Object Code " + transaction.getFinancialObjectCode() + " Sub Object Code " + transaction.getFinancialSubObjectCode() + " is invalid; setting Sub Object to blank.";
764                     if ( LOG.isInfoEnabled() ) {
765                         LOG.info(tempErrorText);
766                     }
767                     errorText += " " + tempErrorText;
768 
769                     transaction.setFinancialSubObjectCode("");
770                 }
771             }
772 
773             if (StringUtils.isNotBlank(transaction.getProjectCode())) {
774 
775                 ProjectCodeService pcs = SpringContext.getBean(ProjectCodeService.class);
776                 ProjectCode pc = pcs.getByPrimaryId(transaction.getProjectCode());
777 
778                 if (ObjectUtils.isNull(pc)) {
779                     if ( LOG.isInfoEnabled() ) {
780                         LOG.info("Project Code " + transaction.getProjectCode() + " is invalid; setting to blank.");
781                     }
782                     errorText += " Project Code " + transaction.getProjectCode() + " is invalid; setting to blank.";
783 
784                     transaction.setProjectCode("");
785                 }
786             }
787         }
788 
789         // clear out GlobalVariable message map, since we have taken care of the errors
790         GlobalVariables.setMessageMap(new MessageMap());
791 
792         return errorText;
793     }
794 
795     /**
796      * Retrieves the error chart code from the parameter table.
797      * @return The error chart code defined in the parameter table.
798      */
799     protected String getErrorChartCode() {
800         return parameterService.getParameterValueAsString(ProcurementCardCreateDocumentsStep.class, ProcurementCardDocumentRuleConstants.ERROR_TRANS_CHART_CODE_PARM_NM);
801     }
802 
803     /**
804      * Retrieves the error account number from the parameter table.
805      * @return The error account number defined in the parameter table.
806      */
807     protected String getErrorAccountNumber() {
808         return parameterService.getParameterValueAsString(ProcurementCardCreateDocumentsStep.class, ERROR_TRANS_ACCOUNT_PARM_NM);
809     }
810 
811     /**
812      * Gets the default Chart Code, Account from the custom Procurement Cardholder table.
813      *
814      */
815     protected ProcurementCardDefault retrieveProcurementCardDefault(String creditCardNumber) {
816         Map<String, String> pkMap = new HashMap<String, String>();
817         pkMap.put(OLEPropertyConstants.CREDIT_CARD_NUMBER, creditCardNumber);
818         ProcurementCardDefault procurementCardDefault = KRADServiceLocatorWeb.getLegacyDataAdapter().findByPrimaryKey(ProcurementCardDefault.class, pkMap);
819 
820         return procurementCardDefault;
821     }
822 
823     /**
824      * Retrieves the default chard code from the parameter table.
825      * @return The default chart code defined in the parameter table.
826      */
827     protected String getDefaultChartCode() {
828         return parameterService.getParameterValueAsString(ProcurementCardLoadStep.class, DEFAULT_TRANS_CHART_CODE_PARM_NM);
829     }
830 
831     /**
832      * Retrieves the default account number from the parameter table.
833      * @return The default account number defined in the parameter table.
834      */
835     protected String getDefaultAccountNumber() {
836         return parameterService.getParameterValueAsString(ProcurementCardLoadStep.class, DEFAULT_TRANS_ACCOUNT_PARM_NM);
837     }
838 
839     /**
840      * Retrieves the default object code from the parameter table.
841      * @return The default object code defined in the parameter table.
842      */
843     protected String getDefaultObjectCode() {
844         return parameterService.getParameterValueAsString(ProcurementCardLoadStep.class, DEFAULT_TRANS_OBJECT_CODE_PARM_NM);
845     }
846 
847     /**
848      * Calls businessObjectService to remove all the procurement card transaction rows from the transaction load table.
849      */
850     protected void cleanTransactionsTable() {
851         KRADServiceLocatorWeb.getLegacyDataAdapter().deleteMatching(ProcurementCardTransaction.class, new HashMap());
852     }
853 
854     /**
855      * Loads all the parsed XML transactions into the temp transaction table.
856      *
857      * @param transactions List of ProcurementCardTransactions to load.
858      */
859     protected void loadTransactions(List transactions) {
860         KRADServiceLocatorWeb.getLegacyDataAdapter().save(transactions);
861     }
862 
863     /**
864      * @return retrieves the presumably injected implementation of ParameterService to use
865      */
866     public ParameterService getParameterService() {
867         return parameterService;
868     }
869 
870     /**
871      * Sets the parameterService attribute.
872      * @param parameterService
873      */
874     public void setParameterService(ParameterService parameterService) {
875         this.parameterService = parameterService;
876     }
877 
878     /**
879      * Gets the businessObjectService attribute.
880      * @return Returns the KRADServiceLocatorWeb.getLegacyDataAdapter().
881      */
882     public BusinessObjectService getBusinessObjectService() {
883         return businessObjectService;
884     }
885 
886     /**
887      * Sets the businessObjectService attribute.
888      * @param businessObjectService The businessObjectService to set.
889      */
890     public void setBusinessObjectService(BusinessObjectService businessObjectService) {
891         this.businessObjectService = businessObjectService;
892     }
893 
894     /**
895      * Gets the documentService attribute.
896      * @return Returns the documentService.
897      */
898     public DocumentService getDocumentService() {
899         return documentService;
900     }
901 
902     /**
903      * Sets the documentService attribute.
904      * @param documentService The documentService to set.
905      */
906     public void setDocumentService(DocumentService documentService) {
907         this.documentService = documentService;
908     }
909 
910     public WorkflowDocumentService getWorkflowDocumentService() {
911         return workflowDocumentService;
912     }
913 
914     public void setWorkflowDocumentService(WorkflowDocumentService workflowDocumentService) {
915         this.workflowDocumentService = workflowDocumentService;
916     }
917 
918     /**
919      * Gets the dataDictionaryService attribute.
920      * @return Returns the dataDictionaryService.
921      */
922     public DataDictionaryService getDataDictionaryService() {
923         return dataDictionaryService;
924     }
925 
926     /**
927      * Sets the dataDictionaryService attribute.
928      * @param dataDictionaryService dataDictionaryService to set.
929      */
930     public void setDataDictionaryService(DataDictionaryService dataDictionaryService) {
931         this.dataDictionaryService = dataDictionaryService;
932     }
933 
934 
935     /**
936      * Gets the dateTimeService attribute.
937      * @return Returns the dateTimeService.
938      */
939     public DateTimeService getDateTimeService() {
940         return dateTimeService;
941     }
942 
943     /**
944      * Sets the dateTimeService attribute.
945      * @param dateTimeService The dateTimeService to set.
946      */
947     public void setDateTimeService(DateTimeService dateTimeService) {
948         this.dateTimeService = dateTimeService;
949     }
950 
951     /**
952      * Sets the accountingLineRuleUtil attribute value.
953      * @param accountingLineRuleUtil The accountingLineRuleUtil to set.
954      */
955     public void setAccountingLineRuleUtil(AccountingLineRuleHelperService accountingLineRuleUtil) {
956         this.accountingLineRuleUtil = accountingLineRuleUtil;
957     }
958 
959     /**
960      * Sets the capitalAssetBuilderModuleService attribute value.
961      * @param capitalAssetBuilderModuleService The capitalAssetBuilderModuleService to set.
962      */
963     public void setCapitalAssetBuilderModuleService(CapitalAssetBuilderModuleService capitalAssetBuilderModuleService) {
964         this.capitalAssetBuilderModuleService = capitalAssetBuilderModuleService;
965     }
966 
967 }