org.kuali.kfs.fp.batch.service.impl
Class ProcurementCardCreateDocumentServiceImpl

java.lang.Object
  extended by org.kuali.kfs.fp.batch.service.impl.ProcurementCardCreateDocumentServiceImpl
All Implemented Interfaces:
ProcurementCardCreateDocumentService

@Transactional
public class ProcurementCardCreateDocumentServiceImpl
extends Object
implements ProcurementCardCreateDocumentService

This is the default implementation of the ProcurementCardCreateDocumentService interface.

See Also:
ProcurementCardCreateDocumentService

Field Summary
protected  AccountingLineRuleHelperService accountingLineRuleUtil
           
protected  org.kuali.rice.kns.service.BusinessObjectService businessObjectService
           
protected  CapitalAssetBuilderModuleService capitalAssetBuilderModuleService
           
protected  org.kuali.rice.kns.service.DataDictionaryService dataDictionaryService
           
protected  org.kuali.rice.kns.service.DateTimeService dateTimeService
           
protected  org.kuali.rice.kns.service.DocumentService documentService
           
protected  org.kuali.rice.kns.service.ParameterService parameterService
           
protected static String WORKFLOW_SEARCH_RESULT_KEY
           
protected  org.kuali.rice.kns.workflow.service.WorkflowDocumentService workflowDocumentService
           
 
Constructor Summary
ProcurementCardCreateDocumentServiceImpl()
           
 
Method Summary
 boolean autoApproveProcurementCardDocuments()
          This method determines if procurement card documents can be auto approved.
protected  void cleanTransactionsTable()
          Calls businessObjectService to remove all the procurement card transaction rows from the transaction load table.
protected  String createAndValidateAccountingLines(ProcurementCardDocument pcardDocument, ProcurementCardTransaction transaction, ProcurementCardTransactionDetail docTransactionDetail)
          From the transaction accounting attributes, creates source and target accounting lines.
protected  void createCardHolderRecord(ProcurementCardDocument pcardDocument, ProcurementCardTransaction transaction)
          Creates card holder record and sets that record to the document given.
protected  ProcurementCardDocument createProcurementCardDocument(List transactions)
          Creates a ProcurementCardDocument from the List of transactions given.
 boolean createProcurementCardDocuments()
          This method retrieves a collection of credit card transactions and traverses through this list, creating ProcurementCardDocuments for each card.
protected  ProcurementCardSourceAccountingLine createSourceAccountingLine(ProcurementCardTransaction transaction, ProcurementCardTransactionDetail docTransactionDetail)
          Creates the from record for the transaction.
protected  ProcurementCardTargetAccountingLine createTargetAccountingLine(ProcurementCardTransaction transaction, ProcurementCardTransactionDetail docTransactionDetail)
          Creates the to record for the transaction.
protected  String createTransactionDetailRecord(ProcurementCardDocument pcardDocument, ProcurementCardTransaction transaction, Integer transactionLineNumber)
          Creates a transaction detail record and adds that record to the document provided.
protected  void createTransactionVendorRecord(ProcurementCardDocument pcardDocument, ProcurementCardTransaction transaction, ProcurementCardTransactionDetail transactionDetail)
          Creates a transaction vendor detail record and adds it to the transaction detail.
 org.kuali.rice.kns.service.BusinessObjectService getBusinessObjectService()
          Gets the businessObjectService attribute.
 org.kuali.rice.kns.service.DataDictionaryService getDataDictionaryService()
          Gets the dataDictionaryService attribute.
 org.kuali.rice.kns.service.DateTimeService getDateTimeService()
          Gets the dateTimeService attribute.
protected  String getDefaultAccountNumber()
          Retrieves the default account number from the parameter table.
protected  String getDefaultChartCode()
          Retrieves the default chard code from the parameter table.
protected  String getDefaultObjectCode()
          Retrieves the default object code from the parameter table.
 org.kuali.rice.kns.service.DocumentService getDocumentService()
          Gets the documentService attribute.
protected  String getErrorAccountNumber()
          Retrieves the error account number from the parameter table.
protected  String getErrorChartCode()
          Retrieves the error chart code from the parameter table.
 org.kuali.rice.kns.workflow.service.WorkflowDocumentService getWorkflowDocumentService()
          Gets the workflowDocumentService attribute.
protected  void loadTransactions(List transactions)
          Loads all the parsed XML transactions into the temp transaction table.
