org.kuali.kfs.module.external.kc.service.impl
Class AccountCreationServiceImpl

java.lang.Object
  extended by org.kuali.kfs.module.external.kc.service.impl.AccountCreationServiceImpl
All Implemented Interfaces:
AccountCreationService

public class AccountCreationServiceImpl
extends Object
implements AccountCreationService


Field Summary
protected static String ACCT_PREFIX_RESTRICTION
           
protected static org.apache.log4j.Logger LOG
           
 
Constructor Summary
AccountCreationServiceImpl()
           
 
Method Summary
 boolean accountsCanCrossCharts()
           
protected  boolean checkAccountNumberPrefix(String accountNumber, AccountCreationStatusDTO accountCreationStatus)
          This method tests whether the accountNumber passed in is prefixed with an allowed prefix, or an illegal one.
protected  boolean checkUniqueAccountNumber(String accountNumber)
          If accounts can't cross charts, then we need to make sure the account number is unique.
 AccountCreationStatusDTO createAccount(AccountParametersDTO accountParameters)
          This is the web service method that creates a new account 1.
 Account createAccountObject(AccountParametersDTO parameters, AccountAutoCreateDefaults defaults)
          This method creates an account to be used for automatic maintenance document
protected  void createAutomaticCGAccountMaintenanceDocument(Account account, AccountCreationStatusDTO accountCreationStatus)
          This method will create a maintenance document for CG account create, set its description and then sets the account business object in it.
 org.kuali.rice.kns.document.Document createCGAccountMaintenanceDocument(AccountCreationStatusDTO accountCreationStatus)
          This method will use the DocumentService to create a new document.
protected  void createRouteAutomaticCGAccountDocument(org.kuali.rice.kns.document.MaintenanceDocument maintenanceAccountDocument, AccountCreationStatusDTO accountCreationStatus)
          This method processes the workflow document actions like save, route and blanket approve depending on the ACCOUNT_AUTO_CREATE_ROUTE system parameter value.
protected  AccountAutoCreateDefaults getAccountDefaults(String unitNumber)
          This method looks up the default table
protected  org.kuali.rice.kns.service.BusinessObjectService getBusinessObjectService()
          Gets the businessObjectService attribute.
protected  org.kuali.rice.kns.service.DataDictionaryService getDataDictionaryService()
           
protected  org.kuali.rice.kns.service.DocumentService getDocumentService()
          Gets the documentService attribute.
protected  org.kuali.rice.kns.service.ParameterService getParameterService()
          Gets the parameterService attribute.
protected  boolean isValidAccount(Account account, AccountCreationStatusDTO accountCreationStatus)
          Check to see if the main link between KFS and KC is valid, namely the chart and account number.
 boolean isValidAccount(String accountNumber)
           
protected  boolean isValidAccountNumberLength(String accountNumber, AccountCreationStatusDTO accountCreationStatus)
          Checks an account numbers exact length
 boolean isValidChartAccount(String chartOfAccountsCode, String accountNumber)
           
 boolean isValidChartCode(String chartOfAccountsCode)
           
protected  boolean isValidUser(String principalId)
          This method check to see if the user can create the account maintenance document and set the user session
 void setBusinessObjectService(org.kuali.rice.kns.service.BusinessObjectService businessObjectService)
          Sets the businessObjectService attribute value.
 void setDataDictionaryService(org.kuali.rice.kns.service.DataDictionaryService dataDictionaryService)
           
 void setDocumentService(org.kuali.rice.kns.service.DocumentService documentService)
          Sets the documentService attribute value.
protected  void setFailStatus(AccountCreationStatusDTO accountCreationStatus, String message)
           
 void setParameterService(org.kuali.rice.kns.service.ParameterService parameterService)
          Sets the parameterService attribute value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected static org.apache.log4j.Logger LOG

ACCT_PREFIX_RESTRICTION

protected static final String ACCT_PREFIX_RESTRICTION
See Also:
Constant Field Values
Constructor Detail

AccountCreationServiceImpl

public AccountCreationServiceImpl()
Method Detail

createAccount

public AccountCreationStatusDTO createAccount(AccountParametersDTO accountParameters)
This is the web service method that creates a new account 1. Creates an account object using the parameters from KC and the default Account table 2. Creates an account automatic maintenance document and puts the account object into it 3. Returns the status object

Specified by:
createAccount in interface AccountCreationService
Parameters:
AccountAutoCreateDefaults -
Returns:
AccountCreationStatusDTO

createAccountObject

public Account createAccountObject(AccountParametersDTO parameters,
                                   AccountAutoCreateDefaults defaults)
