Final Class: Message

Oracle® JavaScript Extension Toolkit (JET)
17.1.0

G12196-01

Since:
  • 0.6.0
Module:
  • ojmessaging

QuickNav

Fields

Description

Constructs a message object.

NOTE: Instead of using the constructor, please use an Object that duck-types Message - has summary, detail, and severity properties. Creating an Message Object provides no additional value than the duck-typed Object.


Usage

Typescript Import Format
//This class is exported directly as module. To import it
import Message= require("ojs/ojmessaging");

For additional information visit:


Final classes in JET

Classes in JET are generally final and do not support subclassing. At the moment, final is not enforced. However, this will likely change in an upcoming JET release.


Constructor

new Message(summary, detail, severity)

Constructs a message object.

NOTE: Instead of using the constructor, please use an Object that duck-types Message - has summary, detail, and severity properties. Creating an Message Object provides no additional value than the duck-typed Object.

Parameters:
Name Type Argument Description
summary string Localized summary message text
detail string Localized detail message text
severity Message.SEVERITY_TYPE | Message.SEVERITY_LEVEL <optional>
An optional severity for this message. Use constants Message.SEVERITY_LEVEL for number types and Message.SEVERITY_TYPE for string types. Default is SEVERITY_ERROR if no severity is specified

Fields

(static) SEVERITY_LEVEL :number

Message severity level
Properties:
Name Type Default Description
CONFIRMATION number 1
ERROR number 4
FATAL number 5
Deprecated:
Since Description
11.0.0 Both "FATAL" and "ERROR" apply the same marker style. Use "ERROR" instead.
INFO number 2
WARNING number 3

(static) SEVERITY_TYPE :string

Indicates the type of severity that the message represents.
Properties:
Name Type Default Description
CONFIRMATION string confirmation Indicates a confirmation that an operation or task was completed. This is the lowest severity level.
ERROR string error Used when data inaccuracies occur when completing a field and that needs fixing before user can continue. This has a lower severity level than fatal.
FATAL string fatal Used when a critical application error or an unknown failure occurs. This is the highest severity level.
Deprecated:
Since Description
11.0.0 Both "FATAL" and "ERROR" apply the same marker style. Use "ERROR" instead.
INFO string info Indicates information or operation messages. This has a lower severity level than warning.
WARNING string warning Indicates an application condition or situation that might require users' attention. This has a lower severity than error.

detail :string

Localized detail text.
Default Value:
  • ""

severity :(Message.SEVERITY_TYPE|Message.SEVERITY_LEVEL)

Severity type of message. See Message.SEVERITY_TYPE for string types and Message.SEVERITY_LEVEL for number types.
Default Value:
  • Message.SEVERITY_TYPE.ERROR

summary :string

Localized summary text.
Default Value:
  • ""

Methods

(static) getMaxSeverity(messages) : {Message.SEVERITY_LEVEL| -1}

Returns the max severity level in a array of message objects.
Parameters:
Name Type Argument Description
messages Array.<Message> <optional>
an array of message instances or duck typed messages
Returns:

-1 if none can be determined; otherwise a severity level as defined by Message.SEVERITY_LEVEL.

Type
Message.SEVERITY_LEVEL| -1

(static) getSeverityLevel(severity) : {Message.SEVERITY_LEVEL}

A convenience method that returns the severity level when given either a severity level of type number or a severity type of string. If severity level is not provided or is not valid this returns a severity error.
Parameters:
Name Type Argument Description
severity Message.SEVERITY_TYPE | Message.SEVERITY_LEVEL <optional>
Returns:
Type
Message.SEVERITY_LEVEL

(static) getSeverityType(level) : {Message.SEVERITY_TYPE}

A convenience method that returns the severity type when given either a severity level of type number or a severity type of string. If severity level is not provided or is not valid this return a severity error.
Parameters:
Name Type Argument Description
level Message.SEVERITY_TYPE | Message.SEVERITY_LEVEL <optional>
Returns:
Type
Message.SEVERITY_TYPE

(static) isValid(messages) : {boolean}

Returns false if messages are of severity error or greater.
Parameters:
Name Type Description
messages Array.<Message> an array of message instances or duck-typed messages
Returns:

true if none of the messages are of severity error or greater. false otherwise

Type
boolean