protected  String parseDocumentIdFromRouteDocHeader(String routeDocHeader)
          Retrieves the document id out of the route document header
protected  List<String> retrieveProcurementCardDocumentsToRoute(String statusCode)
          Returns a list of all initiated but not yet routed procurement card documents, using the KualiWorkflowInfo service.
protected  List retrieveTransactions()
          This method retrieves a list of transactions from a temporary table, and groups them into document lists, based on single transaction indicator or a grouping by card.
 boolean routeProcurementCardDocuments()
          This method retrieves all the procurement card documents with a status of 'I' and routes them to the next step in the routing path.
 void setAccountingLineRuleUtil(AccountingLineRuleHelperService accountingLineRuleUtil)
          Sets the accountingLineRuleUtil attribute value.
 void setBusinessObjectService(org.kuali.rice.kns.service.BusinessObjectService businessObjectService)
          Sets the businessObjectService attribute.
 void setCapitalAssetBuilderModuleService(CapitalAssetBuilderModuleService capitalAssetBuilderModuleService)
          Sets the capitalAssetBuilderModuleService attribute value.
 void setDataDictionaryService(org.kuali.rice.kns.service.DataDictionaryService dataDictionaryService)
          Sets the dataDictionaryService attribute.
 void setDateTimeService(org.kuali.rice.kns.service.DateTimeService dateTimeService)
          Sets the dateTimeService attribute.
 void setDocumentService(org.kuali.rice.kns.service.DocumentService documentService)
          Sets the documentService attribute.
 void setParameterService(org.kuali.rice.kns.service.ParameterService parameterService)
          Sets the parameterService attribute.
 void setWorkflowDocumentService(org.kuali.rice.kns.workflow.service.WorkflowDocumentService workflowDocumentService)
          Sets the workflowDocumentService attribute value.
protected  String validateTargetAccountingLine(ProcurementCardTargetAccountingLine targetLine)
          Validates the chart of account attributes for existence and active indicator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WORKFLOW_SEARCH_RESULT_KEY

protected static final String WORKFLOW_SEARCH_RESULT_KEY
See Also:
Constant Field Values

parameterService

protected org.kuali.rice.kns.service.ParameterService parameterService

businessObjectService

protected org.kuali.rice.kns.service.BusinessObjectService businessObjectService

documentService

protected org.kuali.rice.kns.service.DocumentService documentService

dataDictionaryService

protected org.kuali.rice.kns.service.DataDictionaryService dataDictionaryService

dateTimeService

protected org.kuali.rice.kns.service.DateTimeService dateTimeService

workflowDocumentService

protected org.kuali.rice.kns.workflow.service.WorkflowDocumentService workflowDocumentService

accountingLineRuleUtil

protected AccountingLineRuleHelperService accountingLineRuleUtil

capitalAssetBuilderModuleService

protected CapitalAssetBuilderModuleService capitalAssetBuilderModuleService
Constructor Detail

ProcurementCardCreateDocumentServiceImpl

public ProcurementCardCreateDocumentServiceImpl()
Method Detail

createProcurementCardDocuments

public boolean createProcurementCardDocuments()
This method retrieves a collection of credit card transactions and traverses through this list, creating ProcurementCardDocuments for each card.

Specified by:
createProcurementCardDocuments in interface ProcurementCardCreateDocumentService
Returns:
True if the procurement card documents were created successfully. If any problem occur while creating the documents, a runtime exception will be thrown.
See Also:
ProcurementCardCreateDocumentService.createProcurementCardDocuments()

routeProcurementCardDocuments

public boolean routeProcurementCardDocuments()
This method retrieves all the procurement card documents with a status of 'I' and routes them to the next step in the routing path.

Specified by:
routeProcurementCardDocuments in interface ProcurementCardCreateDocumentService
Returns:
True if the routing was performed successfully. A runtime exception will be thrown if any errors occur while routing.
See Also:
org.kuali.kfs.fp.batch.service.ProcurementCardCreateDocumentService#routeProcurementCardDocuments(java.util.List)

retrieveProcurementCardDocumentsToRoute

protected List<String> retrieveProcurementCardDocumentsToRoute(String statusCode)
                                                        throws org.kuali.rice.kew.exception.WorkflowException,
                                                               RemoteException
Returns a list of all initiated but not yet routed procurement card documents, using the KualiWorkflowInfo service.

