DBA Data[Home] [Help]

PACKAGE: APPS.WF_CORE

Source


1 package WF_CORE AUTHID DEFINER as
2 /* $Header: wfcores.pls 120.15.12020000.4 2013/04/09 17:21:16 skandepu ship $ */
3 /*#
4  * Provides APIs that can be called by an application
5  * program or workflow function in the runtime phase
6  * to handle error processing.
7  * @rep:product OWF
8  * @rep:displayname Workflow Core
9  * @rep:lifecycle active
10  * @rep:compatibility S
11  * @rep:category BUSINESS_ENTITY WF_ENGINE
12  * @rep:ihelp FND/@wfcore See the related online help
13  */
14 
15 --
16 -- CONN_TAG_WF
17 --  This is the connection tag identificator for workflow module
18 -- CONN_TAG_BES
19 --  This is the connection tag identificator for business events
20 CONN_TAG_WF varchar2(2):='wf';
21 CONN_TAG_BES varchar2(3):='bes';
22 
23 
24 --
25 -- SESSION_LEVEL
26 --   The protection level at which this session is operating
27 --
28 session_level   NUMBER := 10;
29 
30 --
31 -- UPLOAD_MODE
32 --   Mode to upload data
33 -- Valid values are:
34 --   UPGRADE - honor both protection and customization levels of data
35 --   UPLOAD - honor only protection level of data
36 --   FORCE - force upload regardless of protection or customization level
37 --
38 upload_mode VARCHAR2(8) := 'UPGRADE';
39 
40 --
41 -- ERROR_XXX - error message variables
42 --   When a workflow error occurs, these variables will be populated
43 --   with all available information about the problem
44 --
45 error_name      VARCHAR2(30);
46 error_number    NUMBER;
47 error_message   VARCHAR2(2000);
48 error_stack     VARCHAR2(32000);
49 
50 
51 
52 /*
53 ** Create a global plsql variable that stores the current item
54 ** type when uploading an item.  This is used by the generic
55 ** loader overlay because the primary key of the wf_item_types
56 ** table is :NAME and the primary key for the wf_item_attributes
57 ** table is :NAME and item_type but the item_type comes from th
58 ** :NAME value in the loader definition
59 */
60 upload_placeholder    VARCHAR2(30) := NULL;
61 
62 -- Local_CS
63 --
64 -- Local CharacterSet
65 LOCAL_CS        VARCHAR2(30) := NULL;
66 
67 -- Newline in local CharacterSet
68 LOCAL_CS_NL     VARCHAR2(30) := NULL;
69 
70 -- Tab in local CharacterSet
71 LOCAL_CS_TB     VARCHAR2(30) := NULL;
72 
73 -- Carriage Return in local CharacterSet
74 LOCAL_CS_CR     VARCHAR2(30) := NULL;
75 
76 -- Bug 3945469
77 -- Create two global plsql variables to store the database major version
78 --   and the value of aq_tm_processes
79 G_ORACLE_MAJOR_VERSION	NUMBER;
80 G_AQ_TM_PROCESSES	VARCHAR2(512) ;
81 
82 --
83 -- Canonical Format Masks
84 --
85 -- Copied from FND_NUMBER and FND_DATE packages.
86 --
87 canonical_date_mask VARCHAR2(26) := 'YYYY/MM/DD HH24:MI:SS';
88 canonical_number_mask VARCHAR2(100) := 'FM999999999999999999999.99999999999999999999';
89 
90 /*
91 ** Implements the Hash Key Method
92 */
93 HashBase               NUMBER := 1;
94 HashSize               NUMBER := 16777216;  -- 2^24
95 
96 -- HashKey
97 -- Generate the Hash Key for a string
98 FUNCTION HashKey (p_HashString in varchar2) return number;
99 
100 --
101 -- Clear
102 --   Clear the error buffers.
103 -- EXCEPTIONS
104 --   none
105 --
106 /*#
107  * Clears the error buffer.
108  * @rep:lifecycle active
109  * @rep:displayname Clear
110  * @rep:ihelp FND/@wfcore#a_clear See the related online help
111  */
112 procedure Clear;
113 pragma restrict_references(CLEAR, WNDS, RNDS, RNPS);
114 
115 --
116 -- Get_Error
117 --   Return current error info and clear error stack.
118 --   Returns null if no current error.
119 --
120 -- IN
121 --   maxErrStackLength - Maximum length of error_stack to return - number
122 --
123 -- OUT
124 --   error_name - error name - varchar2(30)
125 --   error_message - substituted error message - varchar2(2000)
126 --   error_stack - error call stack, truncated if needed  - varchar2(2000)
127 -- EXCEPTIONS
128 --   none
129 --
130 /*#
131  * Returns the internal name of the current error message
132  * and the token substituted error message. The procedure
133  * also clears the error stack. A null value is returned
134  * if there is no current error.
135  * @param err_name Error Name
136  * @param err_message Error Message
137  * @param err_stack Error Stack
138  * @param maxErrStackLength Maximum length of error stack to return
139  * @rep:lifecycle active
140  * @rep:displayname Get Error
141  * @rep:ihelp FND/@wfcore#a_geterr See the related online help
142  */
143 procedure Get_Error(err_name out nocopy varchar2,
144                     err_message out nocopy varchar2,
145                     err_stack out nocopy varchar2,
146                     maxErrStackLength in number default 4000);
147 pragma restrict_references(GET_ERROR, WNDS, RNDS);
148 
149 --
150 -- Token
151 --   define error token
152 -- IN
153 --   token_name  - name of token
154 --   token_value - token value
155 -- EXCEPTIONS
156 --   none
157 --
158 /*#
159  * Defines an error token and substitutes it with a value
160  * for use in a predefined workflow error message.
161  * @param token_name Token  Name
162  * @param token_value Token Value
163  * @rep:lifecycle active
164  * @rep:displayname Token
165  * @rep:ihelp FND/@wfcore#a_token See the related online help
166  */
167 procedure Token(token_name  in varchar2,
168                 token_value in varchar2);
169 pragma restrict_references(TOKEN, WNDS, RNDS);
170 
171 --
172 -- Substitute
173 --   Return substituted message string, with exception if not found
174 -- IN
175 --   mtype - message type (WFERR, WFTKN, etc)
176 --   mname - message internal name
177 -- EXCEPTIONS
178 --   Raises an exception if message is not found.
179 --
180 function Substitute(mtype in varchar2, mname in varchar2)
181 return varchar2;
182 
183 --
184 -- Translate
185 --   Get substituted message string
186 -- IN
187 --   tkn_name - Message name (must be WFTKN)
188 -- RETURNS
189 --   Translated value of string token
190 --
191 /*#
192  * Translates the string value of an error token
193  * by returning the language-specific value for
194  * the token defined in the WF_RESOURCES table for
195  * the current language setting.
196  * @param tkn_name Token Name
197  * @return Translated token value
198  * @rep:lifecycle active
199  * @rep:displayname Translate
200  * @rep:ihelp FND/@wfcore#a_transl See the related online help
201  */
202 function Translate (tkn_name in varchar2)
203 return varchar2;
204 pragma restrict_references(TRANSLATE, WNDS);
205 
206 --
207 -- Raise
208 --   Raise an exception to the caller
209 -- IN
210 --   error_name - error name (must be WFERR)
211 -- EXCEPTIONS
212 --   Raises an a user-defined (20002) exception with the error message.
213 --
214 /*#
215  * Raises a predefined workflow exception to the calling
216  * application by supplying a correct error number and
217  * token substituted message for the specified internal
218  * error message name.
219  * @param name  Name
220  * @rep:lifecycle active
221  * @rep:displayname Raise
222  * @rep:ihelp FND/@wfcore#a_raise See the related online help
223  */
224 procedure Raise(name in varchar2);
225 
226 --
227 -- Context
228 --   set procedure context (for stack trace)
229 -- IN
230 --   pkg_name   - package name
231 --   proc_name  - procedure/function name
232 --   arg1       - first IN argument
233 --   argn       - n'th IN argument
234 -- EXCEPTIONS
235 --   none
236 --
237 /*#
238  * Adds an entry to the error stack to provide context
239  * information that helps locate the source of an error.
240  * Use this procedure with predefined errors raised by
241  * calls to TOKEN( ) and RAISE( ), with custom-defined
242  * exceptions, or even without exceptions whenever an error
243  * condition is detected.
244  * @param pkg_name Package  Name
245  * @param proc_name Procedure Name
246  * @param arg1  Argument 1
247  * @param arg2  Argument 2
248  * @param arg3  Argument 3
249  * @param arg4  Argument 4
250  * @param arg5  Argument 5
251  * @param arg6  Argument 6
252  * @param arg7  Argument 7
253  * @param arg8  Argument 8
254  * @param arg9  Argument 9
255  * @param arg10 Argument 10
256  * @rep:lifecycle active
257  * @rep:displayname Context
258  * @rep:ihelp FND/@wfcore#a_context See the related online help
259  */
260 procedure Context(pkg_name  in varchar2,
261                   proc_name in varchar2,
262                   arg1      in varchar2 default '*none*',
263                   arg2      in varchar2 default '*none*',
264                   arg3      in varchar2 default '*none*',
265                   arg4      in varchar2 default '*none*',
266                   arg5      in varchar2 default '*none*',
267                   arg6      in varchar2 default '*none*',
268                   arg7      in varchar2 default '*none*',
269                   arg8      in varchar2 default '*none*',
270                   arg9      in varchar2 default '*none*',
271                   arg10      in varchar2 default '*none*');
272 pragma restrict_references(CONTEXT, WNDS);
273 
274 --
275 -- RANDOM
276 --   Return a random string
277 -- RETURNS
278 --   A random string, max 80 characters
279 --
280 function RANDOM
281 return varchar2;
282 -- pragma restrict_references(RANDOM, WNDS);
283 
284 --
285 -- ACTIVITY_RESULT
286 --	Return the meaning of an activities result_type
287 --	Including standard engine codes
288 -- IN
289 --   LOOKUP_TYPE
290 --   LOOKUP_CODE
291 --
292 -- RETURNS
293 --   MEANING
294 --
295 function activity_result( result_type in varchar2, result_code in varchar2) return varchar2;
296 pragma restrict_references(ACTIVITY_RESULT, WNDS, WNPS, RNPS);
297 --
298 --
299 --
300 -- GetResource
301 --   Called by WFResourceManager.class. Used by the Monitor and Lov Applet.
302 --   fetch A resource from wf_resource table.
303 -- IN
304 -- x_restype
305 -- x_resname
306 
307 procedure GetResource(x_restype varchar2,
308                       x_resname varchar2);
309 --
310 -- GetResources
311 --   Called by WFResourceManager.class. Used by the Monitor and Lov Applet.
312 --   fetch some resources from wf_resource table that match the respattern.
313 -- IN
314 -- x_restype
315 -- x_respattern
316 procedure GetResources(x_restype varchar2,
317                        x_respattern varchar2);
318 
319 -- *** Substitue HTML Characters ****
320 --function SubstituteSpecialChars
321 
322 /*#
323  * Substitutes HTML character entity references for special characters in
324  * a text string and returns the modified text including the substitutions.
325  * You can use this function as a security precaution when creating a PL/SQL
326  * document or a PL/SQL CLOB document that contains HTML, to ensure that only
327  * the HTML code you intend to include is executed.
328  * @param some_text Text string with HTML characters
329  * @return String with HTML characters substituted with HTML codes
330  * @rep:lifecycle active
331  * @rep:displayname Substitute HTML Special Characters
332  * @rep:compatibility S
333  * @rep:ihelp FND/@a_subsc See the related online help
334  */
335 function SubstituteSpecialChars(some_text in varchar2)
336 return varchar2;
337 pragma restrict_references(SubstituteSpecialChars,WNDS);
338 
339 -- *** Special Char functions ***
340 
341 -- Local_Chr
342 --   Return specified character in current codeset
343 -- IN
344 --   ascii_chr - chr number in US7ASCII
345 function Local_Chr(
346   ascii_chr in number)
347 return varchar2;
348 pragma restrict_references (LOCAL_CHR, WNDS);
349 
350 -- Newline
351 --   Return newline character in current codeset
352 function Newline
353 return varchar2;
354 pragma restrict_references (NEWLINE, WNDS);
355 
356 -- Tab
357 --   Return tab character in current codeset
358 function Tab
359 return varchar2;
360 pragma restrict_references (TAB, WNDS);
361 
362 -- CR - CarriageReturn
363 --   Return CR character in current codeset.
364 function CR
365 return varchar2;
366 
367 --
368 -- CheckIllegalChars (PRIVATE)
369 -- IN
370 --   p_text - text to be checked
371 --   p_raise_exception - raise exception if true
372 -- RET
373 --   Return true if illegal character exists
374 function CheckIllegalChars(p_text varchar2, p_raise_exception boolean, p_illegal_charset varchar2 default null)
375 return boolean;
376 
377 procedure InitCache;
378 
379   -- Bug 7578908. Phase 1 default values for NLS parameters
380   -- Strictly to be used by WF only.
381   FUNCTION nls_date_format   RETURN varchar2;
382   FUNCTION nls_date_language RETURN varchar2;
383   FUNCTION nls_calendar      RETURN varchar2;
384   FUNCTION nls_sort         RETURN varchar2;
385   FUNCTION nls_currency      RETURN varchar2;
386   FUNCTION nls_numeric_characters RETURN varchar2;
387   FUNCTION nls_language RETURN varchar2;
388   FUNCTION nls_territory RETURN varchar2;
389   procedure initializeNLSDefaults;
390 
391   --
392   -- Tag_DB_Session (PRIVATE)
393   -- Used by the different WF Engine entry points to tag the current session
394   -- as per the Connection tag initiative described in bug 9370420
395   -- This procedure checks for the user and application id. If they are not
396   -- set then it means the context is not set.
397   --
401   ** PUBLIC
398   procedure TAG_DB_SESSION(p_module_type varchar, p_action varchar2);
399 
400   /*
402   ** get_database_default_edition - this function retrieves the database's
403   ** default edition from dictionary view DATABASE_PROPERTIES so that both
404   ** Java and PLSQL BES determines how to process business event systems
405   ** raised during patching time
406   */
407   function database_default_edition return varchar2;
408 
409   /*
410   ** PUBLIC
411   ** database_current_edition - this function retrieves the current session's
412   ** edition from sys_context('userenv', 'CURRENT_EDITION_NAME') for
413   ** Java and PLSQL BES to determine how to process business event systems
414   ** raised during patching time
415   */
416   function database_current_edition return varchar2;
417 
418 --
419 -- getDedicatedComponentsCorrIds
420 -- ER 16593551: Gets the correlation Ids of all dedicated components belongs
421 -- to specified agent and return as comma separated values
422 -- IN
423 --   p_agent_name  -- agent name
424 --   p_schemaName  -- schema name
425 -- RETURNS
426 --   boolean
427 --
428   function getDedicatedComponentsCorrIds(p_agent_name in varchar2,
429                                          p_schemaName in varchar2)
430   return varchar2 RESULT_CACHE;
431 
432 --
433 -- matchCorrId
434 -- ER 16593551: Checks that the given message corrId matches with the any one of the
435 -- dedicated components corrId list and returns 0 if it matches, otherwise returns 1
436 -- IN
437 --   p_msgCorrId    -- message correlation Id
438 --   p_corrId_list  -- dedicated components correlation Ids list
439 -- RETURNS
440 --   number
441 --
442 function matchCorrId(p_msgCorrId in varchar2,
443 	               p_corrId_list in varchar2)
444 return number RESULT_CACHE;
445 
446 
447 end WF_CORE;