1 Package Body hxc_ulc_ins as
2 /* $Header: hxculcrhi.pkb 120.2 2005/09/23 06:07:43 rchennur noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hxc_ulc_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_ulc_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_components
71 --
72 insert into hxc_layout_components
73 (layout_component_id
74 ,layout_id
75 ,parent_component_id
76 ,component_name
77 ,component_value
78 ,sequence
79 ,name_value_string
80 ,region_code
81 ,region_code_app_id
82 ,attribute_code
83 ,attribute_code_app_id
84 ,object_version_number
85 ,layout_comp_definition_id
86 ,component_alias
87 ,parent_bean
88 ,attribute1
89 ,attribute2
90 ,attribute3
91 ,attribute4
92 ,attribute5
93 ,creation_date
94 ,created_by
95 ,last_updated_by
96 ,last_update_date
97 ,last_update_login
98 )
99 Values
100 (p_rec.layout_component_id
101 ,p_rec.layout_id
102 ,p_rec.parent_component_id
103 ,p_rec.component_name
104 ,p_rec.component_value
105 ,p_rec.sequence
106 ,p_rec.name_value_string
107 ,p_rec.region_code
108 ,p_rec.region_code_app_id
109 ,p_rec.attribute_code
110 ,p_rec.attribute_code_app_id
111 ,p_rec.object_version_number
112 ,p_rec.layout_comp_definition_id
113 ,p_rec.component_alias
114 ,p_rec.parent_bean
115 ,p_rec.attribute1
116 ,p_rec.attribute2
117 ,p_rec.attribute3
118 ,p_rec.attribute4
119 ,p_rec.attribute5
120 ,sysdate
121 ,fnd_global.user_id
122 ,fnd_global.user_id
123 ,sysdate
124 ,fnd_global.login_id
125 );
126 --
127 --
128 --
129 if g_debug then
130 hr_utility.set_location(' Leaving:'||l_proc, 10);
131 end if;
132 Exception
133 When hr_api.check_integrity_violated Then
134 -- A check constraint has been violated
135 --
136 hxc_ulc_shd.constraint_error
137 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
138 When hr_api.parent_integrity_violated Then
139 -- Parent integrity has been violated
140 --
141 hxc_ulc_shd.constraint_error
142 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
143 When hr_api.unique_integrity_violated Then
144 -- Unique integrity has been violated
145 --
146 hxc_ulc_shd.constraint_error
147 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
148 When Others Then
149 --
150 Raise;
151 End insert_dml;
152 --
153 -- ----------------------------------------------------------------------------
154 -- |------------------------------< pre_insert >------------------------------|
155 -- ----------------------------------------------------------------------------
156 -- {Start Of Comments}
157 --
158 -- Description:
159 -- This private procedure contains any processing which is required before
160 -- the insert dml. Presently, if the entity has a corresponding primary
161 -- key which is maintained by an associating sequence, the primary key for
162 -- the entity will be populated with the next sequence value in
163 -- preparation for the insert dml.
164 --
165 -- Prerequisites:
166 -- This is an internal procedure which is called from the ins procedure.
167 --
168 -- In Parameters:
169 -- A Pl/Sql record structre.
170 --
171 -- Post Success:
172 -- Processing continues.
173 --
174 -- Post Failure:
175 -- If an error has occurred, an error message and exception will be raised
176 -- but not handled.
177 --
178 -- Developer Implementation Notes:
179 -- Any pre-processing required before the insert dml is issued should be
180 -- coded within this procedure. As stated above, a good example is the
181 -- generation of a primary key number via a corresponding sequence.
182 -- It is important to note that any 3rd party maintenance should be reviewed
183 -- before placing in this procedure.
184 --
185 -- Access Status:
186 -- Internal Row Handler Use Only.
187 --
188 -- {End Of Comments}
189 -- ----------------------------------------------------------------------------
190 Procedure pre_insert
191 (p_rec in out nocopy hxc_ulc_shd.g_rec_type
192 ) is
193 --
194 l_proc varchar2(72) ;
195 --
196 Cursor C_Sel1 is select hxc_layout_components_s.nextval from sys.dual;
197 --
198 Begin
199
200 if g_debug then
201 l_proc := g_package||'pre_insert';
202 hr_utility.set_location('Entering:'||l_proc, 5);
203 end if;
204 --
205 --
206 -- Select the next sequence number
207 --
208 Open C_Sel1;
209 Fetch C_Sel1 Into p_rec.layout_component_id;
210 Close C_Sel1;
211 --
212 if g_debug then
213 hr_utility.set_location(' Leaving:'||l_proc, 10);
214 end if;
215 End pre_insert;
216 --
217 -- ----------------------------------------------------------------------------
218 -- |-----------------------------< post_insert >------------------------------|
219 -- ----------------------------------------------------------------------------
220 -- {Start Of Comments}
221 --
222 -- Description:
223 -- This private procedure contains any processing which is required after the
224 -- insert dml.
225 --
226 -- Prerequisites:
227 -- This is an internal procedure which is called from the ins procedure.
228 --
229 -- In Parameters:
230 -- A Pl/Sql record structre.
231 --
232 -- Post Success:
233 -- Processing continues.
234 --
235 -- Post Failure:
236 -- If an error has occurred, an error message and exception will be raised
237 -- but not handled.
238 --
239 -- Developer Implementation Notes:
240 -- Any post-processing required after the insert dml is issued should be
241 -- coded within this procedure. It is important to note that any 3rd party
242 -- maintenance should be reviewed before placing in this procedure.
243 --
244 -- Access Status:
245 -- Internal Row Handler Use Only.
246 --
247 -- {End Of Comments}
248 -- ----------------------------------------------------------------------------
249 Procedure post_insert
250 (p_rec in hxc_ulc_shd.g_rec_type
251 ) is
252 --
253 l_proc varchar2(72) ;
254 --
255 Begin
256
257 if g_debug then
258 l_proc := g_package||'post_insert';
259
260 hr_utility.set_location('Entering:'||l_proc, 5);
261 end if;
262 begin
263 --
264 hxc_ulc_rki.after_insert
265 (p_layout_component_id
266 => p_rec.layout_component_id
267 ,p_layout_id
268 => p_rec.layout_id
269 ,p_parent_component_id
270 => p_rec.parent_component_id
271 ,p_component_name
272 => p_rec.component_name
273 ,p_component_value
274 => p_rec.component_value
275 ,p_sequence
276 => p_rec.sequence
277 ,p_name_value_string
278 => p_rec.name_value_string
279 ,p_region_code
280 => p_rec.region_code
281 ,p_region_code_app_id
282 => p_rec.region_code_app_id
283 ,p_attribute_code
284 => p_rec.attribute_code
285 ,p_attribute_code_app_id
286 => p_rec.attribute_code_app_id
287 ,p_object_version_number
288 => p_rec.object_version_number
289 ,p_layout_comp_definition_id
290 => p_rec.layout_comp_definition_id
291 ,p_component_alias
292 => p_rec.component_alias
293 ,p_parent_bean
294 => p_rec.parent_bean
295 ,p_attribute1
296 => p_rec.attribute1
297 ,p_attribute2
298 => p_rec.attribute2
299 ,p_attribute3
300 => p_rec.attribute3
301 ,p_attribute4
302 => p_rec.attribute4
303 ,p_attribute5
304 => p_rec.attribute5
305 );
306 --
307 exception
308 --
309 when hr_api.cannot_find_prog_unit then
310 --
311 hr_api.cannot_find_prog_unit_error
312 (p_module_name => 'HXC_LAYOUT_COMPONENTS'
313 ,p_hook_type => 'AI');
314 --
315 end;
316 --
317 if g_debug then
318 hr_utility.set_location(' Leaving:'||l_proc, 10);
319 end if;
320 End post_insert;
321 --
322 -- ----------------------------------------------------------------------------
323 -- |---------------------------------< ins >----------------------------------|
324 -- ----------------------------------------------------------------------------
325 Procedure ins
326 (p_rec in out nocopy hxc_ulc_shd.g_rec_type
327 ) is
328 --
329 l_proc varchar2(72) ;
330 --
331 Begin
332 g_debug :=hr_utility.debug_enabled;
333 if g_debug then
334 l_proc := g_package||'ins';
335 hr_utility.set_location('Entering:'||l_proc, 5);
336 end if;
337 --
338 -- Call the supporting insert validate operations
339 --
340 hxc_ulc_bus.insert_validate
341 (p_rec
342 );
343 --
344 -- Call the supporting pre-insert operation
345 --
346 hxc_ulc_ins.pre_insert(p_rec);
347 --
348 -- Insert the row
349 --
350 hxc_ulc_ins.insert_dml(p_rec);
351 --
352 -- Call the supporting post-insert operation
353 --
354 hxc_ulc_ins.post_insert
355 (p_rec
356 );
357 --
358 if g_debug then
359 hr_utility.set_location('Leaving:'||l_proc, 20);
360 end if;
361 end ins;
362 --
363 -- ----------------------------------------------------------------------------
364 -- |---------------------------------< ins >----------------------------------|
365 -- ----------------------------------------------------------------------------
366 Procedure ins
367 (p_layout_id in number
368 ,p_parent_component_id in number
369 ,p_sequence in number
370 ,p_component_name in varchar2 default null
371 ,p_component_value in varchar2 default null
372 ,p_name_value_string in varchar2 default null
373 ,p_region_code in varchar2 default null
374 ,p_region_code_app_id in number default null
375 ,p_attribute_code in varchar2 default null
376 ,p_attribute_code_app_id in number default null
377 ,p_layout_component_id out nocopy number
378 ,p_object_version_number out nocopy number
379 ,p_layout_comp_definition_id in number default null
380 ,p_component_alias in varchar2 default null
381 ,p_parent_bean in varchar2 default null
382 ,p_attribute1 in varchar2 default null
383 ,p_attribute2 in varchar2 default null
384 ,p_attribute3 in varchar2 default null
385 ,p_attribute4 in varchar2 default null
386 ,p_attribute5 in varchar2 default null
387 ) is
388 --
389 l_rec hxc_ulc_shd.g_rec_type;
390 l_proc varchar2(72) ;
391 --
392 Begin
393 g_debug :=hr_utility.debug_enabled;
394 if g_debug then
395 l_proc := g_package||'ins';
396 hr_utility.set_location('Entering:'||l_proc, 5);
397 end if;
398 --
399 -- Call conversion function to turn arguments into the
400 -- p_rec structure.
401 --
402 l_rec :=
403 hxc_ulc_shd.convert_args
404 (null
405 ,p_layout_id
406 ,p_parent_component_id
407 ,p_component_name
408 ,p_component_value
409 ,p_sequence
410 ,p_name_value_string
411 ,p_region_code
412 ,p_region_code_app_id
413 ,p_attribute_code
414 ,p_attribute_code_app_id
415 ,null
416 ,p_layout_comp_definition_id
417 ,p_component_alias
418 ,p_parent_bean
419 ,p_attribute1
420 ,p_attribute2
421 ,p_attribute3
422 ,p_attribute4
423 ,p_attribute5
424 );
425 --
426 -- Having converted the arguments into the hxc_ulc_rec
427 -- plsql record structure we call the corresponding record business process.
428 --
429 hxc_ulc_ins.ins
430 (l_rec
431 );
432 --
433 -- As the primary key argument(s)
434 -- are specified as an OUT's we must set these values.
435 --
436 p_layout_component_id := l_rec.layout_component_id;
437 p_object_version_number := l_rec.object_version_number;
438 --
439 if g_debug then
440 hr_utility.set_location(' Leaving:'||l_proc, 10);
441 end if;
442 End ins;
443 --
444 end hxc_ulc_ins;