Class BTDataCollectionTemplateExportRelease
java.lang.Object
overit.geocall.bl.BusinessTask<DataCollectionTemplateExportReleaseEvent>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidExecutionBusinessTask<DataCollectionTemplateExportReleaseEvent>
overit.geocallapp.wfm.mobileforms.bl.task.BTDataCollection<DataCollectionTemplateExportReleaseEvent>
overit.geocallapp.wfm.mobileforms.bl.template.task.BTDataCollectionTemplateLoad<DataCollectionTemplateExportReleaseEvent>
overit.geocallapp.wfm.mobileforms.bl.template.task.BTDataCollectionTemplateExportRelease
- All Implemented Interfaces:
Serializable,Tool,ValidExecution
@Event(DataCollectionTemplateExportReleaseEvent.class)
public class BTDataCollectionTemplateExportRelease
extends BTDataCollectionTemplateLoad<DataCollectionTemplateExportReleaseEvent>
Business task in order exports the active release of a
When the
DataCollectionTemplate. When the
DataCollectionTemplateExportReleaseEvent is launched the BT notices the call and exports the active release of
the DataCollectionTemplate basing on the event's input. - Since:
- 22.0
- See Also:
- GCApi:
- task
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected WebResourcecreateWebResource(String fileName) Creates a web resource for the given file name.protected voidexecute(DataCollectionTemplateExportReleaseEvent event, PoolKit poolKit) Exports the template active release.protected StringGenerates the file name for the exported template.protected DataCollectionTemplateReleaseloadCurrentRelease(Long templateId, PoolKit poolKit) Loads the current release for a template.protected DTODataCollectionTemplateExportMaps a DataCollectionTemplate to DTODataCollectionTemplateExport.protected StringserializeToJson(DTODataCollectionTemplateExport exportDTO) Serializes the export DTO to JSON string.protected voidwriteToFile(WebResource webResource, String jsonContent) Writes the JSON content to the web resource file.Methods inherited from class overit.geocallapp.wfm.mobileforms.bl.template.task.BTDataCollectionTemplateLoad
loadStructure, loadTemplateMethods 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
-
BTDataCollectionTemplateExportRelease
public BTDataCollectionTemplateExportRelease()
-
-
Method Details
-
execute
protected void execute(DataCollectionTemplateExportReleaseEvent event, PoolKit poolKit) throws DAException, DAValidateException Exports the template active release.- Specified by:
executein classValidExecutionBusinessTask<DataCollectionTemplateExportReleaseEvent>- Parameters:
event- theDataCollectionTemplateExportReleaseEventpoolKit- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
generateFileName
Generates the file name for the exported template.- Parameters:
template- the template release- Returns:
- the file name without whitespaces
-
createWebResource
Creates a web resource for the given file name.- Parameters:
fileName- the file name- Returns:
- the web resource
-
serializeToJson
Serializes the export DTO to JSON string.- Parameters:
exportDTO- the export DTO- Returns:
- the JSON string
-
writeToFile
Writes the JSON content to the web resource file.- Parameters:
webResource- the web resourcejsonContent- the JSON content- Throws:
DAValidateException- if an error occurs while writing the file
-
loadCurrentRelease
protected DataCollectionTemplateRelease loadCurrentRelease(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
-
mapDataCollectionTemplateToExportDTO
protected DTODataCollectionTemplateExport mapDataCollectionTemplateToExportDTO(DataCollectionTemplate template) Maps a DataCollectionTemplate to DTODataCollectionTemplateExport.- Parameters:
template- the source template- Returns:
- the export DTO with filtered fields
-