Class: Message

Oracle® JavaScript Extension Toolkit (JET)
5.0.0

E90577-01

QuickNav

Fields

Message

Version:
  • 5.0.0
Since:
  • 0.6
Module:
  • ojmessaging

Constructor

new Message(summary, detail, severity)

Constructs a message object.

NOTE: Instead of using the constructor, please use an Object that duck-types oj.Message - has summary, detail, and severity properties. Creating an oj.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 number | string <optional>
An optional severity for this message. Use constants oj.Message.SEVERITY_LEVEL for number types and oj.Message.SEVERITY_TYPE for string types. Default is SEVERITY_ERROR if no severity is specified
Example

Set application messages using the messages-custom attribute. This example creates messages the recommended way, by creating an Object that duck-types oj.Message.

--- HTML ---
<oj-input-text messages-custom="{{appMessages}}");></oj-input-text>

--- Javascript ---
// for messagesCustom property
self.appMessages = ko.observable();
var msgs = [];
msgs.push({summary: "Error Summary", detail: "Error Detail", 
 severity: oj.Message.SEVERITY_TYPE['CONFIRMATION']}); 
self.appMessages(msgs);

Fields

(static) SEVERITY_LEVEL :number

Message severity level
Properties:
Name Type Default
FATAL number 5
ERROR number 4
WARNING number 3
INFO number 2
CONFIRMATION number 1

(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.
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.
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.
FATAL string fatal Used when a critical application error or an unknown failure occurs. This is the highest severity level.

detail :string

Localized detail text.
Default Value:
  • ""

severity :string|number

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

summary :string

Localized summary text.
Default Value:
  • ""

Methods

(static) getMaxSeverity(messages) → {number}

Returns the max severity level in a array of message objects.
Parameters:
Name Type Argument Description
messages Array.<oj.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 oj.Message.SEVERITY_LEVEL.
Type
number

(static) getSeverityLevel(severity) → {number}

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 string | number | undefined <optional>
Returns:
Type
number

(static) getSeverityType(level) → {string}

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 string | number | undefined <optional>
Returns:
Type
string

(static) isValid(messages) → {boolean}

Returns false if messages are of severity error or greater.
Parameters:
Name Type Description
messages Array.<oj.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