Class BTDataCollectionTemplateImportRelease
java.lang.Object
overit.geocall.bl.BusinessTask<CheckableEvent<DataCollectionTemplateImportReleaseInput,Void>>
overit.geocallapp.utilities.core.bl.common.check.checkable.task.AbstractCheckableBusinessTask<DataCollectionTemplateImportReleaseInput,Void>
overit.geocallapp.utilities.core.bl.common.check.checkable.task.ValidExecutionAbstractCheckableBusinessTask<DataCollectionTemplateImportReleaseInput,Void>
overit.geocallapp.wfm.mobileforms.bl.task.BTDataCollectionCheckable<DataCollectionTemplateImportReleaseInput,Void>
overit.geocallapp.wfm.mobileforms.bl.template.task.BTDataCollectionTemplateImportRelease
- All Implemented Interfaces:
Serializable,Tool,ValidExecution
@Event(DataCollectionTemplateImportReleaseEvent.class)
public class BTDataCollectionTemplateImportRelease
extends BTDataCollectionCheckable<DataCollectionTemplateImportReleaseInput,Void>
Business task in order to import a complete
When the
DataCollectionTemplate release from JSON. When the
DataCollectionTemplateImportReleaseEvent is launched the BT
notices the call and imports the complete template from the JSON string
provided in the event's input. Error Code:
- Since:
- 22.0
- See Also:
- GCApi:
- task
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidapplyNewCode(BODataCollectionTemplateHeader templateHeader, String newCode) Applies the new code to the template header.protected BODataCollectionTemplateHeaderConverts the export DTO template to business object.protected BODataCollectionTemplateStructureConverts the export DTO structure to business object.createCheckJSONModelEvent(String treeJson) Creates a checker event for validating the JSON model.protected List<CheckerEvent<?>> defineCheckerEvents(DataCollectionTemplateImportReleaseInput input, PoolKit poolKit) Defines the checker events.protected DTODataCollectionTemplateExportdeserializeJson(String templateJson) Deserializes the JSON string to export DTO.protected VoidexecuteProcess(DataCollectionTemplateImportReleaseInput input, PoolKit poolKit) Starting from the uploaded JSON file, it imports the complete template.protected LonginsertTemplate(BODataCollectionTemplateHeader templateHeader, BODataCollectionTemplateStructure templateStructure, PoolKit poolKit) Inserts the template using the insert event.protected DataCollectionTemplateWorkingCopyloadWorkingCopy(Long templateId, PoolKit poolKit) Loads the working copy for the template.protected voidsaveWorkingCopy(DataCollectionTemplateWorkingCopy workingCopy, PoolKit poolKit) Saves the working copy.protected StringserializeTree(DTODataCollectionTemplateExport exportDTO) Serializes the tree model to JSON string.protected voidsetTreeModel(DataCollectionTemplateWorkingCopy workingCopy, DTODataCollectionTemplateExport exportDTO) Sets the tree model on the working copy.protected voidvalidateJsonNotEmpty(String jsonTxt) Validates that the JSON string is not null or empty.Methods inherited from class overit.geocallapp.wfm.mobileforms.bl.task.BTDataCollectionCheckable
getException, isValidExecution, throwExceptionIfInvalidMethods inherited from class overit.geocallapp.utilities.core.bl.common.check.checkable.task.ValidExecutionAbstractCheckableBusinessTask
body, checkValidExecutionMethods inherited from class overit.geocallapp.utilities.core.bl.common.check.checkable.task.AbstractCheckableBusinessTask
buildOutputCheckResult, launchCheckerEvents, throwExceptionIfNecessary, validateMethods inherited from class overit.geocall.bl.BusinessTask
start, start, startAlone, startInBackground
-
Constructor Details
-
BTDataCollectionTemplateImportRelease
public BTDataCollectionTemplateImportRelease()
-
-
Method Details
-
executeProcess
protected Void executeProcess(DataCollectionTemplateImportReleaseInput input, PoolKit poolKit) throws DAException, DAValidateException Starting from the uploaded JSON file, it imports the complete template.- Specified by:
executeProcessin classAbstractCheckableBusinessTask<DataCollectionTemplateImportReleaseInput,Void> - Parameters:
input- theDataCollectionTemplateImportReleaseInputpoolKit- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
deserializeJson
Deserializes the JSON string to export DTO.- Parameters:
templateJson- the JSON string- Returns:
- the export DTO
-
convertToTemplateHeader
protected BODataCollectionTemplateHeader convertToTemplateHeader(DTODataCollectionTemplateExport exportDTO) Converts the export DTO template to business object.- Parameters:
exportDTO- the export DTO- Returns:
- the template header business object
-
convertToTemplateStructure
protected BODataCollectionTemplateStructure convertToTemplateStructure(DTODataCollectionTemplateExport exportDTO) Converts the export DTO structure to business object.- Parameters:
exportDTO- the export DTO- Returns:
- the template structure business object
-
applyNewCode
Applies the new code to the template header.- Parameters:
templateHeader- the template headernewCode- the new code
-
insertTemplate
protected Long insertTemplate(BODataCollectionTemplateHeader templateHeader, BODataCollectionTemplateStructure templateStructure, PoolKit poolKit) throws DAException, DAValidateException Inserts the template using the insert event.- Parameters:
templateHeader- the template headertemplateStructure- the template structurepoolKit- the pool kit- Returns:
- the new template ID
- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
loadWorkingCopy
protected DataCollectionTemplateWorkingCopy loadWorkingCopy(Long templateId, PoolKit poolKit) throws DAException, DAValidateException Loads the working copy for the template.- Parameters:
templateId- the template IDpoolKit- the pool kit- Returns:
- the working copy
- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
setTreeModel
protected void setTreeModel(DataCollectionTemplateWorkingCopy workingCopy, DTODataCollectionTemplateExport exportDTO) Sets the tree model on the working copy.- Parameters:
workingCopy- the working copyexportDTO- the export DTO containing the tree
-
saveWorkingCopy
protected void saveWorkingCopy(DataCollectionTemplateWorkingCopy workingCopy, PoolKit poolKit) throws DAException, DAValidateException Saves the working copy.- Parameters:
workingCopy- the working copypoolKit- the pool kit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
defineCheckerEvents
protected List<CheckerEvent<?>> defineCheckerEvents(DataCollectionTemplateImportReleaseInput input, PoolKit poolKit) throws DAException, DAValidateException Defines the checker events.- Specified by:
defineCheckerEventsin classAbstractCheckableBusinessTask<DataCollectionTemplateImportReleaseInput,Void> - Parameters:
input- theDataCollectionTemplateImportReleaseInputpoolKit- thePoolKit- Returns:
- a list of checker event elements of type CheckerEvent
- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
validateJsonNotEmpty
Validates that the JSON string is not null or empty.- Parameters:
jsonTxt- the JSON string- Throws:
DAValidateException- if the JSON is null or empty
-
serializeTree
Serializes the tree model to JSON string.- Parameters:
exportDTO- the export DTO containing the tree- Returns:
- the tree JSON string
-
createCheckJSONModelEvent
Creates a checker event for validating the JSON model.- Parameters:
treeJson- the tree JSON string- Returns:
- the checker event
-