DBA Data[Home] [Help]

PACKAGE BODY: APPS.IRC_RSE_INS

Source


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