Class BTDataCollectionSheetConversionCreate
java.lang.Object
overit.geocall.bl.BusinessTask<DataCollectionSheetConversionCreateEvent>
overit.geocallapp.wfm.core.bl.datacollection.converter.sheet.task.create.BTDataCollectionSheetConversionCreate
- All Implemented Interfaces:
Serializable,Tool
@Event(DataCollectionSheetConversionCreateEvent.class)
public class BTDataCollectionSheetConversionCreate
extends BusinessTask<DataCollectionSheetConversionCreateEvent>
Business task to convert a
When the
SchedaTree into a DataCollectionSheetInstance. When the
DataCollectionSheetConversionCreateEvent is launched
the BT notices the call and starts the SchedaTree conversion based on the event's input. - Since:
- 13.0
- See Also:
- GCApi:
- task
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected overit.geocallapp.wfm.util.wfmtasklog.WfmTaskLogprotected TeacherDutyprotected DataCollectionValueConverterBucket -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbody(DataCollectionSheetConversionCreateEvent event, PoolKit poolKit) Coverts the givenSchedaTreeinto aDataCollectionSheetInstanceand add it to the event journal.protected BODataCollectionSheetconvertSheetHeader(overit.geocallapp.wfm.srd.scheda.SchedaTree oldSheet, BODataCollectionTemplateHeader newTemplateHeader) Create the newBODataCollectionSheet.protected voidconvertSheetStatus(DataCollectionSheetInstance sheetInstance, Long oldStatus, PoolKit poolKit) Convert the old sheet status into the new one and set it insheetInstanceprotected voidconvertSheetStatusAssociatedToWoOp(DataCollectionSheetInstance sheetInstance, Long oldWoOperationStatus, Long oldSheetStatus, PoolKit poolKit) Set the new sheet status based on work order operation status.protected DataCollectionNodefindNewNodeByOldId(Long oldNodeId, List<DataCollectionNode> newNodeList, DataCollectionTemplateConversionMap conversionMap) Search for the new node with the same code of the old one represented byoldNodeId.protected LocalizedStringgetLocalizedDescription(String description) Get theLocalizedStringrepresenting thedescriptionpassed as parameter.protected LocalizedStringgetSheetDescription(Long oldTemplateId) Get theLocalizedStringcontaining the sheet description The sheet description is the concat of old template code with the old template descriptionprotected LonggetWoOperationStatus(PoolKit poolKit, Long wooId) Get the work order operation status.protected DataCollectionSheetInstanceloadNewSheetInstance(PoolKit poolKit, Long sheetId) Invoke theDataCollectionSheetInstanceLoadEvent.protected voidpopulateNewSheet(overit.geocallapp.wfm.srd.scheda.SchedaTree oldSheet, List<DataCollectionNode> newNodeList, DataCollectionTemplateConversionMap conversionMap, DataCollectionSheetConversionResult conversionResults) Populate the new sheet with values taken from the old one.protected voidsetSheetStatus(DataCollectionSheetInstance sheetInstance, overit.geocallapp.wfm.srd.scheda.SchedaTree oldSheet, PoolKit poolKit) Set new sheet status based on the oldSchedaTreevalues.Methods inherited from class overit.geocall.bl.BusinessTask
start, start, startAlone, startInBackground
-
Field Details
-
logger
protected overit.geocallapp.wfm.util.wfmtasklog.WfmTaskLog logger -
teacherDuty
-
valueConverterBucket
-
-
Constructor Details
-
BTDataCollectionSheetConversionCreate
public BTDataCollectionSheetConversionCreate()
-
-
Method Details
-
body
protected void body(DataCollectionSheetConversionCreateEvent event, PoolKit poolKit) throws DAException, DAValidateException Coverts the givenSchedaTreeinto aDataCollectionSheetInstanceand add it to the event journal.- Specified by:
bodyin classBusinessTask<DataCollectionSheetConversionCreateEvent>- Parameters:
event- theDataCollectionSheetConversionCreateEventpoolKit- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
setSheetStatus
protected void setSheetStatus(DataCollectionSheetInstance sheetInstance, overit.geocallapp.wfm.srd.scheda.SchedaTree oldSheet, PoolKit poolKit) throws DAException, DAValidateException Set new sheet status based on the oldSchedaTreevalues.- Parameters:
sheetInstance- the new sheetoldSheet- the old sheetpoolKit- thePoolKit- Throws:
DAExceptionDAValidateException
-
convertSheetHeader
protected BODataCollectionSheet convertSheetHeader(overit.geocallapp.wfm.srd.scheda.SchedaTree oldSheet, BODataCollectionTemplateHeader newTemplateHeader) Create the newBODataCollectionSheet.- Parameters:
oldSheet- the old sheetnewTemplateHeader- the new sheet header- Returns:
- the new
BODataCollectionSheet
-
getWoOperationStatus
protected Long getWoOperationStatus(PoolKit poolKit, Long wooId) throws DAException, DAValidateException Get the work order operation status.- Parameters:
poolKit- thePoolKitwooId- the work order operation id- Returns:
- Throws:
DAExceptionDAValidateException
-
getSheetDescription
Get theLocalizedStringcontaining the sheet description The sheet description is the concat of old template code with the old template description- Parameters:
oldTemplateId- old template id- Returns:
- the
LocalizedStringcontaining the sheet description
-
convertSheetStatus
protected void convertSheetStatus(DataCollectionSheetInstance sheetInstance, Long oldStatus, PoolKit poolKit) throws DAException, DAValidateException Convert the old sheet status into the new one and set it insheetInstance- Parameters:
sheetInstance- the new sheet instanceoldStatus- the old status idpoolKit- thePoolKit- Throws:
DAExceptionDAValidateException
-
convertSheetStatusAssociatedToWoOp
protected void convertSheetStatusAssociatedToWoOp(DataCollectionSheetInstance sheetInstance, Long oldWoOperationStatus, Long oldSheetStatus, PoolKit poolKit) throws DAException, DAValidateException Set the new sheet status based on work order operation status.- Parameters:
sheetInstance- the new sheet instanceoldWoOperationStatus- the old work order operation statusoldSheetStatus- the old sheet statuspoolKit- thePoolKit- Throws:
DAExceptionDAValidateException
-
loadNewSheetInstance
protected DataCollectionSheetInstance loadNewSheetInstance(PoolKit poolKit, Long sheetId) throws DAException, DAValidateException Invoke theDataCollectionSheetInstanceLoadEvent.- Parameters:
poolKit- thePoolKitsheetId- the new sheet id to load- Returns:
- the loaded
DataCollectionSheetInstance - Throws:
DAExceptionDAValidateException
-
populateNewSheet
protected void populateNewSheet(overit.geocallapp.wfm.srd.scheda.SchedaTree oldSheet, List<DataCollectionNode> newNodeList, DataCollectionTemplateConversionMap conversionMap, DataCollectionSheetConversionResult conversionResults) throws DAValidateException Populate the new sheet with values taken from the old one.- Parameters:
oldSheet- the old sheetnewNodeList- the new sheet node listconversionMap- the template structure conversion mapconversionResults- the sheet conversion log- Throws:
DAValidateException
-
findNewNodeByOldId
protected DataCollectionNode findNewNodeByOldId(Long oldNodeId, List<DataCollectionNode> newNodeList, DataCollectionTemplateConversionMap conversionMap) throws DAValidateException Search for the new node with the same code of the old one represented byoldNodeId. Returns it if it is found, null otherwise.- Parameters:
oldNodeId- the old node idnewNodeList- the new node listconversionMap- the template structure conversion map- Returns:
- the corresponding new node if it is found, null otherwise
- Throws:
DAValidateException
-
getLocalizedDescription
Get theLocalizedStringrepresenting thedescriptionpassed as parameter.- Parameters:
description- the description- Returns:
- the
LocalizedString
-