DBA Data[Home] [Help]

PACKAGE BODY: APPS.OTA_FORUM_API

Source


1 PACKAGE BODY ota_forum_api as
2 /* $Header: otfrmapi.pkb 120.1 2005/08/10 15:05 asud noship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := '  OTA_FORUM_API.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |-------------------------< CREATE_FORUM >---------------------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure create_forum(
13    p_validate                     in  boolean          default false
14   ,p_effective_date               in  date
15   ,p_name                         in  varchar2
16   ,p_description                  in  varchar2         default null
17   ,p_business_group_id            in  number
18   ,p_start_date_active            in  date             default null
19   ,p_end_date_active              in  date             default null
20   ,p_message_type_flag            in  varchar2         default 'P'
21   ,p_allow_html_flag              in  varchar2         default 'N'
22   ,p_allow_attachment_flag        in  varchar2         default 'N'
23   ,p_auto_notification_flag       in  varchar2         default 'N'
24   ,p_public_flag                  in  varchar2         default 'N'
25   ,p_forum_id                     out nocopy number
26   ,p_object_version_number        out nocopy number) is
27   --
28   -- Declare cursors and local variables
29   --
30   l_proc                    varchar2(72) := g_package||' Create_forum';
31   l_forum_id number;
32   l_object_version_number   number;
33   l_effective_date          date;
34   l_end_date date;
35 begin
36   hr_utility.set_location('Entering:'|| l_proc, 10);
37   --
38   -- Issue a savepoint
39   --
40   savepoint CREATE_FORUM;
41   --
42   -- Truncate the time portion from all IN date parameters
43   --
44   l_effective_date := trunc(p_effective_date);
45   --
46   -- Call Before Process User Hook
47   --
48      begin
49   ota_forum_bk1.create_forum_b
50   (  p_effective_date              => p_effective_date
51    ,p_name                          => p_name
52    ,p_description                   => p_description
53   ,p_business_group_id             => p_business_group_id
54   ,p_message_type_flag		   => p_message_type_flag
55   ,p_allow_html_flag		   => p_allow_html_flag
56   ,p_allow_attachment_flag         => p_allow_attachment_flag
57   ,p_auto_notification_flag        => p_auto_notification_flag
58   ,p_public_flag                   => p_public_flag
59   ,p_start_date_active             => p_start_date_active
60   ,p_end_date_active               => p_end_date_active
61   ,p_object_version_number         => p_object_version_number
62     );
63   exception
64     when hr_api.cannot_find_prog_unit then
65       hr_api.cannot_find_prog_unit_error
66         (p_module_name => 'CREATE_FORUM'
67         ,p_hook_type   => 'BP'
68         );
69   end;
70 
71   --
72 
73   -- Validation in addition to Row Handlers
74   --
75   --
76   -- Process Logic
77   --
78 
79   ota_frm_ins.ins
80   (  p_effective_date              => l_effective_date
81   ,p_business_group_id             => p_business_group_id
82   ,p_message_type_flag		   => p_message_type_flag
83   ,p_allow_html_flag		   => p_allow_html_flag
84   ,p_allow_attachment_flag         => p_allow_attachment_flag
85   ,p_auto_notification_flag        => p_auto_notification_flag
86   ,p_public_flag                   => p_public_flag
87   ,p_start_date_active             => p_start_date_active
88   ,p_end_date_active               => p_end_date_active
89   ,p_forum_id                      => l_forum_id
90   ,p_object_version_number         => l_object_version_number
91   );
92 
93    ota_fmt_ins.ins_tl
94     (
95       p_effective_date      => l_effective_date
96   ,p_language_code          => USERENV('LANG')
97   ,p_forum_id         => l_forum_id
98   ,p_name             => p_name
99   ,p_description      => p_description
100     );
101   --
102   -- Call After Process User Hook
103   --
104      begin
105   ota_forum_bk1.create_forum_a
106   (  p_effective_date              => p_effective_date
107    ,p_name                          => p_name
108    ,p_description                   => p_description
109   ,p_business_group_id             => p_business_group_id
110   ,p_message_type_flag		   => p_message_type_flag
111   ,p_allow_html_flag		   => p_allow_html_flag
112   ,p_allow_attachment_flag         => p_allow_attachment_flag
113   ,p_auto_notification_flag        => p_auto_notification_flag
114   ,p_public_flag                   => p_public_flag
115   ,p_start_date_active             => p_start_date_active
116   ,p_end_date_active               => p_end_date_active
117   ,p_forum_id                      => p_forum_id
118   ,p_object_version_number         => p_object_version_number
119     );
120   exception
121     when hr_api.cannot_find_prog_unit then
122       hr_api.cannot_find_prog_unit_error
123         (p_module_name => 'CREATE_FORUM'
124         ,p_hook_type   => 'AP'
125         );
126   end;
127 
128 
129   --
130   -- When in validation only mode raise the Validate_Enabled exception
131   --
132   if p_validate then
133     raise hr_api.validate_enabled;
134   end if;
135   --
136   -- Set all output arguments
137   --
138   p_forum_id                := l_forum_id;
139   p_object_version_number   := l_object_version_number;
140 
141 
142   hr_utility.set_location(' Leaving:'||l_proc, 70);
143 exception
144   when hr_api.validate_enabled then
145     --
146     -- As the Validate_Enabled exception has been raised
147     -- we must rollback to the savepoint
148     --
149     rollback to CREATE_FORUM;
150     --
151     -- Only set output warning arguments
152     -- (Any key or derived arguments must be set to null
153     -- when validation only mode is being used.)
154     --
155     p_forum_id := null;
156     p_object_version_number   := null;
157     hr_utility.set_location(' Leaving:'||l_proc, 80);
158   when others then
159     --
160     -- A validation or unexpected error has occured
161     --
162     rollback to CREATE_FORUM;
163     p_forum_id := null;
164     p_object_version_number   := null;
165     hr_utility.set_location(' Leaving:'||l_proc, 90);
166     raise;
167 end create_forum;
168 -- ----------------------------------------------------------------------------
169 -- |----------------------------< update_forum >---------------------|
170 -- ----------------------------------------------------------------------------
171 --
172 procedure update_forum
173   (p_validate                     in  boolean          default false
174   ,p_effective_date               in  date
175   ,p_name                         in  varchar2
176   ,p_description                  in  varchar2
177   ,p_business_group_id            in  number
178   ,p_start_date_active            in  date             default hr_api.g_date
179   ,p_end_date_active              in  date             default hr_api.g_date
180   ,p_message_type_flag            in  varchar2         default hr_api.g_varchar2
181   ,p_allow_html_flag              in  varchar2         default hr_api.g_varchar2
182   ,p_allow_attachment_flag        in  varchar2         default hr_api.g_varchar2
183   ,p_auto_notification_flag       in  varchar2         default hr_api.g_varchar2
184   ,p_public_flag                  in  varchar2         default hr_api.g_varchar2
185   ,p_forum_id                     in  number
186   ,p_object_version_number        in out nocopy number) is
187   --
188   -- Declare cursors and local variables
189   --
190   l_proc                    varchar2(72) := g_package||' Update Forum';
191   l_effective_date          date;
192   l_object_version_number   number := p_object_version_number;
193   l_end_date date;
194 begin
195   hr_utility.set_location('Entering:'|| l_proc, 10);
196   --
197   -- Issue a savepoint
198   --
199   savepoint UPDATE_FORUM;
200   --
201   -- Truncate the time portion from all IN date parameters
202   --
203   l_effective_date := trunc(p_effective_date);
204   --
205   -- Call Before Process User Hook
206   --
207   begin
208   ota_forum_bk2.update_forum_b
209   (p_effective_date               => p_effective_date
210      ,p_name                          => p_name
211    ,p_description                   => p_description
212    ,p_business_group_id             => p_business_group_id
213    ,p_message_type_flag	 	    => p_message_type_flag
214    ,p_allow_html_flag	  	    => p_allow_html_flag
215    ,p_allow_attachment_flag         => p_allow_attachment_flag
216    ,p_auto_notification_flag        => p_auto_notification_flag
217    ,p_public_flag                   => p_public_flag
218    ,p_start_date_active             => p_start_date_active
219    ,p_end_date_active               => p_end_date_active
220    ,p_forum_id                      => p_forum_id
221    ,p_object_version_number         => p_object_version_number
222    );
223 
224   exception
225     when hr_api.cannot_find_prog_unit then
226       hr_api.cannot_find_prog_unit_error
227         (p_module_name => 'UPDATE_FORUM'
228         ,p_hook_type   => 'BP'
229         );
230   end;
231 
232 
233   --
234   -- Validation in addition to Row Handlers
235   --
236   --
237   -- Process Logic
238   --
239 
240   ota_frm_upd.upd
241     (p_effective_date               => l_effective_date
242    ,p_business_group_id             => p_business_group_id
243    ,p_message_type_flag	 	    => p_message_type_flag
244    ,p_allow_html_flag	  	    => p_allow_html_flag
245    ,p_allow_attachment_flag         => p_allow_attachment_flag
246    ,p_auto_notification_flag        => p_auto_notification_flag
247    ,p_public_flag                   => p_public_flag
248    ,p_start_date_active             => p_start_date_active
249    ,p_end_date_active               => p_end_date_active
250    ,p_forum_id                      => p_forum_id
251    ,p_object_version_number         => p_object_version_number    );
252 
253   ota_fmt_upd.upd_tl( p_effective_date      => l_effective_date
254   ,p_language_code          => USERENV('LANG')
255   ,p_forum_id        => p_forum_id
256   ,p_name     => p_name
257   ,p_description      => p_description  );
258   --
259   -- Call After Process User Hook
260   --
261   begin
262   ota_forum_bk2.update_forum_a
263   (p_effective_date               => p_effective_date
264    ,p_name                          => p_name
265    ,p_description                   => p_description
266    ,p_business_group_id             => p_business_group_id
267    ,p_message_type_flag	 	    => p_message_type_flag
268    ,p_allow_html_flag	  	    => p_allow_html_flag
269    ,p_allow_attachment_flag         => p_allow_attachment_flag
270    ,p_auto_notification_flag        => p_auto_notification_flag
271    ,p_public_flag                   => p_public_flag
272    ,p_start_date_active             => p_start_date_active
273    ,p_end_date_active               => p_end_date_active
274    ,p_forum_id                      => p_forum_id
275    ,p_object_version_number         => p_object_version_number
276    );
277 
278   exception
279     when hr_api.cannot_find_prog_unit then
280       hr_api.cannot_find_prog_unit_error
281         (p_module_name => 'UPDATE_FORUM'
282         ,p_hook_type   => 'AP'
283         );
284   end;
285 
286   --
287   -- When in validation only mode raise the Validate_Enabled exception
288   --
289   if p_validate then
290     raise hr_api.validate_enabled;
291   end if;
292   --
293   -- Set all output arguments
294   --
295   hr_utility.set_location(' Leaving:'||l_proc, 70);
296 exception
297   when hr_api.validate_enabled then
298     --
299     -- As the Validate_Enabled exception has been raised
300     -- we must rollback to the savepoint
301     --
302     rollback to UPDATE_FORUM;
303     --
304     -- Only set output warning arguments
305     -- (Any key or derived arguments must be set to null
306     -- when validation only mode is being used.)
307     --
308     p_object_version_number  := null;
309     hr_utility.set_location(' Leaving:'||l_proc, 80);
310   when others then
311     --
312     -- A validation or unexpected error has occured
313     --
314     rollback to UPDATE_FORUM;
315     p_object_version_number  := l_object_version_number;
316     hr_utility.set_location(' Leaving:'||l_proc, 90);
317     raise;
318 end update_forum;
319 --
320 -- ----------------------------------------------------------------------------
321 -- |-------------------------< DELETE_FORUM >----------------------------------|
322 -- ----------------------------------------------------------------------------
323 --
324 procedure delete_forum
325   (p_validate                      in     boolean  default false
326   ,p_forum_id               in     number
327   ,p_object_version_number         in     number
328   ) is
329   --
330   -- Declare cursors and local variables
331   --
332   l_proc                    varchar2(72) := g_package||' Delete_forum';
333   l_object_version_id       number;
334   --
335   --
336 begin
337   hr_utility.set_location('Entering:'|| l_proc, 10);
338   --
339   -- Issue a savepoint
340   --
341   savepoint DELETE_FORUM;
342   --
343   -- Truncate the time portion from all IN date parameters
344   --
345   --
346 
347   -- Call Before Process User Hook
348   begin
349   ota_forum_bk3.delete_forum_b
350   (p_forum_id        => p_forum_id
351   ,p_object_version_number   => p_object_version_number
352     );
353   exception
354     when hr_api.cannot_find_prog_unit then
355       hr_api.cannot_find_prog_unit_error
356         (p_module_name => 'DELETE_FORUM'
357         ,p_hook_type   => 'BP'
358         );
359   end;
360 
361   --
362   -- Validation in addition to Row Handlers
363   --
364   --
365   -- Process Logic
366   --
367   ota_fmt_del.del_tl
368   (p_forum_id        => p_forum_id
369    --,p_language =>  USERENV('LANG')
370   );
371 
372   ota_frm_del.del
373   (p_forum_id        => p_forum_id
374   ,p_object_version_number   => p_object_version_number
375   );
376 
377 
378   --
379   -- Call After Process User Hook
380   begin
381   ota_forum_bk3.delete_forum_a
382   (p_forum_id        => p_forum_id
383   ,p_object_version_number   => p_object_version_number
384     );
385   exception
386     when hr_api.cannot_find_prog_unit then
387       hr_api.cannot_find_prog_unit_error
388         (p_module_name => 'DELETE_FORUM'
389         ,p_hook_type   => 'AP'
390         );
391   end;
392   --
393   -- When in validation only mode raise the Validate_Enabled exception
394   --
395   if p_validate then
396     raise hr_api.validate_enabled;
397   end if;
398   --
399   -- Set all output arguments
400   --
401   --
402   hr_utility.set_location(' Leaving:'||l_proc, 170);
403 exception
404   when hr_api.validate_enabled then
405     --
406     -- As the Validate_Enabled exception has been raised
407     -- we must rollback to the savepoint
408     --
409     rollback to DELETE_FORUM;
410     --
411     -- Only set output warning arguments
412     -- (Any key or derived arguments must be set to null
413     -- when validation only mode is being used.)
414     --
415     hr_utility.set_location(' Leaving:'||l_proc, 180);
416   when others then
417     --
418     -- A validation or unexpected error has occured
419     --
420     rollback to DELETE_FORUM;
421     hr_utility.set_location(' Leaving:'||l_proc, 190);
422     raise;
423 end delete_forum;
424 --
425 end ota_forum_api;