[Home] [Help]
PACKAGE BODY: APPS.PER_DPF_INS
Source
1 Package Body per_dpf_ins as
2 /* $Header: pedpfrhi.pkb 115.13 2002/12/05 10:20:52 pkakar ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_dpf_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 per_dpf_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 per_dpf_shd.g_api_dml := true; -- Set the api dml status
62 --
63 -- Insert the row into: per_deployment_factors
64 --
65 insert into per_deployment_factors
66 ( deployment_factor_id,
67 position_id,
68 person_id,
69 job_id,
70 business_group_id,
71 work_any_country,
72 work_any_location,
73 relocate_domestically,
74 relocate_internationally,
75 travel_required,
76 country1,
77 country2,
78 country3,
79 work_duration,
80 work_schedule,
81 work_hours,
82 fte_capacity,
83 visit_internationally,
84 only_current_location,
85 no_country1,
86 no_country2,
87 no_country3,
88 comments,
89 earliest_available_date,
90 available_for_transfer,
91 relocation_preference,
92 relocation_required,
93 passport_required,
94 location1,
95 location2,
96 location3,
97 other_requirements,
98 service_minimum,
99 object_version_number,
100 attribute_category,
101 attribute1,
102 attribute2,
103 attribute3,
104 attribute4,
105 attribute5,
106 attribute6,
107 attribute7,
108 attribute8,
109 attribute9,
110 attribute10,
111 attribute11,
112 attribute12,
113 attribute13,
114 attribute14,
115 attribute15,
116 attribute16,
117 attribute17,
118 attribute18,
119 attribute19,
120 attribute20
121 )
122 Values
123 ( p_rec.deployment_factor_id,
124 p_rec.position_id,
125 p_rec.person_id,
126 p_rec.job_id,
127 p_rec.business_group_id,
128 p_rec.work_any_country,
129 p_rec.work_any_location,
130 p_rec.relocate_domestically,
131 p_rec.relocate_internationally,
132 p_rec.travel_required,
133 p_rec.country1,
134 p_rec.country2,
135 p_rec.country3,
136 p_rec.work_duration,
137 p_rec.work_schedule,
138 p_rec.work_hours,
139 p_rec.fte_capacity,
140 p_rec.visit_internationally,
141 p_rec.only_current_location,
142 p_rec.no_country1,
143 p_rec.no_country2,
144 p_rec.no_country3,
145 p_rec.comments,
146 p_rec.earliest_available_date,
150 p_rec.passport_required,
147 p_rec.available_for_transfer,
148 p_rec.relocation_preference,
149 p_rec.relocation_required,
151 p_rec.location1,
152 p_rec.location2,
153 p_rec.location3,
154 p_rec.other_requirements,
155 p_rec.service_minimum,
156 p_rec.object_version_number,
157 p_rec.attribute_category,
158 p_rec.attribute1,
159 p_rec.attribute2,
160 p_rec.attribute3,
161 p_rec.attribute4,
162 p_rec.attribute5,
163 p_rec.attribute6,
164 p_rec.attribute7,
165 p_rec.attribute8,
166 p_rec.attribute9,
167 p_rec.attribute10,
168 p_rec.attribute11,
169 p_rec.attribute12,
170 p_rec.attribute13,
171 p_rec.attribute14,
172 p_rec.attribute15,
173 p_rec.attribute16,
174 p_rec.attribute17,
175 p_rec.attribute18,
176 p_rec.attribute19,
177 p_rec.attribute20
178 );
179 --
180 per_dpf_shd.g_api_dml := false; -- Unset the api dml status
181 --
182 hr_utility.set_location(' Leaving:'||l_proc, 10);
183 Exception
184 When hr_api.check_integrity_violated Then
185 -- A check constraint has been violated
186 per_dpf_shd.g_api_dml := false; -- Unset the api dml status
187 per_dpf_shd.constraint_error
188 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
189 When hr_api.parent_integrity_violated Then
190 -- Parent integrity has been violated
191 per_dpf_shd.g_api_dml := false; -- Unset the api dml status
192 per_dpf_shd.constraint_error
193 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
194 When hr_api.unique_integrity_violated Then
195 -- Unique integrity has been violated
196 per_dpf_shd.g_api_dml := false; -- Unset the api dml status
197 per_dpf_shd.constraint_error
198 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
199 When Others Then
200 per_dpf_shd.g_api_dml := false; -- Unset the api dml status
201 Raise;
202 End insert_dml;
203 --
204 -- ----------------------------------------------------------------------------
205 -- |------------------------------< pre_insert >------------------------------|
206 -- ----------------------------------------------------------------------------
207 -- {Start Of Comments}
208 --
209 -- Description:
210 -- This private procedure contains any processing which is required before
211 -- the insert dml. Presently, if the entity has a corresponding primary
212 -- key which is maintained by an associating sequence, the primary key for
213 -- the entity will be populated with the next sequence value in
214 -- preparation for the insert dml.
215 --
216 -- Prerequisites:
217 -- This is an internal procedure which is called from the ins procedure.
218 --
219 -- In Parameters:
220 -- A Pl/Sql record structre.
221 --
222 -- Post Success:
223 -- Processing continues.
224 --
225 -- Post Failure:
226 -- If an error has occurred, an error message and exception will be raised
227 -- but not handled.
228 --
229 -- Developer Implementation Notes:
230 -- Any pre-processing required before the insert dml is issued should be
231 -- coded within this procedure. As stated above, a good example is the
232 -- generation of a primary key number via a corresponding sequence.
233 -- It is important to note that any 3rd party maintenance should be reviewed
234 -- before placing in this procedure.
235 --
236 -- Access Status:
237 -- Internal Row Handler Use Only.
238 --
239 -- {End Of Comments}
240 -- ----------------------------------------------------------------------------
241 Procedure pre_insert(p_rec in out nocopy per_dpf_shd.g_rec_type) is
242 --
243 l_proc varchar2(72) := g_package||'pre_insert';
244 --
245 Cursor C_Sel1 is select per_deployment_factors_s.nextval from sys.dual;
246 --
247 Begin
248 hr_utility.set_location('Entering:'||l_proc, 5);
249 --
250 --
251 -- Select the next sequence number
252 --
253 Open C_Sel1;
254 Fetch C_Sel1 Into p_rec.deployment_factor_id;
255 Close C_Sel1;
256 --
257 hr_utility.set_location(' Leaving:'||l_proc, 10);
258 End pre_insert;
259 --
260 -- ----------------------------------------------------------------------------
261 -- |-----------------------------< post_insert >------------------------------|
262 -- ----------------------------------------------------------------------------
263 -- {Start Of Comments}
264 --
265 -- Description:
266 -- This private procedure contains any processing which is required after the
267 -- insert dml.
268 --
269 -- Prerequisites:
270 -- This is an internal procedure which is called from the ins procedure.
271 --
272 -- In Parameters:
273 -- A Pl/Sql record structre.
274 --
275 -- Post Success:
276 -- Processing continues.
277 --
278 -- Post Failure:
279 -- If an error has occurred, an error message and exception will be raised
280 -- but not handled.
281 --
282 -- Developer Implementation Notes:
283 -- Any post-processing required after the insert dml is issued should be
284 -- coded within this procedure. It is important to note that any 3rd party
285 -- maintenance should be reviewed before placing in this procedure.
286 --
287 -- Access Status:
288 -- Internal Row Handler Use Only.
289 --
290 -- {End Of Comments}
291 -- ----------------------------------------------------------------------------
292 Procedure post_insert(p_rec in per_dpf_shd.g_rec_type, p_effective_date in date) is
293 --
294 l_proc varchar2(72) := g_package||'post_insert';
295 --
299 -- Start of API User Hook for post_insert.
296 Begin
297 hr_utility.set_location('Entering:'||l_proc, 5);
298 --
300 Begin
301 per_dpf_rki.after_insert
302 (
303 p_deployment_factor_id =>p_rec.deployment_factor_id,
304 p_job_id =>p_rec.job_id,
305 p_position_id =>p_rec.position_id,
306 p_person_id =>p_rec.person_id,
307 p_business_group_id =>p_rec.business_group_id,
308 p_work_any_country =>p_rec.work_any_country,
309 p_work_any_location =>p_rec.work_any_location,
310 p_relocate_domestically =>p_rec.relocate_domestically,
311 p_relocate_internationally =>p_rec.relocate_internationally,
312 p_travel_required =>p_rec.travel_required,
313 p_country1 =>p_rec.country1,
314 p_country2 =>p_rec.country2,
315 p_country3 =>p_rec.country3,
316 p_work_duration =>p_rec.work_duration,
317 p_work_schedule =>p_rec.work_schedule,
318 p_work_hours =>p_rec.work_hours,
319 p_fte_capacity =>p_rec.fte_capacity,
320 p_visit_internationally =>p_rec.visit_internationally,
321 p_only_current_location =>p_rec.only_current_location,
322 p_no_country1 =>p_rec.no_country1,
323 p_no_country2 =>p_rec.no_country2,
324 p_no_country3 =>p_rec.no_country3,
325 p_comments =>p_rec.comments,
326 p_earliest_available_date =>p_rec.earliest_available_date,
327 p_available_for_transfer =>p_rec.available_for_transfer,
328 p_relocation_preference =>p_rec.relocation_preference,
329 p_relocation_required =>p_rec.relocation_required,
330 p_passport_required =>p_rec.passport_required,
331 p_location1 =>p_rec.location1,
332 p_location2 =>p_rec.location2,
333 p_location3 =>p_rec.location3,
334 p_other_requirements =>p_rec.other_requirements,
335 p_service_minimum =>p_rec.service_minimum,
336 p_object_version_number =>p_rec.object_version_number,
337 p_effective_date =>p_effective_date,
338 p_attribute_category =>p_rec.attribute_category,
339 p_attribute1 =>p_rec.attribute1,
340 p_attribute2 =>p_rec.attribute2,
341 p_attribute3 =>p_rec.attribute3,
342 p_attribute4 =>p_rec.attribute4,
343 p_attribute5 =>p_rec.attribute5,
344 p_attribute6 =>p_rec.attribute6,
345 p_attribute7 =>p_rec.attribute7,
346 p_attribute8 =>p_rec.attribute8,
347 p_attribute9 =>p_rec.attribute9,
348 p_attribute10 =>p_rec.attribute10,
349 p_attribute11 =>p_rec.attribute11,
350 p_attribute12 =>p_rec.attribute12,
351 p_attribute13 =>p_rec.attribute13,
352 p_attribute14 =>p_rec.attribute14,
353 p_attribute15 =>p_rec.attribute15,
354 p_attribute16 =>p_rec.attribute16,
355 p_attribute17 =>p_rec.attribute17,
356 p_attribute18 =>p_rec.attribute18,
357 p_attribute19 =>p_rec.attribute19,
358 p_attribute20 =>p_rec.attribute20
359 );
360 exception
361 when hr_api.cannot_find_prog_unit then
362 hr_api.cannot_find_prog_unit_error
363 ( p_module_name => 'PER_DEPLOYMENT_FACTORS',
364 p_hook_type => 'AI'
365 );
366 end;
367 -- End of API User Hook for post_insert.
368 hr_utility.set_location(' Leaving:'||l_proc, 10);
369 End post_insert;
370 --
371 -- ----------------------------------------------------------------------------
372 -- |---------------------------------< ins >----------------------------------|
373 -- ----------------------------------------------------------------------------
374 Procedure ins
375 (
376 p_rec in out nocopy per_dpf_shd.g_rec_type,
377 p_effective_date in date
378 ) is
379 --
380 l_proc varchar2(72) := g_package||'ins';
381 --
382 Begin
383 hr_utility.set_location('Entering:'||l_proc, 5);
384 --
385 -- Call the supporting insert validate operations
386 --
387 per_dpf_bus.insert_validate(p_rec,p_effective_date);
388 --
389 -- Call the supporting pre-insert operation
390 --
391 pre_insert(p_rec);
392 --
393 -- Insert the row
394 --
395 insert_dml(p_rec);
396 --
397 -- Call the supporting post-insert operation
398 --
399 post_insert(p_rec, p_effective_date);
400 end ins;
401 --
402 -- ----------------------------------------------------------------------------
403 -- |---------------------------------< ins >----------------------------------|
404 -- ----------------------------------------------------------------------------
405 Procedure ins
406 (
407 p_deployment_factor_id out nocopy number,
408 p_position_id in number ,
409 p_person_id in number ,
410 p_job_id in number ,
411 p_business_group_id in number,
412 p_work_any_country in varchar2,
413 p_work_any_location in varchar2,
417 p_country1 in varchar2 ,
414 p_relocate_domestically in varchar2,
415 p_relocate_internationally in varchar2,
416 p_travel_required in varchar2,
418 p_country2 in varchar2 ,
419 p_country3 in varchar2 ,
420 p_work_duration in varchar2 ,
421 p_work_schedule in varchar2 ,
422 p_work_hours in varchar2 ,
423 p_fte_capacity in varchar2 ,
424 p_visit_internationally in varchar2 ,
425 p_only_current_location in varchar2 ,
426 p_no_country1 in varchar2 ,
427 p_no_country2 in varchar2 ,
428 p_no_country3 in varchar2 ,
429 p_comments in varchar2 ,
430 p_earliest_available_date in date ,
431 p_available_for_transfer in varchar2 ,
432 p_relocation_preference in varchar2 ,
433 p_relocation_required in varchar2 ,
434 p_passport_required in varchar2 ,
435 p_location1 in varchar2 ,
436 p_location2 in varchar2 ,
437 p_location3 in varchar2 ,
438 p_other_requirements in varchar2 ,
439 p_service_minimum in varchar2 ,
440 p_object_version_number out nocopy number,
441 p_effective_date in date,
442 p_attribute_category in varchar2 ,
443 p_attribute1 in varchar2 ,
444 p_attribute2 in varchar2 ,
445 p_attribute3 in varchar2 ,
446 p_attribute4 in varchar2 ,
447 p_attribute5 in varchar2 ,
448 p_attribute6 in varchar2 ,
449 p_attribute7 in varchar2 ,
450 p_attribute8 in varchar2 ,
451 p_attribute9 in varchar2 ,
452 p_attribute10 in varchar2 ,
453 p_attribute11 in varchar2 ,
454 p_attribute12 in varchar2 ,
455 p_attribute13 in varchar2 ,
456 p_attribute14 in varchar2 ,
457 p_attribute15 in varchar2 ,
458 p_attribute16 in varchar2 ,
459 p_attribute17 in varchar2 ,
460 p_attribute18 in varchar2 ,
461 p_attribute19 in varchar2 ,
462 p_attribute20 in varchar2 ) is
463 --
464 l_rec per_dpf_shd.g_rec_type;
465 l_proc varchar2(72) := g_package||'ins';
466 --
467 Begin
468 hr_utility.set_location('Entering:'||l_proc, 5);
469 --
470 -- Call conversion function to turn arguments into the
471 -- p_rec structure.
472 --
473 l_rec :=
474 per_dpf_shd.convert_args
475 (
476 null,
477 p_position_id,
478 p_person_id,
479 p_job_id,
480 p_business_group_id,
481 p_work_any_country,
482 p_work_any_location,
483 p_relocate_domestically,
484 p_relocate_internationally,
485 p_travel_required,
486 p_country1,
487 p_country2,
488 p_country3,
489 p_work_duration,
490 p_work_schedule,
491 p_work_hours,
492 p_fte_capacity,
493 p_visit_internationally,
494 p_only_current_location,
495 p_no_country1,
496 p_no_country2,
497 p_no_country3,
498 p_comments,
499 p_earliest_available_date,
500 p_available_for_transfer,
501 p_relocation_preference,
502 p_relocation_required,
503 p_passport_required,
504 p_location1,
505 p_location2,
506 p_location3,
507 p_other_requirements,
508 p_service_minimum,
509 null,
510 p_attribute_category,
511 p_attribute1,
512 p_attribute2,
513 p_attribute3,
514 p_attribute4,
515 p_attribute5,
516 p_attribute6,
517 p_attribute7,
518 p_attribute8,
519 p_attribute9,
520 p_attribute10,
521 p_attribute11,
522 p_attribute12,
523 p_attribute13,
524 p_attribute14,
525 p_attribute15,
526 p_attribute16,
527 p_attribute17,
528 p_attribute18,
529 p_attribute19,
530 p_attribute20
531 );
532 --
533 -- Having converted the arguments into the per_dpf_rec
534 -- plsql record structure we call the corresponding record business process.
535 --
536 ins(l_rec,p_effective_date);
537 --
538 -- As the primary key argument(s)
539 -- are specified as an OUT's we must set these values.
540 --
541 p_deployment_factor_id := l_rec.deployment_factor_id;
542 p_object_version_number := l_rec.object_version_number;
543 --
544 hr_utility.set_location(' Leaving:'||l_proc, 10);
545 End ins;
546 --
547 end per_dpf_ins;