DBA Data[Home] [Help]

PACKAGE BODY: APPS.OTA_LP_SECTION_SWI

Source


1 PACKAGE BODY OTA_LP_SECTION_SWI As
2 /* $Header: otlpcswi.pkb 120.0 2005/05/29 07:21 appldev noship $ */
3 --
4 -- Package variables
5 --
6 g_package  varchar2(33) := 'ota_lp_section_swi.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |---------------------< create_lp_section >---------------------|
10 -- ----------------------------------------------------------------------------
11 PROCEDURE create_lp_section
12   (p_validate                     in     number    default hr_api.g_false_num
13   ,p_effective_date               in     date
14   ,p_business_group_id            in     number
15   ,p_section_name                 in     varchar2 default null
16   ,p_description                  in     varchar2 default null
17   ,p_learning_path_id             in     number
18   ,p_section_sequence             in     number
19   ,p_completion_type_code         in     varchar2
20   ,p_no_of_mandatory_courses      in     number  default null
21   ,p_attribute_category           in     varchar2  default null
22   ,p_attribute1                   in     varchar2  default null
23   ,p_attribute2                   in     varchar2  default null
24   ,p_attribute3                   in     varchar2  default null
25   ,p_attribute4                   in     varchar2  default null
26   ,p_attribute5                   in     varchar2  default null
27   ,p_attribute6                   in     varchar2  default null
28   ,p_attribute7                   in     varchar2  default null
29   ,p_attribute8                   in     varchar2  default null
30   ,p_attribute9                   in     varchar2  default null
31   ,p_attribute10                  in     varchar2  default null
32   ,p_attribute11                  in     varchar2  default null
33   ,p_attribute12                  in     varchar2  default null
34   ,p_attribute13                  in     varchar2  default null
35   ,p_attribute14                  in     varchar2  default null
36   ,p_attribute15                  in     varchar2  default null
37   ,p_attribute16                  in     varchar2  default null
38   ,p_attribute17                  in     varchar2  default null
39   ,p_attribute18                  in     varchar2  default null
40   ,p_attribute19                  in     varchar2  default null
41   ,p_attribute20                  in     varchar2  default null
42   ,p_learning_path_section_id     in     number
43   ,p_object_version_number        out nocopy number
44   ,p_return_status                out nocopy varchar2
45   ) is
46   --
47   -- Variables for API Boolean parameters
48   l_validate                      boolean;
49   --
50   -- Variables for IN/OUT parameters
51   --
52   -- Other variables
53   l_learning_path_section_id     number;
54   l_proc    varchar2(72) := g_package ||'create_lp_section';
55 
56   l_section_name        ota_lp_sections_tl.name%TYPE := p_section_name;
57   l_lp_source           ota_learning_paths.path_source_code%TYPE;
58   l_lp_source_function  ota_learning_paths.source_function_code%TYPE;
59 
60 
61   CURSOR get_lp_source IS
62   SELECT source_function_code,
63          path_source_code
64     FROM ota_learning_paths
65    WHERE learning_path_id = p_learning_path_id;
66 
67 Begin
68   hr_utility.set_location(' Entering:' || l_proc,10);
69   --
70   -- Issue a savepoint
71   --
72   savepoint create_lpc_swi;
73   --
74   -- Initialise Multiple Message Detection
75   --
76   hr_multi_message.enable_message_list;
77   --
78   -- Remember IN OUT parameter IN values
79   --
80   --
81   -- Convert constant values to their corresponding boolean value
82   --
83   l_validate :=
84     hr_api.constant_to_boolean
85       (p_constant_value => p_validate);
86   --
87   -- Register Surrogate ID or user key values
88   --
89   ota_lpc_ins.set_base_key_value
90     (p_learning_path_section_id => p_learning_path_section_id
91     );
92 
93   -- default section name if lp is of type talent management.
94   --
95    FOR cr_lp IN get_lp_source
96   LOOP
97        l_lp_source := cr_lp.path_source_code;
98        l_lp_source_function := cr_lp.source_function_code;
99    END LOOP;
100 
101     IF l_lp_source = 'TALENT_MGMT' THEN
102        l_section_name := ota_utility.Get_lookup_meaning
103                                (p_lookup_type    => 'OTA_PLAN_COMPONENT_SOURCE',
104                                 p_lookup_code    => l_lp_source_function,
105                                 p_application_id => 800);
106        l_section_name := substr(p_learning_path_section_id||l_section_name, 1, 80);
107    END IF;
108 
109   --
110   -- Call API
111   --
112   ota_lp_section_api.create_lp_section
113     (p_validate                     => l_validate
114     ,p_effective_date               => p_effective_date
115     ,p_business_group_id            => p_business_group_id
116     ,p_section_name                 => l_section_name
117     ,p_description                  => p_description
118     ,p_learning_path_id             => p_learning_path_id
119     ,p_section_sequence             => p_section_sequence
120     ,p_completion_type_code         => p_completion_type_code
121     ,p_no_of_mandatory_courses      => p_no_of_mandatory_courses
122     ,p_attribute_category           => p_attribute_category
123     ,p_attribute1                   => p_attribute1
124     ,p_attribute2                   => p_attribute2
125     ,p_attribute3                   => p_attribute3
126     ,p_attribute4                   => p_attribute4
127     ,p_attribute5                   => p_attribute5
128     ,p_attribute6                   => p_attribute6
129     ,p_attribute7                   => p_attribute7
130     ,p_attribute8                   => p_attribute8
131     ,p_attribute9                   => p_attribute9
132     ,p_attribute10                  => p_attribute10
133     ,p_attribute11                  => p_attribute11
134     ,p_attribute12                  => p_attribute12
135     ,p_attribute13                  => p_attribute13
136     ,p_attribute14                  => p_attribute14
137     ,p_attribute15                  => p_attribute15
138     ,p_attribute16                  => p_attribute16
139     ,p_attribute17                  => p_attribute17
140     ,p_attribute18                  => p_attribute18
141     ,p_attribute19                  => p_attribute19
142     ,p_attribute20                  => p_attribute20
143     ,p_learning_path_section_id     => l_learning_path_section_id
144     ,p_object_version_number        => p_object_version_number
145     );
146 
147   -- Convert API warning boolean parameter values to specific
148   -- messages and add them to Multiple Message List
149   --
150   --
151   -- Convert API non-warning boolean parameter values
152   --
153   --
154   -- Derive the API return status value based on whether
155   -- messages of any type exist in the Multiple Message List.
156   -- Also disable Multiple Message Detection.
157   --
158   p_return_status := hr_multi_message.get_return_status_disable;
159   hr_utility.set_location(' Leaving:' || l_proc,20);
160   --
161 exception
162   when hr_multi_message.error_message_exist then
163     --
164     -- Catch the Multiple Message List exception which
165     -- indicates API processing has been aborted because
166     -- at least one message exists in the list.
167     --
168     rollback to create_lpc_swi;
169     --
170     -- Reset IN OUT parameters and set OUT parameters
171     --
172     p_object_version_number        := null;
173     p_return_status := hr_multi_message.get_return_status_disable;
174     hr_utility.set_location(' Leaving:' || l_proc, 30);
175   when others then
176     --
177     -- When Multiple Message Detection is enabled catch
178     -- any Application specific or other unexpected
179     -- exceptions.  Adding appropriate details to the
180     -- Multiple Message List.  Otherwise re-raise the
181     -- error.
182     --
183     rollback to create_lpc_swi;
184     if hr_multi_message.unexpected_error_add(l_proc) then
185        hr_utility.set_location(' Leaving:' || l_proc,40);
186        raise;
187     end if;
188     --
189     -- Reset IN OUT and set OUT parameters
190     --
191     p_object_version_number        := null;
192     p_return_status := hr_multi_message.get_return_status_disable;
193     hr_utility.set_location(' Leaving:' || l_proc,50);
194 end create_lp_section;
195 -- ----------------------------------------------------------------------------
196 -- |---------------------< update_lp_section >---------------------|
197 -- ----------------------------------------------------------------------------
198 PROCEDURE update_lp_section
199   (p_validate                     in     number    default hr_api.g_false_num
200   ,p_effective_date               in     date
201   ,p_learning_path_section_id     in     number
202   ,p_section_name                 in     varchar2  default hr_api.g_varchar2
203   ,p_description                  in     varchar2  default hr_api.g_varchar2
204   ,p_object_version_number        in out nocopy number
205   ,p_section_sequence             in     number    default hr_api.g_number
206   ,p_completion_type_code         in     varchar2  default hr_api.g_varchar2
207   ,p_no_of_mandatory_courses      in     number    default hr_api.g_number
208   ,p_attribute_category           in     varchar2  default hr_api.g_varchar2
209   ,p_attribute1                   in     varchar2  default hr_api.g_varchar2
210   ,p_attribute2                   in     varchar2  default hr_api.g_varchar2
211   ,p_attribute3                   in     varchar2  default hr_api.g_varchar2
212   ,p_attribute4                   in     varchar2  default hr_api.g_varchar2
213   ,p_attribute5                   in     varchar2  default hr_api.g_varchar2
214   ,p_attribute6                   in     varchar2  default hr_api.g_varchar2
215   ,p_attribute7                   in     varchar2  default hr_api.g_varchar2
216   ,p_attribute8                   in     varchar2  default hr_api.g_varchar2
217   ,p_attribute9                   in     varchar2  default hr_api.g_varchar2
218   ,p_attribute10                  in     varchar2  default hr_api.g_varchar2
219   ,p_attribute11                  in     varchar2  default hr_api.g_varchar2
220   ,p_attribute12                  in     varchar2  default hr_api.g_varchar2
221   ,p_attribute13                  in     varchar2  default hr_api.g_varchar2
222   ,p_attribute14                  in     varchar2  default hr_api.g_varchar2
223   ,p_attribute15                  in     varchar2  default hr_api.g_varchar2
224   ,p_attribute16                  in     varchar2  default hr_api.g_varchar2
225   ,p_attribute17                  in     varchar2  default hr_api.g_varchar2
226   ,p_attribute18                  in     varchar2  default hr_api.g_varchar2
227   ,p_attribute19                  in     varchar2  default hr_api.g_varchar2
228   ,p_attribute20                  in     varchar2  default hr_api.g_varchar2
229   ,p_return_status                   out nocopy varchar2
230   ) is
231   --
232   -- Variables for API Boolean parameters
233   l_validate                      boolean;
234   --
235   -- Variables for IN/OUT parameters
236   l_object_version_number         number;
237   --
238   -- Other variables
239   l_proc    varchar2(72) := g_package ||'update_lp_section';
240 Begin
241   hr_utility.set_location(' Entering:' || l_proc,10);
242   --
243   -- Issue a savepoint
244   --
245   savepoint update_lpc_swi;
246   --
247   -- Initialise Multiple Message Detection
248   --
249   hr_multi_message.enable_message_list;
250   --
251   -- Remember IN OUT parameter IN values
252   --
253   l_object_version_number         := p_object_version_number;
254   --
255   -- Convert constant values to their corresponding boolean value
256   --
257   l_validate :=
258     hr_api.constant_to_boolean
259       (p_constant_value => p_validate);
260   --
261   -- Register Surrogate ID or user key values
262   --
263   --
264   -- Call API
265   --
266   ota_lp_section_api.update_lp_section
267     (p_validate                     => l_validate
268     ,p_effective_date               => p_effective_date
269     ,p_learning_path_section_id     => p_learning_path_section_id
270     ,p_section_name                 => p_section_name
271     ,p_description                  => p_description
272     ,p_object_version_number        => p_object_version_number
273     ,p_section_sequence             => p_section_sequence
274     ,p_completion_type_code         => p_completion_type_code
275     ,p_no_of_mandatory_courses      => p_no_of_mandatory_courses
276     ,p_attribute_category           => p_attribute_category
277     ,p_attribute1                   => p_attribute1
278     ,p_attribute2                   => p_attribute2
279     ,p_attribute3                   => p_attribute3
280     ,p_attribute4                   => p_attribute4
281     ,p_attribute5                   => p_attribute5
282     ,p_attribute6                   => p_attribute6
283     ,p_attribute7                   => p_attribute7
284     ,p_attribute8                   => p_attribute8
285     ,p_attribute9                   => p_attribute9
286     ,p_attribute10                  => p_attribute10
287     ,p_attribute11                  => p_attribute11
288     ,p_attribute12                  => p_attribute12
289     ,p_attribute13                  => p_attribute13
290     ,p_attribute14                  => p_attribute14
291     ,p_attribute15                  => p_attribute15
292     ,p_attribute16                  => p_attribute16
293     ,p_attribute17                  => p_attribute17
294     ,p_attribute18                  => p_attribute18
295     ,p_attribute19                  => p_attribute19
296     ,p_attribute20                  => p_attribute20
297     );
298   --
299   -- Convert API warning boolean parameter values to specific
300   -- messages and add them to Multiple Message List
301   --
302   --
303   -- Convert API non-warning boolean parameter values
304   --
305   --
306   -- Derive the API return status value based on whether
307   -- messages of any type exist in the Multiple Message List.
308   -- Also disable Multiple Message Detection.
309   --
310   p_return_status := hr_multi_message.get_return_status_disable;
311   hr_utility.set_location(' Leaving:' || l_proc,20);
312   --
313 exception
314   when hr_multi_message.error_message_exist then
315     --
316     -- Catch the Multiple Message List exception which
317     -- indicates API processing has been aborted because
318     -- at least one message exists in the list.
319     --
320     rollback to update_lpc_swi;
321     --
322     -- Reset IN OUT parameters and set OUT parameters
323     --
324     p_object_version_number        := l_object_version_number;
325     p_return_status := hr_multi_message.get_return_status_disable;
326     hr_utility.set_location(' Leaving:' || l_proc, 30);
327   when others then
328     --
329     -- When Multiple Message Detection is enabled catch
330     -- any Application specific or other unexpected
331     -- exceptions.  Adding appropriate details to the
332     -- Multiple Message List.  Otherwise re-raise the
333     -- error.
334     --
335     rollback to update_lpc_swi;
336     if hr_multi_message.unexpected_error_add(l_proc) then
337        hr_utility.set_location(' Leaving:' || l_proc,40);
338        raise;
339     end if;
340     --
341     -- Reset IN OUT and set OUT parameters
342     --
343     p_object_version_number        := l_object_version_number;
344     p_return_status := hr_multi_message.get_return_status_disable;
345     hr_utility.set_location(' Leaving:' || l_proc,50);
346 end update_lp_section;
347 -- ----------------------------------------------------------------------------
348 -- |---------------------< delete_lp_section >---------------------|
349 -- ----------------------------------------------------------------------------
350 PROCEDURE delete_lp_section
351   (p_validate                     in     number    default hr_api.g_false_num
352   ,p_learning_path_section_id     in     number
353   ,p_object_version_number        in     number
354   ,p_return_status                   out nocopy varchar2
355   ) is
356   --
357   -- Variables for API Boolean parameters
358   l_validate                      boolean;
359   --
360   -- Variables for IN/OUT parameters
361   --
362   -- Other variables
363   l_proc    varchar2(72) := g_package ||'delete_lp_section';
364 Begin
365   hr_utility.set_location(' Entering:' || l_proc,10);
366   --
367   -- Issue a savepoint
368   --
369   savepoint delete_lpc_swi;
370   --
371   -- Initialise Multiple Message Detection
372   --
373   hr_multi_message.enable_message_list;
374   --
375   -- Remember IN OUT parameter IN values
376   --
377   --
378   -- Convert constant values to their corresponding boolean value
379   --
380   l_validate :=
381     hr_api.constant_to_boolean
382       (p_constant_value => p_validate);
383   --
384   -- Register Surrogate ID or user key values
385   --
386   --
387   -- Call API
388   --
389   ota_lp_section_api.delete_lp_section
390     (p_validate                     => l_validate
391     ,p_learning_path_section_id     => p_learning_path_section_id
392     ,p_object_version_number        => p_object_version_number
393     );
394   --
395   -- Convert API warning boolean parameter values to specific
396   -- messages and add them to Multiple Message List
397   --
398   --
399   -- Convert API non-warning boolean parameter values
400   --
401   --
402   -- Derive the API return status value based on whether
403   -- messages of any type exist in the Multiple Message List.
404   -- Also disable Multiple Message Detection.
405   --
406   p_return_status := hr_multi_message.get_return_status_disable;
407   hr_utility.set_location(' Leaving:' || l_proc,20);
408   --
409 exception
410   when hr_multi_message.error_message_exist then
411     --
412     -- Catch the Multiple Message List exception which
413     -- indicates API processing has been aborted because
414     -- at least one message exists in the list.
415     --
416     rollback to delete_lpc_swi;
417     --
418     -- Reset IN OUT parameters and set OUT parameters
419     --
420     p_return_status := hr_multi_message.get_return_status_disable;
421     hr_utility.set_location(' Leaving:' || l_proc, 30);
422   when others then
423     --
424     -- When Multiple Message Detection is enabled catch
425     -- any Application specific or other unexpected
426     -- exceptions.  Adding appropriate details to the
427     -- Multiple Message List.  Otherwise re-raise the
428     -- error.
429     --
430     rollback to delete_lpc_swi;
431     if hr_multi_message.unexpected_error_add(l_proc) then
432        hr_utility.set_location(' Leaving:' || l_proc,40);
433        raise;
434     end if;
435     --
436     -- Reset IN OUT and set OUT parameters
437     --
438     p_return_status := hr_multi_message.get_return_status_disable;
439     hr_utility.set_location(' Leaving:' || l_proc,50);
440 end delete_lp_section;
441 end ota_lp_section_swi;