Rem drv: <migrate type="schema_upgrade" version="11.2.0.1.0"/>
Rem
Rem $Header: emcore/source/oracle/sysman/emdrep/sql/core/11.2.0.1/emInternalSDK/events/events_types.sql rbali_oneoff_updated/1 2025/03/14 06:41:12 rbali Exp $
Rem
Rem events_types.sql
Rem
Rem Copyright (c) 2010, 2025, Oracle and/or its affiliates. 
Rem All rights reserved.

Rem BEGIN EMRU_FILE_METADATA
Rem EMRU_SOURCE_FILE:emcore/source/oracle/sysman/emdrep/sql/core/11.2.0.1/emInternalSDK/events/events_types.sql
Rem EMRU_UNIX_DELIVERABLES:
Rem emcore/source/oracle/sysman/emdrep/sql/core/11.2.0.1/emInternalSDK/events/events_types.sql

Rem EMRU_FILE_POSTINSTALL:<!!! enter the view based location of the executable file. If there is NONE leave as-is !!!>
Rem EMRU_GENERIC_FLAG:NONE
Rem END EMRU_FILE_METADATA

Rem
Rem    NAME
Rem      events_types.sql - <one-line expansion of the name>
Rem
Rem    DESCRIPTION
Rem      This package type defines all the pl/sql objects needed to be 
Rem      constructed for events publishing purpose.
Rem      These objects would be required for the pl/sql publishing API stored 
Rem      in GC_EVENT_RECEIVER package
Rem
Rem    NOTES
Rem      <other useful comments, qualifications, etc.>
Rem
Rem    MODIFIED   (MM/DD/YY)
Rem    gbafna      01/07/25 - make synonyms noneditionable
Rem    rnadidar    02/11/15 - cut over to EBR
Rem    zeding      04/01/12 - bug 13904850 - change comment text for event
Rem                           context type value
Rem    rpatti      06/27/11 - bug 12693254 event name size
Rem    rpatti      03/30/11 - introduce processing hint NVP
Rem    sreddy      01/27/11 - remove deduplicate_key
Rem    zeding      12/14/10 - provide more descriptive comments
Rem    rsidlagh    03/17/10 - Changed the gc_event_publish_obj structure to
Rem                           have individual fields for sys_attribs
Rem    zeding      01/13/10 - events eminternals SDK pl/sql objects
Rem    zeding      01/13/10 - Created
Rem

/** This object represents a key value pair object to hold the attribute and its
  * value. This is primarily constructed by the publishing system 
  * @param Name the name of the attribute
  * @param Value the attribute value. The values are represented in string format
  */


ALTER SESSION SET CURRENT_SCHEMA=SYSMAN_TYPES;

CREATE OR REPLACE TYPE gc_event_pair_obj AS OBJECT (
  NAME                 VARCHAR2(256),
  VALUE                VARCHAR2(4000)
);
/

grant execute on gc_event_pair_obj to sysman;

create or replace noneditionable synonym SYSMAN.gc_event_pair_obj for gc_event_pair_obj;



/** This object represents the array of gc_event_pair_obj described above
  */
CREATE OR REPLACE TYPE gc_event_pair_array AS VARRAY(200) of GC_EVENT_PAIR_OBJ;
/

grant execute on gc_event_pair_array to sysman;

create or replace noneditionable synonym SYSMAN.gc_event_pair_array for gc_event_pair_array;


/** This constructor function to create gc_event_context_obj
  * This object represents the event context data object. This is primarily 
  * constructed before the construction of an event object prior to publishing 
  * @param p_name The event context name
  * @param p_type The data type of the value, which is stored 
  *               (0) - for string data
  *               (1) - for numeric data
  * @param p_value The numerical value
  * @param p_string_value The string value 
  */
CREATE OR REPLACE TYPE gc_event_context_obj AS OBJECT (
  NAME                 VARCHAR2(256),
  TYPE                 NUMBER(1),
  VALUE                NUMBER,
  STRING_VALUE         VARCHAR2(4000),
 CONSTRUCTOR FUNCTION gc_event_context_obj (
  p_name                 IN VARCHAR2,
  p_type                 IN NUMBER,
  p_value                IN NUMBER,
  p_string_value         IN VARCHAR2
 ) 
 RETURN SELF AS RESULT
);
/


grant execute on gc_event_context_obj to sysman;

create or replace noneditionable synonym SYSMAN.gc_event_context_obj for gc_event_context_obj;



/** This object represents the array of gc_event_context_obj described above
  */
CREATE OR REPLACE TYPE gc_event_context_array AS VARRAY(100) of GC_EVENT_CONTEXT_OBJ;
/

