DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_WNP_INS

Source


1 Package Body hr_wnp_ins as
2 /* $Header: hrwnprhi.pkb 115.2 2002/12/03 14:20:10 raranjan noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hr_wnp_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_wnp_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   --
62   --
63   --
64   --
65   -- Insert the row into: hr_window_properties_b
66   --
67   insert into hr_window_properties_b
68       (window_property_id
69       ,form_window_id
70       ,template_window_id
71       ,height
72       ,width
73       ,x_position
74       ,y_position
75       ,information_category
76       ,information1
77       ,information2
78       ,information3
79       ,information4
80       ,information5
81       ,information6
82       ,information7
83       ,information8
84       ,information9
85       ,information10
86       ,information11
87       ,information12
88       ,information13
89       ,information14
90       ,information15
91       ,information16
92       ,information17
93       ,information18
94       ,information19
95       ,information20
96       ,information21
97       ,information22
98       ,information23
99       ,information24
100       ,information25
101       ,information26
102       ,information27
103       ,information28
104       ,information29
105       ,information30
106       )
107   Values
108     (p_rec.window_property_id
109     ,p_rec.form_window_id
110     ,p_rec.template_window_id
111     ,p_rec.height
112     ,p_rec.width
113     ,p_rec.x_position
114     ,p_rec.y_position
115     ,p_rec.information_category
116     ,p_rec.information1
117     ,p_rec.information2
118     ,p_rec.information3
119     ,p_rec.information4
120     ,p_rec.information5
121     ,p_rec.information6
122     ,p_rec.information7
123     ,p_rec.information8
124     ,p_rec.information9
125     ,p_rec.information10
126     ,p_rec.information11
127     ,p_rec.information12
128     ,p_rec.information13
129     ,p_rec.information14
130     ,p_rec.information15
131     ,p_rec.information16
132     ,p_rec.information17
133     ,p_rec.information18
134     ,p_rec.information19
135     ,p_rec.information20
136     ,p_rec.information21
137     ,p_rec.information22
138     ,p_rec.information23
139     ,p_rec.information24
140     ,p_rec.information25
141     ,p_rec.information26
142     ,p_rec.information27
143     ,p_rec.information28
144     ,p_rec.information29
145     ,p_rec.information30
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_wnp_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_wnp_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_wnp_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_wnp_shd.g_rec_type
211   ) is
212 --
213   l_proc  varchar2(72) := g_package||'pre_insert';
214 --
215   Cursor C_Sel1 is select hr_window_properties_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.window_property_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_rec                          in hr_wnp_shd.g_rec_type
264   ) is
265 --
266   l_proc  varchar2(72) := g_package||'post_insert';
267 --
268 Begin
269   hr_utility.set_location('Entering:'||l_proc, 5);
270   begin
271     --
272     hr_wnp_rki.after_insert
273       (p_window_property_id
274       => p_rec.window_property_id
275       ,p_form_window_id
276       => p_rec.form_window_id
277       ,p_template_window_id
278       => p_rec.template_window_id
279       ,p_height
280       => p_rec.height
281       ,p_width
282       => p_rec.width
283       ,p_x_position
284       => p_rec.x_position
285       ,p_y_position
286       => p_rec.y_position
287       ,p_information_category
288       => p_rec.information_category
289       ,p_information1
290       => p_rec.information1
291       ,p_information2
292       => p_rec.information2
293       ,p_information3
294       => p_rec.information3
295       ,p_information4
296       => p_rec.information4
297       ,p_information5
298       => p_rec.information5
299       ,p_information6
300       => p_rec.information6
301       ,p_information7
302       => p_rec.information7
303       ,p_information8
304       => p_rec.information8
305       ,p_information9
306       => p_rec.information9
307       ,p_information10
308       => p_rec.information10
309       ,p_information11
310       => p_rec.information11
311       ,p_information12
312       => p_rec.information12
313       ,p_information13
314       => p_rec.information13
315       ,p_information14
316       => p_rec.information14
317       ,p_information15
318       => p_rec.information15
319       ,p_information16
320       => p_rec.information16
321       ,p_information17
322       => p_rec.information17
323       ,p_information18
324       => p_rec.information18
325       ,p_information19
326       => p_rec.information19
327       ,p_information20
328       => p_rec.information20
329       ,p_information21
330       => p_rec.information21
331       ,p_information22
332       => p_rec.information22
333       ,p_information23
334       => p_rec.information23
335       ,p_information24
336       => p_rec.information24
337       ,p_information25
338       => p_rec.information25
339       ,p_information26
340       => p_rec.information26
341       ,p_information27
342       => p_rec.information27
343       ,p_information28
344       => p_rec.information28
345       ,p_information29
346       => p_rec.information29
347       ,p_information30
348       => p_rec.information30
349       );
350     --
351   exception
352     --
353     when hr_api.cannot_find_prog_unit then
354       --
355       hr_api.cannot_find_prog_unit_error
356         (p_module_name => 'HR_WINDOW_PROPERTIES_B'
357         ,p_hook_type   => 'AI');
358       --
359   end;
360   --
361   hr_utility.set_location(' Leaving:'||l_proc, 10);
362 End post_insert;
363 --
364 -- ----------------------------------------------------------------------------
365 -- |---------------------------------< ins >----------------------------------|
366 -- ----------------------------------------------------------------------------
367 Procedure ins
368   (p_rec                          in out nocopy hr_wnp_shd.g_rec_type
369   ) is
370 --
371   l_proc  varchar2(72) := g_package||'ins';
372 --
373 Begin
374   hr_utility.set_location('Entering:'||l_proc, 5);
375   --
376   -- Call the supporting insert validate operations
377   --
378   hr_wnp_bus.insert_validate
379      (p_rec
380      );
381   --
382   -- Call the supporting pre-insert operation
383   --
384   hr_wnp_ins.pre_insert(p_rec);
385   --
386   -- Insert the row
387   --
388   hr_wnp_ins.insert_dml(p_rec);
389   --
390   -- Call the supporting post-insert operation
391   --
392   hr_wnp_ins.post_insert
393      (p_rec
394      );
395   --
396   hr_utility.set_location('Leaving:'||l_proc, 20);
397 end ins;
398 --
399 -- ----------------------------------------------------------------------------
400 -- |---------------------------------< ins >----------------------------------|
401 -- ----------------------------------------------------------------------------
402 Procedure ins
403   (p_form_window_id                 in     number   default null
404   ,p_template_window_id             in     number   default null
405   ,p_height                         in     number   default null
406   ,p_width                          in     number   default null
407   ,p_x_position                     in     number   default null
408   ,p_y_position                     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_window_property_id                out nocopy number
441   ) is
442 --
443   l_rec	  hr_wnp_shd.g_rec_type;
444   l_proc  varchar2(72) := g_package||'ins';
445 --
446 Begin
447   hr_utility.set_location('Entering:'||l_proc, 5);
448   --
449   -- Call conversion function to turn arguments into the
450   -- p_rec structure.
451   --
452   l_rec :=
453   hr_wnp_shd.convert_args
454     (null
455     ,p_form_window_id
456     ,p_template_window_id
457     ,p_height
458     ,p_width
459     ,p_x_position
460     ,p_y_position
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_wnp_rec
495   -- plsql record structure we call the corresponding record business process.
496   --
497   hr_wnp_ins.ins
498      (l_rec
499      );
500   --
501   -- As the primary key argument(s)
502   -- are specified as an OUT's we must set these values.
503   --
504   p_window_property_id := l_rec.window_property_id;
505   --
506   --
507   hr_utility.set_location(' Leaving:'||l_proc, 10);
508 End ins;
509 --
510 end hr_wnp_ins;