DBA Data[Home] [Help]

PACKAGE BODY: APPS.FND_MESSAGE_CACHE

Source


1 package body FND_MESSAGE_CACHE as
2 /* $Header: AFNCMSGB.pls 120.2 2005/10/26 03:26:48 skghosh noship $ */
3 
4 
5     TYPE MSG_TABLE      IS TABLE OF VARCHAR2(2000) INDEX BY BINARY_INTEGER;
6     TYPE MSG_NAME_TABLE IS TABLE OF VARCHAR2(30) INDEX BY BINARY_INTEGER;
7     TYPE MSG_NUMBER_TABLE IS TABLE OF NUMBER(9) INDEX BY BINARY_INTEGER;
8 
9     MSGNAME varchar2(30);
10     MSGDATA varchar2(32000);
11     MSGSET  boolean := FALSE;
12     MSGAPP  varchar2(50);
13 
14     CacheTab  MessageTAB ;
15     TABLE_SIZE binary_integer :=0;
16     MAX_TABLE_SIZE binary_integer :=10;
17 
18     procedure SET_NAME(APPLICATION in varchar2, NAME in varchar2) is
19     begin
20         FND_MESSAGE.SET_NAME(APPLICATION,NAME);
21     end;
22 
23     /*
24     **  ### OVERLOADED (original version) ###
25     **
26     **	SET_TOKEN - define a message token with a value,
27     **              either constant or translated
28     **  Public:  This procedure to be used by all
29     */
30     procedure SET_TOKEN(TOKEN in varchar2,
31                         VALUE in varchar2,
32                         TRANSLATE in boolean default false) is
33     begin
34        FND_MESSAGE.SET_TOKEN(TOKEN,VALUE,TRANSLATE);
35     end set_token;
36 
37     /*
38     ** SET_TOKEN_SQL - define a message token with a SQL query value
39     **
40     ** Description:
41     **   Like SET_TOKEN, except here the value is a SQL statement which
42     **   returns a single varchar2 value.  (e.g. A translated concurrent
43     **   manager name.)  This statement is run when the message text is
44     **   resolved, and the result is used in the token substitution.
45     **
46     ** Arguments:
47     **   token - Token name
48     **   value - Token value.  A SQL statement
49     **
50     */
51     procedure SET_TOKEN_SQL (TOKEN in varchar2,
52                              VALUE in varchar2) is
53     begin
54         FND_MESSAGE.SET_TOKEN_SQL(TOKEN,VALUE);
55     end set_token_sql;
56 
57     /* This procedure is only to be called by the ATG; */
58     /*  not for external use */
59     procedure RETRIEVE(MSGOUT OUT NOCOPY varchar2) is
60     begin
61        FND_MESSAGE.RETRIEVE(MSGOUT);
62     end;
63 
64     procedure CLEAR is
65     begin
66        FND_MESSAGE.CLEAR;
67     end;
68 
69     procedure RAISE_ERROR is
70     begin
71        FND_MESSAGE.RAISE_ERROR;
72     end;
73 
74     /*
75     **	GET_STRING- get a particular translated message
76     **       from the message dictionary database.
77     **
78     **  This is a one-call interface for when you just want to get a
79     **  message without doing any token substitution.
80     **  Returns NAMEIN (Msg name)  if the message cannot be found.
81     */
82     function GET_STRING(APPIN in varchar2,
83 	      NAMEIN in varchar2) return varchar2 is
84      begin
85        return FND_MESSAGE.GET_STRING(APPIN, NAMEIN);
86      end;
87 
88     /*
89     **	FETCH_SQL_TOKEN- get the value for a SQL Query token
90     **     This procedure is only to be called by the ATG
91     **     not for external use
92     */
93     function FETCH_SQL_TOKEN(TOK_VAL in varchar2) return varchar2 is
94       token_text  varchar2(2000);
95     begin
96          return FND_MESSAGE.FETCH_SQL_TOKEN(TOK_VAL);
97     end;
98 
99     /*
100     **	GET_NUMBER- get the message number of a particular message.
101     **
102     **  This routine returns only the message number, given a message
103     **  name.  This routine will be only used in rare cases; normally
104     **  the message name will get displayed automatically by message
105     **  dictionary when outputting a message on the client.
106     **
107     **  You should _not_ use this routine to construct a system for
108     **  storing translated messages (along with numbers) on the server.
109     **  If you need to store translated messages on a server for later
110     **  display on a client, use the set_encoded/get_encoded routines
111     **  to store the messages as untranslated, encoded messages.
112     **
113     **  If you don't know the name of the message on the stack, you
114     **  can use get_encoded and parse_encoded to find it out.
115     **
116     **  Returns 0 if the message has no message number,
117     **         or if its message number is zero.
118     **       NULL if the message can't be found.
119     */
120     function GET_NUMBER(APPIN in varchar2,
121 	      NAMEIN in varchar2) return NUMBER is
122     begin
123 	return  FND_MESSAGE.GET_NUMBER(APPIN,NAMEIN);
124     end;
125 
126 
127 
128     /*
129     **	GET- get a translated and token substituted message
130     **       from the message dictionary database.
131     **       Returns NULL if the message cannot be found.
132     */
133     function GET return varchar2 is
134         MSG       varchar2(2000);
135 	TOK_NAM   varchar2(30);
136 	TOK_VAL   varchar2(2000);
137 	SRCH      varchar2(2000);
138         TTYPE     varchar2(1);
139         POS       NUMBER;
140 	NEXTPOS   NUMBER;
141 	DATA_SIZE NUMBER;
142     begin
143         return FND_MESSAGE.GET;
144     end;
145 
146     function GET_ENCODED return varchar2 is
147     begin
148         return FND_MESSAGE.GET_ENCODED;
149     end;
150 
151 
152     /*
153     ** SET_ENCODED- Set an encoded message onto the message stack
154     */
155     procedure SET_ENCODED(ENCODED_MESSAGE IN varchar2) is
156     begin
157          FND_MESSAGE.SET_ENCODED(ENCODED_MESSAGE);
158     end;
159 
160 
161     /*
162     ** PARSE_ENCODED- Parse the message name and application short name
163     **                out of a message in "encoded" format.
164     */
165     procedure PARSE_ENCODED(ENCODED_MESSAGE IN varchar2,
166 			APP_SHORT_NAME  OUT NOCOPY varchar2,
167 			MESSAGE_NAME    OUT NOCOPY varchar2) is
168     begin
169         FND_MESSAGE.PARSE_ENCODED(ENCODED_MESSAGE,
170                                   APP_SHORT_NAME,
171                                   MESSAGE_NAME);
172     end;
173 
174     /*
175     **	GET_TOKEN- Obtains the value of a named token from the
176     **             current message.
177     */
178     function GET_TOKEN(TOKEN IN VARCHAR2
179             ,REMOVE_FROM_MESSAGE IN VARCHAR2 default NULL /* NULL means 'N'*/
180             ) return varchar2 is
181     begin
182           return FND_MESSAGE.GET_TOKEN(TOKEN,REMOVE_FROM_MESSAGE);
183     end;
184 
185 end fnd_message_cache;
186