1 PACKAGE BODY wf_activities_vl_pub AS
2 /* $Header: wfdefb.pls 120.1 2005/07/02 03:43:48 appldev ship $ */
3
4 /*===========================================================================
5 PACKAGE NAME: wf_activities_vl_pub
6
7 DESCRIPTION:
8
9 OWNER: GKELLNER
10
11 TABLES/RECORDS:
12
13 PROCEDURES/FUNCTIONS:
14
15 ============================================================================*/
16
17 /*===========================================================================
18 PROCEDURE NAME: fetch_activities
19
20 DESCRIPTION: Fetches all the activities and each activities
21 associate attributes for a given item type
22 into a p_wf_activities_vl_tbl table and a
23 p_wf_activity_attr_vl_tbl table based on the
24 item type internal eight character name and the
25 effective_date for the activities. This function
26 can retrieve just one type of activity list like only
27 the processes or notification or it can retrieve
28 all the activity types for a given item type. This
29 function can also retrieve a single activity
30 definition if the internal name along with the
31 item type name is provided. This is especially
32 useful if you wish to display the details for a
33 single activity when it is referenced from some
34 drilldown mechanism.
35
36 The p_wf_activities_vl_tbl table and the
37 p_wf_activity_attr_vl_tbl table are synchronized by
38 the select order of both queries. The
39 draw_activity_list and draw_activity_details functions
40 take advantage of this ordering for performance reasons
41 so they can walk these lists in parallel.
42 When we find an attribute that matches
43 the current activity, we copy that attribute to a temp
44 list until we find a new activity in the attribute
45 list. When this happens we write out the attribute
46 temp list and move to the next activity.
47
48 ============================================================================*/
49 PROCEDURE fetch_activities
50 (p_item_type IN VARCHAR2,
51 p_activity_type IN VARCHAR2,
52 p_effective_date IN DATE,
53 p_name IN VARCHAR2,
54 p_wf_activities_vl_tbl OUT NOCOPY wf_activities_vl_pub.wf_activities_vl_tbl_type,
55 p_wf_activity_attr_vl_tbl OUT NOCOPY wf_activities_vl_pub.wf_activity_attr_vl_tbl_type) IS
56
57 /*===========================================================================
58
59 CURSOR NAME: fetch_typed_activities
60
61 DESCRIPTION: Fetches all activities of a certain type for a given
62 item_type and effective date for the activities.
63
64 You'll notice we are selecting the activity
65 display name three times. The second is a placeholder
66 used when the result type display name.
67 The third occurrence is a placeholder in the
68 record so that I can fill in that column
69 with the message display name if this activity is
70 a notification.
71
72 PARAMETERS:
73
74 c_item_type IN Internal name of the item type
75
76 c_type IN Type of activity you would like to fetch
77 (PROCESS, NOTICE, FUNCTION)
78
79 c_effective_date IN
80 The requested effective date. Since activities can
81 have multiple versions and have effective date ranges
82 for each of those version we need a specific value
83 to determine which of those versions is requested.
84
85 ============================================================================*/
86 CURSOR fetch_typed_activities (c_item_type IN VARCHAR2,
87 c_type IN VARCHAR2,
88 c_effective_date IN DATE) IS
89 SELECT row_id,
90 item_type,
91 name,
92 version,
93 type,
94 rerun,
95 expand_role,
96 protect_level,
97 custom_level,
98 begin_date,
99 end_date,
100 function,
101 function_type,
102 result_type,
103 cost,
104 read_role,
105 write_role,
106 execute_role,
107 icon_name,
108 message,
109 error_process,
110 runnable_flag,
111 error_item_type,
112 event_name,
113 direction,
114 display_name,
115 display_name result_type_display_name,
116 display_name message_display_name,
117 description
118 FROM wf_activities_vl
119 WHERE item_type = c_item_type
120 AND type = c_type
121 AND begin_date <= c_effective_date
122 AND (end_date is null or
123 end_date > c_effective_date)
124 ORDER BY display_name;
125
126 /*===========================================================================
127
128 CURSOR NAME: fetch_typed_activities
129
130 DESCRIPTION: Fetches all activities for a given
131 item_type and effective date for the activities.
132
133 You'll notice we are selecting the activity
134 display name three times. The second is a placeholder
135 used when the result type display name.
136 The third occurrence is a placeholder in the
137 record so that I can fill in that column
138 with the message display name if this activity is
139 a notification.
140
141 PARAMETERS:
142
143 c_item_type IN Internal name of the item type
144
145 c_effective_date IN
146 The requested effective date. Since activities can
147 have multiple versions and have effective date ranges
148 for each of those version we need a specific value
149 to determine which of those versions is requested.
150
151 ============================================================================*/
152 CURSOR fetch_all_activities (c_item_type IN VARCHAR2,
153 c_effective_date IN DATE) IS
154 SELECT row_id,
155 item_type,
156 name,
157 version,
158 type,
159 rerun,
160 expand_role,
161 protect_level,
162 custom_level,
163 begin_date,
164 end_date,
165 function,
166 function_type,
167 result_type,
168 cost,
169 read_role,
170 write_role,
171 execute_role,
172 icon_name,
173 message,
174 error_process,
175 runnable_flag,
176 error_item_type,
177 event_name,
178 direction,
179 display_name,
180 display_name result_type_display_name,
181 display_name message_display_name,
182 description
183 FROM wf_activities_vl
184 WHERE item_type = c_item_type
185 AND begin_date <= c_effective_date
186 AND (end_date is null or
187 end_date > c_effective_date)
188 ORDER BY DECODE(type, 'PROCESS', 1, 'NOTICE', 2, 'FUNCTION', 3, 'EVENT', 4,
189 5),
190 display_name;
191
192
193 /*===========================================================================
194
195 CURSOR NAME: fetch_activity_attributes
196
197 DESCRIPTION: Fetches all activity attributes for the given
198 item_type and effective date for the activity.
199
200 You'll notice that the select orders the
201 results by activity type, activity display
202 name, and then by attribute sequence. The first two
203 order criteria are based on the requirement to
204 synchronize the attribute list with the activity list.
205 The activity list is ordered by activity type and
206 activity display name. When we list the activities
207 and their corresponding attributes we walk these lists
208 in parallel. When we find an attribute that matches
209 the current activity, we copy that attribute to a temp
210 list until we find a new activity in the attribute
211 list. When this happens we write out the attribute
212 temp list and move to the next activity. Thus the need
213 for the special order criteria.
214
215 You might also notice that we are selecting the activity
216 display name four times. The second is a placeholder
217 used when the default value is based on an
218 item attribute. The third occurrence is a
219 placeholder in the record so that I can fill in that column
220 with the lookup type display name if this attribute is
221 validated based on a lookup type. The fourth occurence
222 is later populated with the lookup code display name
223 if the default value is based on a lookup type.
224
225 PARAMETERS:
226
227 c_item_type IN Internal name of the item type
228
229 c_effective_date IN
230 The requested effective date. Since activities can
231 have multiple versions and have effective date ranges
232 for each of those version we need a specific value
233 to determine which of those versions is requested.
234
235 ============================================================================*/
236 CURSOR fetch_activity_attributes (c_item_type IN VARCHAR2,
237 c_effective_date IN VARCHAR2) IS
238 SELECT
239 wact.type activity_type,
240 wact.display_name activity_display_name,
241 wact.display_name attr_default_display_name,
242 wact.display_name lookup_type_display_name,
243 wact.display_name lookup_code_display_name,
244 waa.row_id,
245 waa.activity_item_type,
246 waa.activity_name,
247 waa.activity_version,
248 waa.name,
249 waa.sequence,
250 waa.type,
251 waa.value_type,
252 waa.protect_level,
253 waa.custom_level,
254 waa.subtype,
255 waa.format,
256 waa.text_default,
257 waa.number_default,
258 waa.date_default,
259 waa.display_name,
260 waa.description
261 FROM wf_activity_attributes_vl waa,
262 wf_activities_vl wact
263 WHERE waa.activity_item_type = c_item_type
264 AND wact.item_type = c_item_type
265 AND wact.name = waa.activity_name
266 AND wact.version = waa.activity_version
267 AND wact.begin_date <= c_effective_date
268 AND (wact.end_date is null OR
269 wact.end_date > c_effective_date)
270 ORDER BY DECODE(wact.type, 'PROCESS', 1, 'NOTICE', 2, 'FUNCTION', 3,
271 'EVENT', 4, 5),
272 wact.display_name, waa.sequence;
273
274 l_record_num NUMBER := 0;
275 l_throwaway VARCHAR2(1);
276
277 BEGIN
278
279 /*
280 ** Make sure all the required parameters are set
281 */
282 IF (p_item_type IS NULL) THEN
283
284 return;
285
286 END IF;
287
288 /*
289 ** Check if the caller has passed a specific activity_name to search for.
290 ** If so then just get the row corresponding to that item_type and
291 ** activity_name. If not then get all rows for that item_type. You
292 ** also have the option of selecting activities of a certain type into
293 ** the pl*sql table or all activities for the given item type
294 */
295 IF (p_name IS NOT NULL AND p_activity_type IS NOT NULL) THEN
296
297 SELECT row_id,
298 item_type,
299 name,
300 version,
301 type,
302 rerun,
303 expand_role,
304 protect_level,
305 custom_level,
306 begin_date,
307 end_date,
308 function,
309 function_type,
310 result_type,
311 cost,
312 read_role,
313 write_role,
314 execute_role,
315 icon_name,
316 message,
317 error_process,
318 runnable_flag,
319 error_item_type,
320 event_name,
321 direction,
322 display_name,
323 display_name result_type_display_name,
324 display_name message_display_name,
325 description
326 INTO p_wf_activities_vl_tbl(1)
327 FROM wf_activities_vl
328 WHERE item_type = p_item_type
329 AND type = p_activity_type
330 AND name = p_name
331 AND begin_date <= p_effective_date
332 AND (end_date is null or
333 end_date > p_effective_date);
334
335
336 /*
337 ** Get the display name for the result type for this activity and
338 ** put it in the result_type_display_name field
339 */
340 IF (NVL(p_wf_activities_vl_tbl(1).result_type,
341 '*') <> '*') THEN
342
343 wf_lookup_types_pub.fetch_lookup_display(
344 p_wf_activities_vl_tbl(1).result_type,
345 null,
346 p_wf_activities_vl_tbl(1).result_type_display_name,
347 l_throwaway);
348
349 END IF;
350
351 /*
352 ** If this is a notification activity and the message is populated
353 ** then go get the display name for the message and put it in
354 ** message_display_name
355 */
356 IF (p_wf_activities_vl_tbl(1).message IS NOT NULL) THEN
357
358 wf_messages_vl_pub.fetch_message_display (
359 p_wf_activities_vl_tbl(1).item_type,
360 p_wf_activities_vl_tbl(1).message,
361 p_wf_activities_vl_tbl(1).message_display_name);
362
363 END IF;
364
365 /*
366 ** If you pass in an item_type and an activity type then get all
367 ** activities relating to the given
368 */
369 ELSIF (p_name IS NULL AND p_activity_type IS NOT NULL) THEN
370
371 OPEN fetch_typed_activities (p_item_type,
372 p_activity_type,
373 p_effective_date);
374
375 /*
376 ** Loop through the specific type of activity row
377 ** for the given item_type filling in the p_wf_activities_vl_tbl
378 */
379 LOOP
380
381 l_record_num := l_record_num + 1;
382
383 FETCH fetch_typed_activities INTO p_wf_activities_vl_tbl(l_record_num);
384
385 EXIT WHEN fetch_typed_activities%NOTFOUND;
386
387 /*
388 ** Get the display name for the result type for this activity and
389 ** put it in the result_type_display_name field
390 */
391 IF (NVL(p_wf_activities_vl_tbl(l_record_num).result_type,
392 '*') <> '*') THEN
393
394 wf_lookup_types_pub.fetch_lookup_display(
395 p_wf_activities_vl_tbl(l_record_num).result_type,
396 null,
397 p_wf_activities_vl_tbl(l_record_num).result_type_display_name,
398 l_throwaway);
399
400 END IF;
401
402 /*
403 ** If this is a notification activity and the message is populated
404 ** then go get the display name for the message and put it in
405 ** message_display_name
406 */
407 IF (p_wf_activities_vl_tbl(l_record_num).message IS NOT NULL) THEN
408
409 wf_messages_vl_pub.fetch_message_display (
410 p_wf_activities_vl_tbl(l_record_num).item_type,
411 p_wf_activities_vl_tbl(l_record_num).message,
412 p_wf_activities_vl_tbl(l_record_num).message_display_name);
413
414 END IF;
415
416 END LOOP;
417
418 CLOSE fetch_typed_activities;
419
420 ELSIF (p_name IS NULL AND p_activity_type IS NULL) THEN
421
422 OPEN fetch_all_activities (p_item_type,
423 p_effective_date);
424
425 /*
426 ** Loop through all the activitiy rows for the given item_type
427 ** filling in the p_wf_activities_vl_tbl
428 */
429 LOOP
430
431 l_record_num := l_record_num + 1;
432
433 FETCH fetch_all_activities INTO p_wf_activities_vl_tbl(l_record_num);
434 EXIT WHEN fetch_all_activities%NOTFOUND;
435
436 /*
437 ** Get the display name for the result type for this activity and
438 ** put it in the result_type_display_name field
439 */
440 IF (NVL(p_wf_activities_vl_tbl(l_record_num).result_type,
441 '*') <> '*') THEN
442
443 wf_lookup_types_pub.fetch_lookup_display(
444 p_wf_activities_vl_tbl(l_record_num).result_type,
445 null,
446 p_wf_activities_vl_tbl(l_record_num).result_type_display_name,
447 l_throwaway);
448
449 END IF;
450
451 /*
452 ** If this is a notification activity and the message is populated
453 ** then go get the display name for the message and put it in
454 ** message_display_name
455 */
456 IF (p_wf_activities_vl_tbl(l_record_num).message IS NOT NULL) THEN
457
458 wf_messages_vl_pub.fetch_message_display (
459 p_wf_activities_vl_tbl(l_record_num).item_type,
460 p_wf_activities_vl_tbl(l_record_num).message,
461 p_wf_activities_vl_tbl(l_record_num).message_display_name);
462
463 END IF;
464
465 END LOOP;
466
467 CLOSE fetch_all_activities;
468
469 OPEN fetch_activity_attributes (p_item_type,
470 p_effective_date);
471
472 l_record_num := 0;
473
474 /*
475 ** Loop through all the activitiy rows for the given item_type
476 ** filling in the p_wf_activities_vl_tbl
477 */
478 LOOP
479
480 l_record_num := l_record_num + 1;
481
482 FETCH fetch_activity_attributes INTO
483 p_wf_activity_attr_vl_tbl(l_record_num);
484
485 EXIT WHEN fetch_activity_attributes%NOTFOUND;
486
487 /*
488 ** If the validation for this attribute is a lookup then go get the
489 ** display name for that lookup and put it in the
490 ** lookup_type_display_name record element
491 */
492 IF (p_wf_activity_attr_vl_tbl(l_record_num).type = 'LOOKUP') THEN
493
494 wf_lookup_types_pub.fetch_lookup_display(
495 p_wf_activity_attr_vl_tbl(l_record_num).format,
496 p_wf_activity_attr_vl_tbl(l_record_num).text_default,
497 p_wf_activity_attr_vl_tbl(l_record_num).lookup_type_display_name,
498 p_wf_activity_attr_vl_tbl(l_record_num).lookup_code_display_name);
499
500 END IF;
501
502 /*
503 ** If the default value for this attribute is an item attribute then
504 ** populate the attr_default_display_name with the item attribute display
505 ** name
506 */
507 IF (p_wf_activity_attr_vl_tbl(l_record_num).value_type = 'ITEMATTR') THEN
508
509 wf_item_attributes_vl_pub.fetch_item_attribute_display(
510 p_wf_activity_attr_vl_tbl(l_record_num).activity_item_type,
511 p_wf_activity_attr_vl_tbl(l_record_num).text_default,
512 p_wf_activity_attr_vl_tbl(l_record_num).attr_default_display_name);
513
514 END IF;
515
516 END LOOP;
517
518 CLOSE fetch_activity_attributes;
519
520 END IF;
521
522 EXCEPTION
523 WHEN OTHERS THEN
524 Wf_Core.Context('wf_activities_vl_pub',
525 'fetch_activities',
526 p_item_type,
527 p_activity_type,
528 TO_CHAR(p_effective_date),
529 p_name);
530
531 wf_item_definition.Error;
532
533 END fetch_activities;
534
535
536 /*===========================================================================
537 PROCEDURE NAME: fetch_draw_activity_details
538
539 DESCRIPTION: Fetches and draws a single activity for a
540 given item type. This function is basically
541 a cover for the fetch_activities and
542 draw_activity_details routines.
543
544 ============================================================================*/
545 PROCEDURE fetch_draw_activity_details
546 (p_item_type IN VARCHAR2,
547 p_activity_type IN VARCHAR2,
548 p_effective_date IN VARCHAR2,
549 p_name IN VARCHAR2) IS
550
551 l_username varchar2(320); -- Username to query
552 l_wf_activities_vl_tbl wf_activities_vl_pub.wf_activities_vl_tbl_type;
553 l_wf_activity_attr_vl_tbl wf_activities_vl_pub.wf_activity_attr_vl_tbl_type;
554 l_effective_date DATE;
555 l_date_date DATE;
556 l_valid_date BOOLEAN;
557 l_print_date VARCHAR2(80);
558 l_expected_format VARCHAR2(80);
559
560 BEGIN
561
562 -- Check session and current user
563 wfa_sec.GetSession(l_username);
564
565 /*
566 ** Get the NLS Date format that is currently set. All to_char of
567 ** date values should use the l_expected_format
568 */
569 wf_item_definition_util_pub.validate_date (
570 TO_CHAR(sysdate, 'DD-MON-RRRR HH24:MI:SS'),
571 l_date_date,
572 l_valid_date,
573 l_expected_format);
574
575 l_effective_date := TO_DATE(p_effective_date, 'YYYY/MM/DD HH24:MI:SS');
576 l_print_date := TO_CHAR(l_effective_date, l_expected_format);
577
578 /*
579 ** Create a standard title page with the item_type display name as the title
580 */
581 wf_item_definition.draw_header(
582 p_item_type,
583 l_print_date,
584 'DISPLAY');
585
586
587 /*
588 ** Give me a blank line if this is a process activity
589 ** Any other type of activity is handled correctly by
590 ** the draw skipped activity headers function
591 */
592 IF (p_activity_type = 'PROCESS') THEN
593
594 htp.p('<BR><BR>');
595
596 END IF;
597
598 /*
599 ** Get the activity definition
600 */
601 wf_activities_vl_pub.fetch_activities
602 (p_item_type,
603 p_activity_type,
604 l_effective_date,
605 p_name,
606 l_wf_activities_vl_tbl,
607 l_wf_activity_attr_vl_tbl);
608
609 /*
610 ** Draw the activity definition details
611 */
612 wf_activities_vl_pub.draw_activity_details
613 (l_wf_activities_vl_tbl,
614 l_wf_activity_attr_vl_tbl,
615 l_effective_date,
616 0,
617 FALSE,
618 FALSE);
619
620 EXCEPTION
621 WHEN OTHERS THEN
622 Wf_Core.Context('wf_activities_vl_pub',
623 'fetch_draw_activity_details',
624 p_item_type,
625 p_activity_type,
626 p_effective_date,
627 p_name);
628
629 wf_item_definition.Error;
630
631 END fetch_draw_activity_details;
632
633 /*===========================================================================
634 PROCEDURE NAME: draw_activity_list
635
636 DESCRIPTION: Shows the display name of an activity along with
637 any activity attributes for that activity that
638 have been passed in as a html view as a part of
639 a hierical summary list of an item type.
640 This function uses the htp to generate its html
641 output.
642
643 When we find an attribute that matches
644 the current activity, we copy that attribute and all
645 that follow for that activity to a temp
646 list until we find a new activity in the attribute
647 list. When this happens we write out the attributes
648 using the draw_activity_attr_list.
649
650 ============================================================================*/
651 PROCEDURE draw_activity_list
652 (p_wf_activities_vl_tbl IN wf_activities_vl_pub.wf_activities_vl_tbl_type,
653 p_wf_activity_attr_vl_tbl IN wf_activities_vl_pub.wf_activity_attr_vl_tbl_type,
654 p_effective_date IN DATE,
655 p_indent_level IN NUMBER) IS
656
657 l_activity_record_num NUMBER := 1;
658 l_attr_record_num NUMBER := 1;
659 l_cur_attr_record_num NUMBER := 1;
660 l_highest_activity NUMBER := 1;
661 ii NUMBER := 0;
662 l_activity_type VARCHAR2(8);
663 l_summary_section_title VARCHAR2(240);
664 l_wf_activity_attr_vl_tbl wf_activities_vl_pub.wf_activity_attr_vl_tbl_type;
665
666 BEGIN
667
668 l_activity_type := 'UNSET';
669
670 /*
671 ** Print out all item attribute display names in the pl*sql table
672 */
673 FOR l_activity_record_num IN 1..p_wf_activities_vl_tbl.count LOOP
674
675 /*
676 ** Check to see if the activity type has changed since the last
677 ** that you printed. If so then create the title. If this is a \
678 ** special type of activity like a folder then
679 ** don't reset your context
680 */
681 IF (l_activity_type <> p_wf_activities_vl_tbl(l_activity_record_num).type AND
682 p_wf_activities_vl_tbl(l_activity_record_num).type <> 'FOLDER') THEN
683
684 /*
685 ** Reset the activity type to the local name
686 */
687 l_activity_type := p_wf_activities_vl_tbl(l_activity_record_num).type;
688
689 /*
690 ** The type has changed so print the proper title
691 */
692 IF (l_activity_type = 'PROCESS') THEN
693
694 /*
695 ** Set the the processes title.
696 */
697 l_summary_section_title := wf_core.translate('PROCESSES');
698
699 /*
700 ** Set the indicator for the highest activity found. This is
701 ** used later to print any missing headers.
702 */
703 l_highest_activity := 2;
704
705 ELSIF (l_activity_type = 'NOTICE') THEN
706
707 /*
708 ** Set the the notifications title.
709 */
710 l_summary_section_title := wf_core.translate('WFITD_NOTIFICATIONS');
711
712 /*
713 ** Check to see if you skipped the processes section in case
714 ** there weren't any. If so print out the header for the processes
715 ** here.
716 */
717 wf_item_definition_util_pub.activity_titles_list (
718 l_highest_activity,
719 2,
720 p_indent_level);
721
722 /*
723 ** Set the indicator for the highest activity found. This is
724 ** used later to print any missing headers.
725 */
726 l_highest_activity := 3;
727
728
729 ELSIF (l_activity_type = 'FUNCTION') THEN
730
731 /*
732 ** Set the functions title.
733 */
734 l_summary_section_title := wf_core.translate('WFITD_FUNCTIONS');
735
736 /*
737 ** Check to see if you skipped the processes and or Notifications
738 ** section in case there weren't any. If so print out the
739 ** header for the processes and/or notificaitons here.
740 */
741 wf_item_definition_util_pub.activity_titles_list (
742 l_highest_activity,
743 3,
744 p_indent_level);
745
746 /*
747 ** Set the indicator for the highest activity found. This is
748 ** used later to print any missing headers.
749 */
750 l_highest_activity := 4;
751
752 ELSIF (l_activity_type = 'EVENT') THEN
753
754 /*
755 ** Set the functions title.
756 */
757 l_summary_section_title := wf_core.translate('WFITD_EVENTS');
758
759 /*
760 ** Check to see if you skipped the processes and or Notifications
761 ** section in case there weren't any. If so print out the
762 ** header for the processes and/or notificaitons here.
763 */
764 wf_item_definition_util_pub.activity_titles_list (
765 l_highest_activity,
766 4,
767 p_indent_level);
768
769 /*
770 ** Set the indicator for the highest activity found. This is
771 ** used later to print any missing headers.
772 */
773 l_highest_activity := 5;
774
775 END IF;
776
777 /*
778 ** Create the the activity type summary title.
779 ** Indent it to the level specified
780 */
781 wf_item_definition_util_pub.draw_summary_section_title(
782 l_summary_section_title,
783 p_indent_level);
784
785 END IF;
786
787 /*
788 ** If this is a special type of activity like a folder then
789 ** don't show it in the list
790 */
791 IF (p_wf_activities_vl_tbl(l_activity_record_num).type <> 'FOLDER') THEN
792
793 /*
794 ** The creation of the anchor from the summary frame to the detail
795 ** frame was very complex so I've extracted the function into its
796 ** own routine.
797 */
798 wf_item_definition_util_pub.create_hotlink_to_details (
799 p_wf_activities_vl_tbl(l_activity_record_num).item_type,
800 p_effective_date,
801 l_activity_type,
802 p_wf_activities_vl_tbl(l_activity_record_num).name,
803 p_wf_activities_vl_tbl(l_activity_record_num).display_name,
804 NULL,
805 p_indent_level+1);
806
807 /*
808 ** Here we look for all the activity attributes that are related
809 ** to the current activity. The p_wf_activity_attr_vl_tbl is
810 ** ordered by activity type, activity display name and then
811 ** by activity attribute display name. As long as we stay
812 ** in sync we should be able to correctly create the temp
813 ** attribute list for the current activity.
814 ** We could create a cursor here for the child
815 ** attributes but that would break the rule of separating the UI layer
816 ** and the data layer
817 */
818 l_wf_activity_attr_vl_tbl.delete;
819 l_cur_attr_record_num := 1;
820
821 /*
822 ** Make sure there the l_attr_record_num is less than or equal to
823 ** p_wf_activity_attr_vl_tbl.count. If there is not then the
824 ** l_attr_record_num index of 1
825 ** will cause a 6502-PL*SQL numeric or value error exception.
826 */
827 WHILE (
828 l_attr_record_num <= p_wf_activity_attr_vl_tbl.count AND
829 p_wf_activities_vl_tbl(l_activity_record_num).type =
830 p_wf_activity_attr_vl_tbl(l_attr_record_num).activity_type
831 AND p_wf_activities_vl_tbl(l_activity_record_num).display_name =
832 p_wf_activity_attr_vl_tbl(l_attr_record_num).activity_display_name
833 ) LOOP
834
835 /*
836 ** We have found an attribute for the current activity. Copy the
837 ** contents of that list to a temp attr list and then pass the
838 ** temp list to the activity attribute display function to display
839 ** the results.
840 */
841 l_wf_activity_attr_vl_tbl(l_cur_attr_record_num) :=
842 p_wf_activity_attr_vl_tbl(l_attr_record_num);
843
844 l_attr_record_num := l_attr_record_num + 1;
845 l_cur_attr_record_num := l_cur_attr_record_num + 1;
846
847
848 END LOOP;
849
850 /*
851 ** If the l_cur_attr_record_num is greater than 1 then you
852 ** must have found an attribute for this activity. Copy that
853 ** set of attributes to a temporary pl*sql table and then
854 ** print it out.
855 */
856 IF (l_cur_attr_record_num > 1) THEN
857
858 /*
859 ** List all the activity attribute details for this message that
860 ** we found above. Add two to the current indent level so it
861 ** is pushed in past the start of the message list.
862 */
863 wf_activities_vl_pub.draw_activity_attr_list (
864 l_wf_activity_attr_vl_tbl,
865 p_effective_date,
866 p_indent_level + 2);
867
868 END IF;
869
870 END IF;
871
872 END LOOP;
873
874 /*
875 ** Check to see if you skipped the processes section in case
876 ** there weren't any. If so print out the header for the processes
877 ** here.
878 */
879 wf_item_definition_util_pub.activity_titles_list (
880 l_highest_activity,
881 4,
882 p_indent_level);
883
884 EXCEPTION
885 WHEN OTHERS THEN
886 Wf_Core.Context('wf_activities_vl_pub', 'draw_activity_list');
887 wf_item_definition.Error;
888
889 END draw_activity_list;
890
891
892 /*===========================================================================
893 PROCEDURE NAME: draw_activity_attr_list
894
895 DESCRIPTION: Shows the display names of activity attributes for
896 a given activity as a html view as a part of
897 a hierical summary list of an item type.
898 This function uses the htp to generate its html
899 output.
900
901 ============================================================================*/
902 PROCEDURE draw_activity_attr_list
903 (p_wf_activity_attr_vl_tbl IN wf_activities_vl_pub.wf_activity_attr_vl_tbl_type,
904 p_effective_date IN DATE,
905 p_indent_level IN NUMBER) IS
906
907 l_record_num NUMBER;
908 ii NUMBER := 0;
909
910 BEGIN
911
912 /*
913 ** Create the the activity attributes title.
914 ** I'm using the first record to determine the type since all
915 ** attributes in this list are for the same activity of a specfic
916 ** type
917 */
918 IF (p_wf_activity_attr_vl_tbl(1).activity_type = 'PROCESS') THEN
919
920 wf_item_definition_util_pub.draw_summary_section_title(
921 wf_core.translate('WFITD_PROCESS_ATTRS'),
922 p_indent_level);
923
924 ELSIF (p_wf_activity_attr_vl_tbl(1).activity_type = 'NOTICE') THEN
925
926 wf_item_definition_util_pub.draw_summary_section_title(
927 wf_core.translate('WFITD_NOTIFICATION_ATTRS'),
928 p_indent_level);
929
930 ELSE
931
932 wf_item_definition_util_pub.draw_summary_section_title(
933 wf_core.translate('WFITD_FUNCTION_ATTRS'),
934 p_indent_level);
935
936 END IF;
937
938 /*
939 ** Print out all activity attribute display names in the pl*sql table
940 */
941 FOR l_record_num IN 1..p_wf_activity_attr_vl_tbl.count LOOP
942
943 /*
944 ** The creation of the anchor from the summary frame to the detail
945 ** frame was very complex so I've extracted the function into its
946 ** own routine. The target name is especially complex. It is the
947 ** combination of the activity_type, the activity_name, and the
948 ** activity_attribute_name. This will ensure uniqueness. ie
949 ** #ACTIVITY_ATTR:FUNCTION:CHECK_FUNDS:FUNDS_AVAILABLE
950 */
951 wf_item_definition_util_pub.create_hotlink_to_details (
952 p_wf_activity_attr_vl_tbl(l_record_num).activity_item_type,
953 p_effective_date,
954 'ACTIVITY_ATTR',
955 p_wf_activity_attr_vl_tbl(l_record_num).activity_type||':'||
956 p_wf_activity_attr_vl_tbl(l_record_num).activity_name||':'||
957 p_wf_activity_attr_vl_tbl(l_record_num).name,
958 p_wf_activity_attr_vl_tbl(l_record_num).display_name,
959 NULL,
960 p_indent_level+1);
961
962 END LOOP;
963
964 EXCEPTION
965 WHEN OTHERS THEN
966 Wf_Core.Context('wf_activities_vl_pub', 'draw_activity_attr_list');
967 wf_item_definition.Error;
968
969 END draw_activity_attr_list;
970
971 /*===========================================================================
972 PROCEDURE NAME: draw_activity_details
973
974 DESCRIPTION: Shows all of the details for a list of activities
975 along with any activity attribute details for that
976 activity that have been passed in. The listing is
977 shown as activity detail and then corresponding
978 attributes and then another activity and then its
979
980 When we find an attribute that matches
981 the current activity, we copy that attribute and all
982 that follow for that activity to a temp
983 list until we find a new activity in the attribute
984 list. When this happens we write out the attributes
985 using the draw_activity_attr_details function.
986
987 MODIFICATION LOG:
988 06-JUN-2001 JWSMITH BUG 1819232 - added summary attr for table tag for ADA
989 ============================================================================*/
990 PROCEDURE draw_activity_details
991 (p_wf_activities_vl_tbl IN wf_activities_vl_pub.wf_activities_vl_tbl_type,
992 p_wf_activity_attr_vl_tbl IN wf_activities_vl_pub.wf_activity_attr_vl_tbl_type,
993 p_effective_date IN DATE,
994 p_indent_level IN NUMBER,
995 p_create_child_links IN BOOLEAN,
996 p_print_skipped_titles IN BOOLEAN) IS
997
998 l_username varchar2(320); -- Username to query
999 l_activity_record_num NUMBER := 1;
1000 l_attr_record_num NUMBER := 1;
1001 l_cur_attr_record_num NUMBER := 1;
1002 l_highest_activity NUMBER := 1;
1003 ii NUMBER := 0;
1004 l_timeout_minutes NUMBER := 0;
1005 l_timeout_hours NUMBER := 0;
1006 l_timeout_days NUMBER := 0;
1007 l_runnable_process NUMBER := 0;
1008 l_date_date DATE;
1009 l_valid_date BOOLEAN;
1010 l_expected_format VARCHAR2(80);
1011 l_activity_type VARCHAR2(8);
1012 l_end_date VARCHAR2(80);
1013 l_activity_name_prompt VARCHAR2(80);
1014 l_activity_section_title VARCHAR2(240);
1015 l_wf_activity_attr_vl_tbl wf_activities_vl_pub.wf_activity_attr_vl_tbl_type;
1016
1017 BEGIN
1018
1019 -- Check session and current user
1020 wfa_sec.GetSession(l_username);
1021
1022 l_activity_type := 'UNSET';
1023
1024 /*
1025 ** Print out all item attribute display names in the pl*sql table
1026 */
1027 FOR l_activity_record_num IN 1..p_wf_activities_vl_tbl.count LOOP
1028
1029 /*
1030 ** Check to see if the activity type has changed since the last
1031 ** that you printed. If so then create the title. If this is a
1032 ** special type of activity like a folder then
1033 ** don't reset your context
1034 */
1035 IF (l_activity_type <> p_wf_activities_vl_tbl(l_activity_record_num).type AND
1036 p_wf_activities_vl_tbl(l_activity_record_num).type <> 'FOLDER') THEN
1037
1038 /*
1039 ** Reset the activity type to the local name
1040 */
1041 l_activity_type := p_wf_activities_vl_tbl(l_activity_record_num).type;
1042
1043 /*
1044 ** The type has changed so print the proper title for the region
1045 **
1046 ** Also set the appropriate prompt for the internal name for the
1047 ** activity prompt
1048 */
1049 IF (l_activity_type = 'PROCESS') THEN
1050
1051 /*
1052 ** Put on the the processes title.
1053 */
1054 l_activity_section_title := wf_core.translate('WFITD_PROCESS_DETAILS');
1055 l_activity_name_prompt := wf_core.translate('WFITD_PROCESS_NAME');
1056
1057 /*
1058 ** Set the indicator for the highest activity found. This is
1059 ** used later to print any missing headers.
1060 */
1061 l_highest_activity := 2;
1062
1063 ELSIF (l_activity_type = 'NOTICE') THEN
1064
1065 /*
1066 ** Put on the the processes title.
1067 */
1068 l_activity_section_title := wf_core.translate('WFITD_NOTIFICATION_DETAILS');
1069 l_activity_name_prompt := wf_core.translate('WFITD_NOTIFICATION_NAME');
1070
1071 /*
1072 ** Check to see if you skipped the processes section in case
1073 ** there weren't any. If so print out the header for the processes
1074 ** here.
1075 */
1076 IF (p_print_skipped_titles = TRUE) THEN
1077
1078 wf_item_definition_util_pub.activity_titles_details (
1079 l_highest_activity,
1080 2);
1081
1082 END IF;
1083
1084 /*
1085 ** Set the indicator for the highest activity found. This is
1086 ** used later to print any missing headers.
1087 */
1088 l_highest_activity := 3;
1089
1090 ELSIF (l_activity_type = 'FUNCTION') THEN
1091
1092 /*
1093 ** Put on the the processes title.
1094 */
1095 l_activity_section_title := wf_core.translate('WFITD_FUNCTION_DETAILS');
1096 l_activity_name_prompt := wf_core.translate('WFITD_FUNCTION_NAME');
1097
1098 /*
1099 ** Check to see if you skipped the processes and or Notifications
1100 ** section in case there weren't any. If so print out the
1101 ** header for the processes and/or notificaitons here.
1102 */
1103 IF (p_print_skipped_titles = TRUE) THEN
1104
1105 wf_item_definition_util_pub.activity_titles_details (
1106 l_highest_activity,
1107 3);
1108
1109 END IF;
1110
1111 /*
1112 ** Set the indicator for the highest activity found. This is
1113 ** used later to print any missing headers.
1114 */
1115 l_highest_activity := 4;
1116
1117 ELSIF (l_activity_type = 'EVENT') THEN
1118
1119 /*
1120 ** Put on the the event title.
1121 */
1122 l_activity_section_title := wf_core.translate('WFITD_EVENT_DETAILS');
1123 l_activity_name_prompt := wf_core.translate('WFITD_EVENT_NAME');
1124
1125 /*
1126 ** Check to see if you skipped the events, processes
1127 ** and or Notifications section in case there weren't
1128 ** any. If so print out the header for the processes
1129 ** and/or notificaitons here.
1130 */
1131 IF (p_print_skipped_titles = TRUE) THEN
1132
1133 wf_item_definition_util_pub.activity_titles_details (
1134 l_highest_activity,
1135 4);
1136
1137 END IF;
1138
1139 /*
1140 ** Set the indicator for the highest activity found. This is
1141 ** used later to print any missing headers.
1142 */
1143 l_highest_activity := 5;
1144
1145 END IF;
1146
1147 /*
1148 ** If you are creating the Notification of Function detail
1149 ** list then skip a couple of rows since you don't have an
1150 ** interrupt from the parent to perform this function
1151 */
1152 IF (l_activity_type IN ('NOTICE', 'FUNCTION', 'EVENT')) THEN
1153
1154 htp.p ('<BR><BR>');
1155
1156 END IF;
1157
1158 /*
1159 ** Draw the section title for the activity detail section
1160 */
1161 wf_item_definition_util_pub.draw_detail_section_title (
1162 l_activity_section_title,
1163 0);
1164
1165 END IF;
1166
1167 /*
1168 ** If this is a special type of activity like a folder then
1169 ** don't print it
1170 */
1171 IF (p_wf_activities_vl_tbl(l_activity_record_num).type <> 'FOLDER') THEN
1172
1173 /*
1174 ** Open a new table for each attribute so you can control the spacing
1175 ** between each attribute
1176 */
1177 htp.tableOpen(cattributes=>'border=0 cellpadding=2 cellspacing=0
1178 summary=""');
1179
1180 /*
1181 ** Create the target for the hotlink from the summary view. Also
1182 ** create the first row in the table which is always the display
1183 ** name for the object.
1184 */
1185 wf_item_definition_util_pub.create_details_hotlink_target (
1186 p_wf_activities_vl_tbl(l_activity_record_num).type,
1187 p_wf_activities_vl_tbl(l_activity_record_num).name,
1188 p_wf_activities_vl_tbl(l_activity_record_num).display_name,
1189 l_activity_name_prompt,
1190 0);
1191
1192 /*
1193 ** Create the internal name row in the table.
1194 */
1195 wf_item_definition_util_pub.draw_detail_prompt_value_pair (
1196 wf_core.translate('WFITD_INTERNAL_NAME'),
1197 p_wf_activities_vl_tbl(l_activity_record_num).name);
1198
1199 /*
1200 ** Create the description row in the table
1201 */
1202 wf_item_definition_util_pub.draw_detail_prompt_value_pair (
1203 wf_core.translate('DESCRIPTION'),
1204 p_wf_activities_vl_tbl(l_activity_record_num).description);
1205
1206 /*
1207 ** If this is a process or notification activity, only show the function row
1208 ** if the function field is populate. If this is a function activity then
1209 ** always create the function row
1210 */
1211 IF ((p_wf_activities_vl_tbl(l_activity_record_num).type = 'PROCESS' AND
1212 p_wf_activities_vl_tbl(l_activity_record_num).function IS NOT NULL) OR
1213 p_wf_activities_vl_tbl(l_activity_record_num).type IN ('NOTICE', 'FUNCTION')) THEN
1214
1215
1216 wf_item_definition_util_pub.draw_detail_prompt_value_pair (
1217 wf_core.translate('WFITD_FUNCTION'),
1218 p_wf_activities_vl_tbl(l_activity_record_num).function);
1219
1220 wf_item_definition_util_pub.draw_detail_prompt_value_pair (
1221 wf_core.translate('WFITD_FUNCTION_TYPE'),
1222 NVL(p_wf_activities_vl_tbl(l_activity_record_num).function_type, 'PL/SQL'));
1223
1224 END IF;
1225
1226 /*
1227 ** Create the result type row in the table
1228 ** Do not show the result type field if it is equal to * which
1229 ** occurs when a notification is FYI and doesn't expect a response
1230 */
1231 IF (NVL(p_wf_activities_vl_tbl(l_activity_record_num).result_type,
1232 '*') <> '*') THEN
1233
1234 wf_item_definition_util_pub.draw_detail_prompt_value_pair (
1235 wf_core.translate('WFITD_RESULT_TYPE'),
1236 p_wf_activities_vl_tbl(l_activity_record_num).result_type_display_name);
1237
1238 END IF;
1239
1240 /*
1241 ** There are a number of activity attributes that are tied to the
1242 ** type of activity you are printing. Encapsulated here are most
1243 ** of those differences since they are usually at the bottom of the
1244 ** main dialog in the Builder.
1245 */
1246 IF (l_activity_type = 'PROCESS') THEN
1247
1248 /*
1249 ** Select whether this process is runnable or not. This is
1250 ** the most optimal method of getting this info rather than
1251 ** doing this in the view since you would have to do an
1252 ** outer join on the WF_RUNNABLE_PROCESSES_V view and that
1253 ** will cause a full table scan on activities.
1254 */
1255 SELECT count(*)
1256 INTO l_runnable_process
1257 FROM WF_RUNNABLE_PROCESSES_V
1258 WHERE item_type = p_wf_activities_vl_tbl(l_activity_record_num).item_type
1259 AND process_name = p_wf_activities_vl_tbl(l_activity_record_num).name;
1260
1261 IF (l_runnable_process > 0) THEN
1262
1263 /*
1264 ** Create the runnable row in the table
1265 */
1266 wf_item_definition_util_pub.draw_detail_prompt_value_pair (
1267 wf_core.translate('WFITD_RUNNABLE'),
1268 wf_core.translate('WFITD_YES'));
1269
1270 ELSE
1271
1272 /*
1273 ** Create the runnable row in the table
1274 */
1275 wf_item_definition_util_pub.draw_detail_prompt_value_pair (
1276 wf_core.translate('WFITD_RUNNABLE'),
1277 wf_core.translate('WFITD_NO'));
1278
1279 END IF;
1280
1281 ELSIF (l_activity_type = 'NOTICE') THEN
1282
1283 /*
1284 ** Create the message name row in the table
1285 ** Only create a link to the message details if you are
1286 ** drawing the message details. IN ( 'm not going to use
1287 ** the create_hotlink_to_details here. IN ( could
1288 */
1289 IF (p_create_child_links = TRUE) THEN
1290
1291 wf_item_definition_util_pub.create_hotlink_to_details(
1292 p_wf_activities_vl_tbl(l_activity_record_num).item_type,
1293 p_effective_date,
1294 'MESSAGE',
1295 p_wf_activities_vl_tbl(l_activity_record_num).message,
1296 p_wf_activities_vl_tbl(l_activity_record_num).message_display_name,
1297 wf_core.translate('MESSAGE_NAME'),
1298 0);
1299
1300 ELSE
1301
1302 wf_item_definition_util_pub.draw_detail_prompt_value_pair (
1303 wf_core.translate('MESSAGE_NAME'),
1304 p_wf_activities_vl_tbl(l_activity_record_num).message_display_name);
1305
1306 END IF;
1307
1308 /*
1309 ** Create the expand roles in the table
1310 */
1311 IF (p_wf_activities_vl_tbl(l_activity_record_num).expand_role = 'Y') THEN
1312
1313 wf_item_definition_util_pub.draw_detail_prompt_value_pair (
1314 wf_core.translate('WFITD_EXPAND_ROLES'),
1315 wf_core.translate('WFITD_YES'));
1316
1317 ELSE
1318
1319 wf_item_definition_util_pub.draw_detail_prompt_value_pair (
1320 wf_core.translate('WFITD_EXPAND_ROLES'),
1321 wf_core.translate('WFITD_NO'));
1322
1323 END IF;
1324
1325 ELSIF (l_activity_type = 'FUNCTION') THEN
1326
1327 /*
1328 ** Create the cost row in the table
1329 */
1330 wf_item_definition_util_pub.draw_detail_prompt_value_pair (
1331 wf_core.translate('WFMON_COST'),
1332 TO_CHAR((p_wf_activities_vl_tbl(l_activity_record_num).cost/100)));
1333
1334 ELSIF (l_activity_type = 'EVENT') THEN
1335
1336 /*
1337 ** Create the event name and direction rows in the table
1338 */
1339 wf_item_definition_util_pub.draw_detail_prompt_value_pair (
1340 wf_core.translate('WFITD_EVENT'),
1341 p_wf_activities_vl_tbl(l_activity_record_num).event_name);
1342 wf_item_definition_util_pub.draw_detail_prompt_value_pair (
1343 wf_core.translate('WFITD_DIRECTION'),
1344 p_wf_activities_vl_tbl(l_activity_record_num).direction);
1345
1346 END IF;
1347
1348 /*
1349 ** Create the icon name in the table
1350 */
1351 wf_item_definition_util_pub.draw_detail_prompt_value_pair (
1352 wf_core.translate('WFITD_ICON'),
1353 p_wf_activities_vl_tbl(l_activity_record_num).icon_name);
1354
1355 /*
1356 ** Create the error item type name in the table
1357 */
1358 wf_item_definition_util_pub.draw_detail_prompt_value_pair (
1359 wf_core.translate('WFMON_ERROR_TYPE'),
1360 p_wf_activities_vl_tbl(l_activity_record_num).error_item_type);
1361
1362 /*
1363 ** Create the error process name in the table
1364 */
1365 wf_item_definition_util_pub.draw_detail_prompt_value_pair (
1366 wf_core.translate('WFMON_ERROR_PROCESS'),
1367 p_wf_activities_vl_tbl(l_activity_record_num).error_process);
1368
1369
1370 /*
1371 ** Get the expected format for the date. You'll notice that I've
1372 ** added a time element to sysdate. That ensures the time format
1373 ** will be included in l_expected_format. You don't care about the
1374 ** validation stuff
1375 */
1376 wf_item_definition_util_pub.validate_date (
1377 TO_CHAR(sysdate, 'DD-MON-YY')||' 00:00:00',
1378 l_date_date,
1379 l_valid_date,
1380 l_expected_format);
1381
1382 /*
1383 ** Only populate the l_end_date for the continuation of the effective
1384 ** date if there is an end date otherwise leave it null.
1385 */
1386 IF (p_wf_activities_vl_tbl(l_activity_record_num).end_date IS NOT NULL) THEN
1387
1388 l_end_date := ' - ' ||
1389 TO_CHAR(p_wf_activities_vl_tbl(l_activity_record_num).end_date,
1390 l_expected_format);
1391
1392 ELSE
1393
1394 l_end_date := '';
1395
1396 END IF;
1397
1398 /*
1399 ** Create the effective date range in the table
1400 */
1401 wf_item_definition_util_pub.draw_detail_prompt_value_pair (
1402 wf_core.translate('WFITD_EFFECTIVE'),
1403 TO_CHAR(p_wf_activities_vl_tbl(l_activity_record_num).begin_date,
1404 l_expected_format)|| l_end_date);
1405
1406 /*
1407 ** Create the loop reset description
1408 */
1409 IF (p_wf_activities_vl_tbl(l_activity_record_num).rerun = 'RESET') THEN
1410
1411 wf_item_definition_util_pub.draw_detail_prompt_value_pair (
1412 wf_core.translate('WFITD_LOOP_RESET'),
1413 wf_core.translate('WFITD_LOOP_RESET_VALUE'));
1414
1415 ELSIF (p_wf_activities_vl_tbl(l_activity_record_num).rerun = 'LOOP') THEN
1416
1417 wf_item_definition_util_pub.draw_detail_prompt_value_pair (
1418 wf_core.translate('WFITD_LOOP_RESET'),
1419 wf_core.translate('WFITD_LOOP_RESET_LOOP'));
1420
1421 ELSE
1422
1423 wf_item_definition_util_pub.draw_detail_prompt_value_pair (
1424 wf_core.translate('WFITD_LOOP_RESET'),
1425 wf_core.translate('WFITD_LOOP_RESET_IGNORE'));
1426
1427 END IF;
1428
1429 /*
1430 ** Create the version row in the table
1431 */
1432 wf_item_definition_util_pub.draw_detail_prompt_value_pair (
1433 wf_core.translate('WFITD_VERSION'),
1434 p_wf_activities_vl_tbl(l_activity_record_num).version);
1435
1436 /*
1437 ** Call function to print the read/write/execute roles
1438 */
1439 wf_item_definition_util_pub.draw_read_write_exe_details(
1440 p_wf_activities_vl_tbl(l_activity_record_num).read_role,
1441 p_wf_activities_vl_tbl(l_activity_record_num).write_role,
1442 p_wf_activities_vl_tbl(l_activity_record_num).execute_role,
1443 TRUE);
1444
1445 /*
1446 ** Call function to print the customization/protection levels
1447 */
1448 wf_item_definition_util_pub.draw_custom_protect_details(
1449 p_wf_activities_vl_tbl(l_activity_record_num).custom_level,
1450 p_wf_activities_vl_tbl(l_activity_record_num).protect_level);
1451
1452 /*
1453 ** Table is created so close it out
1454 */
1455 htp.tableClose;
1456
1457 /*
1458 ** Here we look for all the activity attributes that are related to
1459 ** the current activity. The p_wf_activity_attr_vl_tbl is
1460 ** ordered by activty type (PROCESS, NOTICE, FUNCTION) then by
1461 ** display name and then by activity attribute
1462 ** display name. As long as we stay in sync we should be
1463 ** able to correctly create the temp attribute list
1464 ** for the current activity. We could create a cursor
1465 ** here for the child attributes but that would break
1466 ** the rule of separating the UI layer and the data layer
1467 */
1468 l_wf_activity_attr_vl_tbl.delete;
1469 l_cur_attr_record_num := 1;
1470
1471 /*
1472 ** Make sure there is at least on record in the activity attribute
1473 ** list. If there is not then the l_attr_record_num index of 1
1474 ** will cause a 6502-PL*SQL numeric or value error exception.
1475 */
1476 WHILE (
1477 l_attr_record_num <= p_wf_activity_attr_vl_tbl.count AND
1478 p_wf_activities_vl_tbl(l_activity_record_num).type =
1479 p_wf_activity_attr_vl_tbl(l_attr_record_num).activity_type
1480 AND p_wf_activities_vl_tbl(l_activity_record_num).display_name =
1481 p_wf_activity_attr_vl_tbl(l_attr_record_num).activity_display_name
1482 ) LOOP
1483
1484 /*
1485 ** We have found an attribute for the current activity. Copy the
1486 ** contents of that list to a temp attr list and then pass the
1487 ** temp list to the activity_attribute display function to display
1488 ** the results.
1489 */
1490 l_wf_activity_attr_vl_tbl(l_cur_attr_record_num) :=
1491 p_wf_activity_attr_vl_tbl(l_attr_record_num);
1492
1493 l_attr_record_num := l_attr_record_num + 1;
1494 l_cur_attr_record_num := l_cur_attr_record_num + 1;
1495
1496 END LOOP;
1497
1498 /*
1499 ** If the l_cur_attr_record_num is greater than 1 then you
1500 ** must have found an attribute for this activity. Copy that
1501 ** set of attributes to a temporary pl*sql table and then
1502 ** print it out.
1503 */
1504 IF (l_cur_attr_record_num > 1) THEN
1505
1506 /*
1507 ** Put in a couple of blank lines between the current activity
1508 ** and its attributes
1509 */
1510 htp.p('<BR><BR>');
1511
1512 /*
1513 ** List all the activity attribute details for this activity that
1514 ** we found above.
1515 */
1516 wf_activities_vl_pub.draw_activity_attr_details (
1517 l_wf_activity_attr_vl_tbl,
1518 1);
1519
1520 /*
1521 ** If you still have more activities to process and the next activity is
1522 ** the same type as the current one then put in a
1523 ** few blank lines and put in another Activity Details Header
1524 */
1525 IF (l_activity_record_num < p_wf_activities_vl_tbl.count AND
1526 l_activity_type = p_wf_activities_vl_tbl(l_activity_record_num + 1).type) THEN
1527
1528 /*
1529 ** Put in a couple of blank lines between the current activity
1530 ** attributes and the next activity
1531 */
1532 htp.p('<BR><BR>');
1533
1534 /*
1535 ** Draw the section title for the Activity detail section
1536 */
1537 wf_item_definition_util_pub.draw_detail_section_title (
1538 l_activity_section_title,
1539 0);
1540
1541 END IF;
1542
1543 END IF;
1544
1545
1546 /*
1547 ** Draw a line between each activity definition
1548 ** if this is not the last item in the list and if there
1549 ** are no attributes in the attribute list for this activity and
1550 ** there are more activities of the same type
1551 */
1552 IF (l_activity_record_num < p_wf_activities_vl_tbl.count AND
1553 l_cur_attr_record_num = 1 AND
1554 l_activity_type = p_wf_activities_vl_tbl(l_activity_record_num + 1).type) THEN
1555
1556 htp.p ('<HR noshade size="1">');
1557
1558 END IF;
1559
1560 END IF;
1561
1562 END LOOP;
1563
1564 /*
1565 ** Check to see if you skipped the processes section in case
1566 ** there weren't any. If so print out the header for the processes
1567 ** here.
1568 */
1569 IF (p_print_skipped_titles = TRUE) THEN
1570
1571 wf_item_definition_util_pub.activity_titles_details (
1572 l_highest_activity,
1573 4);
1574
1575 END IF;
1576
1577 EXCEPTION
1578 WHEN OTHERS THEN
1579 Wf_Core.Context('wf_activities_vl_pub', 'draw_activity_details');
1580 wf_item_definition.Error;
1581
1582 END draw_activity_details;
1583
1584 /*===========================================================================
1585 PROCEDURE NAME: draw_activity_attr_details
1586
1587 DESCRIPTION: Shows all of the details for a list of
1588 activity attributes for that have been passed
1589 in.
1590
1591 MODIFICATION LOG:
1592 06-JUN-2001 JWSMITH BUG 1819232 - added summary attr for table tag for ADA
1593 ============================================================================*/
1594 PROCEDURE draw_activity_attr_details
1595 (p_wf_activity_attr_vl_tbl IN wf_activities_vl_pub.wf_activity_attr_vl_tbl_type,
1596 p_indent_level IN NUMBER) IS
1597
1598 l_record_num NUMBER;
1599 ii NUMBER := 0;
1600 l_activity_name_prompt VARCHAR2(80);
1601 l_activity_attr_name_prompt VARCHAR2(80);
1602 l_activity_section_title VARCHAR2(240);
1603
1604 BEGIN
1605
1606 /*
1607 ** Create the the activity attributes title.
1608 ** I'm using the first record to determine the type since all
1609 ** attributes in this list are for the same activity of a specfic
1610 ** type
1611 */
1612 IF (p_wf_activity_attr_vl_tbl(1).activity_type = 'PROCESS') THEN
1613
1614 /*
1615 ** Put on the the processes title.
1616 */
1617 l_activity_section_title := wf_core.translate('WFITD_PROCESS_ATTR_DETAILS');
1618 l_activity_name_prompt := wf_core.translate('WFITD_PROCESS_NAME');
1619 l_activity_attr_name_prompt := wf_core.translate('WFITD_PROCESS_ATTR_NAME');
1620
1621 ELSIF (p_wf_activity_attr_vl_tbl(1).activity_type = 'NOTICE') THEN
1622
1623 /*
1624 ** Put on the the notification title.
1625 */
1626 l_activity_section_title := wf_core.translate('WFITD_NOTIFICATION_ATTR_DETAIL');
1627 l_activity_name_prompt := wf_core.translate('WFITD_NOTIFICATION_NAME');
1628 l_activity_attr_name_prompt := wf_core.translate('WFITD_NOTIFICATION_ATTR_NAME');
1629
1630 ELSIF (p_wf_activity_attr_vl_tbl(1).activity_type = 'FUNCTION') THEN
1631
1632 /*
1633 ** Put on the the function title.
1634 */
1635 l_activity_section_title := wf_core.translate('WFITD_FUNCTION_ATTR_DETAILS');
1636 l_activity_name_prompt := wf_core.translate('WFITD_FUNCTION_NAME');
1637 l_activity_attr_name_prompt := wf_core.translate('WFITD_FUNCTION_ATTR_NAME');
1638
1639 END IF;
1640
1641
1642 /*
1643 ** Draw the section title for the activity attribute detail section
1644 */
1645 wf_item_definition_util_pub.draw_detail_section_title (
1646 l_activity_section_title,
1647 0);
1648
1649 /*
1650 ** Print out all meesage attribute display names in the pl*sql table
1651 */
1652 FOR l_record_num IN 1..p_wf_activity_attr_vl_tbl.count LOOP
1653
1654 /*
1655 ** Open a new table for each attribute so you can control the spacing
1656 ** between each attribute
1657 */
1658 htp.tableOpen(cattributes=>'border=0 cellpadding=2 cellspacing=0
1659 summary=""');
1660
1661 /*
1662 ** Create the target for the hotlink from the summary view. Also
1663 ** create the first row in the table which is always the display
1664 ** name for the object.
1665 */
1666 wf_item_definition_util_pub.create_details_hotlink_target (
1667 'ACTIVITY_ATTR',
1668 p_wf_activity_attr_vl_tbl(l_record_num).activity_type||':'||
1669 p_wf_activity_attr_vl_tbl(l_record_num).activity_name||':'||
1670 p_wf_activity_attr_vl_tbl(l_record_num).name,
1671 p_wf_activity_attr_vl_tbl(l_record_num).display_name,
1672 l_activity_attr_name_prompt,
1673 0);
1674
1675 /*
1676 ** Create the internal name row in the table.
1677 */
1678 wf_item_definition_util_pub.draw_detail_prompt_value_pair (
1679 wf_core.translate('WFITD_INTERNAL_NAME'),
1680 p_wf_activity_attr_vl_tbl(l_record_num).name);
1681
1682 /*
1683 ** Create the activity display name row in the table.
1684 */
1685 wf_item_definition_util_pub.draw_detail_prompt_value_pair (
1686 l_activity_name_prompt,
1687 p_wf_activity_attr_vl_tbl(l_record_num).activity_display_name);
1688
1689 /*
1690 ** Create the description row in the table
1691 */
1692 wf_item_definition_util_pub.draw_detail_prompt_value_pair (
1693 wf_core.translate('DESCRIPTION'),
1694 p_wf_activity_attr_vl_tbl(l_record_num).description);
1695
1696 /*
1697 ** Create the attribute type row in the table
1698 */
1699 wf_item_definition_util_pub.draw_detail_prompt_value_pair (
1700 wf_core.translate('WFITD_ATTRIBUTE_TYPE'),
1701 wf_core.translate('WFITD_ATTR_TYPE_'||
1702 p_wf_activity_attr_vl_tbl(l_record_num).type));
1703
1704 /*
1705 ** Create the length/format/lookup type row in the table.
1706 ** If the type is VARCHAR2 then show a length prompt
1707 ** If the type is NUMBER/DATE then show format prompt
1708 ** If the type is LOOKUP then show lookup type prompt
1709 ** If it is any other type then don't show the row at all
1710 */
1711 IF (p_wf_activity_attr_vl_tbl(l_record_num).type = 'VARCHAR2') THEN
1712
1713 wf_item_definition_util_pub.draw_detail_prompt_value_pair (
1714 wf_core.translate('LENGTH'),
1715 p_wf_activity_attr_vl_tbl(l_record_num).format);
1716
1717 ELSIF (p_wf_activity_attr_vl_tbl(l_record_num).type IN ('DATE', 'NUMBER')) THEN
1718
1719 wf_item_definition_util_pub.draw_detail_prompt_value_pair (
1720 wf_core.translate('FORMAT'),
1721 p_wf_activity_attr_vl_tbl(l_record_num).format);
1722
1723 ELSIF (p_wf_activity_attr_vl_tbl(l_record_num).type = 'LOOKUP') THEN
1724
1725 wf_item_definition_util_pub.draw_detail_prompt_value_pair (
1726 wf_core.translate('LOOKUP'),
1727 p_wf_activity_attr_vl_tbl(l_record_num).lookup_type_display_name);
1728
1729 ELSIF (p_wf_activity_attr_vl_tbl(l_record_num).type IN ('URL','DOCUMENT')) THEN
1730 /*
1731 ** If it is URL or DOCUMENT, indicate where the resulting page should be displayed
1732 */
1733 IF (NVL(p_wf_activity_attr_vl_tbl(l_record_num).format, '_top') = '_top') THEN
1734 wf_item_definition_util_pub.draw_detail_prompt_value_pair
1735 (wf_core.translate('WFITD_FRAME_TARGET'), wf_core.translate('WFITD_TOP'));
1736 ELSIF (p_wf_activity_attr_vl_tbl(l_record_num).format = '_blank') THEN
1737 wf_item_definition_util_pub.draw_detail_prompt_value_pair
1738 (wf_core.translate('WFITD_FRAME_TARGET'), wf_core.translate('WFITD_BLANK'));
1739 ELSIF (p_wf_activity_attr_vl_tbl(l_record_num).format = '_self') THEN
1740 wf_item_definition_util_pub.draw_detail_prompt_value_pair
1741 (wf_core.translate('WFITD_FRAME_TARGET'), wf_core.translate('WFITD_SELF'));
1742 ELSIF (p_wf_activity_attr_vl_tbl(l_record_num).format = '_parent') THEN
1743 wf_item_definition_util_pub.draw_detail_prompt_value_pair
1744 (wf_core.translate('WFITD_FRAME_TARGET'), wf_core.translate('WFITD_PARENT'));
1745 END IF;
1746
1747
1748 END IF;
1749
1750 /*
1751 ** Create the default type row
1752 */
1753 wf_item_definition_util_pub.draw_detail_prompt_value_pair (
1754 wf_core.translate('WFITD_DEFAULT_TYPE'),
1755 wf_core.translate('WFITD_DEFAULT_TYPE_'||
1756 p_wf_activity_attr_vl_tbl(l_record_num).value_type));
1757
1758
1759 /*
1760 ** If the default value is a constant then show the default value type
1761 ** that is not null. If the default value is based on an item attribute
1762 ** then show the attr_default_display_name.
1763 */
1764 IF (p_wf_activity_attr_vl_tbl(l_record_num).value_type = 'ITEMATTR') THEN
1765
1766 /*
1767 ** Create the default item attribute row in the table. This is based on the
1768 ** p_wf_activity_attr_vl_tbl(l_record_num).attr_default_display_name
1769 */
1770 wf_item_definition_util_pub.draw_detail_prompt_value_pair (
1771 wf_core.translate('WFITD_DEFAULT_VALUE'),
1772 p_wf_activity_attr_vl_tbl(l_record_num).attr_default_display_name);
1773
1774 /*
1775 ** Create the default value row in the table. If the attribute type is based on
1776 ** a lookup then the default value must be one of the lookup codes. If so print
1777 ** the lookup code that was fetch.
1778 */
1779 ELSIF (p_wf_activity_attr_vl_tbl(l_record_num).type = 'LOOKUP') THEN
1780
1781 wf_item_definition_util_pub.draw_detail_prompt_value_pair (
1782 wf_core.translate('WFITD_DEFAULT_VALUE'),
1783 p_wf_activity_attr_vl_tbl(l_record_num).lookup_code_display_name);
1784
1785 /*
1786 ** If this is any other attribute type then
1787 ** nvl on text value. If there is no text value then try the number
1788 ** default. If there is no number default then try the date.
1789 */
1790 ELSE
1791
1792 wf_item_definition_util_pub.draw_detail_prompt_value_pair (
1793 wf_core.translate('WFITD_DEFAULT_VALUE'),
1794 NVL(p_wf_activity_attr_vl_tbl(l_record_num).text_default,
1795 NVL(TO_CHAR(p_wf_activity_attr_vl_tbl(l_record_num).number_default),
1796 TO_CHAR(p_wf_activity_attr_vl_tbl(l_record_num).date_default))));
1797
1798 END IF;
1799
1800 /*
1801 ** Table is created so close it out
1802 */
1803 htp.tableClose;
1804
1805 /*
1806 ** Draw a line between each activity attribute definition
1807 ** if this is not the last item in the list
1808 */
1809 IF (l_record_num <> p_wf_activity_attr_vl_tbl.count) THEN
1810
1811 htp.p ('<HR noshade size="1">');
1812
1813 END IF;
1814
1815 END LOOP;
1816
1817 EXCEPTION
1818 WHEN OTHERS THEN
1819 Wf_Core.Context('wf_activities_vl_pub', 'draw_activity_attr_details');
1820 wf_item_definition.Error;
1821
1822 END draw_activity_attr_details;
1823
1824 END wf_activities_vl_pub;