DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_WNP_INS

Source


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