grant execute on gc_event_context_array to sysman;

create or replace noneditionable synonym SYSMAN.gc_event_context_array for gc_event_context_array;

/**
 * This object represents the source object information
 */
CREATE OR REPLACE TYPE gc_event_source_info AS OBJECT (
  type     VARCHAR2(32),
  id       RAW(16),
  name     VARCHAR2(64),
  owner    VARCHAR2(64),
  sub_type VARCHAR2(64),
 CONSTRUCTOR FUNCTION gc_event_source_info (
  p_type      IN VARCHAR2,
  p_id        IN RAW,
  p_name      IN VARCHAR2,
  p_owner     IN VARCHAR2,
  p_sub_type  IN VARCHAR2
 )
 RETURN SELF AS RESULT
);
/

grant execute on gc_event_source_info to sysman;

create or replace noneditionable synonym SYSMAN.gc_event_source_info for gc_event_source_info;


CREATE OR REPLACE TYPE gc_ev_msg_info AS OBJECT (
  msg            VARCHAR2(4000),
  msg_nlsid      VARCHAR2(256),
  msg_nlsparams  VARCHAR2(4000),
  msg_resbundle  VARCHAR2(512),
 CONSTRUCTOR FUNCTION gc_ev_msg_info (
  p_msg            IN VARCHAR2,
  p_msg_nlsid      IN VARCHAR2,
  p_msg_nlsparams  IN VARCHAR2,
  p_msg_resbundle  IN VARCHAR2
 )
 RETURN SELF AS RESULT
);
/

grant execute on gc_ev_msg_info to sysman;

create or replace noneditionable synonym SYSMAN.gc_ev_msg_info for gc_ev_msg_info;



CREATE OR REPLACE TYPE gc_event_duplicate_info AS OBJECT (
  first_occurred_date     DATE,
  last_occurred_date      DATE,
  occurrence_count        NUMBER,
 CONSTRUCTOR FUNCTION gc_event_duplicate_info (
  p_first_occurred_date IN DATE,
  p_last_occurred_date  IN DATE,
  p_occurrence_count    IN NUMBER
 )
 RETURN SELF AS RESULT
);
/

grant execute on gc_event_duplicate_info  to sysman;

create or replace noneditionable synonym SYSMAN.gc_event_duplicate_info for gc_event_duplicate_info;



/** This constructor function to create gc_event_publish_obj
  * This object represents the event object, with all the necessary attributes 
  * before the publishing system could publish an event.
  * @param event_class The name of the event class
  * @param source_obj_id The source object id. If an event is purely a target 
  *  based, e.g. a Metric Alert on a target Host1, this value will be set as the
  *  target guid of Host1.
  * @param target_guid The related target guid (will be set if the event
  *  belongs to a source object as well as a target)
  * @param reported_date The date reported by publishing system, 
  *  the date should be normalized to UTC timezone. 
  * @param occurrence_date The actual occurrence time of the event, in UTC.
  *  Typically, the event is reported when detected by the subsystem 
  *  which is typically not when the event actually occurred, but a little
  *  later than that. This is usually because systems typically poll 
  *  to see if there are any issues on a periodic basis.
  *  In some cases, the sub system publishing the event knows exactly
  *  when a specific event occurred, typically true when the event
  *  is being generated by mining a log.  In such cases, the occurrence
  *  time is passed in by using this method.
  * @param severity_level The event severity. Valid values are below (NUMBER)
  *  FATAL(32),
  *  CRITICAL(16),
  *  WARNING(8),
  *  MINOR_WARNING(4),
  *  INFORMATIONAL(2),
  *  CLEAR(0);
  * @param is_auto_close Used to set if an event is auto closed by the system,
  *  or it has to be manually closed by users. In most cases, the source system
  *  publishing a event with a severity like warning or critical is also able 
  *  to raise a corresponding event with clear severity  when the situation is 
  *  fixed. This is called auto close and is the default behavior.
  *  numeric value 1 is for auto_close=true, and 0 is for auto_close=false
  *  In some cases, where the source system is only capable of reporting the
  *  problems, but is unable to detect the clearing of the problems, the
  *  users would have to manually generate a clear event via the UI to 
  *  indicate that the problem is fixed. For such events, publishers should
  *  set auto close to false.
  * @param display_tz Timezone information in which event information is  
  *  displayed in UI or sent in notifications. 
  *  If this piece of information is not specified during event publishing, 
  *     If this event is target based, 
  *       => target TZ will be used
  *     If this event is not target based, 
  *       => default timezone of UTC will be used
  * @param attributes These are name value pairs of system attributes as well 
  *  as class specific attributes.
  * @see events_receiver_pkgdef.sql for a list of system attributes that can 
  *  be set and passed in during event publishing.
  * @param event_name Used to get the event name which describes the nature of 
  *  the event.
  * @param event_key Used to get the event key which describes the specific 
  *  aspect of the source object the event is reporting on. 
  *  NOTE: This is not currently used and should not be set
  * @param event_msg Used to get the event message indicating the textual 
  *  description about the issue should be specified. The corresponding nls 
  *  values for message translation should also be provided.
  * @param action_msg Used to get action message for the event that helps 
  *  diagnosing the issue as recommendation for the user
  * @param is_adr_aware Set to 1 (true) only for adr event. Otherwise it's 
  *  defaulted to 0(false). this is never needed by any event class owners. 
  *  (this is only for some key internal event classes that deal with ADR
  *  incidents)
  * @param context The context attributes for an event. These are attributes 
  *  that are not common to all events of a given class (see class specific
  *  atribute APIs above), but are specific to an individual event.
  *  There is no previous registration of what these attribute names or 
  *  value data types may be. Typical usage is for a subsystem to publish
  *  additional context about an event which might be useful to an end-user
  *  or an integrator or a integration system.
  *  For example, if an event is raised indicating that a tablespace % usage
  *  is above 80%, it may have an additional event context attribute to
  *  indicate that the size of this tablespace is 4 GB and there is .8GB left. 
  * @param categories The category(one or more) the event belongs to. While 
  *  category is not a required element, the entire UI is oriented on categories
  *  so please ensure that you set the event category unless there is a clear 
  *  exception. The list of categories supported is documented on SMP Internal 
  *  wiki as this is a changing list.
  * @param deduplicate_data Needed for event which supports deduplication.
  * @param processing hints These are processing hints used for driving
  *  specific behavior while publishing events. In most case, the value of the
  *  hint is not relevant. The specific hints supported are documented
  *  in the GC_EVENT_RECEIVER package.
  */
