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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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
    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(String holderPath)
    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 class com.tccc.kos.commons.util.ready.ReadyBean
    • setContainerFactory

      public void setContainerFactory(AssignmentContainerFactory factory)
      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 optional factoryJson 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

      public void assign(Assignment a) throws Exception
      Assign an ingredient to a holder.
      Throws:
      Exception
    • unassign

      public void unassign(String holderPath)
      Unassign a holder if it is currently assigned.
    • getAssignments

      public Collection<Assignment> getAssignments()
      Return the collection of active assignments.
    • onPostInstall

      public void onPostInstall(com.tccc.kos.core.service.assembly.Assembly assembly)
      Specified by:
      onPostInstall in interface com.tccc.kos.core.service.assembly.AssemblyListener
    • onUninstall

      public void onUninstall(com.tccc.kos.core.service.assembly.Assembly assembly)
      Specified by:
      onUninstall in interface com.tccc.kos.core.service.assembly.AssemblyListener
    • onContainerInsertStart

      public void onContainerInsertStart(Container container, Holder[] holders)
      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 interface InsertionHolderListener
      Parameters:
      container - the container that was inserted
      holders - the holders inserted into
    • onContainerRemove

      public void onContainerRemove(Container container, Holder[] holders)
      Description copied from interface: InsertionHolderListener
      Called when a container is removed from holder(s).
      Specified by:
      onContainerRemove in interface InsertionHolderListener
      Parameters:
      container - the container that was removed
      holders - the associated holders
    • onLineReplaced

      public void onLineReplaced(Holder holder)
      Description copied from interface: ReplaceLineListener
      Called when a line is replaced for the holder.
      Specified by:
      onLineReplaced in interface ReplaceLineListener
      Parameters:
      holder - the holder with the line being replaced
    • getContainerFactory

      public AssignmentContainerFactory getContainerFactory()