Class BTDynamicFormsTemplateAutoGenerableRequiredSearch
java.lang.Object
overit.geocall.bl.BusinessTask<DynamicFormsTemplateAutoGenerableRequiredSearchEvent>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidExecutionBusinessTask<DynamicFormsTemplateAutoGenerableRequiredSearchEvent>
overit.geocallapp.wfm.mobileforms.bl.task.BTDataCollection<DynamicFormsTemplateAutoGenerableRequiredSearchEvent>
overit.geocallapp.wfm.core.bl.datacollection.template.task.BTDynamicFormsTemplateAutoGenerableRequiredSearch
- All Implemented Interfaces:
Serializable,Tool,ValidExecution
@Event(DynamicFormsTemplateAutoGenerableRequiredSearchEvent.class)
public class BTDynamicFormsTemplateAutoGenerableRequiredSearch
extends BTDataCollection<DynamicFormsTemplateAutoGenerableRequiredSearchEvent>
Business task to search for required auto generable Dynamic Forms templates.
This task searches for Dynamic Forms templates that are marked as "auto generable from mobile" in the Mobile Card configuration and have an outcome rule with the "required if auto-generable" flag set to true for the specified outcome reason.
Algorithm:
- Load all Mobile Card Rules for the current Intervention Group
- Filter on type Dynamic Forms
- Collect all templates defined in 'Template AutoGenerable from mobile' field
- For each template, load related Dynamic Forms Outcome Rules
- If a rule exists for the current outcome reason with ATORREQUIREDIFAUTOGENERABLE = 1, add to result
- Since:
- 22.0
- See Also:
- GCApi:
- task
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected List<DataCollectionTemplateRelease> collectAutoGenerableTemplates(MobileCardConfiguration mobileCardConfiguration, PoolKit poolKit) Collects all template IDs marked as auto generable from mobile in the Mobile Card configuration and loads their current releases.protected voidexecute(DynamicFormsTemplateAutoGenerableRequiredSearchEvent event, PoolKit poolKit) Searches for required auto generable Dynamic Forms templates and writes the result into the event journal.extractAutoGenerableTemplateIds(MobileCardConfiguration mobileCardConfiguration) Extracts all template IDs marked as auto generable from mobile in the Mobile Card configuration.protected Collection<DataCollectionTemplateRelease> filterRequiredTemplates(List<DataCollectionTemplateRelease> autoGenerableTemplates, Long outcomeReasonId, Long workOrderOperation, PoolKit poolKit) Filters templates that have an outcome rule with the required flag set for the given outcome reason and returns the whole template object.protected booleanhasExistingSheet(Long workOrderOperation, PoolKit poolKit) Checks if there's at least one data collection sheet for the given work order operationprotected booleanisTemplateRequiredForOutcome(Long templateStructureId, Long outcomeReasonId, PoolKit poolKit) Checks if a template is required for a given outcome reason.protected MobileCardConfigurationloadMobileCardConfiguration(Long interventionGroupId, PoolKit poolKit) Loads the mobile card configuration for the given intervention group.protected DataCollectionTemplateReleaseloadTemplateRelease(Long templateId, PoolKit poolKit) Loads the current release for a template.protected List<BODataCollectionTemplateStructureOutcomeRule> searchOutcomeRules(Long templateStructureId, Long outcomeReasonId, PoolKit poolKit) Searches for outcome rules for a template structure and outcome reason.protected List<BODataCollectionSheet> searchSheetsByWorkOrderOperation(Long workOrderOperation, PoolKit poolKit) Searches for data collection sheets by work order operation.Methods inherited from class overit.geocallapp.wfm.mobileforms.bl.task.BTDataCollection
getException, isValidExecution, throwExceptionIfInvalidMethods inherited from class overit.geocallapp.utilities.core.bl.common.validexecution.ValidExecutionBusinessTask
body, checkValidExecution, getEventMethods inherited from class overit.geocall.bl.BusinessTask
start, start, startAlone, startInBackground
-
Constructor Details
-
BTDynamicFormsTemplateAutoGenerableRequiredSearch
public BTDynamicFormsTemplateAutoGenerableRequiredSearch()
-
-
Method Details
-
execute
protected void execute(DynamicFormsTemplateAutoGenerableRequiredSearchEvent event, PoolKit poolKit) throws DAException, DAValidateException Searches for required auto generable Dynamic Forms templates and writes the result into the event journal.- Specified by:
executein classValidExecutionBusinessTask<DynamicFormsTemplateAutoGenerableRequiredSearchEvent>- Parameters:
event- theDynamicFormsTemplateAutoGenerableRequiredSearchEventpoolKit- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
loadMobileCardConfiguration
protected MobileCardConfiguration loadMobileCardConfiguration(Long interventionGroupId, PoolKit poolKit) throws DAException, DAValidateException Loads the mobile card configuration for the given intervention group.- Parameters:
interventionGroupId- the intervention group IDpoolKit- the pool kit- Returns:
- the mobile card configuration
- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
collectAutoGenerableTemplates
protected List<DataCollectionTemplateRelease> collectAutoGenerableTemplates(MobileCardConfiguration mobileCardConfiguration, PoolKit poolKit) throws DAException, DAValidateException Collects all template IDs marked as auto generable from mobile in the Mobile Card configuration and loads their current releases.- Parameters:
mobileCardConfiguration- the mobile card configurationpoolKit- the pool kit- Returns:
- list of DataCollectionTemplateRelease objects for auto generable templates
- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
extractAutoGenerableTemplateIds
protected Set<Long> extractAutoGenerableTemplateIds(MobileCardConfiguration mobileCardConfiguration) Extracts all template IDs marked as auto generable from mobile in the Mobile Card configuration.- Parameters:
mobileCardConfiguration- the mobile card configuration- Returns:
- set of auto generable template IDs
-
loadTemplateRelease
protected DataCollectionTemplateRelease loadTemplateRelease(Long templateId, PoolKit poolKit) throws DAException, DAValidateException Loads the current release for a template.- Parameters:
templateId- the template IDpoolKit- the pool kit- Returns:
- the template release, or null if not found
- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
filterRequiredTemplates
protected Collection<DataCollectionTemplateRelease> filterRequiredTemplates(List<DataCollectionTemplateRelease> autoGenerableTemplates, Long outcomeReasonId, Long workOrderOperation, PoolKit poolKit) throws DAException, DAValidateException Filters templates that have an outcome rule with the required flag set for the given outcome reason and returns the whole template object. Also checks if a sheet already exists for the work order operation with the same template structure - if it does, the template is not included in the result.- Parameters:
autoGenerableTemplates- list of auto generable DataCollectionTemplateRelease objectsoutcomeReasonId- the outcome reason IDworkOrderOperation- the work order operation IDpoolKit- the pool kit- Returns:
- collection of required DataCollectionTemplateRelease objects
- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
isTemplateRequiredForOutcome
protected boolean isTemplateRequiredForOutcome(Long templateStructureId, Long outcomeReasonId, PoolKit poolKit) throws DAException, DAValidateException Checks if a template is required for a given outcome reason.- Parameters:
templateStructureId- the template structure IDoutcomeReasonId- the outcome reason IDpoolKit- the pool kit- Returns:
- true if the template is required, false otherwise
- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
searchOutcomeRules
protected List<BODataCollectionTemplateStructureOutcomeRule> searchOutcomeRules(Long templateStructureId, Long outcomeReasonId, PoolKit poolKit) throws DAException, DAValidateException Searches for outcome rules for a template structure and outcome reason.- Parameters:
templateStructureId- the template structure IDoutcomeReasonId- the outcome reason IDpoolKit- the pool kit- Returns:
- list of outcome rules
- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
hasExistingSheet
protected boolean hasExistingSheet(Long workOrderOperation, PoolKit poolKit) throws DAException, DAValidateException Checks if there's at least one data collection sheet for the given work order operation- Parameters:
workOrderOperation- the work order operation IDpoolKit- the pool kit- Returns:
- true if at least one sheet exists, false otherwise
- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
searchSheetsByWorkOrderOperation
protected List<BODataCollectionSheet> searchSheetsByWorkOrderOperation(Long workOrderOperation, PoolKit poolKit) throws DAException, DAValidateException Searches for data collection sheets by work order operation.- Parameters:
workOrderOperation- the work order operation IDpoolKit- the pool kit- Returns:
- list of data collection sheets
- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-