CREATE OR REPLACE TYPE gc_event_publish_obj AS OBJECT (
  event_class          VARCHAR2(20),
  source_obj           GC_EVENT_SOURCE_INFO,
  target_guid          RAW(16),
  reported_date        DATE,
  occurrence_date      DATE,
  severity             NUMBER(2),
  is_auto_close        NUMBER(1),
  display_tz           VARCHAR2(64),
  event_name           VARCHAR2(512),
  event_key            VARCHAR2(2000),
  event_msg            GC_EV_MSG_INFO,
  action_msg           GC_EV_MSG_INFO,
  is_adr_aware         NUMBER(1),
  class_attributes     GC_EVENT_PAIR_ARRAY,
  context_data         GC_EVENT_CONTEXT_ARRAY,
  categories           MGMT_SHORT_STRING_ARRAY,
  deduplicate_data     GC_EVENT_DUPLICATE_INFO,
  processing_hints     GC_EVENT_PAIR_ARRAY,
 CONSTRUCTOR FUNCTION gc_event_publish_obj (
  p_event_class          IN VARCHAR2,
  p_source_obj           IN GC_EVENT_SOURCE_INFO,
  p_target_guid          IN RAW DEFAULT NULL,
  p_reported_date        IN DATE,
  p_occurrence_date      IN DATE DEFAULT NULL,
  p_severity_level       IN NUMBER,
  p_is_auto_close        IN NUMBER DEFAULT 1,
  p_display_tz           IN VARCHAR2 DEFAULT NULL,
  p_event_name           IN VARCHAR2,
  p_event_key            IN VARCHAR2 DEFAULT NULL,
  p_event_msg            IN GC_EV_MSG_INFO,
  p_action_msg           IN GC_EV_MSG_INFO DEFAULT NULL,
  p_is_adr_aware         IN NUMBER DEFAULT 0,
  p_class_attributes     IN GC_EVENT_PAIR_ARRAY,
  p_context_data         IN GC_EVENT_CONTEXT_ARRAY DEFAULT NULL,
  p_categories           IN MGMT_SHORT_STRING_ARRAY DEFAULT NULL,
  p_deduplicate_data     IN GC_EVENT_DUPLICATE_INFO DEFAULT NULL,
  p_processing_hints     IN GC_EVENT_PAIR_ARRAY DEFAULT NULL
 ) 
 RETURN SELF AS RESULT
) NOT FINAL ;
/

grant execute on gc_event_publish_obj  to sysman;

create or replace noneditionable synonym SYSMAN.gc_event_publish_obj for gc_event_publish_obj;


ALTER SESSION SET CURRENT_SCHEMA=SYSMAN;



