DBA Data[Home] [Help]

PACKAGE BODY: APPS.ICXSUNWF

Source


1 PACKAGE BODY icxsunwf as
2 --$Header: ICXWFSNB.pls 115.4 2001/01/03 16:10:52 pkm ship      $
3 --
4 
5 procedure Add_Domain(itemtype        in varchar2,
6                      itemkey                in varchar2,
7                      actid                  in number,
8                      funmode                in varchar2,
9                      result                 out varchar2 ) is
10 
11 l_user_name     varchar2(100);
12 l_supplier_id   number;
13 l_email_address varchar2(240);
14 l_new_user_name varchar2(100);
15 
16 begin
17 
18 if funmode = 'RUN' then
19         --
20 	l_user_name := wf_engine.GetItemAttrText(itemtype => itemtype,
21 						 itemkey => itemkey,
22 					         aname => 'ICX_USER_NAME');
23         --
24         l_supplier_id := wf_engine.GetItemAttrNumber(itemtype  => itemtype,
25                                                      itemkey   => itemkey,
26                                                      aname  => 'SUPPLIER_ID');
27         --
28         l_email_address := wf_engine.GetItemAttrText(itemtype  => itemtype,
29                                                      itemkey   => itemkey,
30                                                      aname  => 'CONTACT_EMAIL_ADDRESS');
31         --
32 	icx_supp_custom.setDomain(p_username => l_user_name,
33 				  p_supplier_id => l_supplier_id,
34 				  p_email_address => l_email_address,
35 			          p_new_username => l_new_user_name);
36 	--
37 	wf_engine.SetItemAttrText(itemtype        => itemtype,
38                                   itemkey         => itemkey,
39                                   aname           => 'ICX_USER_NAME',
40                                   avalue          => l_new_user_name);
41 
42 elsif ( funmode = 'CANCEL' ) then
43      result := 'COMPLETE';
44 end if;
45      result := '';
46 
47 exception
48    when others then
49       wf_core.context('icxsunwf','Add_Domain',itemtype,itemkey);
50       raise;
51 end;
52 
53 procedure Verify_Name(itemtype        in varchar2,
54                       itemkey                in varchar2,
55                       actid                  in number,
56                       funmode                in varchar2,
57                       result                 out varchar2 ) is
58 
59 
60    l_user_name     varchar2(500);
61    l_count         number;
62    l_accept_status varchar2(1);
63 
64 begin
65 
66 if funmode = 'RUN' then
67         --
68 	l_user_name := wf_engine.GetItemAttrText(itemtype => itemtype,
69 						 itemkey => itemkey,
70 					         aname => 'ICX_USER_NAME');
71         --
72    if length(l_user_name) <= 30
73    then
74        -- check if already exists in wf_roles
75        select count(*)
76        into   l_count
77        from   wf_roles
78        where  name = l_user_name;
79 
80        if l_count > 0 then
81 
82           l_accept_status := 'D';
83           result := 'COMPLETE:FAILED';
84        else
85 
86           l_accept_status := 'Y';
87           result := 'COMPLETE:PASSED';
88        end if;
89    else
90 
91 	l_accept_status := 'L';
92         result := 'COMPLETE:FAILED';
93    end if;
94 
95    --
96    wf_engine.SetItemAttrText  (    itemtype        => itemtype,
97 				   itemkey 	   => itemkey,
98 				   aname  	   => 'ICX_ACCEPT_STATUS',
99 				   avalue 	   => l_accept_status);
100 
101 elsif ( funmode = 'CANCEL' ) then
102      result := 'COMPLETE';
103 else
104      result := '';
105 end if;
106 
107 exception
108    when others then
109       wf_core.context('icxsunwf','Verify_Name',itemtype,itemkey);
110       raise;
111 end;
112 
113 procedure StartNameProcess(p_username           in varchar2,
114 			   p_supplier_id        in number,
115 			   p_email_address      in varchar2,
116 			   p_itemkey	        in varchar2) is
117 --
118 l_ItemType 		varchar2(100) := 'ICXSUNAM';
119 --
120 begin
121 	wf_engine.threshold := 9999999.99;
122 	--
123 	wf_engine.createProcess( ItemType => l_ItemType,
124 				 ItemKey  => p_ItemKey,
125 				 process  => 'ICXSUNAP' );
126 	--
127 	--
128         wf_engine.SetItemAttrText (itemtype => l_ItemType,
129                                    itemkey => p_itemkey,
130                                    aname => 'ICX_USER_NAME',
131                                    avalue => upper(p_username));
132         --
133         --
134 	wf_engine.SetItemAttrNumber (itemtype	=> l_ItemType,
135 			      	     itemkey  	=> p_itemkey,
136   		 	      	     aname 	=> 'SUPPLIER_ID',
137 			      	     avalue	=> p_supplier_id);
138         --
139         --
140         wf_engine.SetItemAttrText (itemtype => l_ItemType,
141 				   itemkey => p_itemkey,
142 				   aname => 'CONTACT_EMAIL_ADDRESS',
143 				   avalue => p_email_address);
144         --
145         --
146 	wf_engine.StartProcess ( ItemType => l_ItemType,
147 				 ItemKey  => p_ItemKey );
148 	--
149 	--
150 exception
151    when others then
152       wf_core.context('icxsunwf','StartNameProcess',l_itemtype,p_itemkey);
153       raise;
154 end StartNameProcess;
155 --
156 --
157 end icxsunwf;