DBA Data[Home] [Help]

PACKAGE BODY: APPS.GHR_COMPLAINT_ADRS_API

Source


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