1 Package Body hxc_uld_ins as
2 /* $Header: hxculdrhi.pkb 120.2 2005/09/23 06:19:32 rchennur noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hxc_uld_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_uld_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_definitions
71 --
72 insert into hxc_layout_comp_definitions
73 (layout_comp_definition_id
74 ,component_type
75 ,component_class
76 ,render_type
77 ,object_version_number
78 ,creation_date
79 ,created_by
80 ,last_updated_by
81 ,last_update_date
82 ,last_update_login
83 )
84 Values
85 (p_rec.layout_comp_definition_id
86 ,p_rec.component_type
87 ,p_rec.component_class
88 ,p_rec.render_type
89 ,p_rec.object_version_number
90 ,sysdate
91 ,fnd_global.user_id
92 ,fnd_global.user_id
93 ,sysdate
94 ,fnd_global.login_id
95 );
96 --
97 --
98 --
99 if g_debug then
100 hr_utility.set_location(' Leaving:'||l_proc, 10);
101 end if;
102 Exception
103 When hr_api.check_integrity_violated Then
104 -- A check constraint has been violated
105 --
106 hxc_uld_shd.constraint_error
107 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
108 When hr_api.parent_integrity_violated Then
109 -- Parent integrity has been violated
110 --
111 hxc_uld_shd.constraint_error
112 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
113 When hr_api.unique_integrity_violated Then
114 -- Unique integrity has been violated
115 --
116 hxc_uld_shd.constraint_error
117 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
118 When Others Then
119 --
120 Raise;
121 End insert_dml;
122 --
123 -- ----------------------------------------------------------------------------
124 -- |------------------------------< pre_insert >------------------------------|
125 -- ----------------------------------------------------------------------------
126 -- {Start Of Comments}
127 --
128 -- Description:
129 -- This private procedure contains any processing which is required before
130 -- the insert dml. Presently, if the entity has a corresponding primary
131 -- key which is maintained by an associating sequence, the primary key for
132 -- the entity will be populated with the next sequence value in
133 -- preparation for the insert dml.
134 --
135 -- Prerequisites:
136 -- This is an internal procedure which is called from the ins procedure.
137 --
138 -- In Parameters:
139 -- A Pl/Sql record structre.
140 --
141 -- Post Success:
142 -- Processing continues.
143 --
144 -- Post Failure:
145 -- If an error has occurred, an error message and exception will be raised
146 -- but not handled.
147 --
148 -- Developer Implementation Notes:
149 -- Any pre-processing required before the insert dml is issued should be
150 -- coded within this procedure. As stated above, a good example is the
151 -- generation of a primary key number via a corresponding sequence.
152 -- It is important to note that any 3rd party maintenance should be reviewed
153 -- before placing in this procedure.
154 --
155 -- Access Status:
156 -- Internal Row Handler Use Only.
157 --
158 -- {End Of Comments}
159 -- ----------------------------------------------------------------------------
160 Procedure pre_insert
161 (p_rec in out nocopy hxc_uld_shd.g_rec_type
162 ) is
163 --
164 l_proc varchar2(72) ;
165 --
166 Cursor C_Sel1 is select hxc_layout_comp_definitions_s.nextval from sys.dual;
167 --
168 Begin
169
170 if g_debug then
171 l_proc := g_package||'pre_insert';
172 hr_utility.set_location('Entering:'||l_proc, 5);
173 end if;
174 --
175 --
176 -- Select the next sequence number
177 --
178 Open C_Sel1;
179 Fetch C_Sel1 Into p_rec.layout_comp_definition_id;
180 Close C_Sel1;
181 --
182 if g_debug then
183 hr_utility.set_location(' Leaving:'||l_proc, 10);
184 end if;
185 End pre_insert;
186 --
187 -- ----------------------------------------------------------------------------
188 -- |-----------------------------< post_insert >------------------------------|
189 -- ----------------------------------------------------------------------------
190 -- {Start Of Comments}
191 --
192 -- Description:
193 -- This private procedure contains any processing which is required after the
194 -- insert dml.
195 --
196 -- Prerequisites:
197 -- This is an internal procedure which is called from the ins procedure.
198 --
199 -- In Parameters:
200 -- A Pl/Sql record structre.
201 --
202 -- Post Success:
203 -- Processing continues.
204 --
205 -- Post Failure:
206 -- If an error has occurred, an error message and exception will be raised
207 -- but not handled.
208 --
209 -- Developer Implementation Notes:
210 -- Any post-processing required after the insert dml is issued should be
211 -- coded within this procedure. It is important to note that any 3rd party
212 -- maintenance should be reviewed before placing in this procedure.
213 --
214 -- Access Status:
215 -- Internal Row Handler Use Only.
216 --
217 -- {End Of Comments}
218 -- ----------------------------------------------------------------------------
219 Procedure post_insert
220 (p_rec in hxc_uld_shd.g_rec_type
221 ) is
222 --
223 l_proc varchar2(72) ;
224 --
225 Begin
226
227 if g_debug then
228 l_proc := g_package||'post_insert';
229 hr_utility.set_location('Entering:'||l_proc, 5);
230 end if;
231 begin
232 --
233 hxc_uld_rki.after_insert
234 (p_layout_comp_definition_id
235 => p_rec.layout_comp_definition_id
236 ,p_component_type
237 => p_rec.component_type
238 ,p_component_class
239 => p_rec.component_class
240 ,p_render_type
241 => p_rec.render_type
242 ,p_object_version_number
243 => p_rec.object_version_number
244 );
245 --
246 exception
247 --
248 when hr_api.cannot_find_prog_unit then
249 --
250 hr_api.cannot_find_prog_unit_error
251 (p_module_name => 'HXC_LAYOUT_COMP_DEFINITIONS'
252 ,p_hook_type => 'AI');
253 --
254 end;
255 --
256 if g_debug then
257 hr_utility.set_location(' Leaving:'||l_proc, 10);
258 end if;
259 End post_insert;
260 --
261 -- ----------------------------------------------------------------------------
262 -- |---------------------------------< ins >----------------------------------|
263 -- ----------------------------------------------------------------------------
264 Procedure ins
265 (p_rec in out nocopy hxc_uld_shd.g_rec_type
266 ) is
267 --
268 l_proc varchar2(72) ;
269 --
270 Begin
271 g_debug :=hr_utility.debug_enabled;
272 if g_debug then
273 l_proc := g_package||'ins';
274 hr_utility.set_location('Entering:'||l_proc, 5);
275 end if;
276 --
277 -- Call the supporting insert validate operations
278 --
279 hxc_uld_bus.insert_validate
280 (p_rec
281 );
282 --
283 -- Call the supporting pre-insert operation
284 --
285 hxc_uld_ins.pre_insert(p_rec);
286 --
287 -- Insert the row
288 --
289 hxc_uld_ins.insert_dml(p_rec);
290 --
291 -- Call the supporting post-insert operation
292 --
293 hxc_uld_ins.post_insert
294 (p_rec
295 );
296 --
297 if g_debug then
298 hr_utility.set_location('Leaving:'||l_proc, 20);
299 end if;
300 end ins;
301 --
302 -- ----------------------------------------------------------------------------
303 -- |---------------------------------< ins >----------------------------------|
304 -- ----------------------------------------------------------------------------
305 Procedure ins
306 (p_component_class in varchar2
307 ,p_component_type in varchar2 default null
308 ,p_render_type in varchar2
309 ,p_layout_comp_definition_id out nocopy number
310 ,p_object_version_number out nocopy number
311 ) is
312 --
313 l_rec hxc_uld_shd.g_rec_type;
314 l_proc varchar2(72) ;
315 --
316 Begin
317 g_debug :=hr_utility.debug_enabled;
318 if g_debug then
319 l_proc := g_package||'ins';
320 hr_utility.set_location('Entering:'||l_proc, 5);
321 end if;
322 --
323 -- Call conversion function to turn arguments into the
324 -- p_rec structure.
325 --
326 l_rec :=
327 hxc_uld_shd.convert_args
328 (null
329 ,p_component_type
330 ,p_component_class
331 ,p_render_type
332 ,null
333 );
334 --
335 -- Having converted the arguments into the hxc_uld_rec
336 -- plsql record structure we call the corresponding record business process.
337 --
338 hxc_uld_ins.ins
339 (l_rec
340 );
341 --
342 -- As the primary key argument(s)
343 -- are specified as an OUT's we must set these values.
344 --
345 p_layout_comp_definition_id := l_rec.layout_comp_definition_id;
346 p_object_version_number := l_rec.object_version_number;
347 --
348 if g_debug then
349 hr_utility.set_location(' Leaving:'||l_proc, 10);
350 end if;
351 End ins;
352 --
353 end hxc_uld_ins;