Class InsertRequest
java.lang.Object
com.tccc.kos.ext.dispense.service.insertion.InsertRequest
- All Implemented Interfaces:
com.tccc.kos.commons.core.service.trouble.TroubleAware
,com.tccc.kos.commons.core.service.trouble.TroubleMatcher
public class InsertRequest
extends Object
implements com.tccc.kos.commons.core.service.trouble.TroubleAware, com.tccc.kos.commons.core.service.trouble.TroubleMatcher
An insertion request. A request references a single container
but must specify a holder for each slice in the container.
There is no way to insert just a single slice of a container.
- Since:
- 1.0
- Version:
- 2023-01-31
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
block
(com.tccc.kos.commons.core.service.trouble.Trouble trouble) Add a trouble to the request that blocks the insertion process.void
Add a reason code to block the insertion process.The container being inserted.getData
(InsertionFilter<?> filter) Return filter data from the request that was stored usingsetData()
.Holder[]
The holders being inserted into.getPrevIngredientIds
(Pump<?> pump) Return all previously inserted ingredientId's for the specified pump.boolean
Return true if request is blocked for any reason.boolean
isBootInsert
(Pump<?> pump) Return true if the inserted containerId is the same as the previously inserted containerId during an inventory scan.boolean
Return true if this is the first time this request has been checked by filters.boolean
Return true if this request is part of an inventory scan.boolean
match
(com.tccc.kos.commons.core.service.trouble.Trouble trouble) void
When called, sends an updated version of the holders over the broker.void
onTroubleAdded
(com.tccc.kos.commons.core.service.trouble.Trouble trouble) void
onTroubleRemoved
(com.tccc.kos.commons.core.service.trouble.Trouble trouble) void
onTroubleResolved
(com.tccc.kos.commons.core.service.trouble.Trouble trouble, boolean success) void
setData
(InsertionFilter<?> filter, Object data) Set filter data into the request for use on the next insertion attempt.toString()
void
warn
(com.tccc.kos.commons.core.service.trouble.Trouble trouble) Add a trouble to the request that will be added as a warning if the insertion is successful.
-
Constructor Details
-
InsertRequest
public InsertRequest()
-
-
Method Details
-
isInventoryScan
public boolean isInventoryScan()Return true if this request is part of an inventory scan. This means the container was discovered at startup. Filters can use this as a hint that the container existed before the last reboot and might need to be treated a bit differently from a normal insertion. -
getContainer
The container being inserted. -
getHolders
The holders being inserted into. May contain more than one holder if the container has multiple slices. -
block
Add a reason code to block the insertion process. No additional filters will be called.- Parameters:
reason
- the reason to add
-
block
public void block(com.tccc.kos.commons.core.service.trouble.Trouble trouble) Add a trouble to the request that blocks the insertion process. No additional filters will be called.The trouble will automatically be tagged with the container so the trouble will be removed when the container is removed.
- Parameters:
trouble
- the trouble to add
-
warn
public void warn(com.tccc.kos.commons.core.service.trouble.Trouble trouble) Add a trouble to the request that will be added as a warning if the insertion is successful. This will allow the filter process to continue.The trouble will automatically be tagged with the container so the trouble will be removed when the container is removed.
- Parameters:
trouble
- the trouble to add
-
isFirstCheck
public boolean isFirstCheck()Return true if this is the first time this request has been checked by filters. This allows filters to trigger setup logic for a request without needing to add data to the request. -
isBlocked
public boolean isBlocked()Return true if request is blocked for any reason. -
setData
Set filter data into the request for use on the next insertion attempt. Also a useful way to share state betweencheckRequest()
andcheckPumpRequest
calls. -
getData
Return filter data from the request that was stored usingsetData()
. -
getPrevIngredientIds
Return all previously inserted ingredientId's for the specified pump. -
isBootInsert
Return true if the inserted containerId is the same as the previously inserted containerId during an inventory scan. This will only be true during a reboot as there is no remove of the container. Any other time a container is inserted, it will first remove the existing container. This can be used to trigger special case logic in filters that need to handle reboot inserts differently from a normal insert.Note that this is specific to a pump as pumps have distinct insertion lifecycles.
- Parameters:
pump
- the pump to check
-
notifyUpdate
public void notifyUpdate()When called, sends an updated version of the holders over the broker. This is typically called by a filter that somehow changed the state of the associated holders or pumps and needs to sync external listeners, such as a ui. This generates an update topic event. -
onTroubleAdded
public void onTroubleAdded(com.tccc.kos.commons.core.service.trouble.Trouble trouble) - Specified by:
onTroubleAdded
in interfacecom.tccc.kos.commons.core.service.trouble.TroubleAware
-
onTroubleResolved
public void onTroubleResolved(com.tccc.kos.commons.core.service.trouble.Trouble trouble, boolean success) - Specified by:
onTroubleResolved
in interfacecom.tccc.kos.commons.core.service.trouble.TroubleAware
-
onTroubleRemoved
public void onTroubleRemoved(com.tccc.kos.commons.core.service.trouble.Trouble trouble) - Specified by:
onTroubleRemoved
in interfacecom.tccc.kos.commons.core.service.trouble.TroubleAware
-
match
public boolean match(com.tccc.kos.commons.core.service.trouble.Trouble trouble) - Specified by:
match
in interfacecom.tccc.kos.commons.core.service.trouble.TroubleMatcher
-
toString
-