Class BTAccountInsert
java.lang.Object
overit.geocall.bl.BusinessTask<AccountInsertEvent>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidExecutionBusinessTask<AccountInsertEvent>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidPermissionBusinessTask<AccountInsertEvent>
overit.geocallapp.wfm.accounts.bl.account.task.BTAccountInsert
- All Implemented Interfaces:
Serializable,Tool,ValidExecution
@Event(AccountInsertEvent.class)
public class BTAccountInsert
extends ValidPermissionBusinessTask<AccountInsertEvent>
Business task in order to insert a
When the
Permission:
BOAccount. When the
AccountInsertEvent is launched
the BT notices the call and inserts the BOAccount basing on the event's input. Permission:
Error Code:
- Since:
- 16.0
- See Also:
- GCApi:
- task
-
Field Summary
Fields inherited from class overit.geocallapp.utilities.core.bl.common.validexecution.ValidPermissionBusinessTask
LOG -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckUniqueCode(BOAccount account, PoolKit poolKit) Verifies that the code of the given account is unique.protected voidexecute(AccountInsertEvent event, PoolKit poolKit) Inserts the givenBOAccountand writes the newly generated id into the event journal..protected LonginsertAccount(BOAccount account, PoolKit poolKit) Inserts the given account.protected voidinsertFakeContact(Long addressId, PoolKit poolKit) Inserts the default contact of type "phone" for the account just created, we need to do that because account won't work without a contact.booleanDetermines whether the current state is valid for execution.protected voidupdateTimezone(BOAccount account, PoolKit poolKit) Defines the account time zone and aligns the creation date with it.protected voidvalidate(AccountInsertInput input, PoolKit poolKit) Validates the data before the insert.Methods inherited from class overit.geocallapp.utilities.core.bl.common.validexecution.ValidPermissionBusinessTask
checkValidExecution, getException, throwExceptionIfInvalidMethods inherited from class overit.geocallapp.utilities.core.bl.common.validexecution.ValidExecutionBusinessTask
body, getEventMethods inherited from class overit.geocall.bl.BusinessTask
start, start, startAlone, startInBackground
-
Constructor Details
-
BTAccountInsert
public BTAccountInsert()
-
-
Method Details
-
execute
protected void execute(AccountInsertEvent event, PoolKit poolKit) throws DAException, DAValidateException Inserts the givenBOAccountand writes the newly generated id into the event journal..- Specified by:
executein classValidExecutionBusinessTask<AccountInsertEvent>- Parameters:
event- theAccountInsertEventpoolKit- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
validate
protected void validate(AccountInsertInput input, PoolKit poolKit) throws DAValidateException, DAException Validates the data before the insert.- Parameters:
input- theAccountInsertInputpoolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
insertAccount
protected Long insertAccount(BOAccount account, PoolKit poolKit) throws DAValidateException, DAException Inserts the given account.- Parameters:
account- the accountpoolKit- thePoolKit- Returns:
- the id of the inserted
BOAccount - Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
checkUniqueCode
protected void checkUniqueCode(BOAccount account, PoolKit poolKit) throws DAValidateException, DAException Verifies that the code of the given account is unique.- Parameters:
account- the account to checkpoolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
updateTimezone
protected void updateTimezone(BOAccount account, PoolKit poolKit) throws DAException, DAValidateException Defines the account time zone and aligns the creation date with it.- Parameters:
account- the currentBOAccountpoolKit- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
isValidExecution
public boolean isValidExecution()Description copied from interface:ValidExecutionDetermines whether the current state is valid for execution.- Returns:
- true if execution is valid, false otherwise
-
insertFakeContact
protected void insertFakeContact(Long addressId, PoolKit poolKit) throws DAValidateException, DAException Inserts the default contact of type "phone" for the account just created, we need to do that because account won't work without a contact.- Parameters:
addressId- address id to link the contactpoolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-