Class BTOperationCenterDeductionFromTerritory
java.lang.Object
overit.geocall.bl.BusinessTask<OperationCenterDeductionFromTerritoryEvent>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidExecutionBusinessTask<OperationCenterDeductionFromTerritoryEvent>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidPermissionBusinessTask<OperationCenterDeductionFromTerritoryEvent>
overit.geocallapp.wfm.orchestrator.workorders.bl.operationcenter.task.BTOperationCenterDeductionFromTerritory
- All Implemented Interfaces:
Serializable,Tool,ValidExecution
@Event(OperationCenterDeductionFromTerritoryEvent.class)
public class BTOperationCenterDeductionFromTerritory
extends ValidPermissionBusinessTask<OperationCenterDeductionFromTerritoryEvent>
Valid Permission Business task in order to deduce an
BOOperationCenter
from a BOStructure
starting from a OperationCenterDeductionFromTerritoryInput that has address id, work order type id and reference date - Since:
- 18.0
- See Also:
- GCApi:
- task
-
Field Summary
Fields inherited from class overit.geocallapp.utilities.core.bl.common.validexecution.ValidPermissionBusinessTask
LOG -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected LongdeduceOperationCenter(List<BOStructureValidityPeriod> validityPeriodList, PoolKit poolKit) This method tries to find the operation center by loading the zones from the micro cluster associated to the address.protected voidexecute(OperationCenterDeductionFromTerritoryEvent event, PoolKit poolKit) Executes the actual business logic after validation has passed.protected List<BOStructureValidityPeriod> findValidityPeriods(Date referenceDate, Set<Long> structureIds, PoolKit poolKit) Finds the validity periods for the given reference date, structuresgetIntegrationService(PoolKit poolKit) Return theWorkOrdersIntegrationServiceused to access other domainsbooleanDetermines whether the current state is valid for execution.loadStructures(PoolKit poolKit) Loads the structures associated with the given workOrderType.protected voidvalidateInput(OperationCenterDeductionFromTerritoryInput input, PoolKit poolKit) Validates the data before performing any action that require the inputMethods inherited from class overit.geocallapp.utilities.core.bl.common.validexecution.ValidPermissionBusinessTask
checkValidExecution, getException, throwExceptionIfInvalidMethods inherited from class overit.geocallapp.utilities.core.bl.common.validexecution.ValidExecutionBusinessTask
body, getEventMethods inherited from class overit.geocall.bl.BusinessTask
start, start, startAlone, startInBackground
-
Constructor Details
-
BTOperationCenterDeductionFromTerritory
public BTOperationCenterDeductionFromTerritory()
-
-
Method Details
-
execute
protected void execute(OperationCenterDeductionFromTerritoryEvent event, PoolKit poolKit) throws DAException, DAValidateException Description copied from class:ValidExecutionBusinessTaskExecutes the actual business logic after validation has passed.- Specified by:
executein classValidExecutionBusinessTask<OperationCenterDeductionFromTerritoryEvent>- Parameters:
event- the input event to processpoolKit- thePoolKit- Throws:
DAException- if a data access error occurs during executionDAValidateException- if validation fails during execution
-
validateInput
protected void validateInput(OperationCenterDeductionFromTerritoryInput input, PoolKit poolKit) throws DAValidateException, DAException Validates the data before performing any action that require the input- Parameters:
input- theOperationCenterDeductionFromTerritoryInputobject to be validatedpoolKit- thePoolKit- Throws:
DAValidateException- theDAValidateExceptionthrown if any property id is nullCodes.PROPERTY_REQUIREDor if theBOAddressandBOWorkOrderTyperesource doesn't exist inLoadEventDAException- theDAExceptiongeneric error thrown if there are code related errors inLoadEvent
-
loadStructures
Loads the structures associated with the given workOrderType.- Parameters:
poolKit- thePoolKit- Returns:
- a set of Long values representing the structures ids
- Throws:
DAValidateException- if there are any data-related loading errorsDAException- if there are any generic code-related errors
-
findValidityPeriods
protected List<BOStructureValidityPeriod> findValidityPeriods(Date referenceDate, Set<Long> structureIds, PoolKit poolKit) throws DAException, DAValidateException Finds the validity periods for the given reference date, structures- Parameters:
referenceDate- the reference date to search forstructureIds- the structures from work order type to search inpoolKit- thePoolKit- Returns:
- a list of BOStructureValidityPeriod objects representing the found validity periods, or an empty list if no validity periods are found
- Throws:
DAException- if there are any generic code-related errorsDAValidateException- if there are any data-related loading errors
-
getIntegrationService
public WorkOrdersIntegrationService getIntegrationService(PoolKit poolKit) throws DAValidateException Return theWorkOrdersIntegrationServiceused to access other domains- Parameters:
poolKit- thePoolKit- Returns:
- the
WorkOrdersIntegrationServiceused to access services and events in other domains - Throws:
DAValidateException- thrown if there are data related loading errors
-
deduceOperationCenter
protected Long deduceOperationCenter(List<BOStructureValidityPeriod> validityPeriodList, PoolKit poolKit) throws DAValidateException, DAException This method tries to find the operation center by loading the zones from the micro cluster associated to the address.- Parameters:
validityPeriodList- a list containing all the validity periods for the structurepoolKit- thePoolKit- Returns:
- a long that represents the operation center id or null if not found
- Throws:
DAException- theDAExceptiongeneric error thrown if there are code related errorsDAValidateException- theDAValidateExceptionthrown if there are data related loading errors
-
isValidExecution
public boolean isValidExecution()Description copied from interface:ValidExecutionDetermines whether the current state is valid for execution.- Returns:
- true if execution is valid, false otherwise
-