Class WorkOrderUtil
java.lang.Object
overit.geocallapp.wfm.core.bl.workorder.WorkOrderUtil
Utility class to work with the
WorkOrder-
Method Summary
Modifier and TypeMethodDescriptionstatic booleancheckInterventionGroupNetaCustomerStateMatching(BOTechnicalObjectHeader technicalObjectHeader, Long interventioGroupId) Check if the Neta Integration customer state match the intervention group configurationstatic LongevaluateNewWorkOrderState(Long workOrderTypeId, Long workOrderOriginId, BOWorkOrderHeader workOrderHeader, PooledConnection conn) Evaluate the starting state for a new Work Order looking at the defined rulesstatic LongevaluateNewWorkOrderState(WorkOrder workOrder, PoolKit poolKit) Evaluate the starting state for a new Work Order looking at the defined rules.static LongfindDefaultWareHouseId(WorkOrder workOrder) Retrieve the id of the default warehouse for the operation center of the given work orderstatic LongfindInterventionGroup(Long workOrderTypeId, Long workOrderOperationTypeId, PooledConnection conn) Try to identify the intervention group defined for the activity related to the given work order type and operation typestatic LongLoad the default intervention group idstatic LonggetIdBookingOperation(WorkOrder workOrder) Inspect theWorkOrderto find the firstBOWorkOrderOperationmarked as bookingstatic LonggetResidualTime(WorkOrder workOrder) Returns the difference in time between the current date and the work order end one.static HashGettergetWorkOrderTypeRawData(WorkOrder workOrder) Retrieve the raw data of the work order type of the given work orderstatic booleanSay if the givenWorkOrdercan be considered as bookingstatic booleanisDuplicable(WorkOrder workOrder) Say if the givenWorkOrdercan be duplicatedstatic booleanisFromNetaIntegration(WorkOrder workOrder) Say if the givenWorkOrderhas a type related to a Neta type.static WorkOrderLoad theWorkOrderobject with all its componentsstatic WorkOrderload(Long id, PooledConnection conn) Load theWorkOrderobject with all its componentsstatic voidloadAssociatedMaterials(BOWorkOrderOperation operation) Load and set as extension of the givenBOWorkOrderOperationthe materials associated with the operationstatic voidloadAssociatedMaterials(WorkOrder workOrder) Load and set as extension of theBOWorkOrderOperations of the given work order the raw data of the materials related to themstatic voidloadAssociatedMaterials(WorkOrder workOrder, PooledConnection conn) Load and set as extension of theBOWorkOrderOperations of the given work order the raw data of the materials related to themstatic DBViewloadCustomerMeasuringElements(Long addressId, PooledConnection conn) Load the DBView of the measuring elements related to the given address id.static DBViewloadLinkedWorkOrders(Long workOrderId) Load theDBViewwith the raw data of the work order linked with given onestatic voidloadMaterialiAssociati(BOWorkOrderOperation operation, PooledConnection conn) Load and set as extension of the givenBOWorkOrderOperationthe materials associated with the operationstatic overit.geocallapp.wfm.schedulazione.odl.listaoggetti.TechnicalObjectListloadOperationObjectList(BOWorkOrderOperation operation, PooledConnection conn) Retrieve theTechnicalObjectListcontaining the TechnicalObjects associated with the givenBOWorkOrderOperationstatic voidloadWorkOrderOperationsPerformances(WorkOrder workOrder) For eachBOWorkOrderOperationof the givenWorkOrderload and set as extension the raw data of the related performances.static voidloadWorkOrderOperationsPerformances(WorkOrder workOrder, PooledConnection conn) For eachBOWorkOrderOperationof the givenWorkOrderload and set as extension the raw data of the related performances.static voidloadWorkOrderOperationsTools(WorkOrder workOrder, PooledConnection conn) For eachBOWorkOrderOperationof the givenWorkOrderload and set as extension the raw data of the related tools.static HashGetterloadWorkOrderTypeByComponents(Long workOrderRequestTypeId, Long workOrderServiceTypeId, Long technicalObjectTypeId, PooledConnection conn) Given the work order type main components, this method try to retrieve a work order type.static voidrefreshOperations(WorkOrder workOrder) Allow to load and refresh the operation in memory of a givenWorkOrderobjectstatic voidrefreshOperations(WorkOrder workOrder, PooledConnection conn) Allow to load and refresh the operation in memory of a givenWorkOrderobjectstatic voidstatic voidsave(WorkOrder workOrder, PooledConnection conn) static voidsave(WorkOrder workOrder, WorkOrderSaveEventOptions options, PooledConnection conn)
-
Method Details
-
loadCustomerMeasuringElements
Load the DBView of the measuring elements related to the given address id.- Parameters:
addressId- the address id for which retrieve the measuring elementsconn- aPooledConnectionto execute the operation in transaction. Can be null.- Returns:
- a
DBViewwith the retrieved measuring elements
-
findInterventionGroup
public static Long findInterventionGroup(Long workOrderTypeId, Long workOrderOperationTypeId, PooledConnection conn) Try to identify the intervention group defined for the activity related to the given work order type and operation type- Parameters:
workOrderTypeId- the work order type id to useworkOrderOperationTypeId- the work order operation type id to useconn- aPooledConnectionto execute the operation in transaction. Can be null.- Returns:
- the id of the retrieved intervention group if exists, null otherwise
-
loadWorkOrderTypeByComponents
public static HashGetter loadWorkOrderTypeByComponents(Long workOrderRequestTypeId, Long workOrderServiceTypeId, Long technicalObjectTypeId, PooledConnection conn) Given the work order type main components, this method try to retrieve a work order type. If more than one component match the input, the first one will be returned- Parameters:
workOrderRequestTypeId- the work order request type id to useworkOrderServiceTypeId- the work order service type id to usetechnicalObjectTypeId- the technical object type id to useconn- aPooledConnectionto execute the operation in transaction. Can be null.- Returns:
- the raw data of the first matching work order type
-
evaluateNewWorkOrderState
public static Long evaluateNewWorkOrderState(Long workOrderTypeId, Long workOrderOriginId, BOWorkOrderHeader workOrderHeader, PooledConnection conn) Evaluate the starting state for a new Work Order looking at the defined rules- Parameters:
workOrderTypeId- the work order type of the new work orderworkOrderOriginId- the id that identify the work order sourceworkOrderHeader-BOWorkOrderHeaderthe whole work order headerconn- aPooledConnectionto execute the operation in transaction. Can be null.- Returns:
- the evaluated work order state if the given input match a rule,
BOWorkOrderState.Values.OPENas default otherwise.
-
evaluateNewWorkOrderState
public static Long evaluateNewWorkOrderState(WorkOrder workOrder, PoolKit poolKit) throws DAException Evaluate the starting state for a new Work Order looking at the defined rules.- Parameters:
workOrder- the work orderpoolKit- aPoolKitto execute the operation in transaction. Can't be null.- Returns:
- the evaluated work order state if the given input match a rule,
BOWorkOrderState.Values.OPENas default otherwise. - Throws:
DAException- the DA exception
-
loadLinkedWorkOrders
Load theDBViewwith the raw data of the work order linked with given one- Parameters:
workOrderId- the work order id for which retrieve the linked work orders- Returns:
- the
DBView(eventually empty if no work orders are linked with the given one)
-
load
Load theWorkOrderobject with all its components- Parameters:
id- the id of the work order to load- Returns:
- the whole
WorkOrderobject loaded - Throws:
DAValidateException- if something went wrong in the loading process
-
load
Load theWorkOrderobject with all its components- Parameters:
id- the id of the work order to loadconn- aPooledConnectionto execute the operation in transaction. Can be null.- Returns:
- the whole
WorkOrderobject loaded - Throws:
DAValidateException- if something went wrong in the loading process
-
refreshOperations
Allow to load and refresh the operation in memory of a givenWorkOrderobject- Parameters:
workOrder- theWorkOrderfor which refresh the operations list- Throws:
DAValidateException- if something went wrong in the loading process
-
refreshOperations
public static void refreshOperations(WorkOrder workOrder, PooledConnection conn) throws DAValidateException Allow to load and refresh the operation in memory of a givenWorkOrderobject- Parameters:
workOrder- theWorkOrderfor which refresh the operations listconn- aPooledConnectionto execute the operation in transaction. Can be null.- Throws:
DAValidateException- if something went wrong in the loading process
-
checkInterventionGroupNetaCustomerStateMatching
public static boolean checkInterventionGroupNetaCustomerStateMatching(BOTechnicalObjectHeader technicalObjectHeader, Long interventioGroupId) Check if the Neta Integration customer state match the intervention group configuration- Parameters:
technicalObjectHeader- the technical object to checkinterventioGroupId- the id of the intervention group to consider- Returns:
- true if the check is ok, false otherwise
-
findDefaultWareHouseId
Retrieve the id of the default warehouse for the operation center of the given work order- Parameters:
workOrder- the work order- Returns:
- the id of the default warehouse if exists. Null otherwise.
-
loadAssociatedMaterials
Load and set as extension of theBOWorkOrderOperations of the given work order the raw data of the materials related to them- Parameters:
workOrder- the work order for which load the associated materials- Throws:
DAValidateException- if something went wrong in the loading process- See Also:
-
loadAssociatedMaterials
public static void loadAssociatedMaterials(WorkOrder workOrder, PooledConnection conn) throws DAValidateException Load and set as extension of theBOWorkOrderOperations of the given work order the raw data of the materials related to them- Parameters:
workOrder- the work order for which load the associated materialsconn- aPooledConnectionto execute the operation in transaction. Can be null.- Throws:
DAValidateException- if something went wrong in the loading process- See Also:
-
loadAssociatedMaterials
public static void loadAssociatedMaterials(BOWorkOrderOperation operation) throws DAValidateException Load and set as extension of the givenBOWorkOrderOperationthe materials associated with the operation- Parameters:
operation- theBOWorkOrderOperationfor which load the associated materials- Throws:
DAValidateException- if something went wrong in the loading process
-
loadMaterialiAssociati
public static void loadMaterialiAssociati(BOWorkOrderOperation operation, PooledConnection conn) throws DAValidateException Load and set as extension of the givenBOWorkOrderOperationthe materials associated with the operation- Parameters:
operation- theBOWorkOrderOperationfor which load the associated materialsconn- aPooledConnectionto execute the operation in transaction. Can be null.- Throws:
DAValidateException- if something went wrong in the loading process
-
save
- Parameters:
workOrder- the work order to save- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
save
public static void save(WorkOrder workOrder, PooledConnection conn) throws DAException, DAValidateException - Parameters:
workOrder- the work order to saveconn- aPooledConnectionto execute the operation in transaction. Can be null.- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
save
public static void save(WorkOrder workOrder, WorkOrderSaveEventOptions options, PooledConnection conn) throws DAException, DAValidateException - Parameters:
workOrder- the work order to saveoptions- workOrder saving specific optionsconn- aPooledConnectionto execute the operation in transaction. Can be null.- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception- See Also:
-
getWorkOrderTypeRawData
Retrieve the raw data of the work order type of the given work order- Parameters:
workOrder- theWorkOrderfor which retrieve the work order type data- Returns:
- the
HashGetterwith the raw data of the retrieved work order type
-
isFromNetaIntegration
Say if the givenWorkOrderhas a type related to a Neta type. -
isDuplicable
Say if the givenWorkOrdercan be duplicated -
loadOperationObjectList
public static overit.geocallapp.wfm.schedulazione.odl.listaoggetti.TechnicalObjectList loadOperationObjectList(BOWorkOrderOperation operation, PooledConnection conn) throws DAValidateException, DAException Retrieve theTechnicalObjectListcontaining the TechnicalObjects associated with the givenBOWorkOrderOperation- Parameters:
operation- theBOWorkOrderOperationfor which retrieve theTechnicalObjectListconn- aPooledConnectionto execute the operation in transaction. Can be null.- Returns:
- the
TechnicalObjectList - Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
loadWorkOrderOperationsTools
public static void loadWorkOrderOperationsTools(WorkOrder workOrder, PooledConnection conn) throws DAValidateException For eachBOWorkOrderOperationof the givenWorkOrderload and set as extension the raw data of the related tools.- Parameters:
workOrder- theWorkOrderto for which retrieve the toolsconn- aPooledConnectionto execute the operation in transaction. Can be null.- Throws:
DAValidateException- if something went wrong in the loading process
-
loadWorkOrderOperationsPerformances
public static void loadWorkOrderOperationsPerformances(WorkOrder workOrder) throws DAValidateException For eachBOWorkOrderOperationof the givenWorkOrderload and set as extension the raw data of the related performances.- Parameters:
workOrder- theWorkOrderto for which retrieve the performances- Throws:
DAValidateException- if something went wrong in the loading process
-
loadWorkOrderOperationsPerformances
public static void loadWorkOrderOperationsPerformances(WorkOrder workOrder, PooledConnection conn) throws DAValidateException For eachBOWorkOrderOperationof the givenWorkOrderload and set as extension the raw data of the related performances.- Parameters:
workOrder- theWorkOrderto for which retrieve the performancesconn- aPooledConnectionto execute the operation in transaction. Can be null.- Throws:
DAValidateException- if something went wrong in the loading process
-
getDefaultInterventionGroupId
Load the default intervention group id- Returns:
- the default intervention group configured at company level
-
getIdBookingOperation
Inspect theWorkOrderto find the firstBOWorkOrderOperationmarked as booking- Parameters:
workOrder- theWorkOrderto inspect- Returns:
- the id of the first
BOWorkOrderOperationmarked as booking if exists, null otherwise.
-
isBooking
Say if the givenWorkOrdercan be considered as booking -
getResidualTime
Returns the difference in time between the current date and the work order end one.- Parameters:
workOrder- theWorkOrderto consider- Returns:
- the work order residual time in minutes, null when the end date is null or is equal to
DateUtils.DATE_MAX
-