DBA Data[Home] [Help]

PACKAGE BODY: APPS.IRC_IPD_INS

Source


1 Package Body irc_ipd_ins as
2 /* $Header: iripdrhi.pkb 120.0 2005/07/26 15:09:42 mbocutt noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  irc_ipd_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_pending_data_id_i  number   default null;
14 --
15 -- ----------------------------------------------------------------------------
16 -- |------------------------< set_base_key_value >----------------------------|
17 -- ----------------------------------------------------------------------------
18 procedure set_base_key_value
19   (p_pending_data_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_ipd_ins.g_pending_data_id_i := p_pending_data_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_ipd_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   --
84   --
85   --
86   --
87   -- Insert the row into: irc_pending_data
88   --
89   insert into irc_pending_data
90       (pending_data_id
91       ,email_address
92       ,vacancy_id
93       ,last_name
94       ,first_name
95       ,user_password
96       ,resume_file_name
97       ,resume_description
98       ,resume_mime_type
99       ,resume
100       ,source_type
101       ,job_post_source_name
102       ,posting_content_id
103       ,person_id
104       ,processed
105       ,sex
106       ,date_of_birth
107       ,per_information_category
108       ,per_information1
109       ,per_information2
110       ,per_information3
111       ,per_information4
112       ,per_information5
113       ,per_information6
114       ,per_information7
115       ,per_information8
116       ,per_information9
117       ,per_information10
118       ,per_information11
119       ,per_information12
120       ,per_information13
121       ,per_information14
122       ,per_information15
123       ,per_information16
124       ,per_information17
125       ,per_information18
126       ,per_information19
127       ,per_information20
128       ,per_information21
129       ,per_information22
130       ,per_information23
131       ,per_information24
132       ,per_information25
133       ,per_information26
134       ,per_information27
135       ,per_information28
136       ,per_information29
137       ,per_information30
138       ,error_message
139       ,creation_date
140       ,last_update_date
141       ,allow_access
142       ,user_guid
143       ,visitor_resp_key
144       ,visitor_resp_appl_id
145       ,security_group_key
146       )
147   Values
148     (p_rec.pending_data_id
149     ,p_rec.email_address
150     ,p_rec.vacancy_id
151     ,p_rec.last_name
152     ,p_rec.first_name
153     ,p_rec.user_password
154     ,p_rec.resume_file_name
155     ,p_rec.resume_description
156     ,p_rec.resume_mime_type
157     ,empty_blob()
158     ,p_rec.source_type
159     ,p_rec.job_post_source_name
160     ,p_rec.posting_content_id
161     ,p_rec.person_id
162     ,p_rec.processed
163     ,p_rec.sex
164     ,p_rec.date_of_birth
165     ,p_rec.per_information_category
166     ,p_rec.per_information1
167     ,p_rec.per_information2
168     ,p_rec.per_information3
169     ,p_rec.per_information4
170     ,p_rec.per_information5
171     ,p_rec.per_information6
172     ,p_rec.per_information7
173     ,p_rec.per_information8
174     ,p_rec.per_information9
175     ,p_rec.per_information10
176     ,p_rec.per_information11
177     ,p_rec.per_information12
178     ,p_rec.per_information13
179     ,p_rec.per_information14
180     ,p_rec.per_information15
181     ,p_rec.per_information16
182     ,p_rec.per_information17
183     ,p_rec.per_information18
184     ,p_rec.per_information19
185     ,p_rec.per_information20
186     ,p_rec.per_information21
187     ,p_rec.per_information22
188     ,p_rec.per_information23
189     ,p_rec.per_information24
190     ,p_rec.per_information25
191     ,p_rec.per_information26
192     ,p_rec.per_information27
193     ,p_rec.per_information28
194     ,p_rec.per_information29
195     ,p_rec.per_information30
196     ,p_rec.error_message
197     ,p_rec.creation_date
198     ,p_rec.last_update_date
199     ,p_rec.allow_access
200     ,p_rec.user_guid
201     ,p_rec.visitor_resp_key
202     ,p_rec.visitor_resp_appl_id
203     ,p_rec.security_group_key
204     );
205   --
206   --
207   --
208   hr_utility.set_location(' Leaving:'||l_proc, 10);
209 Exception
210   When hr_api.check_integrity_violated Then
211     -- A check constraint has been violated
212     --
213     irc_ipd_shd.constraint_error
214       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
215   When hr_api.parent_integrity_violated Then
216     -- Parent integrity has been violated
217     --
218     irc_ipd_shd.constraint_error
219       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
220   When hr_api.unique_integrity_violated Then
221     -- Unique integrity has been violated
222     --
223     irc_ipd_shd.constraint_error
224       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
225   When Others Then
226     --
227     Raise;
228 End insert_dml;
229 --
230 -- ----------------------------------------------------------------------------
231 -- |------------------------------< pre_insert >------------------------------|
232 -- ----------------------------------------------------------------------------
233 -- {Start Of Comments}
234 --
235 -- Description:
236 --   This private procedure contains any processing which is required before
237 --   the insert dml. Presently, if the entity has a corresponding primary
238 --   key which is maintained by an associating sequence, the primary key for
239 --   the entity will be populated with the next sequence value in
240 --   preparation for the insert dml.
241 --
242 -- Prerequisites:
243 --   This is an internal procedure which is called from the ins procedure.
244 --
245 -- In Parameters:
246 --   A Pl/Sql record structure.
247 --
248 -- Post Success:
249 --   Processing continues.
250 --
251 -- Post Failure:
252 --   If an error has occurred, an error message and exception will be raised
253 --   but not handled.
254 --
255 -- Developer Implementation Notes:
256 --   Any pre-processing required before the insert dml is issued should be
257 --   coded within this procedure. As stated above, a good example is the
258 --   generation of a primary key number via a corresponding sequence.
259 --   It is important to note that any 3rd party maintenance should be reviewed
260 --   before placing in this procedure.
261 --
262 -- Access Status:
263 --   Internal Row Handler Use Only.
264 --
265 -- {End Of Comments}
266 -- ----------------------------------------------------------------------------
267 Procedure pre_insert
268   (p_rec  in out nocopy irc_ipd_shd.g_rec_type
269   ) is
270 --
271   Cursor C_Sel1 is select irc_pending_data_s.nextval from sys.dual;
272 --
273   Cursor C_Sel2 is
274     Select null
275       from irc_pending_data
276      where pending_data_id =
277              irc_ipd_ins.g_pending_data_id_i;
278 --
279   l_proc   varchar2(72) := g_package||'pre_insert';
280   l_exists varchar2(1);
281 --
282 Begin
283   hr_utility.set_location('Entering:'||l_proc, 5);
284   --
285   If (irc_ipd_ins.g_pending_data_id_i is not null) Then
286     --
287     -- Verify registered primary key values not already in use
288     --
289     Open C_Sel2;
290     Fetch C_Sel2 into l_exists;
291     If C_Sel2%found Then
292        Close C_Sel2;
293        --
294        -- The primary key values are already in use.
295        --
296        fnd_message.set_name('PER','PER_289391_KEY_ALREADY_USED');
297        fnd_message.set_token('TABLE_NAME','irc_pending_data');
298        fnd_message.raise_error;
299     End If;
300     Close C_Sel2;
301     --
302     -- Use registered key values and clear globals
303     --
304     p_rec.pending_data_id :=
305       irc_ipd_ins.g_pending_data_id_i;
306     irc_ipd_ins.g_pending_data_id_i := null;
307   Else
308     --
309     -- No registerd key values, so select the next sequence number
310     --
311     --
312     -- Select the next sequence number
313     --
314     Open C_Sel1;
315     Fetch C_Sel1 Into p_rec.pending_data_id;
316     Close C_Sel1;
317   End If;
318   --
319   hr_utility.set_location(' Leaving:'||l_proc, 10);
320 End pre_insert;
321 --
322 -- ----------------------------------------------------------------------------
323 -- |-----------------------------< post_insert >------------------------------|
324 -- ----------------------------------------------------------------------------
325 -- {Start Of Comments}
326 --
327 -- Description:
328 --   This private procedure contains any processing which is required after
329 --   the insert dml.
330 --
331 -- Prerequisites:
332 --   This is an internal procedure which is called from the ins procedure.
333 --
334 -- In Parameters:
335 --   A Pl/Sql record structre.
336 --
337 -- Post Success:
338 --   Processing continues.
339 --
340 -- Post Failure:
341 --   If an error has occurred, an error message and exception will be raised
342 --   but not handled.
343 --
344 -- Developer Implementation Notes:
345 --   Any post-processing required after the insert dml is issued should be
346 --   coded within this procedure. It is important to note that any 3rd party
347 --   maintenance should be reviewed before placing in this procedure.
348 --
349 -- Access Status:
350 --   Internal Row Handler Use Only.
351 --
352 -- {End Of Comments}
353 -- ----------------------------------------------------------------------------
354 Procedure post_insert
355   (p_rec                          in irc_ipd_shd.g_rec_type
356   ) is
357 --
358   l_proc  varchar2(72) := g_package||'post_insert';
359 --
360 Begin
361   hr_utility.set_location('Entering:'||l_proc, 5);
362   begin
363     --
364     irc_ipd_rki.after_insert
365       (p_pending_data_id
366       => p_rec.pending_data_id
367       ,p_email_address
368       => p_rec.email_address
369       ,p_vacancy_id
370       => p_rec.vacancy_id
371       ,p_last_name
372       => p_rec.last_name
373       ,p_first_name
374       => p_rec.first_name
375       ,p_user_password
376       => p_rec.user_password
377       ,p_resume_file_name
378       => p_rec.resume_file_name
379       ,p_resume_description
380       => p_rec.resume_description
381       ,p_resume_mime_type
382       => p_rec.resume_mime_type
383       ,p_source_type
384       => p_rec.source_type
385       ,p_job_post_source_name
386       => p_rec.job_post_source_name
387       ,p_posting_content_id
388       => p_rec.posting_content_id
389       ,p_person_id
390       => p_rec.person_id
391       ,p_processed
392       => p_rec.processed
393       ,p_sex
394       => p_rec.sex
395       ,p_date_of_birth
396       => p_rec.date_of_birth
397       ,p_per_information_category
398       => p_rec.per_information_category
399       ,p_per_information1
400       => p_rec.per_information1
401       ,p_per_information2
402       => p_rec.per_information2
403       ,p_per_information3
404       => p_rec.per_information3
405       ,p_per_information4
406       => p_rec.per_information4
407       ,p_per_information5
408       => p_rec.per_information5
409       ,p_per_information6
410       => p_rec.per_information6
411       ,p_per_information7
412       => p_rec.per_information7
413       ,p_per_information8
414       => p_rec.per_information8
415       ,p_per_information9
416       => p_rec.per_information9
417       ,p_per_information10
418       => p_rec.per_information10
419       ,p_per_information11
420       => p_rec.per_information11
421       ,p_per_information12
422       => p_rec.per_information12
423       ,p_per_information13
424       => p_rec.per_information13
425       ,p_per_information14
426       => p_rec.per_information14
427       ,p_per_information15
428       => p_rec.per_information15
429       ,p_per_information16
430       => p_rec.per_information16
431       ,p_per_information17
432       => p_rec.per_information17
433       ,p_per_information18
434       => p_rec.per_information18
435       ,p_per_information19
436       => p_rec.per_information19
437       ,p_per_information20
438       => p_rec.per_information20
439       ,p_per_information21
440       => p_rec.per_information21
441       ,p_per_information22
442       => p_rec.per_information22
443       ,p_per_information23
444       => p_rec.per_information23
445       ,p_per_information24
446       => p_rec.per_information24
447       ,p_per_information25
448       => p_rec.per_information25
449       ,p_per_information26
450       => p_rec.per_information26
451       ,p_per_information27
452       => p_rec.per_information27
453       ,p_per_information28
454       => p_rec.per_information28
455       ,p_per_information29
456       => p_rec.per_information29
457       ,p_per_information30
458       => p_rec.per_information30
459       ,p_error_message
460       => p_rec.error_message
461       ,p_creation_date
462       => p_rec.creation_date
463       ,p_last_update_date
464       => p_rec.last_update_date
465       ,p_allow_access
466       => p_rec.allow_access
467       ,p_visitor_resp_key
468       => p_rec.visitor_resp_key
469       ,p_visitor_resp_appl_id
470       => p_rec.visitor_resp_appl_id
471       ,p_security_group_key
472       => p_rec.security_group_key
473       );
474     --
475   exception
476     --
477     when hr_api.cannot_find_prog_unit then
478       --
479       hr_api.cannot_find_prog_unit_error
480         (p_module_name => 'IRC_PENDING_DATA'
481         ,p_hook_type   => 'AI');
482       --
483   end;
484   --
485   hr_utility.set_location(' Leaving:'||l_proc, 10);
486 End post_insert;
487 --
488 -- ----------------------------------------------------------------------------
489 -- |---------------------------------< ins >----------------------------------|
490 -- ----------------------------------------------------------------------------
491 Procedure ins
492   (p_rec                          in out nocopy irc_ipd_shd.g_rec_type
493   ) is
494 --
495   l_proc  varchar2(72) := g_package||'ins';
496 --
497 Begin
498   hr_utility.set_location('Entering:'||l_proc, 5);
499   --
500   -- Call the supporting insert validate operations
501   --
502   irc_ipd_bus.insert_validate
503      (p_rec
504      );
505   --
506   -- Call to raise any errors on multi-message list
507   hr_multi_message.end_validation_set;
508   --
509   -- Call the supporting pre-insert operation
510   --
511   irc_ipd_ins.pre_insert(p_rec);
512   --
513   -- Insert the row
514   --
515   irc_ipd_ins.insert_dml(p_rec);
516   --
517   -- Call the supporting post-insert operation
518   --
519   irc_ipd_ins.post_insert
520      (p_rec
521      );
522   --
523   -- Call to raise any errors on multi-message list
524   hr_multi_message.end_validation_set;
525   --
526   hr_utility.set_location('Leaving:'||l_proc, 20);
527 end ins;
528 --
529 -- ----------------------------------------------------------------------------
530 -- |---------------------------------< ins >----------------------------------|
531 -- ----------------------------------------------------------------------------
532 Procedure ins
533   (p_email_address                  in     varchar2
534   ,p_last_name                      in     varchar2
535   ,p_vacancy_id                     in     number   default null
536   ,p_first_name                     in     varchar2 default null
537   ,p_user_password                  in     varchar2 default null
538   ,p_resume_file_name               in     varchar2 default null
539   ,p_resume_description             in     varchar2 default null
540   ,p_resume_mime_type               in     varchar2 default null
541   ,p_source_type                    in     varchar2 default null
542   ,p_job_post_source_name           in     varchar2 default null
543   ,p_posting_content_id             in     number   default null
544   ,p_person_id                      in     number   default null
545   ,p_processed                      in     varchar2 default null
546   ,p_sex                            in     varchar2 default null
547   ,p_date_of_birth                  in     date     default null
548   ,p_per_information_category       in     varchar2 default null
549   ,p_per_information1               in     varchar2 default null
550   ,p_per_information2               in     varchar2 default null
551   ,p_per_information3               in     varchar2 default null
552   ,p_per_information4               in     varchar2 default null
553   ,p_per_information5               in     varchar2 default null
554   ,p_per_information6               in     varchar2 default null
555   ,p_per_information7               in     varchar2 default null
556   ,p_per_information8               in     varchar2 default null
557   ,p_per_information9               in     varchar2 default null
558   ,p_per_information10              in     varchar2 default null
559   ,p_per_information11              in     varchar2 default null
560   ,p_per_information12              in     varchar2 default null
561   ,p_per_information13              in     varchar2 default null
562   ,p_per_information14              in     varchar2 default null
563   ,p_per_information15              in     varchar2 default null
564   ,p_per_information16              in     varchar2 default null
565   ,p_per_information17              in     varchar2 default null
566   ,p_per_information18              in     varchar2 default null
567   ,p_per_information19              in     varchar2 default null
568   ,p_per_information20              in     varchar2 default null
569   ,p_per_information21              in     varchar2 default null
570   ,p_per_information22              in     varchar2 default null
571   ,p_per_information23              in     varchar2 default null
572   ,p_per_information24              in     varchar2 default null
573   ,p_per_information25              in     varchar2 default null
574   ,p_per_information26              in     varchar2 default null
575   ,p_per_information27              in     varchar2 default null
576   ,p_per_information28              in     varchar2 default null
577   ,p_per_information29              in     varchar2 default null
578   ,p_per_information30              in     varchar2 default null
579   ,p_error_message                  in     varchar2 default null
580   ,p_creation_date                  in     date
581   ,p_last_update_date               in     date
582   ,p_allow_access                   in     varchar2 default null
583   ,p_user_guid                      in     raw      default null
584   ,p_visitor_resp_key               in     varchar2 default null
585   ,p_visitor_resp_appl_id           in     number   default null
586   ,p_security_group_key             in     varchar2 default null
587   ,p_pending_data_id                   out nocopy number
588   ) is
589 --
590   l_rec   irc_ipd_shd.g_rec_type;
591   l_proc  varchar2(72) := g_package||'ins';
592 --
593 Begin
594   hr_utility.set_location('Entering:'||l_proc, 5);
595   --
596   -- Call conversion function to turn arguments into the
597   -- p_rec structure.
598   --
599   l_rec :=
600   irc_ipd_shd.convert_args
601     (null
602     ,p_email_address
603     ,p_vacancy_id
604     ,p_last_name
605     ,p_first_name
606     ,p_user_password
607     ,p_resume_file_name
608     ,p_resume_description
609     ,p_resume_mime_type
610     ,p_source_type
611     ,p_job_post_source_name
612     ,p_posting_content_id
613     ,p_person_id
614     ,p_processed
615     ,p_sex
616     ,p_date_of_birth
617     ,p_per_information_category
618     ,p_per_information1
619     ,p_per_information2
620     ,p_per_information3
621     ,p_per_information4
622     ,p_per_information5
623     ,p_per_information6
624     ,p_per_information7
625     ,p_per_information8
626     ,p_per_information9
627     ,p_per_information10
628     ,p_per_information11
629     ,p_per_information12
630     ,p_per_information13
631     ,p_per_information14
632     ,p_per_information15
633     ,p_per_information16
634     ,p_per_information17
635     ,p_per_information18
636     ,p_per_information19
637     ,p_per_information20
638     ,p_per_information21
639     ,p_per_information22
640     ,p_per_information23
641     ,p_per_information24
642     ,p_per_information25
643     ,p_per_information26
644     ,p_per_information27
645     ,p_per_information28
646     ,p_per_information29
647     ,p_per_information30
648     ,p_error_message
649     ,p_creation_date
650     ,p_last_update_date
651     ,p_allow_access
652     ,p_user_guid
653     ,p_visitor_resp_key
654     ,p_visitor_resp_appl_id
655     ,p_security_group_key
656     );
657   --
658   -- Having converted the arguments into the irc_ipd_rec
659   -- plsql record structure we call the corresponding record business process.
660   --
661   irc_ipd_ins.ins
662      (l_rec
663      );
664   --
665   -- As the primary key argument(s)
666   -- are specified as an OUT's we must set these values.
667   --
668   p_pending_data_id := l_rec.pending_data_id;
669   --
670   --
671   hr_utility.set_location(' Leaving:'||l_proc, 10);
672 End ins;
673 --
674 end irc_ipd_ins;