Class DataCollectionTemplateConverter
java.lang.Object
overit.geocallapp.wfm.core.bl.datacollection.converter.DataCollectionBaseConverter<BODataCollectionTemplateConversion,DataCollectionTemplateConversionInsertEvent>
overit.geocallapp.wfm.core.bl.datacollection.converter.DataCollectionConverter<BODataCollectionTemplateConversion,DataCollectionTemplateConversionInsertEvent>
overit.geocallapp.wfm.core.bl.datacollection.converter.template.DataCollectionTemplateConverter
public class DataCollectionTemplateConverter
extends DataCollectionConverter<BODataCollectionTemplateConversion,DataCollectionTemplateConversionInsertEvent>
This class is responsible for Data Collection Template conversion.
- Since:
- 13.0
- GCApi:
- bo
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringprotected DataCollectionTemplateStructureConverterprotected DataCollectionWorkCycleConverterFields inherited from class overit.geocallapp.wfm.core.bl.datacollection.converter.DataCollectionBaseConverter
CONNECTION_POOL_NAME, logger, teacherDuty -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckResults(PoolKit mainPoolKit, BODataCollectionTemplateConversion conversionLog, List<DataCollectionTemplateStructureConversionResult> structureConversionResultList, List<BODataCollectionWorkCycleConversion> workCycleConversionResultList) Check if any error occurred during conversion steps and write the results on database.voidConvert the templates.voidconvertBody(PoolKit poolKit) The method that contains the conversion logic.Get the description to have in WfmTaskLog.protected voidInitialize the list of template to convert.protected voidinitLogger(Long id) Initialize the logger and pass it to sub converters.protected voidpopulateCreationDateAndUser(PoolKit poolKit, Long templateId, BODataCollectionTemplateHeader newTemplateHead) Set creation user and creation date on new template to match the old one.protected voidpopulateLastModifiedDateAndUser(PoolKit poolKit, Long templateId, BODataCollectionTemplateHeader newTemplateHead) Set last modified user and date on new template to match the old one.protected BODataCollectionTemplateHeadersearchTemplateHeader(PoolKit poolKit, overit.geocallapp.wfm.survey.template.TemplateTree oldTemplateTree) Search for a new template header with the same code as the old template passed as parameter.protected voidupdateLastModifiedUser(PoolKit poolKit, overit.geocallapp.wfm.survey.template.TemplateTree oldTemplateTree, DataCollectionTemplate dataCollectionTemplate) Updates create/last-modified user and date to match the old template users and dates.Methods inherited from class overit.geocallapp.wfm.core.bl.datacollection.converter.DataCollectionConverter
closeLogger, initLogger, isMassive, setMassiveMethods inherited from class overit.geocallapp.wfm.core.bl.datacollection.converter.DataCollectionBaseConverter
commit, getLocalizedDescription, getTeacher, insertConversionResult, rollback, setLogger
-
Field Details
-
ADTEISPDAGENERABLE
- See Also:
-
DATASTAMP
- See Also:
-
LOGIN
- See Also:
-
dataRetriever
-
convertTemplateList
-
structureConverter
-
workCycleConverter
-
-
Constructor Details
-
DataCollectionTemplateConverter
public DataCollectionTemplateConverter()
-
-
Method Details
-
initData
Initialize the list of template to convert.- Parameters:
poolKit- thePoolKit- Throws:
DAExceptionDAValidateException
-
convert
Convert the templates.- Overrides:
convertin classDataCollectionConverter<BODataCollectionTemplateConversion,DataCollectionTemplateConversionInsertEvent> - Parameters:
poolKit- the pool kitisMassive- true to convert all templates, false to convert only a subset.- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
convertBody
The method that contains the conversion logic.- Specified by:
convertBodyin classDataCollectionConverter<BODataCollectionTemplateConversion,DataCollectionTemplateConversionInsertEvent> - Parameters:
poolKit- the pool kit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
searchTemplateHeader
protected BODataCollectionTemplateHeader searchTemplateHeader(PoolKit poolKit, overit.geocallapp.wfm.survey.template.TemplateTree oldTemplateTree) throws DAException, DAValidateException Search for a new template header with the same code as the old template passed as parameter.- Parameters:
poolKit- thePoolKitoldTemplateTree- the old template- Returns:
- the new template header if found, null otherwise.
- Throws:
DAExceptionDAValidateException
-
checkResults
protected void checkResults(PoolKit mainPoolKit, BODataCollectionTemplateConversion conversionLog, List<DataCollectionTemplateStructureConversionResult> structureConversionResultList, List<BODataCollectionWorkCycleConversion> workCycleConversionResultList) throws DAException, DAValidateException Check if any error occurred during conversion steps and write the results on database.- Parameters:
mainPoolKit- the mainPoolKitconversionLog- the template conversion logstructureConversionResultList- the structure conversion resultsworkCycleConversionResultList- the work cycle conversion results- Throws:
DAExceptionDAValidateException
-
updateLastModifiedUser
protected void updateLastModifiedUser(PoolKit poolKit, overit.geocallapp.wfm.survey.template.TemplateTree oldTemplateTree, DataCollectionTemplate dataCollectionTemplate) throws DAException, DAValidateException, SQLException Updates create/last-modified user and date to match the old template users and dates.- Parameters:
poolKit- thePoolKitoldTemplateTree- the old templatedataCollectionTemplate- the new template- Throws:
DAExceptionDAValidateExceptionSQLException
-
populateCreationDateAndUser
protected void populateCreationDateAndUser(PoolKit poolKit, Long templateId, BODataCollectionTemplateHeader newTemplateHead) throws DAException, SQLException, DAValidateException Set creation user and creation date on new template to match the old one.- Parameters:
poolKit- thePoolKittemplateId- old template idnewTemplateHead- new template header- Throws:
DAExceptionSQLExceptionDAValidateException
-
populateLastModifiedDateAndUser
protected void populateLastModifiedDateAndUser(PoolKit poolKit, Long templateId, BODataCollectionTemplateHeader newTemplateHead) throws DAException, SQLException, DAValidateException Set last modified user and date on new template to match the old one.- Parameters:
poolKit- thePoolKittemplateId- old template idnewTemplateHead- new template header- Throws:
DAExceptionSQLExceptionDAValidateException
-
getLogDescription
Get the description to have in WfmTaskLog.- Specified by:
getLogDescriptionin classDataCollectionConverter<BODataCollectionTemplateConversion,DataCollectionTemplateConversionInsertEvent> - Returns:
- the description
-
initLogger
Initialize the logger and pass it to sub converters.- Overrides:
initLoggerin classDataCollectionConverter<BODataCollectionTemplateConversion,DataCollectionTemplateConversionInsertEvent> - Parameters:
id- the unique identifier of the object to be converted- Throws:
DAExceptionDAValidateException
-