public class StatusMessage extends Object
| Modifier and Type | Field and Description |
|---|---|
private ActionType |
action |
private String[] |
aliasIds |
private ComponentType |
componentType |
private String |
description |
private String |
deviceId |
private String |
id |
private int |
progress |
static String |
STATUS_STREAM |
private String |
subDescription |
| Constructor and Description |
|---|
StatusMessage()
Creates an empty status message.
|
StatusMessage(ActionType action,
String id,
String... aliasIds)
Creates a new status message for devices, i.e.,
ComponentTypes.DEVICE. |
StatusMessage(ComponentType componentType,
ActionType action,
String id,
String deviceId,
String... aliasIds)
Creates a new status message.
|
| Modifier and Type | Method and Description |
|---|---|
ActionType |
getAction()
Returns the action type causing this message.
|
String[] |
getAliasIds()
Returns optional alias ids of the component.
|
ComponentType |
getComponentType()
Returns the component type.
|
String |
getDescription()
Returns the description,
ActionTypes.PROCESS. |
String |
getDeviceId()
Returns the device (context) id of the component.
|
String |
getId()
Returns the primary id of the component.
|
int |
getProgress()
Returns the progress for
ActionTypes.PROCESS. |
String |
getSubDescription()
Returns the sub(-task) description,
ActionTypes.PROCESS. |
void |
send(TransportConnector conn)
Sends this message to the given connector on
#STATUS_STREAM. |
(package private) void |
setAction(ActionType action)
Changes the action type.
|
(package private) void |
setAliasIds(String[] aliasIds)
Changes the alias ids of the component.
|
(package private) void |
setComponentType(ComponentType componentType)
Changes the component type.
|
(package private) void |
setDeviceId(String deviceId)
Changes the device (context) id of the component.
|
(package private) void |
setId(String id)
Changes the primary id of the component.
|
StatusMessage |
withDescription(String description)
Sets the description for
getProgress(), ActionTypes.PROCESS. |
StatusMessage |
withProgress(int progress)
Defines the progress for
ActionTypes.PROCESS. |
StatusMessage |
withSubDescription(String subDescription)
Sets the sub(-task) description for
getProgress(), ActionTypes.PROCESS. |
public static final String STATUS_STREAM
private ComponentType componentType
private ActionType action
private String id
private String[] aliasIds
private String deviceId
private int progress
private String description
private String subDescription
StatusMessage()
public StatusMessage(ActionType action, String id, String... aliasIds)
ComponentTypes.DEVICE.action - the actionid - the id of the componentaliasIds - optional alias idspublic StatusMessage(ComponentType componentType, ActionType action, String id, String deviceId, String... aliasIds)
componentType - the component typeaction - the actionid - the id of the componentdeviceId - the id of device providing the context, shall be equal to id if componentType
is ComponentTypes.DEVICE.aliasIds - optional alias idspublic ComponentType getComponentType()
void setComponentType(ComponentType componentType)
componentType - the new component typepublic ActionType getAction()
void setAction(ActionType action)
action - the new action typepublic String getId()
getDeviceId() if
getComponentType() is ComponentTypes.DEVICE.void setId(String id)
id - the primary idpublic String getDeviceId()
getId() if getComponentType()
is ComponentTypes.DEVICE.void setDeviceId(String deviceId)
deviceId - the device idpublic String[] getAliasIds()
void setAliasIds(String[] aliasIds)
aliasIds - the primary idpublic void send(TransportConnector conn) throws IOException
#STATUS_STREAM. [convenience]conn - the connectorIOException - if sending failspublic StatusMessage withProgress(int progress)
ActionTypes.PROCESS.progress - the progress in [0;100]; if 100 longer running process is assumed to be completedpublic int getProgress()
ActionTypes.PROCESS.public StatusMessage withDescription(String description)
getProgress(), ActionTypes.PROCESS.description - the description, may be null or ""public String getDescription()
ActionTypes.PROCESS.public StatusMessage withSubDescription(String subDescription)
getProgress(), ActionTypes.PROCESS.subDescription - the sub(-task) description, may be null or ""public String getSubDescription()
ActionTypes.PROCESS.Copyright © 2022. All rights reserved.