DBA Data[Home] [Help]

PACKAGE BODY: APPS.GHR_COMPLAINT_PEOPLE_API

Source


1 Package Body ghr_complaint_people_api as
2 /* $Header: ghcplapi.pkb 115.1 2003/01/30 16:31:55 asubrahm noship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := '  ghr_complaint_people_api.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |--------------------------< Create_compl_person> >--------------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure create_compl_person
13   (p_validate                       in     boolean  default false
14   ,p_effective_date                 in     date
15   ,p_person_id                      in     number
16   ,p_complaint_id                   in     number
17   ,p_role_code                      in     varchar2 default null
18   ,p_start_date                     in     date     default null
19   ,p_end_date                       in     date     default null
20   ,p_compl_person_id                   out nocopy number
21   ,p_object_version_number             out nocopy number
22    ) is
23 
24   --
25   -- Declare cursors and local variables
26   --
27 
28   l_proc                  varchar2(72) := g_package||'create_compl_person';
29   l_compl_person_id       number;
30   l_object_version_number number;
31 begin
32   hr_utility.set_location('Entering:'|| l_proc, 10);
33   --
34   -- Issue a savepoint
35   --
36   savepoint create_compl_person;
37   hr_utility.set_location(l_proc, 20);
38   --
39   -- Truncate the time portion from all IN date parameters
40   --
41   --
42   -- Call Before Process User Hook
43   --
44   begin
45     ghr_complaint_people_bk_1.create_compl_person_b
46       (p_effective_date                 => trunc(p_effective_date)
47       ,p_person_id                      => p_person_id
48       ,p_complaint_id                   => p_complaint_id
49       ,p_role_code                      => p_role_code
50       ,p_start_date                     => p_start_date
51       ,p_end_date                       => p_end_date
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_compl_person'
57         ,p_hook_type   => 'BP'
58         );
59   end;
60   --
61   --
62   --
63   -- Validation in addition to Row Handlers
64   --
65 
66   hr_utility.set_location(l_proc, 40);
67   --
68   -- Process Logic
69   --
70   ghr_cpl_ins.ins
71  (p_effective_date                  => p_effective_date
72   ,p_person_id                      => p_person_id
73   ,p_complaint_id                   => p_complaint_id
74   ,p_role_code                      => p_role_code
75   ,p_start_date                     => p_start_date
76   ,p_end_date                       => p_end_date
77   ,p_compl_person_id                => l_compl_person_id
78   ,p_object_version_number          => l_object_version_number
79   );
80   hr_utility.set_location(l_proc, 50);
81   --
82   --
83   -- Call After Process User Hook
84   --
85   begin
86     ghr_complaint_people_bk_1.create_compl_person_a
87       (p_effective_date                 => trunc(p_effective_date)
88       ,p_person_id                      => p_person_id
89       ,p_complaint_id                   => p_complaint_id
90       ,p_role_code                      => p_role_code
91       ,p_start_date                     => p_start_date
92       ,p_end_date                       => p_end_date
93       ,p_compl_person_id                => l_compl_person_id
94       ,p_object_version_number          => l_object_version_number
95       );
96   exception
97     when hr_api.cannot_find_prog_unit then
98       hr_api.cannot_find_prog_unit_error
99         (p_module_name => 'create_compl_person'
100         ,p_hook_type   => 'AP'
101         );
102   end;
103   --
104   -- When in validation only mode raise the Validate_Enabled exception
105   --
106   if p_validate then
107     raise hr_api.validate_enabled;
108   end if;
109   --
110   -- Set all output arguments
111   --
112   p_compl_person_id         := l_compl_person_id;
113   p_object_version_number   := l_object_version_number;
114   --
115   hr_utility.set_location(' Leaving:'||l_proc, 70);
116 exception
117   when hr_api.validate_enabled then
118     --
119     -- As the Validate_Enabled exception has been raised
120     -- we must rollback to the savepoint
121     --
122     rollback to create_compl_person;
123     --
124     -- Only set output warning arguments
125     -- (Any key or derived arguments must be set to null
126     -- when validation only mode is being used.)
127     --
128     p_compl_person_id         := null;
129     p_object_version_number   := null;
130     hr_utility.set_location(' Leaving:'||l_proc, 80);
131   when others then
132     --
133     -- A validation or unexpected error has occured
134     --
135     rollback to create_compl_person;
136     --
137     -- Reset IN OUT parameters and set OUT parameters
138     --
139     p_compl_person_id         := null;
140     p_object_version_number   := null;
141     hr_utility.set_location(' Leaving:'||l_proc, 90);
142     raise;
143 end create_compl_person;
144 --
145 
146 
147 procedure update_compl_person
148   (p_validate                     in     boolean default false
149   ,p_effective_date               in     date
150   ,p_compl_person_id              in     number
151   ,p_object_version_number        in out nocopy number
152   ,p_person_id                    in     number    default hr_api.g_number
153   ,p_complaint_id                 in     number    default hr_api.g_number
154   ,p_role_code                    in     varchar2  default hr_api.g_varchar2
155   ,p_start_date                   in     date      default hr_api.g_date
156   ,p_end_date                     in     date      default hr_api.g_date
157    )
158 
159 is
160   l_proc                varchar2(72) := g_package||'update_compl_person';
161   l_object_version_number number;
162 -- Initial OVN.
163   l_i_object_version_number number;
164 begin
165 hr_utility.set_location('Entering:'|| l_proc, 5);
166   --
167    savepoint update_compl_person;
168   --
169   -- Remember IN OUT parameter IN values
170   l_i_object_version_number := p_object_version_number;
171   --
172   -- Truncate the time portion from all IN date parameters
173   --
174 
175   --
176   -- Call Before Process User Hook
177   --
178   begin
179     ghr_complaint_people_bk_2.update_compl_person_b
180       (p_effective_date                 => trunc(p_effective_date)
181       ,p_complaint_id                   => p_complaint_id
182       ,p_person_id                      => p_person_id
183       ,p_role_code                      => p_role_code
184       ,p_start_date                     => p_start_date
185       ,p_end_date                       => p_end_date
186       ,p_compl_person_id                => p_compl_person_id
187       ,p_object_version_number          => p_object_version_number
188       );
189   exception
190     when hr_api.cannot_find_prog_unit then
191       hr_api.cannot_find_prog_unit_error
192         (p_module_name => 'update_compl_person'
193         ,p_hook_type   => 'BP'
194         );
195   end;
196   --
197   -- Validation in addition to Row Handlers
198   --
199   -- Store the original ovn in case we rollback when p_validate is true
200   --
201   l_object_version_number  := p_object_version_number;
202 
203   hr_utility.set_location(l_proc, 6);
204 
205     ghr_cpl_upd.upd
206   (p_effective_date                 => p_effective_date
207   ,p_complaint_id                   => p_complaint_id
208   ,p_person_id                      => p_person_id
209   ,p_role_code                      => p_role_code
210   ,p_start_date                     => p_start_date
211   ,p_end_date                       => p_end_date
212   ,p_compl_person_id                => p_compl_person_id
213   ,p_object_version_number          => l_object_version_number
214   );
215   --
216   -- Call After Process User Hook
217   --
218   begin
219     ghr_complaint_people_bk_2.update_compl_person_a
220       (p_effective_date                 => trunc(p_effective_date)
221       ,p_complaint_id                   => p_complaint_id
222       ,p_person_id                      => p_person_id
223       ,p_role_code                      => p_role_code
224       ,p_start_date                     => p_start_date
225       ,p_end_date                       => p_end_date
226       ,p_compl_person_id                => p_compl_person_id
227       ,p_object_version_number          => l_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_compl_person'
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 output arguments
244   --
245   p_object_version_number  := l_object_version_number;
246   --
247   hr_utility.set_location(' Leaving:'||l_proc, 70);
248 exception
249   when hr_api.validate_enabled then
250     --
251     -- As the Validate_Enabled exception has been raised
252     -- we must rollback to the savepoint
253     --
254     rollback to update_compl_person;
255     --
256     -- Only set output warning arguments
257     -- (Any key or derived arguments must be set to null
258     -- when validation only mode is being used.)
259     --
260     p_object_version_number  := l_i_object_version_number;
261     hr_utility.set_location(' Leaving:'||l_proc, 80);
262   when others then
263     --
264     -- A validation or unexpected error has occured
265     --
266     rollback to update_compl_person;
267     --
268     -- Reset IN OUT parameters and set OUT parameters
269     --
270     p_object_version_number  := l_i_object_version_number;
271     hr_utility.set_location(' Leaving:'||l_proc, 90);
272     raise;
273 
274 end update_compl_person;
275 
276 -- ----------------------------------------------------------------------------
277 -- |-----------------------< delete_compl_person >-----------------------|
278 -- ----------------------------------------------------------------------------
279 --
280 procedure delete_compl_person
281   (p_validate                       in     boolean  default false
282   ,p_compl_person_id                in     number
283   ,p_object_version_number          in     number
284   ) is
285   --
286   -- Declare cursors and local variables
287   --
288   l_proc                  varchar2(72) := g_package||'delete_compl_person';
289   l_exists                boolean      := false;
290 
291 begin
292   hr_utility.set_location('Entering:'|| l_proc, 5);
293   --
294   --
295   savepoint delete_compl_person;
296   --
297   -- Truncate the time portion from all IN date parameters
298   --
299 
300   --
301   -- Call Before Process User Hook
302   --
303   begin
304     ghr_complaint_people_bk_3.delete_compl_person_b
305       (p_compl_person_id                => p_compl_person_id
306       ,p_object_version_number          => p_object_version_number
307       );
308   exception
309     when hr_api.cannot_find_prog_unit then
310       hr_api.cannot_find_prog_unit_error
311         (p_module_name => 'delete_compl_person'
312         ,p_hook_type   => 'BP'
313         );
314   end;
315   --
316   -- Validation in addition to Row Handlers
317   --
318  -- Process Logic
319    ghr_cpl_del.del
320     (p_compl_person_id                => p_compl_person_id
321     ,p_object_version_number          => p_object_version_number
322      );
323  --
324   hr_utility.set_location(l_proc, 8);
325   --
326   -- Call After Process User Hook
327   --
328   begin
329     ghr_complaint_people_bk_3.delete_compl_person_a
330       (p_compl_person_id                => p_compl_person_id
331       ,p_object_version_number          => p_object_version_number
332       );
333   exception
334     when hr_api.cannot_find_prog_unit then
335       hr_api.cannot_find_prog_unit_error
336         (p_module_name => 'delete_compl_person'
337         ,p_hook_type   => 'AP'
338         );
339   end;
340   --
341   -- When in validation only mode raise the Validate_Enabled exception
342   --
343   if p_validate then
344     raise hr_api.validate_enabled;
345   end if;
346   --
347   hr_utility.set_location(' Leaving:'||l_proc, 11);
348 exception
349   when hr_api.validate_enabled then
350     -- we must rollback to the savepoint
351     --
352     ROLLBACK TO delete_compl_person;
353     --
354   When Others then
355     ROLLBACK TO delete_compl_person;
356     raise;
357 
358   hr_utility.set_location(' Leaving:'||l_proc, 12);
359 end delete_compl_person;
360 end ghr_complaint_people_api;
361