Class AssignmentService
java.lang.Object
com.tccc.kos.commons.util.ready.ReadyBean
com.tccc.kos.commons.core.service.AbstractService
com.tccc.kos.ext.dispense.service.assignment.AssignmentService
- All Implemented Interfaces:
com.tccc.kos.commons.core.context.CtxEventListener
,com.tccc.kos.commons.core.service.handle.ContextHandleAware
,com.tccc.kos.commons.core.service.handle.HandleAware
,com.tccc.kos.commons.util.ready.Ready
,com.tccc.kos.commons.util.ready.ReadyListener
,com.tccc.kos.core.service.assembly.AssemblyListener
,InsertionHolderListener
,InsertionListener
,PumpListener
,ReplaceLineListener
public final class AssignmentService
extends com.tccc.kos.commons.core.service.AbstractService
implements com.tccc.kos.core.service.assembly.AssemblyListener, InsertionHolderListener, ReplaceLineListener
Service that allows ingredients to be manually assigned to holders.
This will persist the assignments so they survive reboots. This can
be used for typical dispensers that require that ingredient be
manually mapped during installation / setup.
- Since:
- 1.0
- Version:
- 2023-01-25
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
assign
(Assignment a) Assign an ingredient to a holder.Return the collection of active assignments.boolean
void
onContainerInsertStart
(Container container, Holder[] holders) Called when a container is inserted into one or more holders.void
onContainerRemove
(Container container, Holder[] holders) Called when a container is removed from holder(s).void
onLineReplaced
(Holder holder) Called when a line is replaced for the holder.void
onPostInstall
(com.tccc.kos.core.service.assembly.Assembly assembly) void
onUninstall
(com.tccc.kos.core.service.assembly.Assembly assembly) void
Set the container factory to use when creating containers to use for assignments.void
Unassign a holder if it is currently assigned.Methods inherited from class com.tccc.kos.commons.core.service.AbstractService
getHandle, getHandlePrefix
Methods inherited from class com.tccc.kos.commons.util.ready.ReadyBean
getReady, onDependenciesReady
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.tccc.kos.core.service.assembly.AssemblyListener
onInstall, onPostUninstall, onPreInstall, onPreUninstall
Methods inherited from interface com.tccc.kos.commons.core.context.CtxEventListener
onCtxAutowiringCompleted, onCtxDestroyed, onCtxPhaseCompleted
Methods inherited from interface com.tccc.kos.commons.core.service.handle.HandleAware
addHandleChild, getName, getPath
Methods inherited from interface com.tccc.kos.commons.util.ready.Ready
isReady, setReady
Methods inherited from interface com.tccc.kos.commons.util.ready.ReadyListener
onDependenciesGroupReady
-
Constructor Details
-
AssignmentService
public AssignmentService()
-
-
Method Details
-
onBeanReady
public boolean onBeanReady()- Overrides:
onBeanReady
in classcom.tccc.kos.commons.util.ready.ReadyBean
-
setContainerFactory
Set the container factory to use when creating containers to use for assignments. This allows applications to insert much more complex containers that have more features such as fuel gauges or whatever is desired. The assignment object contains optionalfactoryJson
which allows complex data to be passed through to the factory.The default factory returns base
Container
instances. If replacing the factory, it should be replaced before the core assembly is installed as this triggers the containers to be created. -
assign
Assign an ingredient to a holder.- Throws:
Exception
-
unassign
Unassign a holder if it is currently assigned. -
getAssignments
Return the collection of active assignments. -
onPostInstall
public void onPostInstall(com.tccc.kos.core.service.assembly.Assembly assembly) - Specified by:
onPostInstall
in interfacecom.tccc.kos.core.service.assembly.AssemblyListener
-
onUninstall
public void onUninstall(com.tccc.kos.core.service.assembly.Assembly assembly) - Specified by:
onUninstall
in interfacecom.tccc.kos.core.service.assembly.AssemblyListener
-
onContainerInsertStart
Description copied from interface:InsertionHolderListener
Called when a container is inserted into one or more holders. This is called when the insertion request is first created and the container is linked to the holders. Availability to use the pumps will be subject to filters blocking the insert.- Specified by:
onContainerInsertStart
in interfaceInsertionHolderListener
- Parameters:
container
- the container that was insertedholders
- the holders inserted into
-
onContainerRemove
Description copied from interface:InsertionHolderListener
Called when a container is removed from holder(s).- Specified by:
onContainerRemove
in interfaceInsertionHolderListener
- Parameters:
container
- the container that was removedholders
- the associated holders
-
onLineReplaced
Description copied from interface:ReplaceLineListener
Called when a line is replaced for the holder.- Specified by:
onLineReplaced
in interfaceReplaceLineListener
- Parameters:
holder
- the holder with the line being replaced
-
getContainerFactory
-