Class BTDataCollectionTemplateVisibilityRuleSave
java.lang.Object
overit.geocall.bl.BusinessTask<DataCollectionTemplateVisibilityRuleSaveEvent>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidExecutionBusinessTask<DataCollectionTemplateVisibilityRuleSaveEvent>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidPermissionBusinessTask<DataCollectionTemplateVisibilityRuleSaveEvent>
overit.geocallapp.wfm.mobileforms.bl.template.visibilityrules.task.BTDataCollectionTemplateVisibilityRuleSave
- All Implemented Interfaces:
Serializable,Tool,ValidExecution
@Event(DataCollectionTemplateVisibilityRuleSaveEvent.class)
public class BTDataCollectionTemplateVisibilityRuleSave
extends ValidPermissionBusinessTask<DataCollectionTemplateVisibilityRuleSaveEvent>
Business task for saving a template visibility rule with all its rows.
When the DataCollectionTemplateVisibilityRuleSaveEvent is launched, this task:
- For new rules: inserts the header and all rows
- For existing rules: updates the header, deletes old rows, and inserts new rows
Permission:
- Since:
- 22.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 voidexecute(DataCollectionTemplateVisibilityRuleSaveEvent event, PoolKit poolKit) Executes the actual business logic after validation has passed.protected LonginsertHeader(BODCTemplateVisibilityRuleHeader header, PoolKit poolKit) Inserts the givenBODCTemplateVisibilityRuleHeaderand writes the newly generated id into the event journal.booleanDetermines whether the current state is valid for execution.protected voidmanageRows(Long headerId, List<BODCTemplateVisibilityRuleRow> newRows, PoolKit poolKit) Manages the rows for the given header id.protected List<BODCTemplateVisibilityRuleRow> retrieveExistingRows(Long headerId, PoolKit poolKit) Retrieves all existing rows for the given header id.protected booleanChecks if the two rows match.protected voidupdateHeader(BODCTemplateVisibilityRuleHeader header, PoolKit poolKit) Updates the givenBODCTemplateVisibilityRuleHeader.protected voidValidates the input data for the template visibility rule before saving.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
-
BTDataCollectionTemplateVisibilityRuleSave
public BTDataCollectionTemplateVisibilityRuleSave()
-
-
Method Details
-
execute
protected void execute(DataCollectionTemplateVisibilityRuleSaveEvent event, PoolKit poolKit) throws DAException, DAValidateException Description copied from class:ValidExecutionBusinessTaskExecutes the actual business logic after validation has passed.- Specified by:
executein classValidExecutionBusinessTask<DataCollectionTemplateVisibilityRuleSaveEvent>- Parameters:
event- the input event to processpoolKit- thePoolKit- Throws:
DAException- if a data access error occurs during executionDAValidateException- if validation fails during execution
-
validate
Validates the input data for the template visibility rule before saving.- Parameters:
input- theDataCollectionTemplateVisibilityRuleSaveInputto validate
-
insertHeader
protected Long insertHeader(BODCTemplateVisibilityRuleHeader header, PoolKit poolKit) throws DAException, DAValidateException Inserts the givenBODCTemplateVisibilityRuleHeaderand writes the newly generated id into the event journal.- Parameters:
header- theBODCTemplateVisibilityRuleHeaderto insertpoolKit- thePoolKit- Returns:
- the long
- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
updateHeader
protected void updateHeader(BODCTemplateVisibilityRuleHeader header, PoolKit poolKit) throws DAException, DAValidateException Updates the givenBODCTemplateVisibilityRuleHeader.- Parameters:
header- theBODCTemplateVisibilityRuleHeaderto updatepoolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
retrieveExistingRows
protected List<BODCTemplateVisibilityRuleRow> retrieveExistingRows(Long headerId, PoolKit poolKit) throws DAException, DAValidateException Retrieves all existing rows for the given header id.- Parameters:
headerId- the header idpoolKit- thePoolKit- Returns:
- the list of existing rows
- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
manageRows
protected void manageRows(Long headerId, List<BODCTemplateVisibilityRuleRow> newRows, PoolKit poolKit) throws DAException, DAValidateException Manages the rows for the given header id. Deletes existing rows that are no longer present and inserts new rows.- Parameters:
headerId- the header idnewRows- the list of new rowspoolKit- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
rowsMatch
Checks if the two rows match.- Parameters:
row1- the first rowrow2- the second row- Returns:
- true if the rows match, false otherwise
-
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
-