DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_CNI_INS

Source


1 Package Body per_cni_ins as
2 /* $Header: pecnirhi.pkb 120.0 2005/05/31 06:49 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  per_cni_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_config_information_id_i  number   default null;
14 --
15 -- ----------------------------------------------------------------------------
16 -- |------------------------< set_base_key_value >----------------------------|
17 -- ----------------------------------------------------------------------------
18 procedure set_base_key_value
19   (p_config_information_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   per_cni_ins.g_config_information_id_i := p_config_information_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 per_cni_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   p_rec.object_version_number := 1;
87   --
88   -- Insert the row into: per_ri_config_information
89   --
90   insert into per_ri_config_information
91       (configuration_code
92       ,config_information_category
93       ,config_information1
94       ,config_information2
95       ,config_information3
96       ,config_information4
97       ,config_information5
98       ,config_information6
99       ,config_information7
100       ,config_information8
101       ,config_information9
102       ,config_information10
103       ,config_information11
104       ,config_information12
105       ,config_information13
106       ,config_information14
107       ,config_information15
108       ,config_information16
109       ,config_information17
110       ,config_information18
111       ,config_information19
112       ,config_information20
113       ,config_information21
114       ,config_information22
115       ,config_information23
116       ,config_information24
117       ,config_information25
118       ,config_information26
119       ,config_information27
120       ,config_information28
121       ,config_information29
122       ,config_information30
123       ,config_information_id
124       ,config_sequence
125       ,object_version_number
126       )
127   Values
128     (p_rec.configuration_code
129     ,p_rec.config_information_category
130     ,p_rec.config_information1
131     ,p_rec.config_information2
132     ,p_rec.config_information3
133     ,p_rec.config_information4
134     ,p_rec.config_information5
135     ,p_rec.config_information6
136     ,p_rec.config_information7
137     ,p_rec.config_information8
138     ,p_rec.config_information9
139     ,p_rec.config_information10
140     ,p_rec.config_information11
141     ,p_rec.config_information12
142     ,p_rec.config_information13
143     ,p_rec.config_information14
144     ,p_rec.config_information15
145     ,p_rec.config_information16
146     ,p_rec.config_information17
147     ,p_rec.config_information18
148     ,p_rec.config_information19
149     ,p_rec.config_information20
150     ,p_rec.config_information21
151     ,p_rec.config_information22
152     ,p_rec.config_information23
153     ,p_rec.config_information24
154     ,p_rec.config_information25
155     ,p_rec.config_information26
156     ,p_rec.config_information27
157     ,p_rec.config_information28
158     ,p_rec.config_information29
159     ,p_rec.config_information30
160     ,p_rec.config_information_id
161     ,p_rec.config_sequence
162     ,p_rec.object_version_number
163     );
164   --
165   --
166   --
167   hr_utility.set_location(' Leaving:'||l_proc, 10);
168 Exception
169   When hr_api.check_integrity_violated Then
170     -- A check constraint has been violated
171     --
172     per_cni_shd.constraint_error
173       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
174   When hr_api.parent_integrity_violated Then
175     -- Parent integrity has been violated
176     --
177     per_cni_shd.constraint_error
178       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
179   When hr_api.unique_integrity_violated Then
180     -- Unique integrity has been violated
181     --
182     per_cni_shd.constraint_error
183       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
184   When Others Then
185     --
186     Raise;
187 End insert_dml;
188 --
189 -- ----------------------------------------------------------------------------
190 -- |------------------------------< pre_insert >------------------------------|
191 -- ----------------------------------------------------------------------------
192 -- {Start Of Comments}
193 --
194 -- Description:
195 --   This private procedure contains any processing which is required before
196 --   the insert dml. Presently, if the entity has a corresponding primary
197 --   key which is maintained by an associating sequence, the primary key for
198 --   the entity will be populated with the next sequence value in
199 --   preparation for the insert dml.
200 --
201 -- Prerequisites:
202 --   This is an internal procedure which is called from the ins procedure.
203 --
204 -- In Parameters:
205 --   A Pl/Sql record structure.
206 --
207 -- Post Success:
208 --   Processing continues.
209 --
210 -- Post Failure:
211 --   If an error has occurred, an error message and exception will be raised
212 --   but not handled.
213 --
214 -- Developer Implementation Notes:
215 --   Any pre-processing required before the insert dml is issued should be
216 --   coded within this procedure. As stated above, a good example is the
217 --   generation of a primary key number via a corresponding sequence.
218 --   It is important to note that any 3rd party maintenance should be reviewed
219 --   before placing in this procedure.
220 --
221 -- Access Status:
222 --   Internal Row Handler Use Only.
223 --
224 -- {End Of Comments}
225 -- ----------------------------------------------------------------------------
226 Procedure pre_insert
227   (p_rec  in out nocopy per_cni_shd.g_rec_type
228   ) is
229 --
230   Cursor C_Sel1 is select per_ri_config_information_s.nextval from sys.dual;
231 --
232   Cursor C_Sel2 is
233     Select null
234       from per_ri_config_information
235      where config_information_id =
236              per_cni_ins.g_config_information_id_i;
237 --
238   l_proc   varchar2(72) := g_package||'pre_insert';
239   l_exists varchar2(1);
240 --
241 Begin
242   hr_utility.set_location('Entering:'||l_proc, 5);
243   --
244   If (per_cni_ins.g_config_information_id_i is not null) Then
245     --
246     -- Verify registered primary key values not already in use
247     --
248     Open C_Sel2;
249     Fetch C_Sel2 into l_exists;
250     If C_Sel2%found Then
251        Close C_Sel2;
252        --
253        -- The primary key values are already in use.
254        --
255        fnd_message.set_name('PER','PER_289391_KEY_ALREADY_USED');
256        fnd_message.set_token('TABLE_NAME','per_ri_config_information');
257        fnd_message.raise_error;
258     End If;
259     Close C_Sel2;
260     --
261     -- Use registered key values and clear globals
262     --
263     p_rec.config_information_id :=
264       per_cni_ins.g_config_information_id_i;
265     per_cni_ins.g_config_information_id_i := null;
266   Else
267     --
268     -- No registerd key values, so select the next sequence number
269     --
270     --
271     -- Select the next sequence number
272     --
273     Open C_Sel1;
274     Fetch C_Sel1 Into p_rec.config_information_id;
275     Close C_Sel1;
276   End If;
277   --
278   hr_utility.set_location(' Leaving:'||l_proc, 10);
279 End pre_insert;
280 --
281 -- ----------------------------------------------------------------------------
282 -- |-----------------------------< post_insert >------------------------------|
283 -- ----------------------------------------------------------------------------
284 -- {Start Of Comments}
285 --
286 -- Description:
287 --   This private procedure contains any processing which is required after
288 --   the insert dml.
289 --
290 -- Prerequisites:
291 --   This is an internal procedure which is called from the ins procedure.
292 --
293 -- In Parameters:
294 --   A Pl/Sql record structre.
295 --
296 -- Post Success:
297 --   Processing continues.
298 --
299 -- Post Failure:
300 --   If an error has occurred, an error message and exception will be raised
301 --   but not handled.
302 --
303 -- Developer Implementation Notes:
304 --   Any post-processing required after the insert dml is issued should be
305 --   coded within this procedure. It is important to note that any 3rd party
306 --   maintenance should be reviewed before placing in this procedure.
307 --
308 -- Access Status:
309 --   Internal Row Handler Use Only.
310 --
311 -- {End Of Comments}
312 -- ----------------------------------------------------------------------------
313 Procedure post_insert
314   (p_effective_date               in date
315   ,p_rec                          in per_cni_shd.g_rec_type
316   ) is
317 --
318   l_proc  varchar2(72) := g_package||'post_insert';
319 --
320 Begin
321   hr_utility.set_location('Entering:'||l_proc, 5);
322   begin
323     --
324     per_cni_rki.after_insert
325       (p_effective_date              => p_effective_date
326       ,p_configuration_code
327       => p_rec.configuration_code
328       ,p_config_information_category
329       => p_rec.config_information_category
330       ,p_config_information1
331       => p_rec.config_information1
332       ,p_config_information2
333       => p_rec.config_information2
334       ,p_config_information3
335       => p_rec.config_information3
336       ,p_config_information4
337       => p_rec.config_information4
338       ,p_config_information5
339       => p_rec.config_information5
340       ,p_config_information6
341       => p_rec.config_information6
342       ,p_config_information7
343       => p_rec.config_information7
344       ,p_config_information8
345       => p_rec.config_information8
346       ,p_config_information9
347       => p_rec.config_information9
348       ,p_config_information10
349       => p_rec.config_information10
350       ,p_config_information11
351       => p_rec.config_information11
352       ,p_config_information12
353       => p_rec.config_information12
354       ,p_config_information13
355       => p_rec.config_information13
356       ,p_config_information14
357       => p_rec.config_information14
358       ,p_config_information15
359       => p_rec.config_information15
360       ,p_config_information16
361       => p_rec.config_information16
362       ,p_config_information17
363       => p_rec.config_information17
364       ,p_config_information18
365       => p_rec.config_information18
366       ,p_config_information19
367       => p_rec.config_information19
368       ,p_config_information20
369       => p_rec.config_information20
370       ,p_config_information21
371       => p_rec.config_information21
372       ,p_config_information22
373       => p_rec.config_information22
374       ,p_config_information23
375       => p_rec.config_information23
376       ,p_config_information24
377       => p_rec.config_information24
378       ,p_config_information25
379       => p_rec.config_information25
380       ,p_config_information26
381       => p_rec.config_information26
382       ,p_config_information27
383       => p_rec.config_information27
384       ,p_config_information28
385       => p_rec.config_information28
386       ,p_config_information29
387       => p_rec.config_information29
388       ,p_config_information30
389       => p_rec.config_information30
390       ,p_config_information_id
391       => p_rec.config_information_id
392       ,p_config_sequence
393       => p_rec.config_sequence
394       );
395     --
396   exception
397     --
398     when hr_api.cannot_find_prog_unit then
399       --
400       hr_api.cannot_find_prog_unit_error
401         (p_module_name => 'PER_RI_CONFIG_INFORMATION'
402         ,p_hook_type   => 'AI');
403       --
404   end;
405   --
406   hr_utility.set_location(' Leaving:'||l_proc, 10);
407 End post_insert;
408 --
409 -- ----------------------------------------------------------------------------
410 -- |---------------------------------< ins >----------------------------------|
411 -- ----------------------------------------------------------------------------
412 Procedure ins
413   (p_effective_date               in date
414   ,p_rec                          in out nocopy per_cni_shd.g_rec_type
415   ) is
416 --
417   l_proc  varchar2(72) := g_package||'ins';
418 --
419 Begin
420   hr_utility.set_location('Entering:'||l_proc, 5);
421   --
422   -- Call the supporting insert validate operations
423   --
424   per_cni_bus.insert_validate
425      (p_effective_date
426      ,p_rec
427      );
428   --
429   -- Call to raise any errors on multi-message list
430   hr_multi_message.end_validation_set;
431   --
432   -- Call the supporting pre-insert operation
433   --
434   per_cni_ins.pre_insert(p_rec);
435   --
436   -- Insert the row
437   --
438   per_cni_ins.insert_dml(p_rec);
439   --
440   -- Call the supporting post-insert operation
441   --
442   per_cni_ins.post_insert
443      (p_effective_date
444      ,p_rec
445      );
446   --
447   -- Call to raise any errors on multi-message list
448   hr_multi_message.end_validation_set;
449   --
450   hr_utility.set_location('Leaving:'||l_proc, 20);
451 end ins;
452 --
453 -- ----------------------------------------------------------------------------
454 -- |---------------------------------< ins >----------------------------------|
455 -- ----------------------------------------------------------------------------
456 Procedure ins
457   (p_effective_date                 in     date
458   ,p_configuration_code             in     varchar
459   ,p_config_information_category    in     varchar2
460   ,p_config_sequence                in     number
461   ,p_config_information1            in     varchar2
462   ,p_config_information2            in     varchar2 default null
463   ,p_config_information3            in     varchar2 default null
464   ,p_config_information4            in     varchar2 default null
465   ,p_config_information5            in     varchar2 default null
466   ,p_config_information6            in     varchar2 default null
467   ,p_config_information7            in     varchar2 default null
468   ,p_config_information8            in     varchar2 default null
469   ,p_config_information9            in     varchar2 default null
470   ,p_config_information10           in     varchar2 default null
471   ,p_config_information11           in     varchar2 default null
472   ,p_config_information12           in     varchar2 default null
473   ,p_config_information13           in     varchar2 default null
474   ,p_config_information14           in     varchar2 default null
475   ,p_config_information15           in     varchar2 default null
476   ,p_config_information16           in     varchar2 default null
477   ,p_config_information17           in     varchar2 default null
478   ,p_config_information18           in     varchar2 default null
479   ,p_config_information19           in     varchar2 default null
480   ,p_config_information20           in     varchar2 default null
481   ,p_config_information21           in     varchar2 default null
482   ,p_config_information22           in     varchar2 default null
483   ,p_config_information23           in     varchar2 default null
484   ,p_config_information24           in     varchar2 default null
485   ,p_config_information25           in     varchar2 default null
486   ,p_config_information26           in     varchar2 default null
487   ,p_config_information27           in     varchar2 default null
488   ,p_config_information28           in     varchar2 default null
489   ,p_config_information29           in     varchar2 default null
490   ,p_config_information30           in     varchar2 default null
491   ,p_config_information_id          out nocopy number
492   ,p_object_version_number          out nocopy number
493   ) is
494 --
495   l_rec   per_cni_shd.g_rec_type;
496   l_proc  varchar2(72) := g_package||'ins';
497 --
498 Begin
499   hr_utility.set_location('Entering:'||l_proc, 5);
500   --
501   -- Call conversion function to turn arguments into the
502   -- p_rec structure.
503   --
504   l_rec :=
505   per_cni_shd.convert_args
506     (p_configuration_code
507     ,p_config_information_category
508     ,p_config_information1
509     ,p_config_information2
510     ,p_config_information3
511     ,p_config_information4
512     ,p_config_information5
513     ,p_config_information6
514     ,p_config_information7
515     ,p_config_information8
516     ,p_config_information9
517     ,p_config_information10
518     ,p_config_information11
519     ,p_config_information12
520     ,p_config_information13
521     ,p_config_information14
522     ,p_config_information15
523     ,p_config_information16
524     ,p_config_information17
525     ,p_config_information18
526     ,p_config_information19
527     ,p_config_information20
528     ,p_config_information21
529     ,p_config_information22
530     ,p_config_information23
531     ,p_config_information24
532     ,p_config_information25
533     ,p_config_information26
534     ,p_config_information27
535     ,p_config_information28
536     ,p_config_information29
537     ,p_config_information30
538     ,null
539     ,p_config_sequence
540     ,p_object_version_number
541     );
542   --
543   -- Having converted the arguments into the per_cni_rec
544   -- plsql record structure we call the corresponding record business process.
545   --
546   per_cni_ins.ins
547      (p_effective_date
548      ,l_rec
549      );
550   --
551   -- As the primary key argument(s)
552   -- are specified as an OUT's we must set these values.
553   --
554   p_config_information_id := l_rec.config_information_id;
555   p_object_version_number := l_rec.object_version_number;
556   --
557   --
558   hr_utility.set_location(' Leaving:'||l_proc, 10);
559 End ins;
560 --
561 end per_cni_ins;