DBA Data[Home] [Help]

PACKAGE BODY: APPS.WF_ITEM_DEFINITION

Source


1 PACKAGE BODY wf_item_definition AS
2 /* $Header: wfdefb.pls 120.1 2005/07/02 03:43:48 appldev ship $  */
3 
4 /*===========================================================================
5   PACKAGE NAME:         wf_item_definition
6 
7   DESCRIPTION:
8 
9   OWNER:                GKELLNER
10 
11 ============================================================================*/
12 
13 /*===========================================================================
14   PROCEDURE NAME:       find_item_type
15 
16   DESCRIPTION:
17                         Main Find View drawing routine.  This is the
18                         main entry point into the Item Type
19                         Definition View.  This view has two attributes: The
20                         Item Type List shows all the Items Types that
21                         are currently stored in the Workflow database
22                         repository.  The effective date allows you to
23                         chose which date you would like the view to be
24                         effective for.   Since activities can
25                         have multiple versions and have effective date ranges
26                         for each of those version we need a specific value
27                         to determine which of those versions is requested.
28                         Once the user clicks on the Find buttton from
29                         this view, the draw_item_type function takes over to
30                         create the Item Type Definition.
31 
32  MODIFICATION LOG:
33      06-JUN-2001 JWSMITH BUG 1819232 -Added ID attr for TD tag for ADA
34                  - Added summary attr for table tag
35 
36 ============================================================================*/
37 PROCEDURE find_item_type IS
38 
39   l_username            VARCHAR2(320);
40   l_admin_role          VARCHAR2(320);
41   l_admin_privilege     BOOLEAN;
42 
43   l_char_date           VARCHAR2(80);
44   l_date_date           DATE;
45   l_valid_date          BOOLEAN;
46   l_expected_format     VARCHAR2(80);
47 
48   /*
49   ** List of all item types based no security or admin access
50   */
51   CURSOR admin_itemtypes IS
52   SELECT display_name, name
53   FROM   wf_item_types_vl
54   ORDER BY 1;
55 
56   /*
57   ** List of item types based on owner access for a given user.
58   */
59   CURSOR user_itemtypes IS
60   SELECT distinct wit.display_name, wit.name
61   FROM   wf_item_types_vl wit, wf_items wik
62   WHERE  wik.owner_role = l_username
63   AND    wik.item_type = wit.name
64   ORDER BY 1;
65 
66   CURSOR all_users IS
67   SELECT distinct wik.owner_role owner_role
68   FROM   wf_items wik
69   ORDER BY 1;
70 
71 BEGIN
72 
73    /*
74    ** Make sure the user has signed on
75    */
76    wfa_sec.GetSession(l_username);
77 
78    /*
79    ** Check what security controls are enabled
80    */
81    l_admin_role := wf_core.Translate('WF_ADMIN_ROLE');
82 
83    IF (l_admin_role <> '*')  THEN
84 
85        IF (wf_directory.IsPerformer(l_username, l_admin_role)) THEN
86 
87           l_admin_privilege := TRUE;
88 
89        ELSE
90 
91           l_admin_privilege := FALSE;
92 
93        END IF;
94 
95    ELSE
96 
97        /*
98        ** No security is enabled so everyone has admin privileges.
99        */
100        l_admin_privilege := TRUE;
101 
102    END IF;
103 
104    /*
105    ** Create a standard title page with the item_type display name as the title
106    */
107    wf_item_definition.draw_header(
108       NULL,
109       NULL,
110       'FIND');
111 
112    /*
113    ** We use the simple GET method, when the form is submitted it
114    ** generates a URL of the form
115    **
116    **    http://...wf_item_definition.draw_item_type?x_process=<name>&x_ident= ...
117    **
118    ** which is what our instance_list procedure (defined later) is
119    ** expecting to get passed.
120    */
121   htp.formOpen(curl=>'wf_item_definition.draw_item_type',
122                cmethod=>'GET', cattributes=>'NAME="WF_FIND"');
123 
124    /*
125    ** Create a table for the find attributes.
126    */
127    htp.tableOpen(calign=>'CENTER', cattributes=>'border=0 cellpadding=2 cellspacing=0 summary=""');
128 
129    /*
130    ** Create the prompt for the item type poplist
131    */
132    htp.tableRowOpen;
133    htp.tableData(cvalue=>'<LABEL FOR="i_item_type">' ||
134                  wf_core.translate('ITEMTYPE') || '</LABEL>',
135                  calign=>'right',
136                  cattributes=>'valign=middle id=""');
137 
138 
139    /*
140    ** Create the item type poplist
141    */
142    htp.p('<TD ID="' || wf_core.translate('ITEMTYPE') || '">');
143    htp.formSelectOpen(cname=>'p_item_type',cattributes=>'id="i_item_type"');
144 
145    /*
146    ** Create the item type poplist.  If you have admin privs then show
147    ** all item types
148    */
149    IF (l_admin_privilege) THEN
150 
151      FOR it IN admin_itemtypes LOOP
152 
153        /*
154        ** Take care of the case where the item type has a space in it.
155        ** We used a + to represent the space in the list of values since you
156        ** can escape it in a poplist and pass it through the post.
157        */
158        htp.formSelectOption(cvalue=>it.display_name,
159                             cattributes=>'value='||REPLACE(it.name,' ', '+'));
160 
161      END LOOP;
162 
163    ELSE
164 
165      /*
166      ** If you do not have admin privs then show only those item types
167      ** for which you have owner access
168      */
169      FOR it IN user_itemtypes LOOP
170 
171        htp.formSelectOption(cvalue=>it.display_name,
172                             cattributes=>'value='||REPLACE(it.name,' ', '+'));
173 
174      END LOOP;
175 
176    END IF;
177 
178    htp.formSelectClose;
179 
180    htp.p('</TD>');
181 
182    htp.tableRowClose;
183 
184 
185    /*
186    ** Create the prompt for the Effective poplist
187    */
188    htp.tableRowOpen;
189 
190    htp.tableData(cvalue=>'<LABEL FOR="i_effective_date">' ||
191                  wf_core.translate('WFITD_EFFECTIVE_DATE') || '</LABEL>',
192                  calign=>'right',
193                  cattributes=>'valign=middle id=""');
194 
195    /*
196    ** Get the expected format for the date.  You don't care about the
197    ** validation stuff
198    */
199    wf_item_definition_util_pub.validate_date (
200       TO_CHAR(sysdate),
201       l_date_date,
202       l_valid_date,
203       l_expected_format);
204 
205    /*
206    ** Set the default Effective Date value based on the l_expected_format
207    */
208    l_char_date := TO_CHAR(SYSDATE, l_expected_format);
209 
210    htp.tableData(cvalue=>htf.formText(cname=>'p_effective_date',
211                                        csize=>'30',
212                                        cmaxlength=>'240',
213                                        cvalue=>l_char_date,
214                  cattributes=>'id="i_effective_date"'),
215                  calign=>'left', cattributes=>'id=""');
216 
217    htp.tableRowClose;
218 
219    htp.tableClose;
220    htp.formClose;
221 
222    -- Add submit button
223    htp.tableopen(calign=>'CENTER',cattributes=>'summary=""');
224    htp.tableRowOpen;
225 
226    htp.p('<TD ID="">');
227 
228    wfa_html.create_reg_button ('javascript:document.WF_FIND.submit()',
229                               wf_core.translate ('FIND'),
230                               wfa_html.image_loc,
231                               'fndfind.gif',
232                               wf_core.translate ('FIND'));
233 
234    htp.p('</TD>');
235 
236    htp.tableRowClose;
237    htp.tableClose;
238 
239    wfa_sec.footer;
240    htp.htmlClose;
241 
242    EXCEPTION
243    WHEN OTHERS THEN
244       Wf_Core.Context('wf_item_definition', 'find_item_type');
245       wf_item_definition.Error;
246 
247 END find_item_type;
248 
249 /*===========================================================================
250   PROCEDURE NAME:       draw_item_type
251 
252   DESCRIPTION:          Main routine that will create a three framed
253                         view that shows the complete definition of an
254                         item type.  The top frame is the view header.
255                         It show the title of the view along with
256                         controls to return to the find window, return
257                         to the main menu or exit the system.  It then
258                         displays the Item Type Summary and Item Type
259                         Details in two separate frame below the header frame.
260                         The left frame consists of the hierarchical summary
261                         of the Item Type Definition showing all display
262                         names for attributes, processes, notifications,
263                         functions, etc.  The right frame consists of
264                         a complete listing of all the objects and their
265                         associated properties for the given item type.
266 
267 
268 ============================================================================*/
269 PROCEDURE draw_item_type (
270   p_item_type           VARCHAR2 ,
271   p_effective_date      VARCHAR2 )
272  IS
273 
274 l_username            VARCHAR2(320);
275 l_valid_date          BOOLEAN;
276 l_date_date           DATE;
277 l_effective_date      VARCHAR2(80);
278 l_expected_format     VARCHAR2(80);
279 l_item_type           VARCHAR2(30);
280 
281 BEGIN
282 
283 
284   /*
285   ** Make sure the user has signed on
286   */
287   wfa_sec.GetSession(l_username);
288 
289   /*
290   ** Create the three frames for the Item Definition Summary.
291   ** The frames are constructed in the following manner:
292   ** ______________________
293   **|                     |
294   **|       HEADER        |
295   **|---------------------|
296   **|          |          |
297   **|          |          |
298   **| SUMMARY  |  DETAILS |
299   **|          |          |
300   **|          |          |
301   **|---------------------|
302   */
303 
304   htp.title(wf_core.translate('WFITD_ITEM_TYPE_DEFINITION'));
305 
306   /*
307   ** Take care of the case where the item type has a space in it.
308   ** We used a + to represent the space in the list of values since you
309   ** can escape it in a poplist and pass it through the post.  Here we'll
310   ** switch it back and let the convert function take care of it.
311   */
312   l_item_type := REPLACE(p_item_type, '+', ' ');
313 
314   /*
315   ** Check if there is a time included with the search criteria
316   ** If not the add midnight to the time so the activities will always
317   ** be after the given date on the same day.
318   */
319   /*
320   ** Do not replace + here, because we are to encode them later on
321   IF (INSTR(p_effective_date, ':') = 0) THEN
322 
323      l_effective_date := p_effective_date || '+23:59:59';
324 
325   ELSE
326 
327      l_effective_date := REPLACE(p_effective_date, ' ', '+');
328 
329   END IF;
330   */
331 
332   IF (INSTR(p_effective_date, ':') = 0) THEN
333 
334      l_effective_date := p_effective_date || ' 23:59:59';
335 
336   END IF;
337 
338   /*
339   ** Create the top header frameset and the bottom summary/detail frameset
340   */
341   htp.p ('<FRAMESET ROWS="10%,90%" BORDER=0
342            TITLE="' || WF_CORE.Translate('WFITD_ITEM_TYPE_DEFINITION') || '" LONGDESC="' ||           owa_util.get_owa_service_path ||
343            'wfa_html.LongDesc?p_token=WFITD_ITEM_TYPE_DEFINITION">');
344 
345   /*
346   ** Create the header frame
347   */
348   htp.p ('<FRAME NAME=HEADER '||
349           'SRC='||
350            owa_util.get_owa_service_path||
351            'wf_item_definition.draw_header?p_item_type='||
352             wfa_html.conv_special_url_chars(l_item_type)||
353            '&p_effective_date='||
354             wfa_html.conv_special_url_chars(l_effective_date)||
355             '&p_caller=DISPLAY'||
356            ' MARGINHEIGHT=10 MARGINWIDTH=10 '||
357            'NORESIZE SCROLLING="NO" FRAMEBORDER=YES'||
358            '" TITLE="' ||
359            WF_CORE.Translate('WFITD_ITEM_TYPE_DEFINITION') || '" LONGDESC="' ||
360            owa_util.get_owa_service_path ||
361            'wfa_html.LongDesc?p_token=WFITD_ITEM_TYPE_DEFINITION">');
362 
363 
364 
365 
366   /*
367   ** Check the effective date that was passed in.  If it is invalid
368   ** Then just show a frame with an error.  Otherwise show the
369   ** frameset for the summary and details.
370   */
371   wf_item_definition_util_pub.validate_date (
372      l_effective_date,
373      l_date_date,
374      l_valid_date,
375      l_expected_format);
376 
377   /*
378   ** The date that was passed in is good so continue to draw the
379   ** frameset for the summary and details.
380   */
381   IF (l_valid_date = TRUE) THEN
382 
383      /*
384      ** Now create the summary/detail frameset
385      */
386      htp.p ('<FRAMESET COLS="35%,65%" BORDER=0 BGCOLOR="#CCCCCC"
387               TITLE="' || WF_CORE.Translate('WFITD_ITEM_TYPE_DEFINITION') || '"
388               LONGDESC="' ||           owa_util.get_owa_service_path ||
389               'wfa_html.LongDesc?p_token=WFITD_ITEM_TYPE_DEFINITION">');
390 
391      /*
392      ** Create the summary frame
393      */
394      htp.p ('<FRAME NAME=SUMMARY '||
395             'SRC='||
396             owa_util.get_owa_service_path||
397             'wf_item_definition.draw_item_summary?p_item_type='||
398             wfa_html.conv_special_url_chars(l_item_type)||
399             '&p_effective_date='||
400             wfa_html.conv_special_url_chars(l_effective_date)||
401             ' MARGINHEIGHT=10 MARGINWIDTH=10 FRAMEBORDER=0 WRAP=OFF' ||
402             '" TITLE="' ||
403            WF_CORE.Translate('WFITD_ITEM_TYPE_DEFINITION') || '" LONGDESC="' ||
404            owa_util.get_owa_service_path ||
405            'wfa_html.LongDesc?p_token=WFITD_ITEM_TYPE_DEFINITION">');
406 
407      /*
408      ** Create the details frame
409      */
410      htp.p ('<FRAME NAME=DETAILS '||
411             'SRC='||
412             owa_util.get_owa_service_path||
413             'wf_item_definition.draw_item_details?p_item_type='||
414             wfa_html.conv_special_url_chars(l_item_type)||
415             '&p_effective_date='||
416             wfa_html.conv_special_url_chars(l_effective_date)||
417             ' MARGINHEIGHT=10 MARGINWIDTH=10 FRAMEBORDER=YES' ||
418             '" TITLE="' ||
419            WF_CORE.Translate('WFITD_ITEM_TYPE_DEFINITION') || '" LONGDESC="' ||
420            owa_util.get_owa_service_path ||
421            'wfa_html.LongDesc?p_token=WFITD_ITEM_TYPE_DEFINITION">');
422 
423      /*
424      ** Close the summary/details frameset
425      */
426      htp.p ('</FRAMESET>');
427 
428    ELSE
429 
430      /*
431      ** Create the error frame
432      */
433      htp.p ('<FRAME NAME=DETAILS '||
434             'SRC='||
435             owa_util.get_owa_service_path||
436             'wf_item_definition.draw_error?p_effective_date='||
437              wfa_html.conv_special_url_chars(l_effective_date)||
438             '&p_expected_format='||l_expected_format||
439             ' MARGINHEIGHT=10 MARGINWIDTH=10 FRAMEBORDER=YES'||
440             '" TITLE="' ||
441            WF_CORE.Translate('WFITD_ITEM_TYPE_DEFINITION') || '" LONGDESC="' ||
442            owa_util.get_owa_service_path ||
443            'wfa_html.LongDesc?p_token=WFITD_ITEM_TYPE_DEFINITION">');
444 
445   END IF;
446 
447   /*
448   ** Close the header and summary/details frameset
449   */
450   htp.p ('</FRAMESET>');
451 
452   htp.htmlClose;
453 
454   EXCEPTION
455   WHEN OTHERS THEN
456      Wf_Core.Context('wf_item_definition',
457         'draw_item_type',
458          p_item_type,
459          p_effective_date);
460 
461      wf_item_definition.Error;
462 
463 END draw_item_type;
464 
465 /*===========================================================================
466   PROCEDURE NAME:       draw_header
467 
468   DESCRIPTION:
469                         Draws the top frame of the Item Definition View.
470                         It show the title of the view along with
471                         controls to return to the find window, return
472                         to the main menu or exit the system.
473 
474 ============================================================================*/
475 PROCEDURE draw_header (
476   p_item_type           VARCHAR2 ,
477   p_effective_date      VARCHAR2 ,
478   p_caller              VARCHAR2 ) IS
479 
480 l_username                  VARCHAR2(320);
481 l_item_type_display_name    VARCHAR2(240) := NULL;
482 l_title                     VARCHAR2(240) := NULL;
483 l_wf_item_types_vl_tbl      wf_item_types_vl_pub.wf_item_types_vl_tbl_type;
484 
485 BEGIN
486 
487  -- Make sure user has signed on
488   wfa_sec.GetSession(l_username);
489 
490 
491   /*
492   ** Get the display name for the item type if it was passed in
493   */
494   IF (p_item_type IS NOT NULL) THEN
495 
496      wf_item_types_vl_pub.fetch_item_type
497         (p_item_type,
498          l_wf_item_types_vl_tbl);
499 
500      l_item_type_display_name := '('||l_wf_item_types_vl_tbl(1).display_name||')';
501 
502      /*
503      ** Add the effective date to the item type display name
504      ** if it was passed in
505      */
506 /*
507 ** Don't like this but I can see it coming up so I'll leave it here.
508 */
509 /*
510      IF (p_effective_date IS NOT NULL) THEN
511 
512        l_item_type_display_name := l_item_type_display_name || ' - ' ||
513          p_effective_date || ')';
514 
515      ELSE
516 
517        l_item_type_display_name := l_item_type_display_name || ')';
518 
519      END IF;
520 */
521 
522   END IF;
523 
524   IF (p_caller = 'FIND') THEN
525 
526      l_title := wf_core.translate('WFITD_FIND_ITEM_TYPE');
527 
528   ELSIF (p_caller = 'DISPLAY') THEN
529 
530     l_title := wf_core.translate('WFITD_ITEM_TYPE_DEFINITION');
531 
532     --call get session again to set icx values.
533     --this is important when comming from find screen because this
534     --will be executed in a new frame, which is a new session
535 
536   END IF;
537 
538   /*
539   ** Create the  Window title
540   */
541   htp.htmlOpen;
542   htp.headOpen;
543   htp.title(l_title);
544 --  wfa_html.create_help_function('wfnew/wfnew49.htm');
545   wfa_html.create_help_function('wf/links/itt.htm?ITTDEFPG');
546 
547   /*
548   ** Open body and draw standard header
549   */
550   if (p_caller = 'FIND') THEN
551 
552      wfa_sec.header(FALSE, '', l_title, FALSE);
553 
554   else
555 
556      wfa_sec.header(FALSE, 'wf_item_definition.find_item_type', l_title,FALSE);
557 
558   end if;
559 
560   htp.p('</BODY>');
561 
562   EXCEPTION
563   WHEN OTHERS THEN
564      Wf_Core.Context('wf_item_definition',
565          'draw_header',
566          p_item_type,
567          p_effective_date,
568          p_caller);
569 
570      wf_item_definition.Error;
571 
572 END draw_header;
573 
574 /*===========================================================================
575   PROCEDURE NAME:       draw_item_summary
576 
577   DESCRIPTION:          Draws a hierarchical summary of the Item
578                         Type Definition showing all display names for
579                         attributes, processes, notifications, functions,
580                         etc.  The following is an example of the output:
581 
582 ============================================================================*/
583 PROCEDURE draw_item_summary (
584   p_item_type           VARCHAR2 ,
585   p_effective_date      VARCHAR2 )
586  IS
587 
588   l_valid_date                BOOLEAN;
589   l_effective_date            DATE;
590   l_item_type                 VARCHAR2(30);
591   l_username                  VARCHAR2(320);
592   l_expected_format           VARCHAR2(80);
593 
594   l_wf_item_types_vl_tbl      wf_item_types_vl_pub.wf_item_types_vl_tbl_type;
595   l_wf_item_attributes_vl_tbl wf_item_attributes_vl_pub.wf_item_attributes_vl_tbl_type;
596   l_wf_activities_vl_tbl       wf_activities_vl_pub.wf_activities_vl_tbl_type;
597   l_wf_activity_attr_vl_tbl    wf_activities_vl_pub.wf_activity_attr_vl_tbl_type;
598   l_wf_messages_vl_tbl         wf_messages_vl_pub.wf_messages_vl_tbl_type;
599   l_wf_message_attr_vl_tbl     wf_messages_vl_pub.wf_message_attr_vl_tbl_type;
600   l_wf_lookup_types_tbl        wf_lookup_types_pub.wf_lookup_types_tbl_type;
601   l_wf_lookups_tbl             wf_lookup_types_pub.wf_lookups_tbl_type;
602 
603 BEGIN
604 
605   /*
606   ** Make sure the user has signed on
607   */
608   wfa_sec.GetSession(l_username);
609 
610   l_item_type := p_item_type;
611 
612   /*
613   ** Check the effective date that was passed in.  If it is invalid
614   ** Then just show a frame with an error.  Otherwise show the
615   ** frameset for the summary and details.
616   */
617   wf_item_definition_util_pub.validate_date (
618      p_effective_date,
619      l_effective_date,
620      l_valid_date,
621      l_expected_format);
622 
623   /*
624   ** Get all the information about this item type
625   */
626   wf_item_types_vl_pub.fetch_item_type
627      (l_item_type,
628       l_wf_item_types_vl_tbl);
629 
630 
631   /*
632   ** Fetch all the item attributes associtated with this item type
633   */
634   wf_item_attributes_vl_pub.fetch_item_attributes
635           (l_item_type,
636            null,
637            l_wf_item_attributes_vl_tbl);
638 
639   /*
640   ** Fetch all the activity information into a list.
641   ** This function will fetch all types of
642   ** activities order by Processes, Notfications, Functions, and then by
643   ** their display name
644   */
645   wf_activities_vl_pub.fetch_activities
646           (l_item_type,
647            null,
648            l_effective_date,
649            null,
650            l_wf_activities_vl_tbl,
651            l_wf_activity_attr_vl_tbl);
652 
653   /*
654   ** Fetch all the messages and their associated attributes for this item type
655   */
656   wf_messages_vl_pub.fetch_messages
657           (l_item_type,
658            null,
659            l_wf_messages_vl_tbl,
660            l_wf_message_attr_vl_tbl);
661 
662 
663   /*
664   ** Fetch all the lookup types associtated with this item type
665   */
666   wf_lookup_types_pub.fetch_lookup_types
667           (l_item_type,
668            null,
669            l_wf_lookup_types_tbl,
670            l_wf_lookups_tbl);
671 
672   /*
673   ** Open body and draw standard header
674   */
675   wfa_sec.header(background_only=>TRUE);
676 
677   /*
678   ** Open a new table for each attribute so you can control the spacing
679   ** between each attribute
680   */
681   htp.tableOpen(cattributes=>'border=0 cellpadding=0 cellspacing=0 summary=""');
682 
683   /*
684   ** List all the item type names
685   */
686   wf_item_types_vl_pub.draw_item_type_list
687           (l_wf_item_types_vl_tbl,
688            l_effective_date,
689            0);
690 
691   /*
692   ** List all the item attribute names
693   */
694   wf_item_attributes_vl_pub.draw_item_attribute_list
695           (l_wf_item_attributes_vl_tbl,
696            l_effective_date,
697            1);
698 
699   /*
700   ** List all the activity names.  This function will list all type of
701   ** activities order by Processes, Notfications, Functions, and then
702   ** by their display name.  This is based on how the list was created, not
703   ** by any special processing by the draw_activity_list function
704   */
705   wf_activities_vl_pub.draw_activity_list
706           (l_wf_activities_vl_tbl,
707            l_wf_activity_attr_vl_tbl,
708            l_effective_date,
709            1);
710 
711   /*
712   ** List all the message names
713   */
714   wf_messages_vl_pub.draw_message_list
715           (l_wf_messages_vl_tbl,
716            l_wf_message_attr_vl_tbl,
717            l_effective_date,
718            1);
719 
720   /*
721   ** List all the lookup type names
722   */
723   wf_lookup_types_pub.draw_lookup_type_list
724           (l_wf_lookup_types_tbl,
725            l_wf_lookups_tbl,
726            l_effective_date,
727            1);
728 
729 
730   /*
731   ** Table is created so close it out
732   */
733   htp.tableClose;
734 
735   EXCEPTION
736   WHEN OTHERS THEN
737      Wf_Core.Context('wf_item_definition',
738          'draw_item_summary',
739          p_item_type,
740          p_effective_date);
741 
742      wf_item_definition.Error;
743 
744 END draw_item_summary;
745 
746 /*===========================================================================
747   PROCEDURE NAME:       draw_item_details
748 
749   DESCRIPTION:          Draws a complete listing of all the objects and their
750                         associated properties for the given item type.
751                         The following is an example of the output:
752 
753 ============================================================================*/
754 PROCEDURE draw_item_details (
755   p_item_type           VARCHAR2 ,
756   p_effective_date      VARCHAR2 )
757  IS
758 
759   l_valid_date                BOOLEAN;
760   l_effective_date            DATE;
761   l_username                  VARCHAR2(320);
762   l_item_type                 VARCHAR2(30);
763   l_expected_format           VARCHAR2(80);
764 
765   l_wf_item_types_vl_tbl      wf_item_types_vl_pub.wf_item_types_vl_tbl_type;
766   l_wf_item_attributes_vl_tbl wf_item_attributes_vl_pub.wf_item_attributes_vl_tbl_type;
767   l_wf_activities_vl_tbl       wf_activities_vl_pub.wf_activities_vl_tbl_type;
768   l_wf_activity_attr_vl_tbl    wf_activities_vl_pub.wf_activity_attr_vl_tbl_type;
769   l_wf_messages_vl_tbl         wf_messages_vl_pub.wf_messages_vl_tbl_type;
770   l_wf_message_attr_vl_tbl     wf_messages_vl_pub.wf_message_attr_vl_tbl_type;
771   l_wf_lookup_types_tbl        wf_lookup_types_pub.wf_lookup_types_tbl_type;
772   l_wf_lookups_tbl             wf_lookup_types_pub.wf_lookups_tbl_type;
773 
774 BEGIN
775 
776   l_item_type := p_item_type;
777 
778   /*
779   ** Make sure the user has signed on
780   */
781   wfa_sec.GetSession(l_username);
782 
783   /*
784   ** Check the effective date that was passed in.  If it is invalid
785   ** Then just show a frame with an error.  Otherwise show the
786   ** frameset for the summary and details.
787   */
788   wf_item_definition_util_pub.validate_date (
789      p_effective_date,
790      l_effective_date,
791      l_valid_date,
792      l_expected_format);
793 
794   /*
795   ** Get all the information about this item type
796   */
797   wf_item_types_vl_pub.fetch_item_type
798      (l_item_type,
799       l_wf_item_types_vl_tbl);
800 
801   /*
802   ** Fetch all the item attributes associtated with this item type
803   */
804   wf_item_attributes_vl_pub.fetch_item_attributes
805           (l_item_type,
806            null,
807            l_wf_item_attributes_vl_tbl);
808 
809   /*
810   ** Fetch all the activity information into a list.
811   ** This function will fetch all types of
812   ** activities order by Processes, Notfications, Functions, and then by
813   ** their display name
814   */
815   wf_activities_vl_pub.fetch_activities
816           (l_item_type,
817            null,
818            l_effective_date,
819            null,
820            l_wf_activities_vl_tbl,
821            l_wf_activity_attr_vl_tbl);
822 
823   /*
824   ** Fetch all the messages and their associated attributes for this item type
825   */
826   wf_messages_vl_pub.fetch_messages
827           (l_item_type,
828            null,
829            l_wf_messages_vl_tbl,
830            l_wf_message_attr_vl_tbl);
831 
832   /*
833   ** Fetch all the lookup types associtated with this item type
834   */
835   wf_lookup_types_pub.fetch_lookup_types
836           (l_item_type,
837            null,
838            l_wf_lookup_types_tbl,
839            l_wf_lookups_tbl);
840 
841   /*
842   ** Open body and draw standard header
843   */
844   wfa_sec.header(background_only=>TRUE);
845 
846   /*
847   ** List all the item type details
848   */
849   wf_item_types_vl_pub.draw_item_type_details
850           (l_wf_item_types_vl_tbl,
851            1);
852 
853   /*
854   ** Finish off the list with a couple of blank rows
855   */
856   htp.p ('<BR><BR>');
857 
858   /*
859   ** List all the item attribute details
860   */
861   wf_item_attributes_vl_pub.draw_item_attribute_details
862           (l_wf_item_attributes_vl_tbl,
863            1);
864 
865   /*
866   ** Finish off the list with a couple of blank rows
867   */
868   htp.p ('<BR><BR>');
869 
870   /*
871   ** List all the activity details
872   */
873   wf_activities_vl_pub.draw_activity_details
874           (l_wf_activities_vl_tbl,
875            l_wf_activity_attr_vl_tbl,
876            l_effective_date,
877            1,
878            TRUE,
879            TRUE);
880 
881   /*
882   ** Finish off the list with a couple of blank rows
883   */
884   htp.p ('<BR><BR>');
885 
886   /*
887   ** List all the message details
888   */
889   wf_messages_vl_pub.draw_message_details
890           (l_wf_messages_vl_tbl,
891            l_wf_message_attr_vl_tbl,
892            1);
893 
894   /*
895   ** Finish off the list with a couple of blank rows
896   */
897   htp.p ('<BR><BR>');
898 
899   /*
900   ** List all the lookup type details
901   */
902   wf_lookup_types_pub.draw_lookup_type_details
903           (l_wf_lookup_types_tbl,
904            l_wf_lookups_tbl,
905            1);
906 
907   EXCEPTION
908   WHEN OTHERS THEN
909      Wf_Core.Context('wf_item_definition',
910          'draw_item_details',
911          p_item_type,
912          p_effective_date);
913 
914      wf_item_definition.Error;
915 
916 END draw_item_details;
917 
918 /*===========================================================================
919   PROCEDURE NAME:       error
920 
921   DESCRIPTION:
922                         Print a page with an error message.
923                         Errors are retrieved from these sources in order:
924                              1. wf_core errors
925                              2. Oracle errors
926                              3. Unspecified INTERNAL error
927 
928 ============================================================================*/
929 PROCEDURE error IS
930 BEGIN
931 
932 null;
933 end Error;
934 
935 /*===========================================================================
936   PROCEDURE NAME:       draw_error
937 
938   DESCRIPTION:          Draws the bottom frame for the error message if an
939                         invalid date has been entered
940 
941 ============================================================================*/
942 PROCEDURE draw_error (p_effective_date          VARCHAR2 ,
943                       p_expected_format         VARCHAR2 ) IS
944 
945 BEGIN
946   wfa_sec.header(background_only=>TRUE);
947 
948   /*
949   ** skip a line
950   */
951   htp.p('<BR>');
952 
953   /*
954   ** Write the error message in bold
955   */
956   htp.bold(wf_core.translate('WFITD_INVALID_EFFECTIVE'));
957 
958   /*
959   ** Write the value the user entered normally
960   */
961   htp.p(' '||p_effective_date);
962 
963   /*
964   ** skip a line
965   */
966   htp.p('<BR><BR>');
967 
968   /*
969   ** Show the expected format
970   */
971   htp.p(wf_core.translate('WFITD_USE_FORMAT')||' '||
972       TO_CHAR(sysdate, p_expected_format));
973 
974   wfa_sec.footer;
975 
976   EXCEPTION
977   WHEN OTHERS THEN
978      Wf_Core.Context('wf_item_definition', 'draw_error');
979      wf_item_definition.Error;
980 
981 END draw_error;
982 
983 /*===========================================================================
984   PROCEDURE NAME:       fetch_item_definition_url
985 
986   DESCRIPTION:          Fetches the url address to initiate the
987                         Item Definition View
988 
989 ============================================================================*/
990 PROCEDURE fetch_item_definition_url (p_item_definition_url OUT NOCOPY VARCHAR2) IS
991 
992 BEGIN
993 
994    p_item_definition_url := owa_util.get_owa_service_path||
995       'wf_item_definition.find_item_type';
996 
997   EXCEPTION
998   WHEN OTHERS THEN
999      Wf_Core.Context('wf_item_definition', 'fetch_item_definition_url');
1000      wf_item_definition.Error;
1001 
1002 END fetch_item_definition_url;
1003 
1004 END wf_item_definition;