[Home] [Help]
PACKAGE BODY: APPS.IRC_RSE_INS
Source
1 Package Body irc_rse_ins as
2 /* $Header: irrserhi.pkb 120.0 2005/07/26 15:17:04 mbocutt noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' irc_rse_ins.'; -- Global package name
9 --
10 -- The following global variables are only to be used by
11 -- the set_base_key_value and pre_insert procedures.
12 --
13 g_recruiting_site_id_i number default null;
14 --
15 -- ----------------------------------------------------------------------------
16 -- |------------------------< set_base_key_value >----------------------------|
17 -- ----------------------------------------------------------------------------
18 procedure set_base_key_value
19 (p_recruiting_site_id in number) is
20 --
21 l_proc varchar2(72) := g_package||'set_base_key_value';
22 --
23 Begin
24 hr_utility.set_location('Entering:'||l_proc, 10);
25 --
26 irc_rse_ins.g_recruiting_site_id_i := p_recruiting_site_id;
27 --
28 hr_utility.set_location(' Leaving:'||l_proc, 20);
29 End set_base_key_value;
30 --
31 --
32 -- ----------------------------------------------------------------------------
33 -- |------------------------------< insert_dml >------------------------------|
34 -- ----------------------------------------------------------------------------
35 -- {Start Of Comments}
36 --
37 -- Description:
38 -- This procedure controls the actual dml insert logic. The processing of
39 -- this procedure are as follows:
40 -- 1) Initialise the object_version_number to 1 if the object_version_number
41 -- is defined as an attribute for this entity.
42 -- 2) To set and unset the g_api_dml status as required (as we are about to
43 -- perform dml).
44 -- 3) To insert the row into the schema.
45 -- 4) To trap any constraint violations that may have occurred.
46 -- 5) To raise any other errors.
47 --
48 -- Prerequisites:
49 -- This is an internal private procedure which must be called from the ins
50 -- procedure and must have all mandatory attributes set (except the
51 -- object_version_number which is initialised within this procedure).
52 --
53 -- In Parameters:
54 -- A Pl/Sql record structre.
55 --
56 -- Post Success:
57 -- The specified row will be inserted into the schema.
58 --
59 -- Post Failure:
60 -- On the insert dml failure it is important to note that we always reset the
61 -- g_api_dml status to false.
62 -- If a check, unique or parent integrity constraint violation is raised the
63 -- constraint_error procedure will be called.
64 -- If any other error is reported, the error will be raised after the
65 -- g_api_dml status is reset.
66 --
67 -- Developer Implementation Notes:
68 -- None.
69 --
70 -- Access Status:
71 -- Internal Row Handler Use Only.
72 --
73 -- {End Of Comments}
74 -- ----------------------------------------------------------------------------
75 Procedure insert_dml
76 (p_rec in out nocopy irc_rse_shd.g_rec_type
77 ) is
78 --
79 l_proc varchar2(72) := g_package||'insert_dml';
80 --
81 Begin
82 hr_utility.set_location('Entering:'||l_proc, 5);
83 p_rec.object_version_number := 1; -- Initialise the object version
84 --
85 irc_rse_shd.g_api_dml := true; -- Set the api dml status
86 --
87 -- Insert the row into: irc_all_recruiting_sites
88 --
89 insert into irc_all_recruiting_sites
90 (recruiting_site_id
91 ,date_from
92 ,date_to
93 ,posting_username
94 ,posting_password
95 ,internal
96 ,external
97 ,third_party
98 ,posting_cost
99 ,posting_cost_period
100 ,posting_cost_currency
101 ,stylesheet
102 ,attribute_category
103 ,attribute1
104 ,attribute2
105 ,attribute3
106 ,attribute4
107 ,attribute5
108 ,attribute6
109 ,attribute7
110 ,attribute8
111 ,attribute9
112 ,attribute10
113 ,attribute11
114 ,attribute12
115 ,attribute13
116 ,attribute14
117 ,attribute15
118 ,attribute16
119 ,attribute17
120 ,attribute18
121 ,attribute19
122 ,attribute20
123 ,attribute21
124 ,attribute22
125 ,attribute23
126 ,attribute24
127 ,attribute25
128 ,attribute26
129 ,attribute27
130 ,attribute28
131 ,attribute29
132 ,attribute30
133 ,object_version_number
134 ,internal_name
135 )
136 Values
137 (p_rec.recruiting_site_id
138 ,p_rec.date_from
139 ,p_rec.date_to
140 ,p_rec.posting_username
141 ,p_rec.posting_password
142 ,p_rec.internal
143 ,p_rec.external
144 ,p_rec.third_party
145 ,p_rec.posting_cost
146 ,p_rec.posting_cost_period
147 ,p_rec.posting_cost_currency
148 ,p_rec.stylesheet
149 ,p_rec.attribute_category
150 ,p_rec.attribute1
151 ,p_rec.attribute2
152 ,p_rec.attribute3
153 ,p_rec.attribute4
154 ,p_rec.attribute5
155 ,p_rec.attribute6
156 ,p_rec.attribute7
157 ,p_rec.attribute8
158 ,p_rec.attribute9
159 ,p_rec.attribute10
160 ,p_rec.attribute11
161 ,p_rec.attribute12
162 ,p_rec.attribute13
163 ,p_rec.attribute14
164 ,p_rec.attribute15
165 ,p_rec.attribute16
166 ,p_rec.attribute17
167 ,p_rec.attribute18
168 ,p_rec.attribute19
169 ,p_rec.attribute20
170 ,p_rec.attribute21
171 ,p_rec.attribute22
172 ,p_rec.attribute23
173 ,p_rec.attribute24
174 ,p_rec.attribute25
175 ,p_rec.attribute26
176 ,p_rec.attribute27
177 ,p_rec.attribute28
178 ,p_rec.attribute29
179 ,p_rec.attribute30
180 ,p_rec.object_version_number
181 ,p_rec.internal_name
182 );
183 --
184 --
185 irc_rse_shd.g_api_dml := false; -- Unset the api dml status
186 hr_utility.set_location(' Leaving:'||l_proc, 10);
187 Exception
188 When hr_api.check_integrity_violated Then
189 -- A check constraint has been violated
190 irc_rse_shd.g_api_dml := false; -- Unset the api dml status
191 --
192 irc_rse_shd.constraint_error
193 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
194 When hr_api.parent_integrity_violated Then
195 -- Parent integrity has been violated
196 irc_rse_shd.g_api_dml := false; -- Unset the api dml status
197 --
198 irc_rse_shd.constraint_error
199 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
200 When hr_api.unique_integrity_violated Then
201 -- Unique integrity has been violated
202 irc_rse_shd.g_api_dml := false; -- Unset the api dml status
203 --
204 irc_rse_shd.constraint_error
205 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
206 When Others Then
207 irc_rse_shd.g_api_dml := false; -- Unset the api dml status
208 --
209 Raise;
210 End insert_dml;
211 --
212 -- ----------------------------------------------------------------------------
213 -- |------------------------------< pre_insert >------------------------------|
214 -- ----------------------------------------------------------------------------
215 -- {Start Of Comments}
216 --
217 -- Description:
218 -- This private procedure contains any processing which is required before
219 -- the insert dml. Presently, if the entity has a corresponding primary
220 -- key which is maintained by an associating sequence, the primary key for
221 -- the entity will be populated with the next sequence value in
222 -- preparation for the insert dml.
223 --
224 -- Prerequisites:
225 -- This is an internal procedure which is called from the ins procedure.
226 --
227 -- In Parameters:
228 -- A Pl/Sql record structure.
229 --
230 -- Post Success:
231 -- Processing continues.
232 --
233 -- Post Failure:
234 -- If an error has occurred, an error message and exception will be raised
235 -- but not handled.
236 --
237 -- Developer Implementation Notes:
238 -- Any pre-processing required before the insert dml is issued should be
239 -- coded within this procedure. As stated above, a good example is the
240 -- generation of a primary key number via a corresponding sequence.
241 -- It is important to note that any 3rd party maintenance should be reviewed
242 -- before placing in this procedure.
243 --
244 -- Access Status:
245 -- Internal Row Handler Use Only.
246 --
247 -- {End Of Comments}
248 -- ----------------------------------------------------------------------------
249 Procedure pre_insert
250 (p_rec in out nocopy irc_rse_shd.g_rec_type
251 ) is
252 --
253 Cursor C_Sel1 is select irc_all_recruiting_sites_s.nextval from sys.dual;
254 --
255 Cursor C_Sel2 is
256 Select null
257 from irc_all_recruiting_sites
258 where recruiting_site_id =
259 irc_rse_ins.g_recruiting_site_id_i;
260 --
261 l_proc varchar2(72) := g_package||'pre_insert';
262 l_exists varchar2(1);
263 --
264 Begin
265 hr_utility.set_location('Entering:'||l_proc, 5);
266 --
267 If (irc_rse_ins.g_recruiting_site_id_i is not null) Then
268 --
269 -- Verify registered primary key values not already in use
270 --
271 Open C_Sel2;
272 Fetch C_Sel2 into l_exists;
273 If C_Sel2%found Then
274 Close C_Sel2;
275 --
276 -- The primary key values are already in use.
277 --
278 fnd_message.set_name('PER','PER_289391_KEY_ALREADY_USED');
279 fnd_message.set_token('TABLE_NAME','irc_all_recruiting_sites');
280 fnd_message.raise_error;
281 End If;
282 Close C_Sel2;
283 --
284 -- Use registered key values and clear globals
285 --
286 p_rec.recruiting_site_id :=
287 irc_rse_ins.g_recruiting_site_id_i;
288 irc_rse_ins.g_recruiting_site_id_i := null;
289 Else
290 --
291 -- No registerd key values, so select the next sequence number
292 --
293 --
294 -- Select the next sequence number
295 --
296 Open C_Sel1;
297 Fetch C_Sel1 Into p_rec.recruiting_site_id;
298 Close C_Sel1;
299 End If;
300 --
301 hr_utility.set_location(' Leaving:'||l_proc, 10);
302 End pre_insert;
303 --
304 -- ----------------------------------------------------------------------------
305 -- |-----------------------------< post_insert >------------------------------|
306 -- ----------------------------------------------------------------------------
307 -- {Start Of Comments}
308 --
309 -- Description:
310 -- This private procedure contains any processing which is required after
311 -- the insert dml.
312 --
313 -- Prerequisites:
314 -- This is an internal procedure which is called from the ins procedure.
315 --
316 -- In Parameters:
317 -- A Pl/Sql record structre.
318 --
319 -- Post Success:
320 -- Processing continues.
321 --
322 -- Post Failure:
323 -- If an error has occurred, an error message and exception will be raised
324 -- but not handled.
325 --
326 -- Developer Implementation Notes:
327 -- Any post-processing required after the insert dml is issued should be
328 -- coded within this procedure. It is important to note that any 3rd party
329 -- maintenance should be reviewed before placing in this procedure.
330 --
331 -- Access Status:
332 -- Internal Row Handler Use Only.
333 --
334 -- {End Of Comments}
335 -- ----------------------------------------------------------------------------
336 Procedure post_insert
337 (p_effective_date in date
338 ,p_rec in irc_rse_shd.g_rec_type
339 ) is
340 --
341 l_proc varchar2(72) := g_package||'post_insert';
342 --
343 Begin
344 hr_utility.set_location('Entering:'||l_proc, 5);
345 begin
346 --
347 irc_rse_rki.after_insert
348 (p_effective_date => p_effective_date
349 ,p_recruiting_site_id
350 => p_rec.recruiting_site_id
351 ,p_date_from
352 => p_rec.date_from
353 ,p_date_to
354 => p_rec.date_to
355 ,p_posting_username
356 => p_rec.posting_username
357 ,p_posting_password
358 => p_rec.posting_password
359 ,p_internal
360 => p_rec.internal
361 ,p_external
362 => p_rec.external
363 ,p_third_party
364 => p_rec.third_party
365 ,p_posting_cost
366 => p_rec.posting_cost
367 ,p_posting_cost_period
368 => p_rec.posting_cost_period
369 ,p_posting_cost_currency
370 => p_rec.posting_cost_currency
371 ,p_stylesheet
372 => p_rec.stylesheet
373 ,p_attribute_category
374 => p_rec.attribute_category
375 ,p_attribute1
376 => p_rec.attribute1
377 ,p_attribute2
378 => p_rec.attribute2
379 ,p_attribute3
380 => p_rec.attribute3
381 ,p_attribute4
382 => p_rec.attribute4
383 ,p_attribute5
384 => p_rec.attribute5
385 ,p_attribute6
386 => p_rec.attribute6
387 ,p_attribute7
388 => p_rec.attribute7
389 ,p_attribute8
390 => p_rec.attribute8
391 ,p_attribute9
392 => p_rec.attribute9
393 ,p_attribute10
394 => p_rec.attribute10
395 ,p_attribute11
396 => p_rec.attribute11
397 ,p_attribute12
398 => p_rec.attribute12
399 ,p_attribute13
400 => p_rec.attribute13
401 ,p_attribute14
402 => p_rec.attribute14
403 ,p_attribute15
404 => p_rec.attribute15
405 ,p_attribute16
406 => p_rec.attribute16
407 ,p_attribute17
408 => p_rec.attribute17
409 ,p_attribute18
410 => p_rec.attribute18
411 ,p_attribute19
412 => p_rec.attribute19
413 ,p_attribute20
414 => p_rec.attribute20
415 ,p_attribute21
416 => p_rec.attribute21
417 ,p_attribute22
418 => p_rec.attribute22
419 ,p_attribute23
420 => p_rec.attribute23
421 ,p_attribute24
422 => p_rec.attribute24
423 ,p_attribute25
424 => p_rec.attribute25
425 ,p_attribute26
426 => p_rec.attribute26
427 ,p_attribute27
428 => p_rec.attribute27
429 ,p_attribute28
430 => p_rec.attribute28
431 ,p_attribute29
432 => p_rec.attribute29
433 ,p_attribute30
434 => p_rec.attribute30
435 ,p_object_version_number
436 => p_rec.object_version_number
437 ,p_internal_name
438 => p_rec.internal_name
439 );
440 --
441 exception
442 --
443 when hr_api.cannot_find_prog_unit then
444 --
445 hr_api.cannot_find_prog_unit_error
446 (p_module_name => 'IRC_ALL_RECRUITING_SITES'
447 ,p_hook_type => 'AI');
448 --
449 end;
450 --
451 hr_utility.set_location(' Leaving:'||l_proc, 10);
452 End post_insert;
453 --
457 Procedure ins
454 -- ----------------------------------------------------------------------------
455 -- |---------------------------------< ins >----------------------------------|
456 -- ----------------------------------------------------------------------------
458 (p_effective_date in date
459 ,p_rec in out nocopy irc_rse_shd.g_rec_type
460 ) is
461 --
462 l_proc varchar2(72) := g_package||'ins';
463 --
464 Begin
465 hr_utility.set_location('Entering:'||l_proc, 5);
466 --
467 -- Call the supporting insert validate operations
468 --
469 irc_rse_bus.insert_validate
470 (p_effective_date
471 ,p_rec
472 );
473 --
474 -- Call to raise any errors on multi-message list
475 hr_multi_message.end_validation_set;
476 --
477 -- Call the supporting pre-insert operation
478 --
479 irc_rse_ins.pre_insert(p_rec);
480 --
481 -- Insert the row
482 --
483 irc_rse_ins.insert_dml(p_rec);
484 --
485 -- Call the supporting post-insert operation
486 --
487 irc_rse_ins.post_insert
488 (p_effective_date
489 ,p_rec
490 );
491 --
492 -- Call to raise any errors on multi-message list
493 hr_multi_message.end_validation_set;
494 --
495 hr_utility.set_location('Leaving:'||l_proc, 20);
496 end ins;
497 --
498 -- ----------------------------------------------------------------------------
499 -- |---------------------------------< ins >----------------------------------|
500 -- ----------------------------------------------------------------------------
501 Procedure ins
502 (p_effective_date in date
503 ,p_date_from in date default null
504 ,p_date_to in date default null
505 ,p_posting_username in varchar2 default null
506 ,p_posting_password in varchar2 default null
507 ,p_internal in varchar2
508 ,p_external in varchar2
509 ,p_third_party in varchar2
510 ,p_posting_cost in number default null
511 ,p_posting_cost_period in varchar2 default null
512 ,p_posting_cost_currency in varchar2 default null
513 ,p_stylesheet in varchar2 default null
514 ,p_attribute_category in varchar2 default null
515 ,p_attribute1 in varchar2 default null
516 ,p_attribute2 in varchar2 default null
517 ,p_attribute3 in varchar2 default null
518 ,p_attribute4 in varchar2 default null
519 ,p_attribute5 in varchar2 default null
520 ,p_attribute6 in varchar2 default null
521 ,p_attribute7 in varchar2 default null
522 ,p_attribute8 in varchar2 default null
523 ,p_attribute9 in varchar2 default null
524 ,p_attribute10 in varchar2 default null
525 ,p_attribute11 in varchar2 default null
526 ,p_attribute12 in varchar2 default null
527 ,p_attribute13 in varchar2 default null
528 ,p_attribute14 in varchar2 default null
529 ,p_attribute15 in varchar2 default null
530 ,p_attribute16 in varchar2 default null
531 ,p_attribute17 in varchar2 default null
532 ,p_attribute18 in varchar2 default null
533 ,p_attribute19 in varchar2 default null
534 ,p_attribute20 in varchar2 default null
535 ,p_attribute21 in varchar2 default null
536 ,p_attribute22 in varchar2 default null
537 ,p_attribute23 in varchar2 default null
538 ,p_attribute24 in varchar2 default null
539 ,p_attribute25 in varchar2 default null
540 ,p_attribute26 in varchar2 default null
541 ,p_attribute27 in varchar2 default null
542 ,p_attribute28 in varchar2 default null
543 ,p_attribute29 in varchar2 default null
544 ,p_attribute30 in varchar2 default null
545 ,p_internal_name in varchar2
546 ,p_recruiting_site_id out nocopy number
547 ,p_object_version_number out nocopy number
548 ) is
549 --
550 l_rec irc_rse_shd.g_rec_type;
551 l_proc varchar2(72) := g_package||'ins';
552 --
553 Begin
554 hr_utility.set_location('Entering:'||l_proc, 5);
555 --
556 -- Call conversion function to turn arguments into the
557 -- p_rec structure.
558 --
559 l_rec :=
560 irc_rse_shd.convert_args
561 (null
562 ,p_date_from
563 ,p_date_to
564 ,p_posting_username
565 ,p_posting_password
566 ,p_internal
567 ,p_external
568 ,p_third_party
569 ,p_posting_cost
570 ,p_posting_cost_period
571 ,p_posting_cost_currency
572 ,p_stylesheet
573 ,p_attribute_category
574 ,p_attribute1
575 ,p_attribute2
576 ,p_attribute3
577 ,p_attribute4
578 ,p_attribute5
579 ,p_attribute6
580 ,p_attribute7
581 ,p_attribute8
582 ,p_attribute9
583 ,p_attribute10
584 ,p_attribute11
585 ,p_attribute12
586 ,p_attribute13
587 ,p_attribute14
588 ,p_attribute15
589 ,p_attribute16
590 ,p_attribute17
591 ,p_attribute18
592 ,p_attribute19
593 ,p_attribute20
594 ,p_attribute21
595 ,p_attribute22
596 ,p_attribute23
597 ,p_attribute24
598 ,p_attribute25
599 ,p_attribute26
600 ,p_attribute27
601 ,p_attribute28
602 ,p_attribute29
603 ,p_attribute30
604 ,null
605 ,p_internal_name
606 );
607 --
608 -- Having converted the arguments into the irc_rse_rec
609 -- plsql record structure we call the corresponding record business process.
610 --
611 irc_rse_ins.ins
612 (p_effective_date
613 ,l_rec
614 );
615 --
616 -- As the primary key argument(s)
617 -- are specified as an OUT's we must set these values.
618 --
619 p_recruiting_site_id := l_rec.recruiting_site_id;
620 p_object_version_number := l_rec.object_version_number;
621 --
622 hr_utility.set_location(' Leaving:'||l_proc, 10);
623 End ins;
624 --
625 end irc_rse_ins;