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