Returns:
a list of procurement card documents to route
Throws:
org.kuali.rice.kew.exception.WorkflowException
RemoteException

parseDocumentIdFromRouteDocHeader

protected String parseDocumentIdFromRouteDocHeader(String routeDocHeader)
Retrieves the document id out of the route document header

Parameters:
routeDocHeader - the String representing an HTML link to the document
Returns:
the document id

autoApproveProcurementCardDocuments

public boolean autoApproveProcurementCardDocuments()
This method determines if procurement card documents can be auto approved. A document can be auto approved if the grace period for allowing auto approval of a procurement card document has passed. The grace period is defined by a parameter in the parameters table. The create date of the document is then compared against the current date and if the difference is larger than the grace period defined, then the document is auto approved.

Specified by:
autoApproveProcurementCardDocuments in interface ProcurementCardCreateDocumentService
Returns:
This method always returns true.
See Also:
ProcurementCardCreateDocumentService.autoApproveProcurementCardDocuments()

retrieveTransactions

protected List retrieveTransactions()
This method retrieves a list of transactions from a temporary table, and groups them into document lists, based on single transaction indicator or a grouping by card.

Returns:
List containing transactions for document.

createProcurementCardDocument

protected ProcurementCardDocument createProcurementCardDocument(List transactions)
Creates a ProcurementCardDocument from the List of transactions given.

Parameters:
transactions - List of ProcurementCardTransaction objects to be used for creating the document.
Returns:
A ProcurementCardDocument populated with the transactions provided.

createCardHolderRecord

protected void createCardHolderRecord(ProcurementCardDocument pcardDocument,
                                      ProcurementCardTransaction transaction)
Creates card holder record and sets that record to the document given.

Parameters:
pcardDocument - Procurement card document to place the record in.
transaction - The transaction to set the card holder record fields from.

createTransactionDetailRecord

protected String createTransactionDetailRecord(ProcurementCardDocument pcardDocument,
                                               ProcurementCardTransaction transaction,
                                               Integer transactionLineNumber)
Creates a transaction detail record and adds that record to the document provided.

Parameters:
pcardDocument - Document to place record in.
transaction - Transaction to set fields from.
transactionLineNumber - Line number of the new transaction detail record within the procurement card document.
Returns:
The error text that was generated from the creation of the detail records. If the text is empty, no errors were encountered.

createTransactionVendorRecord

protected void createTransactionVendorRecord(ProcurementCardDocument pcardDocument,
                                             ProcurementCardTransaction transaction,
                                             ProcurementCardTransactionDetail transactionDetail)
Creates a transaction vendor detail record and adds it to the transaction detail.

Parameters:
pcardDocument - The procurement card document to retrieve values from.
transaction - Transaction to set fields from.
transactionDetail - The transaction detail to set the vendor record on.

createAndValidateAccountingLines

protected String createAndValidateAccountingLines(ProcurementCardDocument pcardDocument,
                                                  ProcurementCardTransaction transaction,
                                                  ProcurementCardTransactionDetail docTransactionDetail)
From the transaction accounting attributes, creates source and target accounting lines. Attributes are validated first, and replaced with default and error values if needed. There will be 1 source and 1 target line generated.

Parameters:
pcardDocument - The procurement card document to add the new accounting lines to.
transaction - The transaction to process into account lines.
docTransactionDetail - The transaction detail to create source and target accounting lines from.
Returns:
String containing any error messages.

createTargetAccountingLine

protected ProcurementCardTargetAccountingLine createTargetAccountingLine(ProcurementCardTransaction transaction,
                                                                         ProcurementCardTransactionDetail docTransactionDetail)
Creates the to record for the transaction. The chart of account attributes from the transaction are used to create the accounting line.

Parameters:
transaction - The transaction to pull information from to create the accounting line.
docTransactionDetail - The transaction detail to pull information from to populate the accounting line.
Returns:
The target accounting line fully populated with values from the parameters passed in.

createSourceAccountingLine

protected ProcurementCardSourceAccountingLine createSourceAccountingLine(ProcurementCardTransaction transaction,
                                                                         ProcurementCardTransactionDetail docTransactionDetail)
Creates the from record for the transaction. The clearing chart, account, and object code is used for creating the line.

Parameters:
transaction - The transaction to pull information from to create the accounting line.
docTransactionDetail - The transaction detail to pull information from to populate the accounting line.
Returns:
The source accounting line fully populated with values from the parameters passed in.

validateTargetAccountingLine

