DBA Data[Home] [Help]

PACKAGE BODY: APPS.SOA_REMOVE

Source


1 package body SOA_REMOVE as
2 /* $Header: SOAREMB.pls 120.1.12020000.3 2013/02/19 10:16:43 rajeevkk ship $ */
3 
4 G_NO_ERROR      pls_integer := 0;          -- success without any error.
5 G_WARNING       pls_integer := 1;          -- generic warning.
6 
7 
8 --PROCEDURE
9 
10 procedure remove_class_derived_entry (
11 	                        p_base_class_id in pls_integer,
12 				p_service_type in varchar2,
13                                 p_err_code OUT NOCOPY pls_integer,
14 	                        p_err_message OUT NOCOPY varchar2
15                                      ) IS
16 
17          c_irep_base_name fnd_irep_classes .irep_name%type;
18          c_class_type fnd_irep_classes .class_type%type;
19          --dbms_output.put_line('STARTING Removal Process');
20          cursor c_derived_class_entry(c_irep_name in fnd_irep_classes .irep_name%type , c_base_class_id in number , c_service_type in fnd_irep_classes .class_type%type) is
21           select class_id,class_type from fnd_irep_classes where irep_name = c_irep_name and assoc_class_id = c_base_class_id and class_type = c_service_type;
22 
23          cursor c_derived_class_entry1(c_irep_name in fnd_irep_classes .irep_name%type , c_base_class_id in number, c_service_type in fnd_irep_classes. class_type%type) is
24           select count(*) l_count from fnd_irep_classes where irep_name = c_irep_name and assoc_class_id = c_base_class_id and class_type = c_service_type;
25           c_class_rec c_derived_class_entry1%ROWTYPE;
26           d_count pls_integer:= -1;
27 
28 
29         begin
30           if (p_base_class_id is null ) then
31 		p_err_code := -1;
32 		wf_core.token('BaseClassId',p_base_class_id);
33   		p_err_message := wf_core.translate('WF_WS_BASE_CLASS_NOT_EXIST');
34 		raise program_exit;
35           end if;
36 
37           select irep_name into c_irep_base_name from fnd_irep_classes where class_id = p_base_class_id;
38           select class_type into c_class_type from fnd_irep_classes where class_id = p_base_class_id;
39 
40 		  if c_class_type = 'XMLGATEWAY' then
41           update fnd_irep_classes set irep_name=c_irep_base_name where assoc_class_id=p_base_class_id;
42           end if;
43 
44           open c_derived_class_entry1(c_irep_base_name,p_base_class_id,p_service_type);
45           fetch c_derived_class_entry1 into c_class_rec;
46           close c_derived_class_entry1;
47 
48          if c_class_rec.l_count = 0 then
49           	p_err_code := -1;
50   		wf_core.token('BaseClassId',p_base_class_id);
51   		p_err_message := wf_core.translate('WF_WS_DERIVED_CLASS_NOT_EXIST');
52   		raise program_exit;
53   	end if;
54 
55 
56           d_count := c_class_rec.l_count;
57           FOR c_derived_class_entry_rec1 IN c_derived_class_entry(c_irep_base_name,p_base_class_id,p_service_type)
58           LOOP
59 
60             --if (c_derived_class_entry_rec1.class_type = 'SOAPSERVICEDOC'  OR  c_derived_class_entry_rec1.class_type = 'WEBSERVICEDOC') then
61             --  remove_derived_function_entry(c_derived_class_entry_rec1.class_id,p_err_code ,p_err_message );
62             --end if;
63             remove_derived_function_entry(c_derived_class_entry_rec1.class_id,p_err_code ,p_err_message );
64 
65            begin
66              delete from fnd_irep_classes where class_id = c_derived_class_entry_rec1.class_id;
67              --dbms_output.put_line('classId to delete' || c_derived_class_entry_rec1.class_id);
68             exception
69  		when program_exit then
70  			raise program_exit;
71  		when others then
72  			p_err_code := -1;
73  			wf_core.token('BaseClassId',p_base_class_id);
74                         wf_core.token('DerivedClassId',c_derived_class_entry_rec1.class_id);
75  			wf_core.token('SqlErr',SQLERRM);
76  			p_err_message := wf_core.translate('WF_WS_CLASS_FUNC_ITER');
77  			raise program_exit;
78  		end;
79 
80               d_count := d_count-1;
81         END LOOP;
82         if(d_count = 0) then
83         p_err_code := 0;
84         wf_core.token('BaseClassId',p_base_class_id);
85         p_err_message := wf_core.translate('WF_WS_DELETE_SUCCESS');
86         end if;
87 
88           exception
89  		when program_exit then
90  			null;
91  		when others then
92                       p_err_code := -1;
93                       p_err_message := wf_core.translate('WF_WS_CLASS_REMOVE');
94 
95 
96 end remove_class_derived_entry;
97 
98 --PROCEDURE
99 
100 procedure remove_derived_function_entry(
101                                         p_derived_class_id in pls_integer,
102                                         p_err_code OUT NOCOPY pls_integer,
103                                         p_err_message OUT NOCOPY varchar2
104                                         ) IS
105 
106         cursor c_derived_function_entry(c_derived_class_id in number) is
107  	select function_id  from fnd_form_functions where irep_class_id = c_derived_class_id;
108 
109         cursor c_derived_function_entry1(c_derived_class_id in number) is
110  	select COUNT(*) l_count from fnd_form_functions where irep_class_id = c_derived_class_id;
111         c_function_rec c_derived_function_entry1%ROWTYPE;
112         c_class_type fnd_irep_classes .class_type%type;
113         base_class_id fnd_irep_classes .assoc_class_id%type;
114         f_count pls_integer := -1;
115         begin
116 
117         if (p_derived_class_id is null ) then
118 		p_err_code := -1;
119 		wf_core.token('DerivedClassId',p_derived_class_id);
120   		p_err_message := wf_core.translate('WF_WS_DERIVED_CLASS_NOT_EXIST');
121 		raise program_exit;
122           end if;
123 
124         open c_derived_function_entry1(p_derived_class_id);
125         fetch c_derived_function_entry1 into c_function_rec;
126         close c_derived_function_entry1;
127 
128          if c_function_rec.l_count = 0 then
129           	select assoc_class_id into base_class_id from fnd_irep_classes where class_id=p_derived_class_id;
130                 select class_type into c_class_type from fnd_irep_classes where class_id=base_class_id;
131                 if c_class_type = 'XMLGATEWAY' then
132                   DBMS_OUTPUT.PUT_LINE('XMLGateway service exempted from fnd_form_functions check ');
133                  else
134                 p_err_code := -1;
135   		p_err_message := wf_core.translate('WF_WS_DERIVED_FUNC_NOT_EXIST');
136   		raise program_exit;
137                 end if;
138         end if;
139         f_count := c_function_rec.l_count;
140 
141         FOR c_derived_function_entry_rec IN c_derived_function_entry(p_derived_class_id)
142         LOOP
143 
144              if(c_derived_function_entry_rec.function_id is null) then
145 
146                p_err_code := -1;
147                p_err_message := wf_core.translate('WF_WS_BASE_FUNC_NOT_EXIST');
151                --dbms_output.put_line('functionId to delete' || c_derived_function_entry_rec.function_id );
148                raise program_exit;
149              end if;
150                remove_function_lang_entries(c_derived_function_entry_rec.function_id ,p_derived_class_id ,p_err_code ,p_err_message );
152                delete from fnd_form_functions where function_id = c_derived_function_entry_rec.function_id;
153                f_count  := f_count -1;
154         END LOOP;
155         if(f_count = 0) then
156         p_err_code := 0;
157  	p_err_message := wf_core.translate('WF_WS_DELETE_SUCCESS');
158         end if;
159 
160         exception
161  		when program_exit then
162  			raise program_exit;
163  		when others then
164                       p_err_code := -1;
165                       p_err_message := wf_core.translate('WF_WS_FUNCTION_REMOVE');
166 
167 end remove_derived_function_entry;
168 
169 --PROCEDURE
170 
171 procedure remove_function_lang_entries(
172                                        p_derived_function_id in pls_integer,
173                                        p_derived_class_id in pls_integer,
174                                        p_err_code OUT NOCOPY pls_integer,
175 	                               p_err_message OUT NOCOPY varchar2
176                                       ) IS
177 
178   cursor c_derived_function_tl(c_derived_function_id in pls_integer) is
179 	select *
180 	from fnd_form_functions_tl
181 	where function_id = c_derived_function_id;
182 
183   begin
184 
185      if ( p_derived_function_id is null  ) then
186  		p_err_code := -1;
187  		p_err_message := 'Base Function ID or Function ID is null';
188  		raise program_exit;
189      end if ;
190     /*FOR c_derived_function_tl_rec IN c_derived_function_tl(p_derived_function_id)
191      LOOP
192       dbms_output.put_line(c_derived_function_tl_rec.language);
193      END LOOP;*/
194     remove_class_lang_entry(p_derived_class_id,p_err_code,p_err_message);
195     delete from fnd_form_functions_tl where function_id = p_derived_function_id;
196     p_err_code := 0;
197     p_err_message := wf_core.translate('WF_WS_DELETE_SUCCESS');
198 
199 exception
200 when program_exit then
201 	raise program_exit;
202 when others then
203 	p_err_code := -1;
204         wf_core.token('DerivedFunctionId',p_derived_function_id);
205 	wf_core.token('SqlErr',SQLERRM);
206 	p_err_message := wf_core.translate('WF_WS_FUNC_LANG_REMOVE');
207 
208 
209 
210 end remove_function_lang_entries;
211 
212 -- PROCEDURE
213 
214 procedure remove_class_lang_entry(
215                                   p_derived_class_id in pls_integer,
216                                   p_err_code OUT NOCOPY pls_integer,
217                                   p_err_message OUT NOCOPY varchar2
218                                   ) IS
219 
220    cursor c_derived_class_tl(c_derived_class_id in pls_integer) is
221  	select *
222  	from fnd_irep_classes_tl
223  	where class_id = c_derived_class_id  ;
224 
225    begin
226     if (p_derived_class_id is null) then
227           p_err_code := -1;
228           p_err_message := 'Base Class ID or Class ID is null';
229           raise program_exit;
230     end if;
231 
232    /* FOR c_derived_class_tl_rec IN c_derived_class_tl(p_derived_class_id)
233     LOOP
234         dbms_output.put_line(c_derived_class_tl_rec.language);
235     END LOOP;*/
236     delete  from fnd_irep_classes_tl where class_id = p_derived_class_id  ;
237     p_err_code := 0;
238     p_err_message := wf_core.translate('WF_WS_DELETE_SUCCESS');
239 exception
240   when program_exit then
241 	raise program_exit;
242   when others then
243 	p_err_code := -1;
244         wf_core.token('DerivedClassId',p_derived_class_id);
245         wf_core.token('SqlErr',SQLERRM);
246 	p_err_message := wf_core.translate('WF_WS_CLASS_LANG_REMOVE');
247 
248 
249 
250 end remove_class_lang_entry ;
251 
252 end SOA_REMOVE;