Script: Class dw.system.StatusItem

Class StatusItem

A StatusItem holds all the status information. Multi StatusItems are bundled together into a Status.

Properties

code : String

The status code is the unique identifier for the message and can be used by client programs to check for a specific status and to generate a localized message.

details : Map Read Only

The optional details for this StatusItem.

error : boolean Read Only

Returns whether this Status Item represents and error.

message : String

The default human readable message for this Status. Note: Custom code and client programs must not use this message to identify a specific status. The getCode() must be used for that purpose. The actual message can change from release to release.

parameters : List

The parameters to construct a custom message.

status : Number

The status.

Constructor Summary

StatusItem()

Constructs a new OK StatusItem.

StatusItem(status : Number)

Constructs a new StatusItem with the given status.

StatusItem(status : Number, code : String)

Constructs a new StatusItem with the given status and code.

StatusItem(status : Number, code : String, message : String, parameters : Object...)

Constructs a new StatusItem with the given values.

Method Summary

addDetail(key : String, value : Object) : void

Add an additional detail to this StatusItem.

getCode() : String

The status code is the unique identifier for the message and can be used by client programs to check for a specific status and to generate a localized message.

getDetails() : Map

Returns the optional details for this StatusItem.

getMessage() : String

Returns the default human readable message for this Status.

getParameters() : List

Returns the parameters to construct a custom message.

getStatus() : Number

Returns the status.

isError() : boolean

Returns whether this Status Item represents and error.

setCode(code : String) : void

Method to set the status code.

setMessage(message : String) : void

Sets the default human readable message for this Status.

setParameters(parameters : Object...) : void

Sets the parameters for a custom message.

setStatus(status : Number) : void

Set the status.

Methods inherited from class Object

assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values

Constructor Detail

StatusItem

publicStatusItem()

Constructs a new OK StatusItem.


StatusItem

publicStatusItem(status : Number)

Constructs a new StatusItem with the given status.

Parameters:

status - either Status.OK or Status.ERROR.


StatusItem

publicStatusItem(status : Number, code : String)

Constructs a new StatusItem with the given status and code.

Parameters:

status - either Status.OK or Status.ERROR.

code - a string representing a more detailed status code, e.g. "IMPEX-120".


StatusItem

publicStatusItem(status : Number, code : String, message : String, parameters : Object...)

Constructs a new StatusItem with the given values.

Parameters:

status - Status.OK or Status.ERROR.

code - a string representing a more detailed status code, e.g. "IMPEX-120".

message - a default human readable message

parameters - a list of parameters to construct a custom message


Method Detail

addDetail

addDetail(key : String, value : Object) : void

Add an additional detail to this StatusItem.

Parameters:

key - the key for the detail.

value - the detail value.

getCode

getCode() : String

The status code is the unique identifier for the message and can be used by client programs to check for a specific status and to generate a localized message.

Returns:

the status code.


getDetails

getDetails() : Map

Returns the optional details for this StatusItem.

Returns:

the optional details for this StatusItem.


getMessage

getMessage() : String

Returns the default human readable message for this Status. Note: Custom code and client programs must not use this message to identify a specific status. The getCode() must be used for that purpose. The actual message can change from release to release.

Returns:

the default human readable message for this Status.


getParameters

getParameters() : List

Returns the parameters to construct a custom message.

Returns:

the parameters to construct a custom message.


getStatus

getStatus() : Number

Returns the status.

Returns:

either Status.OK or Status.ERROR.


isError

isError() : boolean

Returns whether this Status Item represents and error.

Returns:

true is this item represents an error, false otherwise.


setCode

setCode(code : String) : void

Method to set the status code. The status code is the unique identifier for the message and can be used by client programs to check for a specific status and to generate a localized message.

Parameters:

code - the status code.


setMessage

setMessage(message : String) : void

Sets the default human readable message for this Status.

Parameters:

message - the default human readable message for this Status.


setParameters

setParameters(parameters : Object...) : void

Sets the parameters for a custom message.

Parameters:

parameters - the parameters for a custom message.


setStatus

setStatus(status : Number) : void

Set the status.

Parameters:

status - either Status.OK or Status.ERROR.