Class AssignmentService

All Implemented Interfaces:
CtxEventListener, ContextHandleAware, HandleAware, Ready, ReadyAndReadyListener, ReadyListener, AssemblyListener, InsertionHolderListener, InsertionListener, PumpListener, ReplaceLineListener

public final class AssignmentService extends AbstractService implements 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 Details

    • AssignmentService

      public AssignmentService()
  • Method Details

    • onBeanReady

      public boolean onBeanReady()
      Specified by:
      onBeanReady in interface ReadyAndReadyListener
    • 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(Assembly assembly)
      Specified by:
      onPostInstall in interface AssemblyListener
    • onUninstall

      public void onUninstall(Assembly assembly)
      Specified by:
      onUninstall in interface 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()