DBA Data[Home] [Help]

PACKAGE BODY: APPS.MSD_NTF

Source


1 PACKAGE BODY MSD_NTF AS
2 /* $Header: msdntwfb.pls 120.3 2006/02/14 09:43:30 faliu noship $ */
3 
4 PROCEDURE SETUSER (AdHocRole in varchar2,
5                     UserList in varchar2)
6 IS
7 BEGIN
8    wf_directory.AddUsersToAdHocRole(role_name => AdHocRole,
9                                     role_users => UserList);
10 end SETUSER;
11 
12 PROCEDURE SETROLE (AdHocRole in varchar2, ExpDays in number)
13 IS
14    roleDisplayName varchar2(340);
15    roleName varchar2(320);
16    addDays number;
17 
18 BEGIN
19    roleDisplayName := AdHocRole;
20    roleName := AdHocRole;
21    addDays := ExpDays;
22 
23    wf_directory.CreateAdHocRole(role_name => roleName,
24 			role_display_name => roleDisplayName,
25                                 language  => NULL,
26                                 territory => NULL,
27                          role_description => NULL,
28                  notification_preference  => 'MAILHTML',
29                                role_users => NULL,
30                            email_address  => NULL,
31                                 fax       => NULL,
32                                 status    => 'ACTIVE',
33                          expiration_date  => sysdate+addDays);
34 end SETROLE;
35 
36 PROCEDURE REMUSER (AdHocRole in varchar2,
37                    UserList in varchar2)
38 IS
39 BEGIN
40  wf_directory.RemoveUsersFromAdHocRole(AdHocRole, UserList);
41 end REMUSER;
42 
43 --
44 -- REMALL cleans up wf_local_roles.  It is called from OES by ntf.purgerole
45 -- ntf.purgerole also calls wf_purge.notificatons and wf_purgeItem
46 -- along with this so all expired notifications are cleaned.
47 -- These are called by expiration_date.
48 --
49 PROCEDURE REMALL (AdHocRole in varchar2)
50 IS
51 BEGIN
52   wf_directory.RemoveUsersFromAdHocRole(AdHocRole);
53 
54   delete wf_local_roles
55   where name = AdHocRole;
56 
57   commit;
58 
59 end REMALL;
60 
61 --
62 -- Accepts arguements to set message for notifications.
63 -- Creates notifcation process, sets attributes and
64 -- starts [sends] the notification.  It relies on the
65 -- Ad Hoc directory service being set.
66 
67 PROCEDURE DO_NTFY (WorkflowProcess in varchar2,
68                       iteminput in varchar2,
69                       inputkey in varchar2,
70                       inowner in varchar2,
71                       AdHocRole in varchar2,
72                       URLfragment in varchar2,
73 		      Subject in varchar2,
74                       msgBody in varchar2)
75 IS
76    itemtype varchar2(30);
77    itemkey varchar2(240);
78    owner varchar2(320);
79 BEGIN
80    itemtype := iteminput;
81    itemkey := inputkey;
82    owner := inowner;
83 
84    wf_engine.CreateProcess(ItemType => ItemType,
85                            itemKey => ItemKey,
86                            process => WorkflowProcess);
87    wf_engine.SetItemOwner(ItemType => ItemType,
88                          ItemKey => ItemKey,
89                          owner => owner);
90    wf_engine.SetItemAttrText(Itemtype => ItemType,
91 				   Itemkey => ItemKey,
92 				   aname => 'ADHOCROLE',
93 				   avalue => AdHocRole);
94    wf_engine.SetItemAttrText(Itemtype => ItemType,
95 				   Itemkey => ItemKey,
96 				   aname => 'NTFSUBJECT',
97 				   avalue => Subject);
98    wf_engine.SetItemAttrText(Itemtype => ItemType,
99 				   Itemkey => ItemKey,
100 				   aname => 'NTFMSGBODY',
101 				   avalue => msgBody);
102    wf_engine.SetItemAttrText(Itemtype => ItemType,
103 				   Itemkey => ItemKey,
104 				   aname => 'URLVALUE',
105 				   avalue => URLfragment);
106 
107    wf_engine.StartProcess(ItemType => ItemType,
108                          ItemKey => ItemKey);
109    return;
110    exception
111      when others then
112         WF_CORE.CONTEXT('MSD_NTF', 'DO_NTFY ',
113          itemtype, itemkey);
114    raise;
115 end DO_NTFY;
116 
117 
118 procedure SHOW_REPORT_CLOB(document_id in varchar2,
119                            display_type in varchar2,
120                            document in out nocopy clob,
121                            document_type in out nocopy varchar2) IS
122 begin
123   --check display_type
124   if (display_type <> 'text/plain') then
125     document_type := 'text/html';
126     dbms_lob.append(document, msd_common_utilities.dbms_aw_interp(document_id));
127   end if;
128 
129   -- handle case where the assignment or the alert has been deleted
130   EXCEPTION
131     when others then
132       null;
133 end SHOW_REPORT_CLOB;
134 
135 end MSD_NTF;