[Home] [Help]
PACKAGE BODY: APPS.GHR_PDI_INS
Source
1 Package Body ghr_pdi_ins as
2 /* $Header: ghpdirhi.pkb 120.1 2005/06/13 12:28:25 vravikan noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ghr_pdi_ins.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------------< insert_dml >------------------------------|
12 -- ----------------------------------------------------------------------------
13 -- {Start Of Comments}
14 --
15 -- Description:
16 -- This procedure controls the actual dml insert logic. The processing of
17 -- this procedure are as follows:
18 -- 1) Initialise the object_version_number to 1 if the object_version_number
19 -- is defined as an attribute for this entity.
20 -- 2) To set and unset the g_api_dml status as required (as we are about to
21 -- perform dml).
22 -- 3) To insert the row into the schema.
23 -- 4) To trap any constraint violations that may have occurred.
24 -- 5) To raise any other errors.
25 --
26 -- Prerequisites:
27 -- This is an internal private procedure which must be called from the ins
28 -- procedure and must have all mandatory attributes set (except the
29 -- object_version_number which is initialised within this procedure).
30 --
31 -- In Parameters:
32 -- A Pl/Sql record structre.
33 --
34 -- Post Success:
35 -- The specified row will be inserted into the schema.
36 --
37 -- Post Failure:
38 -- On the insert dml failure it is important to note that we always reset the
39 -- g_api_dml status to false.
40 -- If a check, unique or parent integrity constraint violation is raised the
41 -- constraint_error procedure will be called.
42 -- If any other error is reported, the error will be raised after the
43 -- g_api_dml status is reset.
44 --
45 -- Developer Implementation Notes:
46 -- None.
47 --
48 -- Access Status:
49 -- Internal Row Handler Use Only.
50 --
51 -- {End Of Comments}
52 -- ----------------------------------------------------------------------------
53 Procedure insert_dml(p_rec in out nocopy ghr_pdi_shd.g_rec_type) is
54 --
55 l_proc varchar2(72) := g_package||'insert_dml';
56 --
57 Begin
58 hr_utility.set_location('Entering:'||l_proc, 5);
59 p_rec.object_version_number := 1; -- Initialise the object version
60 --
61 --ghr_pdi_shd.g_api_dml := true; -- Set the api dml status
62 --
63 -- Insert the row into: ghr_position_descriptions
64 --
65 insert into ghr_position_descriptions
66 ( position_description_id,
67 routing_group_id,
68 date_from,
69 date_to,
70 opm_cert_num,
71 flsa,
72 financial_statement,
73 subject_to_ia_action,
74 position_status,
75 position_is,
76 position_sensitivity,
77 competitive_level,
78 pd_remarks,
79 position_class_std,
80 category,
81 career_ladder,
82 supervisor_name,
83 supervisor_title,
84 supervisor_date,
85 manager_name,
86 manager_title,
87 manager_date,
88 classifier_name,
89 classifier_title,
90 classifier_date,
91 attribute_category,
92 attribute1,
93 attribute2,
94 attribute3,
95 attribute4,
96 attribute5,
97 attribute6,
98 attribute7,
99 attribute8,
100 attribute9,
101 attribute10,
102 attribute11,
103 attribute12,
104 attribute13,
105 attribute14,
106 attribute15,
107 attribute16,
108 attribute17,
109 attribute18,
110 attribute19,
111 attribute20,
112 business_group_id,
113 object_version_number
114 )
115 Values
116 ( p_rec.position_description_id,
117 p_rec.routing_group_id,
118 p_rec.date_from,
119 p_rec.date_to,
120 p_rec.opm_cert_num,
121 p_rec.flsa,
122 p_rec.financial_statement,
123 p_rec.subject_to_ia_action,
124 p_rec.position_status,
125 p_rec.position_is,
126 p_rec.position_sensitivity,
127 p_rec.competitive_level,
128 p_rec.pd_remarks,
129 p_rec.position_class_std,
130 p_rec.category,
131 p_rec.career_ladder,
132 p_rec.supervisor_name,
133 p_rec.supervisor_title,
134 p_rec.supervisor_date,
135 p_rec.manager_name,
136 p_rec.manager_title,
137 p_rec.manager_date,
138 p_rec.classifier_name,
139 p_rec.classifier_title,
140 p_rec.classifier_date,
141 p_rec.attribute_category,
142 p_rec.attribute1,
143 p_rec.attribute2,
144 p_rec.attribute3,
145 p_rec.attribute4,
146 p_rec.attribute5,
147 p_rec.attribute6,
148 p_rec.attribute7,
149 p_rec.attribute8,
150 p_rec.attribute9,
151 p_rec.attribute10,
152 p_rec.attribute11,
153 p_rec.attribute12,
154 p_rec.attribute13,
155 p_rec.attribute14,
156 p_rec.attribute15,
157 p_rec.attribute16,
158 p_rec.attribute17,
159 p_rec.attribute18,
160 p_rec.attribute19,
161 p_rec.attribute20,
162 p_rec.business_group_id,
163 p_rec.object_version_number
164 );
165 --
166 --ghr_pdi_shd.g_api_dml := false; -- Unset the api dml status
167 --
168 hr_utility.set_location(' Leaving:'||l_proc, 10);
169 Exception
170 When hr_api.check_integrity_violated Then
171 -- A check constraint has been violated
172 --ghr_pdi_shd.g_api_dml := false; -- Unset the api dml status
173 ghr_pdi_shd.constraint_error
174 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
175 When hr_api.parent_integrity_violated Then
176 -- Parent integrity has been violated
177 --ghr_pdi_shd.g_api_dml := false; -- Unset the api dml status
178 ghr_pdi_shd.constraint_error
179 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
180 When hr_api.unique_integrity_violated Then
181 -- Unique integrity has been violated
182 --ghr_pdi_shd.g_api_dml := false; -- Unset the api dml status
183 ghr_pdi_shd.constraint_error
184 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
185 When Others Then
186 --ghr_pdi_shd.g_api_dml := false; -- Unset the api dml status
187 Raise;
188 End insert_dml;
189 --
190 -- ----------------------------------------------------------------------------
191 -- |------------------------------< pre_insert >------------------------------|
192 -- ----------------------------------------------------------------------------
193 -- {Start Of Comments}
194 --
195 -- Description:
196 -- This private procedure contains any processing which is required before
197 -- the insert dml. Presently, if the entity has a corresponding primary
198 -- key which is maintained by an associating sequence, the primary key for
199 -- the entity will be populated with the next sequence value in
200 -- preparation for the insert dml.
201 --
202 -- Prerequisites:
203 -- This is an internal procedure which is called from the ins procedure.
204 --
205 -- In Parameters:
206 -- A Pl/Sql record structre.
207 --
208 -- Post Success:
209 -- Processing continues.
210 --
211 -- Post Failure:
212 -- If an error has occurred, an error message and exception will be raised
213 -- but not handled.
214 --
215 -- Developer Implementation Notes:
216 -- Any pre-processing required before the insert dml is issued should be
217 -- coded within this procedure. As stated above, a good example is the
218 -- generation of a primary key number via a corresponding sequence.
219 -- It is important to note that any 3rd party maintenance should be reviewed
220 -- before placing in this procedure.
221 --
222 -- Access Status:
223 -- Internal Row Handler Use Only.
224 --
225 -- {End Of Comments}
226 -- ----------------------------------------------------------------------------
227 Procedure pre_insert(p_rec in out nocopy ghr_pdi_shd.g_rec_type) is
228 --
229 l_proc varchar2(72) := g_package||'pre_insert';
230 --
231 Cursor C_Sel1 is select ghr_position_descriptions_s.nextval from sys.dual;
232 --
233 Begin
234 hr_utility.set_location('Entering:'||l_proc, 5);
235 --
236 --
237 -- Select the next sequence number
238 --
239 Open C_Sel1;
240 Fetch C_Sel1 Into p_rec.position_description_id;
241 Close C_Sel1;
242 --
243 hr_utility.set_location(' Leaving:'||l_proc, 10);
244 End pre_insert;
245 --
246 -- ----------------------------------------------------------------------------
247 -- |-----------------------------< post_insert >------------------------------|
248 -- ----------------------------------------------------------------------------
249 -- {Start Of Comments}
250 --
251 -- Description:
252 -- This private procedure contains any processing which is required after the
253 -- insert dml.
254 --
255 -- Prerequisites:
256 -- This is an internal procedure which is called from the ins procedure.
257 --
258 -- In Parameters:
259 -- A Pl/Sql record structre.
260 --
261 -- Post Success:
262 -- Processing continues.
263 --
264 -- Post Failure:
265 -- If an error has occurred, an error message and exception will be raised
266 -- but not handled.
267 --
268 -- Developer Implementation Notes:
269 -- Any post-processing required after the insert dml is issued should be
270 -- coded within this procedure. It is important to note that any 3rd party
271 -- maintenance should be reviewed before placing in this procedure.
272 --
273 -- Access Status:
274 -- Internal Row Handler Use Only.
275 --
276 -- {End Of Comments}
277 -- ----------------------------------------------------------------------------
278 Procedure post_insert(p_rec in ghr_pdi_shd.g_rec_type) is
279 --
280 l_proc varchar2(72) := g_package||'post_insert';
281 --
282 Begin
283 hr_utility.set_location('Entering:'||l_proc, 5);
284 --
285 --
286 -- This is a hook point and the user hook for post_insert is called here.
287 --
288 begin
289 ghr_pdi_rki.after_insert (
290 p_position_description_id => p_rec.position_description_id,
291 p_classifier_date => p_rec.classifier_date,
292 -- p_pa_request_id => p_rec.pa_request_id,
293 p_attribute_category => p_rec.attribute_category,
294 p_routing_group_id => p_rec.routing_group_id,
295 p_date_from => p_rec.date_from,
296 p_date_to => p_rec.date_to,
297 p_opm_cert_num => p_rec.opm_cert_num,
298 p_flsa => p_rec.flsa,
299 p_financial_statement => p_rec.financial_statement,
300 p_subject_to_ia_action => p_rec.subject_to_ia_action,
301 p_position_status => p_rec.position_status,
302 p_position_is => p_rec.position_is,
303 p_position_sensitivity => p_rec.position_sensitivity,
304 p_competitive_level => p_rec.competitive_level,
305 p_pd_remarks => p_rec.pd_remarks,
306 p_position_class_std => p_rec.position_class_std,
307 p_category => p_rec.category,
308 p_career_ladder => p_rec.career_ladder,
309 p_supervisor_name => p_rec.supervisor_name,
310 p_supervisor_title => p_rec.supervisor_title,
311 p_supervisor_date => p_rec.supervisor_date,
312 p_manager_name => p_rec.manager_name,
313 p_manager_title => p_rec.manager_title,
314 p_manager_date => p_rec.manager_date,
315 p_classifier_name => p_rec.classifier_name,
316 p_classifier_title => p_rec.classifier_title,
317 p_attribute1 => p_rec.attribute1,
318 p_attribute2 => p_rec.attribute2,
319 p_attribute3 => p_rec.attribute3,
320 p_attribute4 => p_rec.attribute4,
321 p_attribute5 => p_rec.attribute5,
322 p_attribute6 => p_rec.attribute6,
323 p_attribute7 => p_rec.attribute7,
324 p_attribute8 => p_rec.attribute8,
325 p_attribute9 => p_rec.attribute9,
326 p_attribute10 => p_rec.attribute10,
327 p_attribute11 => p_rec.attribute11,
328 p_attribute12 => p_rec.attribute12,
329 p_attribute13 => p_rec.attribute13,
330 p_attribute14 => p_rec.attribute14,
331 p_attribute15 => p_rec.attribute15,
332 p_attribute16 => p_rec.attribute16,
333 p_attribute17 => p_rec.attribute17,
334 p_attribute18 => p_rec.attribute18,
335 p_attribute19 => p_rec.attribute19,
336 p_attribute20 => p_rec.attribute20,
337 p_business_group_id => p_rec.business_group_id,
338 p_object_version_number => p_rec.object_version_number
339 );
340 exception
341 when hr_api.cannot_find_prog_unit then
342 hr_api.cannot_find_prog_unit_error
343 ( p_module_name => 'GHR_POSITION_DESCRIPTIONS'
344 ,p_hook_type => 'AI'
345 );
346 end;
347 -- End of API User Hook for post_insert.
348 --
349 hr_utility.set_location(' Leaving:'||l_proc, 10);
350 End post_insert;
351 --
352 -- ----------------------------------------------------------------------------
353 -- |---------------------------------< ins >----------------------------------|
354 -- ----------------------------------------------------------------------------
355 Procedure ins
356 (
357 p_rec in out nocopy ghr_pdi_shd.g_rec_type
358 ) is
359 --
360 l_proc varchar2(72) := g_package||'ins';
361 --
362 Begin
363 hr_utility.set_location('Entering:'||l_proc, 5);
364 --
365 -- Call the supporting insert validate operations
366 --
367 ghr_pdi_bus.insert_validate(p_rec);
368 --
369 -- Call the supporting pre-insert operation
370 --
371 pre_insert(p_rec);
372 --
373 -- Insert the row
374 --
375 insert_dml(p_rec);
376 --
377 -- Call the supporting post-insert operation
378 --
379 post_insert(p_rec);
380 end ins;
381 --
382 -- ----------------------------------------------------------------------------
383 -- |---------------------------------< ins >----------------------------------|
384 -- ----------------------------------------------------------------------------
385 Procedure ins
386 (
387 p_position_description_id out nocopy number,
388 p_routing_group_id in number default null,
389 p_date_from in date,
390 p_date_to in date default null,
391 p_opm_cert_num in varchar2 default null,
392 p_flsa in varchar2 default null,
393 p_financial_statement in varchar2 default null,
394 p_subject_to_ia_action in varchar2 default null,
395 p_position_status in number default null,
396 p_position_is in varchar2 default null,
397 p_position_sensitivity in varchar2 default null,
398 p_competitive_level in varchar2 default null,
399 p_pd_remarks in varchar2 default null,
400 p_position_class_std in varchar2 default null,
401 p_category in varchar2 default null,
402 p_career_ladder in varchar2 default null,
403 p_supervisor_name in varchar2 default null,
404 p_supervisor_title in varchar2 default null,
405 p_supervisor_date in date default null,
406 p_manager_name in varchar2 default null,
407 p_manager_title in varchar2 default null,
408 p_manager_date in date default null,
409 p_classifier_name in varchar2 default null,
410 p_classifier_title in varchar2 default null,
411 p_classifier_date in date default null,
412 p_attribute_category in varchar2 default null,
413 p_attribute1 in varchar2 default null,
414 p_attribute2 in varchar2 default null,
415 p_attribute3 in varchar2 default null,
416 p_attribute4 in varchar2 default null,
417 p_attribute5 in varchar2 default null,
418 p_attribute6 in varchar2 default null,
419 p_attribute7 in varchar2 default null,
420 p_attribute8 in varchar2 default null,
421 p_attribute9 in varchar2 default null,
422 p_attribute10 in varchar2 default null,
423 p_attribute11 in varchar2 default null,
424 p_attribute12 in varchar2 default null,
425 p_attribute13 in varchar2 default null,
426 p_attribute14 in varchar2 default null,
427 p_attribute15 in varchar2 default null,
428 p_attribute16 in varchar2 default null,
429 p_attribute17 in varchar2 default null,
430 p_attribute18 in varchar2 default null,
431 p_attribute19 in varchar2 default null,
432 p_attribute20 in varchar2 default null,
433 p_business_group_id in number default null,
434 p_object_version_number out nocopy number
435 ) is
436 --
437 l_rec ghr_pdi_shd.g_rec_type;
438 l_proc varchar2(72) := g_package||'ins';
439 --
440 Begin
441 hr_utility.set_location('Entering:'||l_proc, 5);
442 --
443 -- Call conversion function to turn arguments into the
444 -- p_rec structure.
445 --
446 l_rec :=
447 ghr_pdi_shd.convert_args
448 (
449 null,
450 p_routing_group_id,
451 p_date_from,
452 p_date_to,
453 p_opm_cert_num,
454 p_flsa,
455 p_financial_statement,
456 p_subject_to_ia_action,
457 p_position_status,
458 p_position_is,
459 p_position_sensitivity,
460 p_competitive_level,
461 p_pd_remarks,
462 p_position_class_std,
463 p_category,
464 p_career_ladder,
465 p_supervisor_name,
466 p_supervisor_title,
467 p_supervisor_date,
468 p_manager_name,
469 p_manager_title,
470 p_manager_date,
471 p_classifier_name,
472 p_classifier_title,
473 p_classifier_date,
474 p_attribute_category,
475 p_attribute1,
476 p_attribute2,
477 p_attribute3,
478 p_attribute4,
479 p_attribute5,
480 p_attribute6,
481 p_attribute7,
482 p_attribute8,
483 p_attribute9,
484 p_attribute10,
485 p_attribute11,
486 p_attribute12,
487 p_attribute13,
488 p_attribute14,
489 p_attribute15,
490 p_attribute16,
491 p_attribute17,
492 p_attribute18,
493 p_attribute19,
494 p_attribute20,
495 p_business_group_id,
496 null
497 );
498 --
499 -- Having converted the arguments into the ghr_pdi_rec
500 -- plsql record structure we call the corresponding record business process.
501 --
502 ins(l_rec);
503 --
504 -- As the primary key argument(s)
505 -- are specified as an OUT's we must set these values.
506 --
507 p_position_description_id := l_rec.position_description_id;
508 p_object_version_number := l_rec.object_version_number;
509 --
510 hr_utility.set_location(' Leaving:'||l_proc, 10);
511 End ins;
512 --
513 end ghr_pdi_ins;