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