DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_TMP_INS

Source


1 Package Body hr_tmp_ins as
2 /* $Header: hrtmprhi.pkb 115.6 2002/12/03 11:31:46 raranjan noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hr_tmp_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_tmp_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_templates_b
66   --
67   insert into hr_form_templates_b
68       (form_template_id
69       ,object_version_number
70       ,application_id
71       ,form_id
72       ,template_name
73       ,enabled_flag
74       ,legislation_code
75       ,attribute_category
76       ,attribute1
77       ,attribute2
78       ,attribute3
79       ,attribute4
80       ,attribute5
81       ,attribute6
82       ,attribute7
83       ,attribute8
84       ,attribute9
85       ,attribute10
86       ,attribute11
87       ,attribute12
88       ,attribute13
89       ,attribute14
90       ,attribute15
91       ,attribute16
92       ,attribute17
93       ,attribute18
94       ,attribute19
95       ,attribute20
96       ,attribute21
97       ,attribute22
98       ,attribute23
99       ,attribute24
100       ,attribute25
101       ,attribute26
102       ,attribute27
103       ,attribute28
104       ,attribute29
105       ,attribute30
106       )
107   Values
108     (p_rec.form_template_id
109     ,p_rec.object_version_number
110     ,p_rec.application_id
111     ,p_rec.form_id
112     ,p_rec.template_name
113     ,p_rec.enabled_flag
114     ,p_rec.legislation_code
115     ,p_rec.attribute_category
116     ,p_rec.attribute1
117     ,p_rec.attribute2
118     ,p_rec.attribute3
119     ,p_rec.attribute4
120     ,p_rec.attribute5
121     ,p_rec.attribute6
122     ,p_rec.attribute7
123     ,p_rec.attribute8
124     ,p_rec.attribute9
125     ,p_rec.attribute10
126     ,p_rec.attribute11
127     ,p_rec.attribute12
128     ,p_rec.attribute13
129     ,p_rec.attribute14
130     ,p_rec.attribute15
131     ,p_rec.attribute16
132     ,p_rec.attribute17
133     ,p_rec.attribute18
134     ,p_rec.attribute19
135     ,p_rec.attribute20
136     ,p_rec.attribute21
137     ,p_rec.attribute22
138     ,p_rec.attribute23
139     ,p_rec.attribute24
140     ,p_rec.attribute25
141     ,p_rec.attribute26
142     ,p_rec.attribute27
143     ,p_rec.attribute28
144     ,p_rec.attribute29
145     ,p_rec.attribute30
146     );
147   --
148   --
149   --
150   hr_utility.set_location(' Leaving:'||l_proc, 10);
151 Exception
152   When hr_api.check_integrity_violated Then
153     -- A check constraint has been violated
154     --
155     hr_tmp_shd.constraint_error
156       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
157   When hr_api.parent_integrity_violated Then
158     -- Parent integrity has been violated
159     --
160     hr_tmp_shd.constraint_error
161       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
162   When hr_api.unique_integrity_violated Then
163     -- Unique integrity has been violated
164     --
165     hr_tmp_shd.constraint_error
166       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
167   When Others Then
168     --
169     Raise;
170 End insert_dml;
171 --
172 -- ----------------------------------------------------------------------------
173 -- |------------------------------< pre_insert >------------------------------|
174 -- ----------------------------------------------------------------------------
175 -- {Start Of Comments}
176 --
177 -- Description:
178 --   This private procedure contains any processing which is required before
179 --   the insert dml. Presently, if the entity has a corresponding primary
180 --   key which is maintained by an associating sequence, the primary key for
181 --   the entity will be populated with the next sequence value in
182 --   preparation for the insert dml.
183 --
184 -- Prerequisites:
185 --   This is an internal procedure which is called from the ins procedure.
186 --
187 -- In Parameters:
188 --   A Pl/Sql record structre.
189 --
190 -- Post Success:
191 --   Processing continues.
192 --
193 -- Post Failure:
194 --   If an error has occurred, an error message and exception will be raised
195 --   but not handled.
196 --
197 -- Developer Implementation Notes:
198 --   Any pre-processing required before the insert dml is issued should be
199 --   coded within this procedure. As stated above, a good example is the
200 --   generation of a primary key number via a corresponding sequence.
201 --   It is important to note that any 3rd party maintenance should be reviewed
202 --   before placing in this procedure.
203 --
204 -- Access Status:
205 --   Internal Row Handler Use Only.
206 --
207 -- {End Of Comments}
208 -- ----------------------------------------------------------------------------
209 Procedure pre_insert
210   (p_rec  in out nocopy hr_tmp_shd.g_rec_type
211   ) is
212 --
213   l_proc  varchar2(72) := g_package||'pre_insert';
214 --
215   Cursor C_Sel1 is select hr_form_templates_b_s.nextval from sys.dual;
216 --
217 Begin
218   hr_utility.set_location('Entering:'||l_proc, 5);
219   --
220   --
221   -- Select the next sequence number
222   --
223   Open C_Sel1;
224   Fetch C_Sel1 Into p_rec.form_template_id;
225   Close C_Sel1;
226   --
227   hr_utility.set_location(' Leaving:'||l_proc, 10);
228 End pre_insert;
229 --
230 -- ----------------------------------------------------------------------------
231 -- |-----------------------------< post_insert >------------------------------|
232 -- ----------------------------------------------------------------------------
233 -- {Start Of Comments}
234 --
235 -- Description:
236 --   This private procedure contains any processing which is required after the
237 --   insert dml.
238 --
239 -- Prerequisites:
240 --   This is an internal procedure which is called from the ins procedure.
241 --
242 -- In Parameters:
243 --   A Pl/Sql record structre.
244 --
245 -- Post Success:
246 --   Processing continues.
247 --
248 -- Post Failure:
249 --   If an error has occurred, an error message and exception will be raised
250 --   but not handled.
251 --
252 -- Developer Implementation Notes:
253 --   Any post-processing required after the insert dml is issued should be
254 --   coded within this procedure. It is important to note that any 3rd party
255 --   maintenance should be reviewed before placing in this procedure.
256 --
257 -- Access Status:
258 --   Internal Row Handler Use Only.
259 --
260 -- {End Of Comments}
261 -- ----------------------------------------------------------------------------
262 Procedure post_insert
263   (p_effective_date               in date
264   ,p_rec                          in hr_tmp_shd.g_rec_type
265   ) is
266 --
267   l_proc  varchar2(72) := g_package||'post_insert';
268 --
269 Begin
270   hr_utility.set_location('Entering:'||l_proc, 5);
271   begin
272     --
273     hr_tmp_rki.after_insert
274       (p_effective_date              => p_effective_date
275       ,p_form_template_id
276       => p_rec.form_template_id
277       ,p_object_version_number
278       => p_rec.object_version_number
279       ,p_application_id
280       => p_rec.application_id
281       ,p_form_id
282       => p_rec.form_id
283       ,p_template_name
284       => p_rec.template_name
285       ,p_enabled_flag
286       => p_rec.enabled_flag
287       ,p_legislation_code
288       => p_rec.legislation_code
289       ,p_attribute_category
290       => p_rec.attribute_category
291       ,p_attribute1
292       => p_rec.attribute1
293       ,p_attribute2
294       => p_rec.attribute2
295       ,p_attribute3
296       => p_rec.attribute3
297       ,p_attribute4
298       => p_rec.attribute4
299       ,p_attribute5
300       => p_rec.attribute5
301       ,p_attribute6
302       => p_rec.attribute6
303       ,p_attribute7
304       => p_rec.attribute7
305       ,p_attribute8
306       => p_rec.attribute8
307       ,p_attribute9
308       => p_rec.attribute9
309       ,p_attribute10
310       => p_rec.attribute10
311       ,p_attribute11
312       => p_rec.attribute11
313       ,p_attribute12
314       => p_rec.attribute12
315       ,p_attribute13
316       => p_rec.attribute13
317       ,p_attribute14
318       => p_rec.attribute14
319       ,p_attribute15
320       => p_rec.attribute15
321       ,p_attribute16
322       => p_rec.attribute16
323       ,p_attribute17
324       => p_rec.attribute17
325       ,p_attribute18
326       => p_rec.attribute18
327       ,p_attribute19
328       => p_rec.attribute19
329       ,p_attribute20
330       => p_rec.attribute20
331       ,p_attribute21
332       => p_rec.attribute21
333       ,p_attribute22
334       => p_rec.attribute22
335       ,p_attribute23
336       => p_rec.attribute23
337       ,p_attribute24
338       => p_rec.attribute24
339       ,p_attribute25
340       => p_rec.attribute25
341       ,p_attribute26
342       => p_rec.attribute26
343       ,p_attribute27
344       => p_rec.attribute27
345       ,p_attribute28
346       => p_rec.attribute28
347       ,p_attribute29
348       => p_rec.attribute29
349       ,p_attribute30
350       => p_rec.attribute30
351       );
352     --
353   exception
354     --
355     when hr_api.cannot_find_prog_unit then
356       --
357       hr_api.cannot_find_prog_unit_error
358         (p_module_name => 'HR_FORM_TEMPLATES_B'
359         ,p_hook_type   => 'AI');
360       --
361   end;
362   --
363   hr_utility.set_location(' Leaving:'||l_proc, 10);
364 End post_insert;
365 --
366 -- ----------------------------------------------------------------------------
367 -- |---------------------------------< ins >----------------------------------|
368 -- ----------------------------------------------------------------------------
369 Procedure ins
370   (p_effective_date               in date
371   ,p_rec                          in out nocopy hr_tmp_shd.g_rec_type
372   ) is
373 --
374   l_proc  varchar2(72) := g_package||'ins';
375 --
376 Begin
377   hr_utility.set_location('Entering:'||l_proc, 5);
378   --
379   -- Call the supporting insert validate operations
380   --
381   hr_tmp_bus.insert_validate
382      (p_effective_date
383      ,p_rec
384      );
385   --
386   -- Call the supporting pre-insert operation
387   --
388   hr_tmp_ins.pre_insert(p_rec);
389   --
390   -- Insert the row
391   --
392   hr_tmp_ins.insert_dml(p_rec);
393   --
394   -- Call the supporting post-insert operation
395   --
396   hr_tmp_ins.post_insert
397      (p_effective_date
398      ,p_rec
399      );
400   --
401   hr_utility.set_location('Leaving:'||l_proc, 20);
402 end ins;
403 --
404 -- ----------------------------------------------------------------------------
405 -- |---------------------------------< ins >----------------------------------|
406 -- ----------------------------------------------------------------------------
407 Procedure ins
408   (p_effective_date               in     date
409   ,p_application_id                 in     number
410   ,p_form_id                        in     number
411   ,p_template_name                  in     varchar2
412   ,p_enabled_flag                   in     varchar2
413   ,p_legislation_code               in     varchar2 default null
414   ,p_attribute_category             in     varchar2 default null
415   ,p_attribute1                     in     varchar2 default null
416   ,p_attribute2                     in     varchar2 default null
417   ,p_attribute3                     in     varchar2 default null
418   ,p_attribute4                     in     varchar2 default null
419   ,p_attribute5                     in     varchar2 default null
420   ,p_attribute6                     in     varchar2 default null
421   ,p_attribute7                     in     varchar2 default null
422   ,p_attribute8                     in     varchar2 default null
423   ,p_attribute9                     in     varchar2 default null
424   ,p_attribute10                    in     varchar2 default null
425   ,p_attribute11                    in     varchar2 default null
426   ,p_attribute12                    in     varchar2 default null
427   ,p_attribute13                    in     varchar2 default null
428   ,p_attribute14                    in     varchar2 default null
429   ,p_attribute15                    in     varchar2 default null
430   ,p_attribute16                    in     varchar2 default null
431   ,p_attribute17                    in     varchar2 default null
432   ,p_attribute18                    in     varchar2 default null
433   ,p_attribute19                    in     varchar2 default null
434   ,p_attribute20                    in     varchar2 default null
435   ,p_attribute21                    in     varchar2 default null
436   ,p_attribute22                    in     varchar2 default null
437   ,p_attribute23                    in     varchar2 default null
438   ,p_attribute24                    in     varchar2 default null
439   ,p_attribute25                    in     varchar2 default null
440   ,p_attribute26                    in     varchar2 default null
441   ,p_attribute27                    in     varchar2 default null
442   ,p_attribute28                    in     varchar2 default null
443   ,p_attribute29                    in     varchar2 default null
444   ,p_attribute30                    in     varchar2 default null
445   ,p_form_template_id                  out nocopy number
446   ,p_object_version_number             out nocopy number
447   ) is
448 --
449   l_rec	  hr_tmp_shd.g_rec_type;
450   l_proc  varchar2(72) := g_package||'ins';
451 --
452 Begin
453   hr_utility.set_location('Entering:'||l_proc, 5);
454   --
455   -- Call conversion function to turn arguments into the
456   -- p_rec structure.
457   --
458   l_rec :=
459   hr_tmp_shd.convert_args
460     (null
461     ,null
462     ,p_application_id
463     ,p_form_id
464     ,p_template_name
465     ,p_enabled_flag
466     ,p_legislation_code
467     ,p_attribute_category
468     ,p_attribute1
469     ,p_attribute2
470     ,p_attribute3
471     ,p_attribute4
472     ,p_attribute5
473     ,p_attribute6
474     ,p_attribute7
475     ,p_attribute8
476     ,p_attribute9
477     ,p_attribute10
478     ,p_attribute11
479     ,p_attribute12
480     ,p_attribute13
481     ,p_attribute14
482     ,p_attribute15
483     ,p_attribute16
484     ,p_attribute17
485     ,p_attribute18
486     ,p_attribute19
487     ,p_attribute20
488     ,p_attribute21
489     ,p_attribute22
490     ,p_attribute23
491     ,p_attribute24
492     ,p_attribute25
493     ,p_attribute26
494     ,p_attribute27
495     ,p_attribute28
496     ,p_attribute29
497     ,p_attribute30
498     );
499   --
500   -- Having converted the arguments into the hr_tmp_rec
501   -- plsql record structure we call the corresponding record business process.
502   --
503   hr_tmp_ins.ins
504      (p_effective_date
505      ,l_rec
506      );
507   --
508   -- As the primary key argument(s)
509   -- are specified as an OUT's we must set these values.
510   --
511   p_form_template_id := l_rec.form_template_id;
512   p_object_version_number := l_rec.object_version_number;
513   --
514   hr_utility.set_location(' Leaving:'||l_proc, 10);
515 End ins;
516 --
517 end hr_tmp_ins;