DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_KI_TOPICS_API

Source


1 Package Body HR_KI_TOPICS_API as
2 /* $Header: hrtpcapi.pkb 115.0 2004/01/09 04:37:54 vkarandi noship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := 'HR_KI_TOPICS_API';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |--------------------------< CREATE_TOPIC >--------------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure create_topic
13     (p_validate                      in     boolean  default false
14     ,p_language_code                 in     varchar2 default hr_api.userenv_lang
15     ,p_topic_key                     in     varchar2
16     ,p_handler                       in     varchar2
17     ,p_name                          in     varchar2
18     ,p_topic_id                      out    nocopy   number
19     ,p_object_version_number         out    nocopy   number
20   ) is
21   --
22   -- Declare cursors and local variables
23   --
24   l_proc                varchar2(72) := g_package||'create_topic';
25   l_topic_id      number;
26   l_language_code       varchar2(30);
27   l_object_version_number number;
28 
29 begin
30   hr_utility.set_location('Entering:'|| l_proc, 10);
31   --
32   -- Issue a savepoint
33   --
34   savepoint create_topic;
35   --
36   -- Remember IN OUT parameter IN values
37   --
38   --l_in_out_parameter := p_in_out_parameter;
39   l_language_code:=p_language_code;
40 
41   hr_api.validate_language_code(p_language_code => l_language_code);
42 
43   --
44   -- Call Before Process User Hook
45   --
46   begin
47     hr_ki_topics_bk1.create_topic_b
48       ( p_language_code   => l_language_code
49        ,p_topic_key       => p_topic_key
50        ,p_handler         => p_handler
51        ,p_name            => p_name
52       );
53   exception
54     when hr_api.cannot_find_prog_unit then
55       hr_api.cannot_find_prog_unit_error
56         (p_module_name => 'create_topic'
57         ,p_hook_type   => 'BP'
58         );
59   end;
60 
61   --
62   -- Process Logic
63   --
64   hr_tpc_ins.ins
65      (p_topic_key                => p_topic_key
66       ,p_handler                 => p_handler
67       ,p_topic_id                => l_topic_id
68       ,p_object_version_number   => l_object_version_number
69       );
70 
71   hr_ttl_ins.ins_tl(
72        p_language_code           => l_language_code
73       ,p_topic_id                => l_topic_id
74       ,p_name                    => p_name
75       );
76 
77 
78   --
79   -- Call After Process User Hook
80   --
81   begin
82     hr_ki_topics_bk1.create_topic_a
83       (
84        p_language_code           =>    l_language_code
85       ,p_topic_key               =>    p_topic_key
86       ,p_handler                 =>    p_handler
87       ,p_name                    =>    p_name
88       ,p_topic_id                =>    l_topic_id
89       ,p_object_version_number   =>    l_object_version_number
90       );
91   exception
92     when hr_api.cannot_find_prog_unit then
93       hr_api.cannot_find_prog_unit_error
94         (p_module_name => 'create_topic'
95         ,p_hook_type   => 'AP'
96         );
97   end;
98   --
99   -- When in validation only mode raise the Validate_Enabled exception
100   --
101   if p_validate then
102     raise hr_api.validate_enabled;
103   end if;
104   --
105   -- Set all IN OUT and OUT parameters with out values
106   --
107   p_topic_id               := l_topic_id;
108   p_object_version_number  := l_object_version_number;
109 
110   --
111   hr_utility.set_location(' Leaving:'||l_proc, 70);
112 exception
113   when hr_api.validate_enabled then
114     --
115     -- As the Validate_Enabled exception has been raised
116     -- we must rollback to the savepoint
117     --
118     rollback to create_topic;
119     --
120     -- Reset IN OUT parameters and set OUT parameters
121     -- (Any key or derived arguments must be set to null
122     -- when validation only mode is being used.)
123     --
124 
125     p_topic_id               := null;
126     p_object_version_number  := null;
127 
128     hr_utility.set_location(' Leaving:'||l_proc, 80);
129   when others then
130     --
131     -- A validation or unexpected error has occured
132     --
133     rollback to create_topic;
134     --
135     -- Reset IN OUT parameters and set all
136     -- OUT parameters, including warnings, to null
137     --
138 
139     p_topic_id               := null;
140     p_object_version_number  := null;
141 
142     hr_utility.set_location(' Leaving:'||l_proc, 90);
143     raise;
144 end create_topic;
145 --
146 --
147 -- ----------------------------------------------------------------------------
148 -- |--------------------------< UPDATE_TOPIC >--------------------------|
149 -- ----------------------------------------------------------------------------
150 --
151 procedure update_topic
152   (p_validate                      in     boolean  default false
153   ,p_language_code                 in     varchar2 default hr_api.userenv_lang
154   ,p_handler                       in     varchar2 default hr_api.g_varchar2
155   ,p_name                          in     varchar2 default hr_api.g_varchar2
156   ,p_topic_id                      in     number
157   ,p_object_version_number         in out nocopy   number
158   ) is
159   --
160   -- Declare cursors and local variables
161   --
162   l_proc                varchar2(72) := g_package||'update_topic';
163   l_language_code       varchar2(30);
164   l_object_version_number number := p_object_version_number;
165 
166 begin
167   hr_utility.set_location('Entering:'|| l_proc, 10);
168   --
169   -- Issue a savepoint
170   --
171   savepoint update_topic;
172   --
173   -- Remember IN OUT parameter IN values
174   --
175   --l_in_out_parameter := p_in_out_parameter;
176   l_language_code:=p_language_code;
177 
178   hr_api.validate_language_code(p_language_code => l_language_code);
179 
180   --
181   -- Call Before Process User Hook
182   --
183   begin
184     hr_ki_topics_bk2.update_topic_b
185       ( p_language_code          => l_language_code
186        ,p_handler                => p_handler
187        ,p_name                   => p_name
188        ,p_topic_id               => p_topic_id
189        ,p_object_version_number  => p_object_version_number
190 
191       );
192   exception
193     when hr_api.cannot_find_prog_unit then
194       hr_api.cannot_find_prog_unit_error
195         (p_module_name => 'update_topic'
196         ,p_hook_type   => 'BP'
197         );
198   end;
199 
200   --
201   -- Process Logic
202   --
203   hr_tpc_upd.upd
204      (
205       p_topic_id                => p_topic_id
206      ,p_handler                 => p_handler
207      ,p_object_version_number   => p_object_version_number
208       );
209 
210   hr_ttl_upd.upd_tl(
211       p_language_code    => l_language_code
212       ,p_topic_id        => p_topic_id
213       ,p_name            => p_name
214       );
215 
216 
217   --
218   -- Call After Process User Hook
219   --
220   begin
221     hr_ki_topics_bk2.update_topic_a
222       (
223        p_language_code           =>    l_language_code
224       ,p_handler                 =>    p_handler
225       ,p_name                    =>    p_name
226       ,p_topic_id                =>    p_topic_id
227       ,p_object_version_number   =>    p_object_version_number
228       );
229   exception
230     when hr_api.cannot_find_prog_unit then
231       hr_api.cannot_find_prog_unit_error
232         (p_module_name => 'update_topic'
233         ,p_hook_type   => 'AP'
234         );
235   end;
236   --
237   -- When in validation only mode raise the Validate_Enabled exception
238   --
239   if p_validate then
240     raise hr_api.validate_enabled;
241   end if;
242   --
243   -- Set all IN OUT and OUT parameters with out values
244   --
245   --
246   hr_utility.set_location(' Leaving:'||l_proc, 70);
247 exception
248   when hr_api.validate_enabled then
249     --
250     -- As the Validate_Enabled exception has been raised
251     -- we must rollback to the savepoint
252     --
253     rollback to update_topic;
254     --
255     -- Reset IN OUT parameters and set OUT parameters
256     -- (Any key or derived arguments must be set to null
257     -- when validation only mode is being used.)
258     --
259 
260     p_object_version_number  := l_object_version_number;
261 
262     hr_utility.set_location(' Leaving:'||l_proc, 80);
263   when others then
264     --
265     -- A validation or unexpected error has occured
266     --
267     rollback to update_topic;
268     --
269     -- Reset IN OUT parameters and set all
270     -- OUT parameters, including warnings, to null
271     --
272 
273     p_object_version_number  := l_object_version_number;
274 
275     hr_utility.set_location(' Leaving:'||l_proc, 90);
276     raise;
277 end update_topic;
278 --
279 --
280 -- ----------------------------------------------------------------------------
281 -- |----------------------------< DELETE_TOPIC >------------------------------|
282 -- ----------------------------------------------------------------------------
283 --
284 procedure delete_topic
285   (
286    p_validate                 in boolean	 default false
287   ,P_topic_id                 in number
288   ,p_object_version_number    in number
289   ) is
290   --
291   -- Declare cursors and local variables
292   --
293   l_proc                varchar2(72) := g_package||'delete_topic';
294 
295 begin
296   hr_utility.set_location('Entering:'|| l_proc, 10);
297   --
298   -- Issue a savepoint
299   --
300   savepoint delete_topic;
301   --
302   -- Remember IN OUT parameter IN values
303   --
304 
305   -- Call Before Process User Hook
306   --
307   begin
308     hr_ki_topics_bk3.delete_topic_b
309       (
310        p_topic_id          => p_topic_id
311       ,p_object_version_number  => p_object_version_number
312 
313       );
314   exception
315     when hr_api.cannot_find_prog_unit then
316       hr_api.cannot_find_prog_unit_error
317         (p_module_name => 'delete_topic'
318         ,p_hook_type   => 'BP'
319         );
320   end;
321 
322   --
323   -- Process Logic
324   --
325   hr_tpc_shd.lck
326      (
327       p_topic_id                => p_topic_id
328      ,p_object_version_number   => p_object_version_number
329      );
330   hr_ttl_del.del_tl(
331       p_topic_id          => p_topic_id
332       );
333   hr_tpc_del.del
334      (
335       p_topic_id          => p_topic_id
336      ,p_object_version_number   => p_object_version_number
337       );
338 
339 
340   --
341   -- Call After Process User Hook
342   --
343   begin
344     hr_ki_topics_bk3.delete_topic_a
345       (
346        p_topic_id          =>    p_topic_id
347       ,p_object_version_number   =>    p_object_version_number
348       );
349   exception
350     when hr_api.cannot_find_prog_unit then
351       hr_api.cannot_find_prog_unit_error
352         (p_module_name => 'delete_topic'
353         ,p_hook_type   => 'AP'
354         );
355   end;
356   --
357   -- When in validation only mode raise the Validate_Enabled exception
358   --
359   if p_validate then
360     raise hr_api.validate_enabled;
361   end if;
362   --
363   -- Set all IN OUT and OUT parameters with out values
364   --
365 
366   --
367   hr_utility.set_location(' Leaving:'||l_proc, 70);
368 exception
369   when hr_api.validate_enabled then
370     --
371     -- As the Validate_Enabled exception has been raised
372     -- we must rollback to the savepoint
373     --
374     rollback to delete_topic;
375     --
376     -- Reset IN OUT parameters and set OUT parameters
377     -- (Any key or derived arguments must be set to null
378     -- when validation only mode is being used.)
379     --
380 
381     hr_utility.set_location(' Leaving:'||l_proc, 80);
382   when others then
383     --
384     -- A validation or unexpected error has occured
385     --
386     rollback to delete_topic;
387     --
388     -- Reset IN OUT parameters and set all
389     -- OUT parameters, including warnings, to null
390     --
391     hr_utility.set_location(' Leaving:'||l_proc, 90);
392     raise;
393 end delete_topic;
394 end HR_KI_TOPICS_API;