DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_TPP_INS

Source


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