DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_ULP_INS

Source


1 Package Body hxc_ulp_ins as
2 /* $Header: hxculprhi.pkb 120.2 2005/09/23 09:52:13 rchennur noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hxc_ulp_ins.';  -- Global package name
9 g_debug boolean := hr_utility.debug_enabled;
10 --
11 -- ----------------------------------------------------------------------------
12 -- |------------------------------< insert_dml >------------------------------|
13 -- ----------------------------------------------------------------------------
14 -- {Start Of Comments}
15 --
16 -- Description:
17 --   This procedure controls the actual dml insert logic. The processing of
18 --   this procedure are as follows:
19 --   1) Initialise the object_version_number to 1 if the object_version_number
20 --      is defined as an attribute for this entity.
21 --   2) To set and unset the g_api_dml status as required (as we are about to
22 --      perform dml).
23 --   3) To insert the row into the schema.
24 --   4) To trap any constraint violations that may have occurred.
25 --   5) To raise any other errors.
26 --
27 -- Prerequisites:
28 --   This is an internal private procedure which must be called from the ins
29 --   procedure and must have all mandatory attributes set (except the
30 --   object_version_number which is initialised within this procedure).
31 --
32 -- In Parameters:
33 --   A Pl/Sql record structre.
34 --
35 -- Post Success:
36 --   The specified row will be inserted into the schema.
37 --
38 -- Post Failure:
39 --   On the insert dml failure it is important to note that we always reset the
40 --   g_api_dml status to false.
41 --   If a check, unique or parent integrity constraint violation is raised the
42 --   constraint_error procedure will be called.
43 --   If any other error is reported, the error will be raised after the
44 --   g_api_dml status is reset.
45 --
46 -- Developer Implementation Notes:
47 --   None.
48 --
49 -- Access Status:
50 --   Internal Row Handler Use Only.
51 --
52 -- {End Of Comments}
53 -- ----------------------------------------------------------------------------
54 Procedure insert_dml
55   (p_rec in out nocopy hxc_ulp_shd.g_rec_type
56   ) is
57 --
58   l_proc  varchar2(72) ;
59 --
60 Begin
61 
62   if g_debug then
63   	l_proc := g_package||'insert_dml';
64   	hr_utility.set_location('Entering:'||l_proc, 5);
65   end if;
66   p_rec.object_version_number := 1;  -- Initialise the object version
67   --
68   --
69   --
70   -- Insert the row into: hxc_layout_comp_prompts
71   --
72   insert into hxc_layout_comp_prompts
73       (layout_comp_prompt_id
74       ,layout_component_id
75       ,prompt_alias
76       ,prompt_type
77       ,region_code
78       ,region_application_id
79       ,attribute_code
80       ,attribute_application_id
81       ,object_version_number
82       ,creation_date
83 ,created_by
84 ,last_updated_by
85 ,last_update_date
86 ,last_update_login
87       )
88   Values
89     (p_rec.layout_comp_prompt_id
90     ,p_rec.layout_component_id
91     ,p_rec.prompt_alias
92     ,p_rec.prompt_type
93     ,p_rec.region_code
94     ,p_rec.region_application_id
95     ,p_rec.attribute_code
96     ,p_rec.attribute_application_id
97     ,p_rec.object_version_number
98      ,sysdate
99  ,fnd_global.user_id
100  ,fnd_global.user_id
101  ,sysdate
102  ,fnd_global.login_id
103     );
104   --
105   --
106   --
107   if g_debug then
108   	hr_utility.set_location(' Leaving:'||l_proc, 10);
109   end if;
110 Exception
111   When hr_api.check_integrity_violated Then
112     -- A check constraint has been violated
113     --
114     hxc_ulp_shd.constraint_error
115       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
116   When hr_api.parent_integrity_violated Then
117     -- Parent integrity has been violated
118     --
119     hxc_ulp_shd.constraint_error
120       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
121   When hr_api.unique_integrity_violated Then
122     -- Unique integrity has been violated
123     --
124     hxc_ulp_shd.constraint_error
125       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
126   When Others Then
127     --
128     Raise;
129 End insert_dml;
130 --
131 -- ----------------------------------------------------------------------------
132 -- |------------------------------< pre_insert >------------------------------|
133 -- ----------------------------------------------------------------------------
134 -- {Start Of Comments}
135 --
136 -- Description:
137 --   This private procedure contains any processing which is required before
138 --   the insert dml. Presently, if the entity has a corresponding primary
139 --   key which is maintained by an associating sequence, the primary key for
140 --   the entity will be populated with the next sequence value in
141 --   preparation for the insert dml.
142 --
143 -- Prerequisites:
144 --   This is an internal procedure which is called from the ins procedure.
145 --
146 -- In Parameters:
147 --   A Pl/Sql record structre.
148 --
149 -- Post Success:
150 --   Processing continues.
151 --
152 -- Post Failure:
153 --   If an error has occurred, an error message and exception will be raised
154 --   but not handled.
155 --
156 -- Developer Implementation Notes:
157 --   Any pre-processing required before the insert dml is issued should be
158 --   coded within this procedure. As stated above, a good example is the
159 --   generation of a primary key number via a corresponding sequence.
160 --   It is important to note that any 3rd party maintenance should be reviewed
161 --   before placing in this procedure.
162 --
163 -- Access Status:
164 --   Internal Row Handler Use Only.
165 --
166 -- {End Of Comments}
167 -- ----------------------------------------------------------------------------
168 Procedure pre_insert
169   (p_rec  in out nocopy hxc_ulp_shd.g_rec_type
170   ) is
171 --
172   l_proc  varchar2(72) ;
173 --
174   Cursor C_Sel1 is select hxc_layout_comp_prompts_s.nextval from sys.dual;
175 --
176 Begin
177 
178   if g_debug then
179   	l_proc := g_package||'pre_insert';
180   	hr_utility.set_location('Entering:'||l_proc, 5);
181   end if;
182   --
183   --
184   -- Select the next sequence number
185   --
186   Open C_Sel1;
187   Fetch C_Sel1 Into p_rec.layout_comp_prompt_id;
188   Close C_Sel1;
189   --
190   if g_debug then
191   	hr_utility.set_location(' Leaving:'||l_proc, 10);
192   end if;
193 End pre_insert;
194 --
195 -- ----------------------------------------------------------------------------
196 -- |-----------------------------< post_insert >------------------------------|
197 -- ----------------------------------------------------------------------------
198 -- {Start Of Comments}
199 --
200 -- Description:
201 --   This private procedure contains any processing which is required after the
202 --   insert dml.
203 --
204 -- Prerequisites:
205 --   This is an internal procedure which is called from the ins procedure.
206 --
207 -- In Parameters:
208 --   A Pl/Sql record structre.
209 --
210 -- Post Success:
211 --   Processing continues.
212 --
213 -- Post Failure:
214 --   If an error has occurred, an error message and exception will be raised
215 --   but not handled.
216 --
217 -- Developer Implementation Notes:
218 --   Any post-processing required after the insert dml is issued should be
219 --   coded within this procedure. It is important to note that any 3rd party
220 --   maintenance should be reviewed before placing in this procedure.
221 --
222 -- Access Status:
223 --   Internal Row Handler Use Only.
224 --
225 -- {End Of Comments}
226 -- ----------------------------------------------------------------------------
227 Procedure post_insert
228   (p_rec                          in hxc_ulp_shd.g_rec_type
229   ) is
230 --
231   l_proc  varchar2(72) ;
232 --
233 Begin
234 
235   if g_debug then
236   	l_proc := g_package||'post_insert';
237   	hr_utility.set_location('Entering:'||l_proc, 5);
238   end if;
239   begin
240     --
241     hxc_ulp_rki.after_insert
242       (p_layout_comp_prompt_id
243       => p_rec.layout_comp_prompt_id
244       ,p_layout_component_id
245       => p_rec.layout_component_id
246       ,p_prompt_alias
247       => p_rec.prompt_alias
248       ,p_prompt_type
249       => p_rec.prompt_type
250       ,p_region_code
251       => p_rec.region_code
252       ,p_region_application_id
253       => p_rec.region_application_id
254       ,p_attribute_code
255       => p_rec.attribute_code
256       ,p_attribute_application_id
257       => p_rec.attribute_application_id
258       ,p_object_version_number
259       => p_rec.object_version_number
260       );
261     --
262   exception
263     --
264     when hr_api.cannot_find_prog_unit then
265       --
266       hr_api.cannot_find_prog_unit_error
267         (p_module_name => 'HXC_LAYOUT_COMP_PROMPTS'
268         ,p_hook_type   => 'AI');
269       --
270   end;
271   --
272   if g_debug then
273   	hr_utility.set_location(' Leaving:'||l_proc, 10);
274   end if;
275 End post_insert;
276 --
277 -- ----------------------------------------------------------------------------
278 -- |---------------------------------< ins >----------------------------------|
279 -- ----------------------------------------------------------------------------
280 Procedure ins
281   (p_rec                          in out nocopy hxc_ulp_shd.g_rec_type
282   ) is
283 --
284   l_proc  varchar2(72) ;
285 --
286 Begin
287   g_debug :=hr_utility.debug_enabled;
288   if g_debug then
289   	l_proc := g_package||'ins';
290   	hr_utility.set_location('Entering:'||l_proc, 5);
291   end if;
292   --
293   -- Call the supporting insert validate operations
294   --
295   hxc_ulp_bus.insert_validate
296      (p_rec
297      );
298   --
299   -- Call the supporting pre-insert operation
300   --
301   hxc_ulp_ins.pre_insert(p_rec);
302   --
303   -- Insert the row
304   --
305   hxc_ulp_ins.insert_dml(p_rec);
306   --
307   -- Call the supporting post-insert operation
308   --
309   hxc_ulp_ins.post_insert
310      (p_rec
311      );
312   --
313   if g_debug then
314   	hr_utility.set_location('Leaving:'||l_proc, 20);
315   end if;
316 end ins;
317 --
318 -- ----------------------------------------------------------------------------
319 -- |---------------------------------< ins >----------------------------------|
320 -- ----------------------------------------------------------------------------
321 Procedure ins
322   (p_layout_component_id            in     number
323   ,p_prompt_alias                   in     varchar2
324   ,p_prompt_type                    in     varchar2
325   ,p_region_code                    in     varchar2
326   ,p_region_application_id          in     number
327   ,p_attribute_code                 in     varchar2
328   ,p_attribute_application_id       in     number
329   ,p_layout_comp_prompt_id             out nocopy number
330   ,p_object_version_number             out nocopy number
331   ) is
332 --
333   l_rec	  hxc_ulp_shd.g_rec_type;
334   l_proc  varchar2(72) ;
335 --
336 Begin
337   g_debug :=hr_utility.debug_enabled;
338   if g_debug then
339   	l_proc := g_package||'ins';
340   	hr_utility.set_location('Entering:'||l_proc, 5);
341   end if;
342   --
343   -- Call conversion function to turn arguments into the
344   -- p_rec structure.
345   --
346   l_rec :=
347   hxc_ulp_shd.convert_args
348     (null
349     ,p_layout_component_id
350     ,p_prompt_alias
351     ,p_prompt_type
352     ,p_region_code
353     ,p_region_application_id
354     ,p_attribute_code
355     ,p_attribute_application_id
356     ,null
357     );
358   --
359   -- Having converted the arguments into the hxc_ulp_rec
360   -- plsql record structure we call the corresponding record business process.
361   --
362   hxc_ulp_ins.ins
363      (l_rec
364      );
365   --
366   -- As the primary key argument(s)
367   -- are specified as an OUT's we must set these values.
368   --
369   p_layout_comp_prompt_id := l_rec.layout_comp_prompt_id;
370   p_object_version_number := l_rec.object_version_number;
371   --
372   if g_debug then
373   	hr_utility.set_location(' Leaving:'||l_proc, 10);
374   end if;
375 End ins;
376 --
377 end hxc_ulp_ins;