DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_TPP_INS

Source


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