This method creates an account to be used for automatic maintenance document

Parameters:
AccountParametersDTO -
Returns:
Account

setFailStatus

protected void setFailStatus(AccountCreationStatusDTO accountCreationStatus,
                             String message)

createAutomaticCGAccountMaintenanceDocument

protected void createAutomaticCGAccountMaintenanceDocument(Account account,
                                                           AccountCreationStatusDTO accountCreationStatus)
This method will create a maintenance document for CG account create, set its description and then sets the account business object in it. The document will then be tried to route, save or blanket approve automatically based on the system parameter. If successful, the method returns the newly created document number to the caller.

See Also:
org.kuali.kfs.coa.document.service.CreateAccountService#createAutomaticCGAccountMaintenanceDocument()

createRouteAutomaticCGAccountDocument

protected void createRouteAutomaticCGAccountDocument(org.kuali.rice.kns.document.MaintenanceDocument maintenanceAccountDocument,
                                                     AccountCreationStatusDTO accountCreationStatus)
This method processes the workflow document actions like save, route and blanket approve depending on the ACCOUNT_AUTO_CREATE_ROUTE system parameter value. If the system parameter value is not of save or submit or blanketapprove, put an error message and quit. Throws an document WorkflowException if the specific document action fails to perform.

Parameters:
maintenanceAccountDocument, - errorMessages

createCGAccountMaintenanceDocument

public org.kuali.rice.kns.document.Document createCGAccountMaintenanceDocument(AccountCreationStatusDTO accountCreationStatus)
This method will use the DocumentService to create a new document. The documentTypeName is gathered by using MaintenanceDocumentDictionaryService which uses Account class to get the document type name.

Parameters:
AccountCreationStatusDTO -
Returns:
document returns a new document for the account document type or null if there is an exception thrown.

getAccountDefaults

protected AccountAutoCreateDefaults getAccountDefaults(String unitNumber)
This method looks up the default table

Parameters:
String - unitNumber
Returns:
AccountAutoCreateDefaults

isValidAccount

protected boolean isValidAccount(Account account,
                                 AccountCreationStatusDTO accountCreationStatus)
Check to see if the main link between KFS and KC is valid, namely the chart and account number. If these two values have some kind of error, then we don't want to generate an Account document and we'll want to return a failure to KC.

Parameters:
account -
accountCreationStatus -
Returns:

accountsCanCrossCharts

public boolean accountsCanCrossCharts()
Specified by:
accountsCanCrossCharts in interface AccountCreationService

isValidAccount

public boolean isValidAccount(String accountNumber)
Specified by:
isValidAccount in interface AccountCreationService

isValidChartCode

public boolean isValidChartCode(String chartOfAccountsCode)
Specified by:
isValidChartCode in interface AccountCreationService

isValidChartAccount

public boolean isValidChartAccount(String chartOfAccountsCode,
                                   String accountNumber)
Specified by:
isValidChartAccount in interface AccountCreationService

isValidAccountNumberLength

protected boolean isValidAccountNumberLength(String accountNumber,
                                             AccountCreationStatusDTO accountCreationStatus)
Checks an account numbers exact length

Parameters:
accountNumber -
size - to be returned
Returns:

checkAccountNumberPrefix

protected boolean checkAccountNumberPrefix(String accountNumber,
                                           AccountCreationStatusDTO accountCreationStatus)
This method tests whether the accountNumber passed in is prefixed with an allowed prefix, or an illegal one. The illegal prefixes are passed in as an array of strings.

Parameters:
accountNumber - - The Account Number to be tested.
Returns:
false if the accountNumber starts with any of the illegalPrefixes, true otherwise

checkUniqueAccountNumber

protected boolean checkUniqueAccountNumber(String accountNumber)
If accounts can't cross charts, then we need to make sure the account number is unique.

Parameters:
accountNumber -
Returns:

isValidUser

protected boolean isValidUser(String principalId)
This method check to see if the user can create the account maintenance document and set the user session

Parameters:
String - principalId
Returns:
boolean

getDocumentService

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

Returns:
Current value of documentService.

setDocumentService

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

Parameters:
documentService -

getParameterService

protected org.kuali.rice.kns.service.ParameterService getParameterService()
Gets the parameterService attribute.

Returns:
Returns the parameterService.

setParameterService

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

Parameters:
parameterService - The parameterService to set.

getDataDictionaryService

protected org.kuali.rice.kns.service.DataDictionaryService getDataDictionaryService()

setDataDictionaryService

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

setBusinessObjectService

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

Parameters:
businessObjectService - The businessObjectService to set.

getBusinessObjectService

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

Returns:
Returns the businessObjectService.


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