[Home] [Help]
PACKAGE BODY: APPS.WF_EVENTS_PKG
Source
1 package body WF_EVENTS_PKG as
2 /* $Header: WFEVEVTB.pls 120.11 2008/02/15 09:35:21 sstomar ship $ */
3 m_table_name varchar2(255) := 'WF_EVENTS';
4 m_package_version varchar2(30) := '1.0';
5
6 m_null varchar2(10) := '*NULL*';
7
8 procedure fetch_custom_level(X_GUID in raw,
9 X_CUSTOMIZATION_LEVEL out nocopy varchar2);
10
11 procedure INSERT_ROW (
12 X_ROWID in out nocopy varchar2,
13 X_GUID in raw,
14 X_NAME in varchar2,
15 X_TYPE in varchar2,
16 X_STATUS in varchar2,
17 X_GENERATE_FUNCTION in varchar2,
18 X_OWNER_NAME in varchar2,
19 X_OWNER_TAG in varchar2,
20 X_DISPLAY_NAME in varchar2,
21 X_DESCRIPTION in varchar2,
22 X_CUSTOMIZATION_LEVEL in varchar2,
23 X_LICENSED_FLAG in varchar2,
24 X_JAVA_GENERATE_FUNC in varchar2,
25 X_IREP_ANNOTATION in varchar2
26 ) is
27 cursor C is select rowid from wf_events where guid = X_GUID;
28 l_licensed_flag varchar2(1);
29 begin
30 l_licensed_flag := is_product_licensed (X_OWNER_TAG);
31 insert into wf_events (
32 guid,
33 name,
34 type,
35 status,
36 generate_function,
37 owner_name,
38 owner_tag,
39 customization_level,
40 licensed_flag,
41 java_generate_func,
42 irep_annotation
43 ) values (
44 X_GUID,
45 X_NAME,
46 X_TYPE,
47 X_STATUS,
48 X_GENERATE_FUNCTION,
49 X_OWNER_NAME,
50 X_OWNER_TAG,
51 X_CUSTOMIZATION_LEVEL,
52 l_licensed_flag,
53 X_JAVA_GENERATE_FUNC,
54 X_IREP_ANNOTATION
55 );
56
57 insert into wf_events_tl (
58 guid,
59 language,
60 display_name,
61 description,
62 source_lang)
63 select X_GUID,
64 L.CODE,
65 X_DISPLAY_NAME,
66 X_DESCRIPTION,
67 userenv('LANG')
68 from wf_languages l
69 where l.installed_flag = 'Y'
70 and not exists
71 (select null
72 from wf_events_tl t
73 where t.guid = X_GUID
74 and t.language = l.code);
75
76 open c;
77 fetch c into X_ROWID;
78 if (c%notfound) then
79 close c;
80 raise no_data_found;
81 else
82 wf_event.raise('oracle.apps.wf.event.event.create',x_guid);
83 end if;
84 close c;
85 exception
86 when others then
87 wf_core.context('Wf_Events_Pkg', 'Insert_Row', x_guid, x_name, x_type);
88 raise;
89 end INSERT_ROW;
90 ----------------------------------------------------------------------------
91 procedure UPDATE_ROW (
92 X_GUID in raw,
93 X_NAME in varchar2,
94 X_TYPE in varchar2,
95 X_STATUS in varchar2,
96 X_GENERATE_FUNCTION in varchar2,
97 X_OWNER_NAME in varchar2,
98 X_OWNER_TAG in varchar2,
99 X_DISPLAY_NAME in varchar2,
100 X_DESCRIPTION in varchar2,
101 X_CUSTOMIZATION_LEVEL in varchar2,
102 X_LICENSED_FLAG in varchar2,
103 X_JAVA_GENERATE_FUNC in varchar2,
104 X_IREP_ANNOTATION in varchar2
105 ) is
106 l_custom_level varchar2(1);
107 l_update_allowed varchar2(1);
108 l_licensed_flag varchar2(1);
109 l_raise_event_flag varchar2(1) := 'N';
110
111 CURSOR c_getguid(p_name in varchar2) IS
112 SELECT guid
113 FROM wf_events
114 WHERE name = p_name;
115
116 l_guid raw(16);
117
118 begin
119
120 open c_getguid(x_name);
121 fetch c_getguid into l_guid;
122 if (c_getguid%notfound) then
123 l_guid := x_guid;
124 end if;
125 close c_getguid;
126
127 l_licensed_flag := is_product_licensed (X_OWNER_TAG);
128
129 if g_Mode = 'FORCE' then
130 update wf_events set
131 name = X_NAME,
132 type = X_TYPE,
133 status = X_STATUS,
134 generate_function = X_GENERATE_FUNCTION,
135 owner_name = X_OWNER_NAME,
136 owner_tag = X_OWNER_TAG,
137 licensed_flag = l_licensed_flag,
138 customization_level = X_CUSTOMIZATION_LEVEL,
139 java_generate_func = X_JAVA_GENERATE_FUNC,
140 irep_annotation = X_IREP_ANNOTATION
141 where guid = l_guid;
142
143 update wf_events_tl set
144 display_name = X_DISPLAY_NAME,
145 description = X_DESCRIPTION,
146 source_lang = userenv('LANG')
147 where guid = l_guid
148 and userenv('LANG') in (language, source_lang);
149
150 if (sql%notfound) then
151 raise no_data_found;
152 else
153 -- Only raise if all if no no_data_found
154 wf_event.raise('oracle.apps.wf.event.event.update',l_guid);
155 end if;
156
157 else
158 -- User logged in is not seed. Its either the UI or the Loader
159 fetch_custom_level(l_guid, l_custom_level);
160 l_update_allowed := is_update_allowed(X_CUSTOMIZATION_LEVEL, l_custom_level);
161
162 if l_update_allowed = 'N' then
163 -- Set up the Error Stack
164 wf_core.context('WF_EVENTS_PKG','UPDATE_ROW',
165 x_name,
166 l_custom_level,
167 X_CUSTOMIZATION_LEVEL);
168 return;
169 end if;
170
171 if X_CUSTOMIZATION_LEVEL = 'C' then
172 if g_Mode = 'UPGRADE' then
173 -- The Loader can update as the Custom Level is C
174 update wf_events set
175 name = X_NAME,
176 type = X_TYPE,
177 status = X_STATUS,
178 generate_function = X_GENERATE_FUNCTION,
179 owner_name = X_OWNER_NAME,
180 owner_tag = X_OWNER_TAG,
181 customization_level = X_CUSTOMIZATION_LEVEL,
182 licensed_flag = l_licensed_flag,
183 java_generate_func = X_JAVA_GENERATE_FUNC,
184 irep_annotation = X_IREP_ANNOTATION
185 where guid = l_guid;
186
187 update wf_events_tl set
188 display_name = X_DISPLAY_NAME,
189 description = X_DESCRIPTION,
190 source_lang = userenv('LANG')
191 where guid = l_guid
192 and userenv('LANG') in (language, source_lang);
193
194 l_raise_event_flag := 'Y';
195 else
196 -- UI users cannot update Core events
197 null;
198
199 end if;
200 elsif X_CUSTOMIZATION_LEVEL = 'L' then
201 if g_Mode = 'UPGRADE' then
202 -- Limit events can have only a status change..
203 -- When the loader is loading the events the
204 -- users changes must be preserved. Update all
205 -- fields EXCEPT the status field.
206 update wf_events set
207 name = X_NAME,
208 type = X_TYPE,
209 generate_function = X_GENERATE_FUNCTION,
210 owner_name = X_OWNER_NAME,
211 owner_tag = X_OWNER_TAG,
212 customization_level = X_CUSTOMIZATION_LEVEL,
213 licensed_flag = l_licensed_flag,
214 java_generate_func = X_JAVA_GENERATE_FUNC,
215 irep_annotation = X_IREP_ANNOTATION
216 where guid = l_guid;
217
218 update wf_events_tl set
219 display_name = X_DISPLAY_NAME,
220 description = X_DESCRIPTION,
221 source_lang = userenv('LANG')
222 where guid = l_guid
223 and userenv('LANG') in (language, source_lang);
224
225 l_raise_event_flag := 'Y';
226 else
227 -- Caller of the Update is the UI
228 -- Limit events can have only a status change..
229 -- When the user is updating the event using the UI
230 -- Updates are allowed ONLY to the status field.
231 update wf_events set
232 status = X_STATUS
233 where guid = l_guid;
234
235 l_raise_event_flag := 'Y';
236 end if;
237 elsif X_CUSTOMIZATION_LEVEL = 'U' then
238 -- Here are the updates allowed for extensible and User defined events
239 -- only when the caller is the UI
240 if g_Mode = 'CUSTOM' then
241 update wf_events set
242 name = X_NAME,
243 type = X_TYPE,
244 status = X_STATUS,
245 generate_function = X_GENERATE_FUNCTION,
246 owner_name = X_OWNER_NAME,
247 owner_tag = X_OWNER_TAG,
248 customization_level = X_CUSTOMIZATION_LEVEL,
249 licensed_flag = l_licensed_flag,
250 java_generate_func = X_JAVA_GENERATE_FUNC,
251 irep_annotation = X_IREP_ANNOTATION
252 where guid = l_guid;
253
254 update wf_events_tl set
255 display_name = X_DISPLAY_NAME,
256 description = X_DESCRIPTION,
257 source_lang = userenv('LANG')
258 where guid = l_guid
259 and userenv('LANG') in (language, source_lang);
260
261 l_raise_event_flag := 'Y';
262 else
263 -- The caller is Loader and the only way of
264 -- Uploading the data is in FORCE mode
265 null;
266 end if;
267 else
268 -- Raise error..
269 Wf_Core.Token('REASON','Invalid Customization Level:' ||
270 l_custom_level);
271 Wf_Core.Raise('WFSQL_INTERNAL');
272 end if;
273
274 -- Only raise if update has succeeded.
275 if (l_raise_event_flag = 'Y') then
276 wf_event.raise('oracle.apps.wf.event.event.update',l_guid);
277 end if;
278
279 end if;
280
281
282 exception
283 when no_data_found then
284 raise;
285 when others then
286 wf_core.context('Wf_Events_Pkg', 'Update_Row', l_guid, x_name, x_type);
287 raise;
288 end UPDATE_ROW;
289 ----------------------------------------------------------------------------
290 procedure DELETE_ROW (
291 X_GUID in raw
292 ) is
293 begin
294 wf_event.raise('oracle.apps.wf.event.event.delete',x_guid);
295
296
297 delete from wf_events_tl where guid = X_GUID;
298
299 if (sql%notfound) then
300 raise no_data_found;
301 end if;
302
303
304 delete from wf_events where guid = X_GUID;
305
306 if (sql%notfound) then
307 raise no_data_found;
308 end if;
309
310 -- Invalidate cache
311 wf_bes_cache.SetMetaDataUploaded();
312 exception
313 when others then
314 wf_core.context('Wf_Events_Pkg', 'Delete_Row', x_guid);
315 raise;
316 end DELETE_ROW;
317 ----------------------------------------------------------------------------
318 procedure LOAD_ROW (
319 X_GUID in raw,
320 X_NAME in varchar2,
321 X_TYPE in varchar2,
322 X_STATUS in varchar2,
323 X_GENERATE_FUNCTION in varchar2,
324 X_OWNER_NAME in varchar2,
325 X_OWNER_TAG in varchar2,
326 X_DISPLAY_NAME in varchar2,
327 X_DESCRIPTION in varchar2,
328 X_CUSTOMIZATION_LEVEL in varchar2,
329 X_LICENSED_FLAG in varchar2,
330 X_JAVA_GENERATE_FUNC in varchar2,
331 X_IREP_ANNOTATION in varchar2
332 ) is
333 row_id varchar2(64);
334 begin
335 begin
336 WF_EVENTS_PKG.UPDATE_ROW (
337 X_GUID => X_GUID,
338 X_NAME => X_NAME,
339 X_TYPE => X_TYPE,
340 X_STATUS => X_STATUS,
341 X_GENERATE_FUNCTION => X_GENERATE_FUNCTION,
342 X_OWNER_NAME => X_OWNER_NAME,
343 X_OWNER_TAG => X_OWNER_TAG,
344 X_DISPLAY_NAME => X_DISPLAY_NAME,
345 X_DESCRIPTION => X_DESCRIPTION,
346 X_CUSTOMIZATION_LEVEL => X_CUSTOMIZATION_LEVEL,
347 X_LICENSED_FLAG => X_LICENSED_FLAG,
348 X_JAVA_GENERATE_FUNC => X_JAVA_GENERATE_FUNC,
349 X_IREP_ANNOTATION => X_IREP_ANNOTATION
350 );
351
352 -- Invalidate cache
353 wf_bes_cache.SetMetaDataUploaded();
354 exception
355 when no_data_found then
356 begin
357 WF_EVENTS_PKG.INSERT_ROW(
358 X_ROWID => row_id,
359 X_GUID => X_GUID,
360 X_NAME => X_NAME,
361 X_TYPE => X_TYPE,
362 X_STATUS => X_STATUS,
363 X_GENERATE_FUNCTION => X_GENERATE_FUNCTION,
364 X_OWNER_NAME => X_OWNER_NAME,
365 X_OWNER_TAG => X_OWNER_TAG,
366 X_DISPLAY_NAME => X_DISPLAY_NAME,
367 X_DESCRIPTION => X_DESCRIPTION,
368 X_CUSTOMIZATION_LEVEL => X_CUSTOMIZATION_LEVEL,
369 X_LICENSED_FLAG => X_LICENSED_FLAG,
370 X_JAVA_GENERATE_FUNC => X_JAVA_GENERATE_FUNC,
371 X_IREP_ANNOTATION => X_IREP_ANNOTATION
372 );
373 exception
374 when DUP_VAL_ON_INDEX then
375 wf_core.token('EVENT',X_NAME);
376 Wf_Core.Raise('WFE_UNIQUE_CONSTRAINT');
377 end;
378 end;
379
380 exception
381 when others then
382 wf_core.context('Wf_Events_Pkg', 'Load_Row', x_guid, x_name, x_type);
383 raise;
384 end LOAD_ROW;
385 ----------------------------------------------------------------------------
386 procedure ADD_LANGUAGE
387 is
388 begin
389 /**
390 Commenting off the costly pl/sql code
391 delete from wf_events_tl t
392 where not exists
393 (select 'baserow'
394 from wf_events b
395 where b.guid = t.guid);
396
397 update wf_events_tl t set (display_name, description)
398 = (select b.display_name, b.description
399 from wf_events_tl b
400 where b.guid = t.guid
401 and b.language = t.source_lang)
402 where (t.guid, t.language) in
403 (select subt.guid,
404 subt.language
405 from wf_events_tl subb, wf_events_tl subt
406 where subb.guid = subt.guid
407 and subb.language = subt.source_lang
408 and (subb.display_name <> subt.display_name
409 or subb.description <> subt.description
410 or (subb.description is null and subt.description is not null)
411 or (subb.description is not null and subt.description is null))
412 );
413
414 **/
415
416 insert into wf_events_tl (
417 guid,
418 language,
419 display_name,
420 description,
421 source_lang)
422 select b.guid,
423 l.code,
424 b.display_name,
425 b.description,
426 b.source_lang
427 from wf_events_tl b, wf_languages l
428 where l.installed_flag = 'Y'
429 and b.language = userenv('LANG')
430 and (b.guid , l.code) NOT IN
431 (select /*+ hash_aj index_ffs(T,WF_EVENTS_TL_U1) */
432 t.guid ,T.LANGUAGE
433 from wf_events_tl T) ;
434 exception
435 when others then
436 wf_core.context('Wf_Events_Pkg', 'Add_language');
437 raise;
438 end ADD_LANGUAGE;
439 ----------------------------------------------------------------------------
440 function GENERATE (
441 X_GUID in raw
442 ) return varchar2 is
443 buf varchar2(32000);
444 l_doc xmldom.DOMDocument;
445 l_element xmldom.DOMElement;
446 l_root xmldom.DOMNode;
447 l_node xmldom.DOMNode;
448 l_header xmldom.DOMNode;
449
450 l_NAME varchar2(240);
451 l_type varchar2(8);
452 l_status varchar2(8);
453 l_generate_function varchar2(240);
454 l_owner_name varchar2(30);
455 l_owner_tag varchar2(30);
456 l_customization_level varchar2(1);
457 l_licensed_flag varchar2(1);
458 l_display_name varchar2(80);
459 l_description varchar2(2000);
460 l_javagenerate varchar2(240);
461 l_irep_annotation varchar2(2000);
462 begin
463 select NAME, TYPE, STATUS, GENERATE_FUNCTION, OWNER_NAME,
464 OWNER_TAG, DISPLAY_NAME, DESCRIPTION, CUSTOMIZATION_LEVEL,
465 LICENSED_FLAG,JAVA_GENERATE_FUNC, IREP_ANNOTATION
466 into L_NAME, L_TYPE, L_STATUS, L_GENERATE_FUNCTION, L_OWNER_NAME,
467 L_OWNER_TAG, L_DISPLAY_NAME, L_DESCRIPTION, l_customization_level,
468 l_licensed_flag,l_javagenerate, l_irep_annotation
469 from wf_events_vl
470 where guid = x_guid;
471
472 l_doc := xmldom.newDOMDocument;
473 l_root := xmldom.makeNode(l_doc);
474 l_root := wf_event_xml.newtag (l_doc, l_root, wf_event_xml.masterTagName);
475 l_header := wf_event_xml.newtag(l_doc, l_root, m_table_name);
476 l_node := wf_event_xml.newtag(l_doc, l_header, wf_event_xml.versionTagName,
477 m_package_version);
478 -- l_node := wf_event_xml.newtag(l_doc, l_header, 'GUID',
479 -- rawtohex(x_GUID));
480 l_node := wf_event_xml.newtag(l_doc, l_header, 'GUID', '#NEW');
481 l_node := wf_event_xml.newtag(l_doc, l_header, 'NAME',
482 l_name);
483 l_node := wf_event_xml.newtag(l_doc, l_header, 'TYPE',
484 l_type);
485 l_node := wf_event_xml.newtag(l_doc, l_header, 'STATUS',
486 l_status);
487 l_node := wf_event_xml.newtag(l_doc, l_header, 'GENERATE_FUNCTION',
488 l_generate_function);
489 l_node := wf_event_xml.newtag(l_doc, l_header, 'OWNER_NAME',
490 l_owner_name);
491 l_node := wf_event_xml.newtag(l_doc, l_header, 'OWNER_TAG',
492 l_owner_tag);
493 l_node := wf_event_xml.newtag(l_doc, l_header, 'CUSTOMIZATION_LEVEL',
494 NVL(l_customization_level, 'L'));
495 l_node := wf_event_xml.newtag(l_doc, l_header, 'LICENSED_FLAG',
496 NVL(l_licensed_flag, 'Y'));
497
498 --Bug 3328673
499 --New tag for loader <JAVA_GENERATE_FUNC> nullable field
500 l_node := wf_event_xml.newtag(l_doc, l_header, 'JAVA_GENERATE_FUNC',
501 l_javagenerate);
502
503 l_node := wf_event_xml.newtag(l_doc, l_header, 'DISPLAY_NAME',
504 l_display_name);
505 l_node := wf_event_xml.newtag(l_doc, l_header, 'DESCRIPTION',
506 l_description);
507
508 if (l_irep_annotation is null) then
509 -- create an annotation template
510 l_irep_annotation := wf_core.newline ||
511 '/*#'||wf_core.newline||
512 ' * '||l_description||wf_core.newline||
513 ' * '||wf_core.newline||
514 ' * @rep:scope public '||wf_core.newline||
515 ' * @rep:displayname '||l_display_name||wf_core.newline||
516 ' * @rep:product '||l_owner_tag||wf_core.newline||
517 ' * @rep:category BUSINESS_ENTITY '||wf_core.newline||
518 ' */'||wf_core.newline;
519
520 elsif (trim(l_irep_annotation) = m_null) then
521 -- event was reviewed for annotation and decided not to be annotated
522 l_irep_annotation := null;
523 end if;
524
525 -- l_node := wf_event_xml.newCDATATag(l_doc, l_header, 'IREP_ANNOTATION', l_irep_annotation);
526 l_node := wf_event_xml.newtag(l_doc, l_header, 'IREP_ANNOTATION', l_irep_annotation);
527
528 xmldom.writeToBuffer(l_root, buf);
529
530 return buf;
531 exception
532 when others then
533 wf_core.context('Wf_Events_Pkg', 'Generate', x_guid);
534 raise;
535 end GENERATE;
536 ----------------------------------------------------------------------------
537 procedure RECEIVE (
538 X_MESSAGE in varchar2
539 ) is
540 l_guid varchar2(32);
541 l_name varchar2(240);
542 l_type varchar2(8);
543 l_status varchar2(8);
544 l_generate_function varchar2(240);
545 l_owner_name varchar2(30);
546 l_owner_tag varchar2(30);
547 l_display_name varchar2(80);
548 l_description varchar2(2000);
549 l_version varchar2(80);
550 l_message varchar2(32000);
551 l_customization_level varchar2(1) := 'L';
552 l_licensed_flag varchar2(1) := 'Y';
553
554 l_node_name varchar2(255);
555 l_node xmldom.DOMNode;
556 l_child xmldom.DOMNode;
557 l_value varchar2(32000);
558 l_length integer;
559 l_node_list xmldom.DOMNodeList;
560 l_javagenerate varchar2(240);
561 l_irep_annotation varchar2(2000);
562 begin
563
564 l_message := x_message;
565 l_message := WF_EVENT_SYNCHRONIZE_PKG.SetGUID(l_message); -- update #NEW
566 l_message := WF_EVENT_SYNCHRONIZE_PKG.SetSYSTEMGUID(l_message); -- update #LOCAL
567 l_message := WF_EVENT_SYNCHRONIZE_PKG.SetSID(l_message); -- update #SID
568
569 l_node_list := wf_event_xml.findTable(l_message, m_table_name);
570 l_length := xmldom.getLength(l_node_list);
571
572 -- loop through elements that we received.
573 for i in 0..l_length-1 loop
574 l_node := xmldom.item(l_node_list, i);
575 l_node_name := xmldom.getNodeName(l_node);
576 if xmldom.hasChildNodes(l_node) then
577 l_child := xmldom.GetFirstChild(l_node);
578 l_value := xmldom.getNodevalue(l_child);
579 else
580 l_value := NULL;
581 end if;
582
583 if(l_node_name = 'GUID') then
584 l_guid := l_value;
585 elsif(l_node_name = 'NAME') then
586 l_NAME := l_value;
587 elsif(l_node_name = 'TYPE') then
588 l_TYPE := l_value;
589 elsif(l_node_name = 'STATUS') then
590 l_STATUS := l_value;
591 elsif(l_node_name = 'GENERATE_FUNCTION') then
592 l_GENERATE_FUNCTION := l_value;
593 elsif(l_node_name = 'OWNER_NAME') then
594 l_OWNER_NAME := l_value;
595 elsif(l_node_name = 'OWNER_TAG') then
596 l_OWNER_TAG := l_value;
597 elsif(l_node_name = 'DISPLAY_NAME') then
598 l_DISPLAY_NAME := l_value;
599 elsif(l_node_name = 'DESCRIPTION') then
600 l_DESCRIPTION := l_value;
601 elsif(l_node_name = 'CUSTOMIZATION_LEVEL') then
602 l_CUSTOMIZATION_LEVEL := l_value;
603 elsif(l_node_name = 'LICENSED_FLAG') then
604 l_LICENSED_FLAG := l_value;
605 elsif(l_node_name = wf_event_xml.versionTagName) then
606 l_version := l_value;
607 elsif(l_node_name = 'JAVA_GENERATE_FUNC') then
608 l_javagenerate := l_value;
609 elsif(l_node_name = 'IREP_ANNOTATION') then
610 -- if empty tags are provided in the WFX the event was reviewed for
611 -- annotation and hence does not require the template next time it
612 -- is downloaded
613 if (l_value is null or length(trim(l_value)) <= 0) then
614 l_irep_annotation := m_null;
615 else
616 l_irep_annotation := l_value;
617 end if;
618 else
619 Wf_Core.Token('REASON', 'Invalid column name found:' ||
620 l_node_name || ' with value:'||l_value);
621 Wf_Core.Raise('WFSQL_INTERNAL');
622 end if;
623 end loop;
624
625 if (L_OWNER_NAME is null)
626 or (L_OWNER_TAG is null) then
627 if WF_EVENTS_PKG.g_Mode <> 'UPGRADE' then
628 Wf_Core.Token('REASON','Event Owner Name and Owner Tag cannot be null');
629 Wf_Core.Raise('WFSQL_INTERNAL');
630 else
631 wf_core.context('Wf_Events_Pkg', 'Receive',
632 'WARNING! WARNING! Event OWNER_NAME/OWNER_TAG cannot be null for Event ' || l_name);
633 end if;
634 end if;
635
636 load_row(l_guid, L_NAME, L_TYPE, L_STATUS, L_GENERATE_FUNCTION,
637 L_OWNER_NAME, L_OWNER_TAG, L_DISPLAY_NAME, l_DESCRIPTION,
638 l_CUSTOMIZATION_LEVEL, l_LICENSED_FLAG ,l_javagenerate, l_irep_annotation);
639 exception
640 when others then
641 wf_core.context('Wf_Events_Pkg', 'Receive', x_message);
642 raise;
643 end RECEIVE;
644
645
646 procedure fetch_custom_level(X_GUID in raw,
647 X_CUSTOMIZATION_LEVEL out nocopy varchar2)
648 is
649 cursor c_getCustomLevel is
650 select CUSTOMIZATION_LEVEL from
651 WF_EVENTS
652 where guid = X_GUID;
653
654 l_custom_level varchar2(1);
655 l_found varchar2(1) := 'N';
656
657 begin
658 for v_customlevel in c_getCustomLevel loop
659 X_CUSTOMIZATION_LEVEL := v_customlevel.customization_level;
660 l_found := 'Y';
661 end loop;
662
663 if l_found = 'N' then
664 -- The Event was not found...
665 raise no_data_found;
666 end if;
667
668 end fetch_custom_level;
669
670 ----------------------------------------------------------------------------
671 function is_product_licensed( X_OWNER_TAG in varchar2)
672 return varchar2
673 is
674 l_licensed_flag varchar2(1);
675 l_schema varchar2(30);
676 l_industry varchar2(1);
677 l_appl_id number;
678
679 e_package_not_found EXCEPTION;
680 PRAGMA EXCEPTION_INIT(e_package_not_found, -06550);
681 begin
682 /* Customer defined Data should not have impact licensing
683 if g_Mode = 'CUSTOM' then
684 return ('Y');
685 end if; */
686
687 begin
688 execute immediate 'begin if NOT FND_INSTALLATION.get_app_info(:a, :b, :c,:d) then raise FND_API.G_EXC_ERROR; end if; end;'
689
690 using X_OWNER_TAG, out l_licensed_flag, out l_industry, out l_schema;
691
692 -- The possible values for l_licensed_flag from the API are:
693 -- I: Installed : licensed_flag must be set to 'Y'
694 -- N: Not Installed : licensed_flag must be set to 'N'
695 -- S: Shared Install : licensed_flag must be set to 'Y'
696 if l_licensed_flag in('S', 'I') then
697 l_licensed_flag := 'Y';
698 else
699 begin
700 select application_id
701 into l_appl_id
702 from fnd_application
703 where application_short_name = X_OWNER_TAG;
704
705 If l_appl_id >= 20000 then
706 l_licensed_flag := 'Y';
707 end if;
708 exception
709 when no_data_found then
710 null;
711 end;
712 end if;
713
714 exception
715 when e_package_not_found then
716 l_licensed_flag := 'Y';
717 end;
718 return (l_licensed_flag);
719
720 end is_product_licensed;
721
722 ----------------------------------------------------------------------------
723 function is_update_allowed(X_CUSTOM_LEVEL_NEW in varchar2,
724 X_CUSTOM_LEVEL_OLD in varchar2) return varchar2
725 is
726 begin
727
728 -- Cannot overwrite data with a higher customization level
729 if X_CUSTOM_LEVEL_NEW = 'U' then
730 if X_CUSTOM_LEVEL_OLD in ('C','L') then
731 -- Error will be logged
732 return ('N');
733 elsif X_CUSTOM_LEVEL_OLD = 'U' then
734 -- Return Y. Update is based on the caller
735 return ('Y');
736 end if;
737 elsif X_CUSTOM_LEVEL_NEW = 'L' then
738 if X_CUSTOM_LEVEL_OLD = 'C' then
739 -- Error will be logged
740 return('N');
741 elsif X_CUSTOM_LEVEL_OLD = 'U' then
742 -- Override it
743 return('Y');
744 else
745 -- Customization Level is L
746 return('Y');
747 end if;
748 elsif X_CUSTOM_LEVEL_NEW = 'C' then
749 -- Override the values in the database irrespective of the value
750 -- Return Y. Update is based on the caller
751 return('Y');
752 end if;
753
754 end is_update_allowed;
755 ----------------------------------------------------------------------------
756 -- This is called by the SSA Framework (wfehtmb.pls) only before calling any
757 -- table handlers
758
759 procedure setMode
760 is
761 uname varchar2(320);
762 begin
763 /*if g_Mode is null then
764 wfa_sec.GetSession(uname);
765 end if;
766
767 if uname = g_SeedUser then
768 g_Mode := 'FORCE';
769 else
770 g_Mode := 'CUSTOM';
771 end if;
772 */
773 WF_EVENTS_APPS_PKG.setMode;
774 end setMode;
775
776 ----------------------------------------------------------------------------
777 -- This is called by the OA Framework code before calling the table handlers
778
779 procedure FWKsetMode
780 is
781 uname varchar2(320);
782 begin
783 /*if g_Mode is null then
784 uname := wfa_sec.GetFWKUserName;
785 end if;
786
787 if uname = g_SeedUser then
788 g_Mode := 'FORCE';
789 else
790 g_Mode := 'CUSTOM';
791 end if;
792 */
793 WF_EVENTS_APPS_PKG.FWKsetMode;
794 end FWKsetMode;
795 ----------------------------------------------------------------------------
796 -- This is called by the Loader before calling any table handlers
797
798 procedure LoadersetMode(x_mode in varchar2)
799 is
800 begin
801 g_Mode := x_mode;
802 end LoadersetMode;
803 ----------------------------------------------------------------------------
804
805 end WF_EVENTS_PKG;