DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_CNP_INS

Source


1 Package Body hr_cnp_ins as
2 /* $Header: hrcnprhi.pkb 120.1 2011/04/28 12:03:13 sidsaxen ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  hr_cnp_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
54   (p_rec in out nocopy hr_cnp_shd.g_rec_type
55   ) is
56 --
57   l_proc  varchar2(72) := g_package||'insert_dml';
58 --
59 Begin
60   hr_utility.set_location('Entering:'||l_proc, 5);
61   p_rec.object_version_number := 1;
62   --
63   --
64   -- Added the following code as a part of Zero Downtime Patching Project.
65   -- Code Starts Here.
66   --
67 
68   PER_RIC_PKG.chk_integrity(
69     p_entity_name=>'HR_CANVAS_PROPERTIES',
70     p_ref_entity_info=>
71     PER_RIC_PKG.ref_entity_tbl(
72       PER_RIC_PKG.ref_info_rec('HR_FORM_CANVASES_B',PER_RIC_PKG.column_info_tbl(
73         PER_RIC_PKG.col_info_rec('FORM_CANVAS_ID',NULL,p_rec.form_canvas_id,NULL))),
74       PER_RIC_PKG.ref_info_rec('HR_TEMPLATE_CANVASES_B', PER_RIC_PKG.column_info_tbl(
75         PER_RIC_PKG.col_info_rec('TEMPLATE_CANVAS_ID',NULL,p_rec.template_canvas_id,NULL)))),
76     p_ref_type=>'INS');
77 
78   --
79   -- Code Ends Here
80   --
81   --
82   -- Insert the row into: hr_canvas_properties
83   --
84   insert into hr_canvas_properties
85       (canvas_property_id
86       ,object_version_number
87       ,form_canvas_id
88       ,template_canvas_id
89       ,height
90       ,visible
91       ,width
92       ,x_position
93       ,y_position
94       ,information_category
95       ,information1
96       ,information2
97       ,information3
98       ,information4
99       ,information5
100       ,information6
101       ,information7
102       ,information8
103       ,information9
104       ,information10
105       ,information11
106       ,information12
107       ,information13
108       ,information14
109       ,information15
110       ,information16
111       ,information17
112       ,information18
113       ,information19
114       ,information20
115       ,information21
116       ,information22
117       ,information23
118       ,information24
119       ,information25
120       ,information26
121       ,information27
122       ,information28
123       ,information29
124       ,information30
125     )
126   Values
127     (p_rec.canvas_property_id
128     ,p_rec.object_version_number
129     ,p_rec.form_canvas_id
130     ,p_rec.template_canvas_id
131     ,p_rec.height
132     ,p_rec.visible
133     ,p_rec.width
134     ,p_rec.x_position
135     ,p_rec.y_position
136     ,p_rec.information_category
137     ,p_rec.information1
138     ,p_rec.information2
139     ,p_rec.information3
140     ,p_rec.information4
141     ,p_rec.information5
142     ,p_rec.information6
143     ,p_rec.information7
144     ,p_rec.information8
145     ,p_rec.information9
146     ,p_rec.information10
147     ,p_rec.information11
148     ,p_rec.information12
149     ,p_rec.information13
150     ,p_rec.information14
151     ,p_rec.information15
152     ,p_rec.information16
153     ,p_rec.information17
154     ,p_rec.information18
155     ,p_rec.information19
156     ,p_rec.information20
157     ,p_rec.information21
158     ,p_rec.information22
159     ,p_rec.information23
160     ,p_rec.information24
161     ,p_rec.information25
162     ,p_rec.information26
163     ,p_rec.information27
164     ,p_rec.information28
165     ,p_rec.information29
166     ,p_rec.information30
167     );
168   --
169   --
170   --
171   hr_utility.set_location(' Leaving:'||l_proc, 10);
172 Exception
173   When hr_api.check_integrity_violated Then
174     -- A check constraint has been violated
175     --
176     hr_cnp_shd.constraint_error
177       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
178   When hr_api.parent_integrity_violated Then
179     -- Parent integrity has been violated
180     --
181     hr_cnp_shd.constraint_error
182       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
183   When hr_api.unique_integrity_violated Then
184     -- Unique integrity has been violated
185     --
186     hr_cnp_shd.constraint_error
187       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
188   When Others Then
189     --
190     Raise;
191 End insert_dml;
192 --
193 -- ----------------------------------------------------------------------------
194 -- |------------------------------< pre_insert >------------------------------|
195 -- ----------------------------------------------------------------------------
196 -- {Start Of Comments}
197 --
198 -- Description:
199 --   This private procedure contains any processing which is required before
200 --   the insert dml. Presently, if the entity has a corresponding primary
201 --   key which is maintained by an associating sequence, the primary key for
202 --   the entity will be populated with the next sequence value in
203 --   preparation for the insert dml.
204 --
205 -- Prerequisites:
206 --   This is an internal procedure which is called from the ins procedure.
207 --
208 -- In Parameters:
209 --   A Pl/Sql record structre.
210 --
211 -- Post Success:
212 --   Processing continues.
213 --
214 -- Post Failure:
215 --   If an error has occurred, an error message and exception will be raised
216 --   but not handled.
217 --
218 -- Developer Implementation Notes:
219 --   Any pre-processing required before the insert dml is issued should be
220 --   coded within this procedure. As stated above, a good example is the
221 --   generation of a primary key number via a corresponding sequence.
222 --   It is important to note that any 3rd party maintenance should be reviewed
223 --   before placing in this procedure.
224 --
225 -- Access Status:
226 --   Internal Row Handler Use Only.
227 --
228 -- {End Of Comments}
229 -- ----------------------------------------------------------------------------
230 Procedure pre_insert
231   (p_rec  in out nocopy hr_cnp_shd.g_rec_type
232   ) is
233 --
234   l_proc  varchar2(72) := g_package||'pre_insert';
235 --
236   Cursor C_Sel1 is select hr_canvas_properties_s.nextval from sys.dual;
237 --
238 Begin
239   hr_utility.set_location('Entering:'||l_proc, 5);
240   --
241   --
242   -- Select the next sequence number
243   --
244   Open C_Sel1;
245   Fetch C_Sel1 Into p_rec.canvas_property_id;
246   Close C_Sel1;
247   --
248   hr_utility.set_location(' Leaving:'||l_proc, 10);
249 End pre_insert;
250 --
251 -- ----------------------------------------------------------------------------
252 -- |-----------------------------< post_insert >------------------------------|
253 -- ----------------------------------------------------------------------------
254 -- {Start Of Comments}
255 --
256 -- Description:
257 --   This private procedure contains any processing which is required after the
258 --   insert dml.
259 --
260 -- Prerequisites:
261 --   This is an internal procedure which is called from the ins procedure.
262 --
263 -- In Parameters:
264 --   A Pl/Sql record structre.
265 --
266 -- Post Success:
267 --   Processing continues.
268 --
269 -- Post Failure:
270 --   If an error has occurred, an error message and exception will be raised
271 --   but not handled.
272 --
273 -- Developer Implementation Notes:
274 --   Any post-processing required after the insert dml is issued should be
275 --   coded within this procedure. It is important to note that any 3rd party
276 --   maintenance should be reviewed before placing in this procedure.
277 --
278 -- Access Status:
279 --   Internal Row Handler Use Only.
280 --
281 -- {End Of Comments}
282 -- ----------------------------------------------------------------------------
283 Procedure post_insert
284   (p_effective_date               in date
285   ,p_rec                          in hr_cnp_shd.g_rec_type
286   ) is
287 --
288   l_proc  varchar2(72) := g_package||'post_insert';
289 --
290 Begin
291   hr_utility.set_location('Entering:'||l_proc, 5);
292   begin
293     --
294     hr_cnp_rki.after_insert
295       (p_effective_date               => p_effective_date
296       ,p_canvas_property_id           => p_rec.canvas_property_id
297       ,p_object_version_number        => p_rec.object_version_number
298       ,p_form_canvas_id               => p_rec.form_canvas_id
299       ,p_template_canvas_id           => p_rec.template_canvas_id
300       ,p_height                       => p_rec.height
301       ,p_visible                      => p_rec.visible
302       ,p_width                        => p_rec.width
303       ,p_x_position                   => p_rec.x_position
304       ,p_y_position                   => p_rec.y_position
305       ,p_information_category         => p_rec.information_category
306       ,p_information1                 => p_rec.information1
307       ,p_information2                 => p_rec.information2
308       ,p_information3                 => p_rec.information3
309       ,p_information4                 => p_rec.information4
310       ,p_information5                 => p_rec.information5
311       ,p_information6                 => p_rec.information6
312       ,p_information7                 => p_rec.information7
313       ,p_information8                 => p_rec.information8
314       ,p_information9                 => p_rec.information9
315       ,p_information10                => p_rec.information10
316       ,p_information11                => p_rec.information11
317       ,p_information12                => p_rec.information12
318       ,p_information13                => p_rec.information13
319       ,p_information14                => p_rec.information14
320       ,p_information15                => p_rec.information15
321       ,p_information16                => p_rec.information16
322       ,p_information17                => p_rec.information17
323       ,p_information18                => p_rec.information18
324       ,p_information19                => p_rec.information19
325       ,p_information20                => p_rec.information20
326       ,p_information21                => p_rec.information21
327       ,p_information22                => p_rec.information22
328       ,p_information23                => p_rec.information23
329       ,p_information24                => p_rec.information24
330       ,p_information25                => p_rec.information25
331       ,p_information26                => p_rec.information26
332       ,p_information27                => p_rec.information27
333       ,p_information28                => p_rec.information28
334       ,p_information29                => p_rec.information29
335       ,p_information30                => p_rec.information30
336       );
337     --
338   exception
339     --
340     when hr_api.cannot_find_prog_unit then
341       --
342       hr_api.cannot_find_prog_unit_error
343         (p_module_name => 'HR_CANVAS_PROPERTIES'
344         ,p_hook_type   => 'AI');
345       --
346   end;
347   --
348   hr_utility.set_location(' Leaving:'||l_proc, 10);
349 End post_insert;
350 --
351 -- ----------------------------------------------------------------------------
352 -- |---------------------------------< ins >----------------------------------|
353 -- ----------------------------------------------------------------------------
354 Procedure ins
355   (p_effective_date               in date
356   ,p_rec                          in out nocopy hr_cnp_shd.g_rec_type
357   ) is
358 --
359   l_proc  varchar2(72) := g_package||'ins';
360 --
361 Begin
362   hr_utility.set_location('Entering:'||l_proc, 5);
363   --
364   -- Call the supporting insert validate operations
365   --
366   hr_cnp_bus.insert_validate
367      (p_effective_date
368      ,p_rec
369      );
370   --
371   -- Call the supporting pre-insert operation
372   --
373   hr_cnp_ins.pre_insert(p_rec);
374   --
375   -- Insert the row
376   --
377   hr_cnp_ins.insert_dml(p_rec);
378   --
379   -- Call the supporting post-insert operation
380   --
381   hr_cnp_ins.post_insert
382      (p_effective_date
383      ,p_rec
384      );
385   --
386   hr_utility.set_location('Leaving:'||l_proc, 20);
387 end ins;
388 --
389 -- ----------------------------------------------------------------------------
390 -- |---------------------------------< ins >----------------------------------|
391 -- ----------------------------------------------------------------------------
392 Procedure ins
393   (p_effective_date               in     date
394   ,p_form_canvas_id                 in     number   default null
395   ,p_template_canvas_id             in     number   default null
396   ,p_height                         in     number   default null
397   ,p_visible                        in     number   default null
398   ,p_width                          in     number   default null
399   ,p_x_position                     in     number   default null
400   ,p_y_position                     in     number   default null
401   ,p_information_category           in     varchar2 default null
402   ,p_information1                   in     varchar2 default null
403   ,p_information2                   in     varchar2 default null
404   ,p_information3                   in     varchar2 default null
405   ,p_information4                   in     varchar2 default null
406   ,p_information5                   in     varchar2 default null
407   ,p_information6                   in     varchar2 default null
408   ,p_information7                   in     varchar2 default null
409   ,p_information8                   in     varchar2 default null
410   ,p_information9                   in     varchar2 default null
411   ,p_information10                  in     varchar2 default null
412   ,p_information11                  in     varchar2 default null
413   ,p_information12                  in     varchar2 default null
414   ,p_information13                  in     varchar2 default null
415   ,p_information14                  in     varchar2 default null
416   ,p_information15                  in     varchar2 default null
417   ,p_information16                  in     varchar2 default null
418   ,p_information17                  in     varchar2 default null
419   ,p_information18                  in     varchar2 default null
420   ,p_information19                  in     varchar2 default null
421   ,p_information20                  in     varchar2 default null
422   ,p_information21                  in     varchar2 default null
423   ,p_information22                  in     varchar2 default null
424   ,p_information23                  in     varchar2 default null
425   ,p_information24                  in     varchar2 default null
426   ,p_information25                  in     varchar2 default null
427   ,p_information26                  in     varchar2 default null
428   ,p_information27                  in     varchar2 default null
429   ,p_information28                  in     varchar2 default null
430   ,p_information29                  in     varchar2 default null
431   ,p_information30                  in     varchar2 default null
432   ,p_canvas_property_id                out nocopy number
433   ,p_object_version_number             out nocopy number
434   ) is
435 --
436   l_rec   hr_cnp_shd.g_rec_type;
437   l_proc  varchar2(72) := g_package||'ins';
438 --
439 Begin
440   hr_utility.set_location('Entering:'||l_proc, 5);
441   --
442   -- Call conversion function to turn arguments into the
443   -- p_rec structure.
444   --
445   l_rec :=
446   hr_cnp_shd.convert_args
447     (null
448     ,p_form_canvas_id
449     ,p_object_version_number
450     ,p_template_canvas_id
451     ,p_height
452     ,p_visible
453     ,p_width
454     ,p_x_position
455     ,p_y_position
456     ,p_information_category
457     ,p_information1
458     ,p_information2
459     ,p_information3
460     ,p_information4
461     ,p_information5
462     ,p_information6
463     ,p_information7
464     ,p_information8
465     ,p_information9
466     ,p_information10
467     ,p_information11
468     ,p_information12
469     ,p_information13
470     ,p_information14
471     ,p_information15
472     ,p_information16
473     ,p_information17
474     ,p_information18
475     ,p_information19
476     ,p_information20
477     ,p_information21
478     ,p_information22
479     ,p_information23
480     ,p_information24
481     ,p_information25
482     ,p_information26
483     ,p_information27
484     ,p_information28
485     ,p_information29
486     ,p_information30
487     );
488   --
489   -- Having converted the arguments into the hr_cnp_rec
490   -- plsql record structure we call the corresponding record business process.
491   --
492   hr_cnp_ins.ins
493      (p_effective_date
494      ,l_rec
495      );
496   --
497   -- As the primary key argument(s)
498   -- are specified as an OUT's we must set these values.
499   --
500   p_canvas_property_id := l_rec.canvas_property_id;
501   p_object_version_number := l_rec.object_version_number;
502   --
503   hr_utility.set_location(' Leaving:'||l_proc, 10);
504 End ins;
505 --
506 end hr_cnp_ins;