1 package FND_EVENT AUTHID CURRENT_USER as
2 /* $Header: AFAMEVTS.pls 120.2 2005/08/19 18:23:35 tkamiya ship $ */
3
4
5
6 -- Name : initialize
7 -- Description:
8 -- initialize sets the context for the event.
9 -- One has to call initialize before calling fnd_event.post.
10 -- Returns event_id if successfull otherwise 0.
11 -- Arguments:
12 -- source_application_id -
13 -- source_type - 'M'(manager)/'R'(Request)
14 -- source_id - concurrent_process_id/concurrent_request_id
15 -- dest_type - destination type
16 -- message_appl_short_name
17 -- - application short name of the message
18 -- name - message name
19 -- severity - ERROR/WARNING/FATAL
20 -- module - source module name
21 --
22
23 FUNCTION initialize(source_application_id IN NUMBER default 0,
24 source_type IN VARCHAR2,
25 source_id IN NUMBER,
26 dest_type IN VARCHAR2 default '0',
27 message_appl_short_name IN VARCHAR2,
28 name IN VARCHAR2,
29 severity IN VARCHAR2 default 'WARNING',
30 module IN VARCHAR2 default Null) return number;
31
32 -- Name : set_token
33 -- Description:
34 -- It sets the token name and token value.
35 -- Call this procedure for each token you have for a event.
36 -- call initialize before calling set_token
37 -- Arguments:
38 -- event_id - event_id value for which you are setting the token.
39 -- token - token name
40 -- value - token value
41 -- type - 'C' = Constant. Value is used directly in the token
42 -- substitution.
43 -- 'S' = Select. Value is a SQL statement which returns a single
44 -- varchar2 value. (e.g. A translated concurrent
45 -- manager name.) This statement is run when the
46 -- even is retrieved, and the result is used in
47 -- the token substitution.
48 -- 'T' = Translate. Value is a message name. This message must
49 -- belong to the same application as the
50 -- message specified in the INITIALIZE function.
51 -- The message text will be used in the token
52 -- substitution.
53
54
55 PROCEDURE set_token(event_id IN number,
56 token IN VARCHAR2,
57 value IN VARCHAR2 default NULL,
58 type IN VARCHAR2 default 'C');
59 -- Name : post
60 -- Description:
61 -- It inserts the cp_event into fnd_events table, fnd_event_tokens
62 -- Call this function after calling initialize and optionally set_token.
63 -- If successfull it returns TRUE else returns FALSE.
64 -- Arguments: event_id - event_id for which you want to post events.
65
66 FUNCTION post (event_id IN number )
67 return boolean;
68
69
70 -- Name : get
71 -- Description:
72 -- Gets the event for a given source_id, source_type.
73 -- Also returns the # of unprocessed events that match
74 -- the source_id and source_type.
75 -- Be cautious while using this procedure in while or for loops.
76 -- It may lead to infinite loop.
77 -- Stop calling this procedure when you get remaining events = 0 for a
78 -- given source_id and source_type.
79 -- If successfull returns event_id else returns 0.
80 -- Arguments:
81 -- source_id - event source id, IN parameter
82 -- source_type - event source type, IN parameter
83 -- event_string - event message, OUT parameter
84 -- remaining - Number of unprocessed events that match the source_id
85 -- and source_type. OUT parameter
86
87 FUNCTION get ( source_id IN number,
88 source_type IN varchar2,
89 processed IN boolean default FALSE,
90 message IN OUT NOCOPY varchar2,
91 remaining IN OUT NOCOPY number) return boolean;
92
93
94 --
95 -- Name
96 -- OEM_GET
97 --
98 -- Purpose
99 -- Retrieves the next unprocessed event with a destination type
100 -- of 'O' from the fnd_events table. The retrieved event is marked
101 -- as processed.
102 --
103 -- Arguments
104 -- event_text - Text of the event. (out)
105 -- Buffer must be at least 2000 bytes.
106 -- event_time - Date/time of event posting.
107 -- event_severity - 'WARNING' or 'ERROR'
108 --
109 -- Returns
110 -- 0 - There are no unprocessed OEM events.
111 -- 1 - An event was successfully retrieved.
112 -- 2 - Error. The event_text parameter will contain
113 -- the error message.
114 --
115 -- Notes
116 -- Error messages are returned in the event_text paramter.
117 --
118 function oem_get ( event_text out NOCOPY varchar2,
119 event_time out NOCOPY date,
120 event_severity out NOCOPY varchar2 ) return number;
121
122 -- New function to retrieve the event text, given the id
123 function oem_get_text ( event_id in number ) return varchar2;
124
125 -- New function to set an event as processed
126 function oem_set_processed ( event_id in number ) return number;
127
128 end FND_EVENT;