Class BasicInstruction

java.lang.Object
net.solarnetwork.domain.BasicInstruction
All Implemented Interfaces:
Serializable, Instruction

public class BasicInstruction extends Object implements Instruction, Serializable
Basic implementation of Instruction.
Since:
2.0
Version:
1.0
Author:
matt
See Also:
  • Constructor Details

    • BasicInstruction

      public BasicInstruction(Long id, String topic, Instant instructionDate, InstructionStatus status)
      Constructor.
      Parameters:
      id - the local instruction ID
      topic - the instruction topic
      instructionDate - the instruction date
      status - the status, or null
    • BasicInstruction

      public BasicInstruction(Instruction other, Long id, InstructionStatus status)
      Copy constructor.
      Parameters:
      other - the instruction to copy
      id - if provided, the ID to use
      status - if provided, the new status to use
    • BasicInstruction

      public BasicInstruction(Instruction other, InstructionStatus status)
      Copy constructor.
      Parameters:
      other - the instruction to copy
      status - if provided, the new status to use
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getId

      public Long getId()
      Description copied from interface: Instruction
      Get a unique ID for the instruction.
      Specified by:
      getId in interface Instruction
      Returns:
      local unique ID
    • getTopic

      public String getTopic()
      Description copied from interface: Instruction
      Get the topic of the instruction -- a unique identifier for the instruction type.
      Specified by:
      getTopic in interface Instruction
      Returns:
      the topic name
    • getInstructionDate

      public Instant getInstructionDate()
      Description copied from interface: Instruction
      Get the date/time the instruction was requested.
      Specified by:
      getInstructionDate in interface Instruction
      Returns:
      the date
    • getParameterNames

      public Iterable<String> getParameterNames()
      Description copied from interface: Instruction
      Get an Iterator of all unique instruction parameter names.
      Specified by:
      getParameterNames in interface Instruction
      Returns:
      iterator, never null
    • isParameterAvailable

      public boolean isParameterAvailable(String parameterName)
      Description copied from interface: Instruction
      Test if a specific parameter has an associated value available.
      Specified by:
      isParameterAvailable in interface Instruction
      Parameters:
      parameterName - the parameter name to test for
      Returns:
      true if the parameter name has at least one value available
    • getParameterValue

      public String getParameterValue(String parameterName)
      Description copied from interface: Instruction
      Get a single parameter value for a specific parameter name.
      Specified by:
      getParameterValue in interface Instruction
      Parameters:
      parameterName - the parameter name to get the value for
      Returns:
      the first available parameter name, or null if not available
    • getAllParameterValues

      public String[] getAllParameterValues(String parameterName)
      Description copied from interface: Instruction
      Get all parameter values for a specific parameter name;
      Specified by:
      getAllParameterValues in interface Instruction
      Parameters:
      parameterName - the parameter name to get the values for
      Returns:
      all available parameter values, or null if not available
    • getStatus

      public InstructionStatus getStatus()
      Description copied from interface: Instruction
      Get the instruction status.
      Specified by:
      getStatus in interface Instruction
      Returns:
      the status
    • addParameter

      public void addParameter(String name, String value)
      Add a new parameter value.
      Parameters:
      name - the parameter name
      value - the parameter value
    • putParameters

      public void putParameters(String name, List<String> values)
      Add a list of parameter values.
      Parameters:
      name - the parameter name
      values - the parameter values
    • getParameterMultiMap

      public Map<String,List<String>> getParameterMultiMap()
      Description copied from interface: Instruction
      Get a multi-valued map of all parameter values.
      Specified by:
      getParameterMultiMap in interface Instruction
      Returns:
      the parameters as a multi-valued map, never null