Interface Instruction
- All Superinterfaces:
net.solarnetwork.domain.Instruction
- All Known Implementing Classes:
BasicInstruction
An instruction is like a single name (the topic) with an arbitrary
number of named key/value parameters. All parameter names and values are
Strings. Each parameter can have any number of associated values.
An Instruction is considered equal to another Instruction only if the
instructionId and instructorId values are equal.
- Version:
- 2.2
- Author:
- matt
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringAn ID to use for locally-initiated instructions, ingetInstructorId().static final StringThe name of an instruction parameter that represents the desired execution date for the instruction.static final StringThe task instruction parameter for a "parent" instruction ID.static final StringThe task instruction parameter for the "parent" instructor ID. -
Method Summary
Modifier and TypeMethodDescriptiondefault InstantGet the instruction execution date, if available.default StringGet an identifier for this instruction.Get the unique ID for the sender of the instruction, for example the DN of the sender's certificate.Get the instruction state.default booleanisLocal()Test if this instruction is a local instruction.default InstanttimestampParameterValue(String parameterName) Get a date parameter value, if available.Methods inherited from interface net.solarnetwork.domain.Instruction
getAllParameterValues, getId, getInstructionDate, getInstructionState, getParameterMap, getParameterMultiMap, getParameterNames, getParameterValue, getTopic, isParameterAvailable
-
Field Details
-
LOCAL_INSTRUCTION_ID
An ID to use for locally-initiated instructions, ingetInstructorId().- See Also:
-
PARAM_EXECUTION_DATE
The name of an instruction parameter that represents the desired execution date for the instruction.The parameter value can be either a
longepoch millisecond value or an ISO 8601 instant.- Since:
- 2.1
- See Also:
-
PARAM_PARENT_INSTRUCTION_ID
The task instruction parameter for a "parent" instruction ID.This parameter can be used to track instructions created by other instructions.
- Since:
- 2.2
- See Also:
-
PARAM_PARENT_INSTRUCTOR_ID
The task instruction parameter for the "parent" instructor ID.This parameter can be used to track instructions created by other instructions.
- Since:
- 2.2
- See Also:
-
-
Method Details
-
getIdentifier
Get an identifier for this instruction.This can be used for logging, display, etc.
- Returns:
- an identifier, never null
-
getInstructorId
String getInstructorId()Get the unique ID for the sender of the instruction, for example the DN of the sender's certificate.- Returns:
- the instructor ID
-
getStatus
InstructionStatus getStatus()Get the instruction state.- Specified by:
getStatusin interfacenet.solarnetwork.domain.Instruction- Returns:
- the state, or null if none available
-
getExecutionDate
Get the instruction execution date, if available.This method looks for the
PARAM_EXECUTION_DATEparameter and tries to parse that as a date. The parameter value can be either alongepoch millisecond value or an ISO 8601 instant.- Returns:
- the instruction execution date, or null if one is not available or cannot be parsed
- Since:
- 2.1
- See Also:
-
timestampParameterValue
Get a date parameter value, if available.This method supports the same date format as described in the
PARAM_EXECUTION_DATEparameter: the parameter value can be either alongepoch millisecond value or an ISO 8601 instant.- Parameters:
parameterName- the name of the parameter to parse as a timestamp- Returns:
- the parameter value parsed as a timestamp, or null if one is not available or cannot be parsed
- Since:
- 2.2
- See Also:
-
isLocal
default boolean isLocal()Test if this instruction is a local instruction.- Returns:
- true if
getInstructorId()isLOCAL_INSTRUCTION_ID - Since:
- 2.2
-