protected String validateTargetAccountingLine(ProcurementCardTargetAccountingLine targetLine)
Validates the chart of account attributes for existence and active indicator. Will substitute for defined default parameters or set fields to empty that if they have errors.

Parameters:
targetLine - The target accounting line to be validated.
Returns:
String with error messages discovered during validation. An empty string indicates no validation errors were found.

getErrorChartCode

protected String getErrorChartCode()
Retrieves the error chart code from the parameter table.

Returns:
The error chart code defined in the parameter table.

getErrorAccountNumber

protected String getErrorAccountNumber()
Retrieves the error account number from the parameter table.

Returns:
The error account number defined in the parameter table.

getDefaultChartCode

protected String getDefaultChartCode()
Retrieves the default chard code from the parameter table.

Returns:
The default chart code defined in the parameter table.

getDefaultAccountNumber

protected String getDefaultAccountNumber()
Retrieves the default account number from the parameter table.

Returns:
The default account number defined in the parameter table.

getDefaultObjectCode

protected String getDefaultObjectCode()
Retrieves the default object code from the parameter table.

Returns:
The default object code defined in the parameter table.

cleanTransactionsTable

protected void cleanTransactionsTable()
Calls businessObjectService to remove all the procurement card transaction rows from the transaction load table.


loadTransactions

protected void loadTransactions(List transactions)
Loads all the parsed XML transactions into the temp transaction table.

Parameters:
transactions - List of ProcurementCardTransactions to load.

setParameterService

public void setParameterService(org.kuali.rice.kns.service.ParameterService parameterService)
Sets the parameterService attribute.

Parameters:
parameterService -

getBusinessObjectService

public org.kuali.rice.kns.service.BusinessObjectService getBusinessObjectService()
Gets the businessObjectService attribute.

Returns:
Returns the businessObjectService.

setBusinessObjectService

public void setBusinessObjectService(org.kuali.rice.kns.service.BusinessObjectService businessObjectService)
Sets the businessObjectService attribute.

Parameters:
businessObjectService - The businessObjectService to set.

getDocumentService

public org.kuali.rice.kns.service.DocumentService getDocumentService()
Gets the documentService attribute.

Returns:
Returns the documentService.

setDocumentService

public void setDocumentService(org.kuali.rice.kns.service.DocumentService documentService)
Sets the documentService attribute.

Parameters:
documentService - The documentService to set.

getDataDictionaryService

public org.kuali.rice.kns.service.DataDictionaryService getDataDictionaryService()
Gets the dataDictionaryService attribute.

Returns:
Returns the dataDictionaryService.

setDataDictionaryService

public void setDataDictionaryService(org.kuali.rice.kns.service.DataDictionaryService dataDictionaryService)
Sets the dataDictionaryService attribute.

Parameters:
dataDictionaryService - dataDictionaryService to set.

getDateTimeService

public org.kuali.rice.kns.service.DateTimeService getDateTimeService()
Gets the dateTimeService attribute.

Returns:
Returns the dateTimeService.

setDateTimeService

public void setDateTimeService(org.kuali.rice.kns.service.DateTimeService dateTimeService)
Sets the dateTimeService attribute.

Parameters:
dateTimeService - The dateTimeService to set.

getWorkflowDocumentService

public org.kuali.rice.kns.workflow.service.WorkflowDocumentService getWorkflowDocumentService()
Gets the workflowDocumentService attribute.

Returns:
Returns the workflowDocumentService.

setWorkflowDocumentService

public void setWorkflowDocumentService(org.kuali.rice.kns.workflow.service.WorkflowDocumentService workflowDocumentService)
Sets the workflowDocumentService attribute value.

Parameters:
workflowDocumentService - The workflowDocumentService to set.

setAccountingLineRuleUtil

public void setAccountingLineRuleUtil(AccountingLineRuleHelperService accountingLineRuleUtil)
Sets the accountingLineRuleUtil attribute value.

Parameters:
accountingLineRuleUtil - The accountingLineRuleUtil to set.

setCapitalAssetBuilderModuleService

public void setCapitalAssetBuilderModuleService(CapitalAssetBuilderModuleService capitalAssetBuilderModuleService)
Sets the capitalAssetBuilderModuleService attribute value.

Parameters:
capitalAssetBuilderModuleService - The capitalAssetBuilderModuleService to set.


Copyright © 2005-2012 The Kuali Foundation. All Rights Reserved.