DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_FMP_INS

Source


1 Package Body hr_fmp_ins as
2 /* $Header: hrfmprhi.pkb 115.5 2003/10/30 07:11:27 bsubrama noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  hr_fmp_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_fmp_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_form_properties
66   --
67   insert into hr_form_properties
68       (form_property_id
69       ,object_version_number
70       ,application_id
71       ,form_id
72       ,form_template_id
73       ,help_target
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.form_property_id
108     ,p_rec.object_version_number
109     ,p_rec.application_id
110     ,p_rec.form_id
111     ,p_rec.form_template_id
112     ,p_rec.help_target
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_fmp_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_fmp_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_fmp_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:
195 -- Developer Implementation Notes:
192 --   If an error has occurred, an error message and exception will be raised
193 --   but not handled.
194 --
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_fmp_shd.g_rec_type
209   ) is
210 --
211   l_proc  varchar2(72) := g_package||'pre_insert';
212 --
213   Cursor C_Sel1 is select hr_form_properties_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.form_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
251 --   Any post-processing required after the insert dml is issued should be
248 --   but not handled.
249 --
250 -- Developer Implementation Notes:
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_rec                          in hr_fmp_shd.g_rec_type
262   ) is
263 --
264   l_proc  varchar2(72) := g_package||'post_insert';
265 --
266 Begin
267   hr_utility.set_location('Entering:'||l_proc, 5);
268   begin
269     --
270     hr_fmp_rki.after_insert
271       (p_form_property_id
272       => p_rec.form_property_id
273       ,p_object_version_number
274       => p_rec.object_version_number
275       ,p_application_id
276       => p_rec.application_id
277       ,p_form_id
278       => p_rec.form_id
279       ,p_form_template_id
280       => p_rec.form_template_id
281       ,p_help_target
282       => p_rec.help_target
283       ,p_information_category
284       => p_rec.information_category
285       ,p_information1
286       => p_rec.information1
287       ,p_information2
288       => p_rec.information2
289       ,p_information3
290       => p_rec.information3
291       ,p_information4
292       => p_rec.information4
293       ,p_information5
294       => p_rec.information5
295       ,p_information6
296       => p_rec.information6
297       ,p_information7
298       => p_rec.information7
299       ,p_information8
300       => p_rec.information8
301       ,p_information9
302       => p_rec.information9
303       ,p_information10
304       => p_rec.information10
305       ,p_information11
306       => p_rec.information11
307       ,p_information12
308       => p_rec.information12
309       ,p_information13
310       => p_rec.information13
311       ,p_information14
312       => p_rec.information14
313       ,p_information15
314       => p_rec.information15
315       ,p_information16
316       => p_rec.information16
317       ,p_information17
318       => p_rec.information17
319       ,p_information18
320       => p_rec.information18
321       ,p_information19
322       => p_rec.information19
323       ,p_information20
324       => p_rec.information20
325       ,p_information21
326       => p_rec.information21
327       ,p_information22
328       => p_rec.information22
329       ,p_information23
330       => p_rec.information23
331       ,p_information24
332       => p_rec.information24
333       ,p_information25
334       => p_rec.information25
335       ,p_information26
336       => p_rec.information26
337       ,p_information27
338       => p_rec.information27
339       ,p_information28
340       => p_rec.information28
341       ,p_information29
342       => p_rec.information29
343       ,p_information30
344       => p_rec.information30
345       );
346     --
347   exception
348     --
349     when hr_api.cannot_find_prog_unit then
350       --
351       hr_api.cannot_find_prog_unit_error
352         (p_module_name => 'HR_FORM_PROPERTIES'
353         ,p_hook_type   => 'AI');
354       --
355   end;
356   --
357   hr_utility.set_location(' Leaving:'||l_proc, 10);
358 End post_insert;
359 --
360 -- ----------------------------------------------------------------------------
361 -- |---------------------------------< ins >----------------------------------|
362 -- ----------------------------------------------------------------------------
363 Procedure ins
364   (p_rec                          in out nocopy hr_fmp_shd.g_rec_type
365   ) is
366 --
367   l_proc  varchar2(72) := g_package||'ins';
368 --
369 Begin
370   hr_utility.set_location('Entering:'||l_proc, 5);
371   --
372   -- Call the supporting insert validate operations
373   --
374   hr_fmp_bus.insert_validate
375      (p_rec
376      );
377   --
378   -- Call the supporting pre-insert operation
379   --
380   hr_fmp_ins.pre_insert(p_rec);
381   --
382   -- Insert the row
383   --
384   hr_fmp_ins.insert_dml(p_rec);
385   --
386   -- Call the supporting post-insert operation
387   --
388   hr_fmp_ins.post_insert
389      (p_rec
390      );
391   --
392   hr_utility.set_location('Leaving:'||l_proc, 20);
393 end ins;
394 --
395 -- ----------------------------------------------------------------------------
396 -- |---------------------------------< ins >----------------------------------|
397 -- ----------------------------------------------------------------------------
398 Procedure ins
399   (p_application_id                 in     number   default null
400   ,p_form_id                        in     number   default null
401   ,p_form_template_id               in     number   default null
402   ,p_help_target                    in     varchar2 default null
403   ,p_information_category           in     varchar2 default null
404   ,p_information1                   in     varchar2 default null
405   ,p_information2                   in     varchar2 default null
406   ,p_information3                   in     varchar2 default null
407   ,p_information4                   in     varchar2 default null
408   ,p_information5                   in     varchar2 default null
409   ,p_information6                   in     varchar2 default null
410   ,p_information7                   in     varchar2 default null
411   ,p_information8                   in     varchar2 default null
412   ,p_information9                   in     varchar2 default null
413   ,p_information10                  in     varchar2 default null
414   ,p_information11                  in     varchar2 default null
415   ,p_information12                  in     varchar2 default null
416   ,p_information13                  in     varchar2 default null
417   ,p_information14                  in     varchar2 default null
418   ,p_information15                  in     varchar2 default null
419   ,p_information16                  in     varchar2 default null
420   ,p_information17                  in     varchar2 default null
421   ,p_information18                  in     varchar2 default null
422   ,p_information19                  in     varchar2 default null
423   ,p_information20                  in     varchar2 default null
424   ,p_information21                  in     varchar2 default null
425   ,p_information22                  in     varchar2 default null
426   ,p_information23                  in     varchar2 default null
427   ,p_information24                  in     varchar2 default null
428   ,p_information25                  in     varchar2 default null
429   ,p_information26                  in     varchar2 default null
430   ,p_information27                  in     varchar2 default null
431   ,p_information28                  in     varchar2 default null
432   ,p_information29                  in     varchar2 default null
433   ,p_information30                  in     varchar2 default null
434   ,p_form_property_id                  out nocopy number
435   ,p_object_version_number             out nocopy number
436   ) is
437 --
438   l_rec   hr_fmp_shd.g_rec_type;
439   l_proc  varchar2(72) := g_package||'ins';
440 --
441 Begin
442   hr_utility.set_location('Entering:'||l_proc, 5);
443   --
444   -- Call conversion function to turn arguments into the
445   -- p_rec structure.
446   --
447   l_rec :=
448   hr_fmp_shd.convert_args
449     (null
450     ,p_application_id
451     ,p_object_version_number
452     ,p_form_id
453     ,p_form_template_id
454     ,p_help_target
455     ,p_information_category
456     ,p_information1
457     ,p_information2
458     ,p_information3
459     ,p_information4
460     ,p_information5
461     ,p_information6
462     ,p_information7
463     ,p_information8
464     ,p_information9
465     ,p_information10
466     ,p_information11
467     ,p_information12
468     ,p_information13
469     ,p_information14
470     ,p_information15
471     ,p_information16
472     ,p_information17
473     ,p_information18
474     ,p_information19
475     ,p_information20
476     ,p_information21
477     ,p_information22
478     ,p_information23
479     ,p_information24
480     ,p_information25
481     ,p_information26
482     ,p_information27
483     ,p_information28
484     ,p_information29
485     ,p_information30
486     );
487   --
488   -- Having converted the arguments into the hr_fmp_rec
489   -- plsql record structure we call the corresponding record business process.
490   --
491   hr_fmp_ins.ins
492      (l_rec
493      );
494   --
495   -- As the primary key argument(s)
496   -- are specified as an OUT's we must set these values.
497   --
498   p_form_property_id := l_rec.form_property_id;
499   p_object_version_number := l_rec.object_version_number;
500   --
501   hr_utility.set_location(' Leaving:'||l_proc, 10);
502 End ins;
503 --
504 end hr_fmp_ins;