1 Package Body hxc_lck_upd as
2 /* $Header: hxclocktypesrhi.pkb 120.2 2005/09/23 08:08:21 nissharm noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hxc_lck_upd.'; -- Global package name
9
10 g_debug boolean := hr_utility.debug_enabled;
11 --
12 -- ----------------------------------------------------------------------------
13 -- |------------------------------< update_dml >------------------------------|
14 -- ----------------------------------------------------------------------------
15 -- {Start Of Comments}
16 --
17 -- Description:
18 -- This procedure controls the actual dml update logic. The processing of
19 -- this procedure is:
20 -- 1) Increment the object_version_number by 1 if the object_version_number
21 -- is defined as an attribute for this entity.
22 -- 2) To set and unset the g_api_dml status as required (as we are about to
23 -- perform dml).
24 -- 3) To update the specified row in the schema using the primary key in
25 -- the predicates.
26 -- 4) To trap any constraint violations that may have occurred.
27 -- 5) To raise any other errors.
28 --
29 -- Prerequisites:
30 -- This is an internal private procedure which must be called from the upd
31 -- procedure.
32 --
33 -- In Parameters:
34 -- A Pl/Sql record structre.
35 --
36 -- Post Success:
37 -- The specified row will be updated in the schema.
38 --
39 -- Post Failure:
40 -- On the update dml failure it is important to note that we always reset the
41 -- g_api_dml status to false.
42 -- If a check, unique or parent integrity constraint violation is raised the
43 -- constraint_error procedure will be called.
44 -- If any other error is reported, the error will be raised after the
45 -- g_api_dml status is reset.
46 --
47 -- Developer Implementation Notes:
48 -- The update 'set' attribute list should be modified if any of your
49 -- attributes are not updateable.
50 --
51 -- Access Status:
52 -- Internal Row Handler Use Only.
53 --
54 -- {End Of Comments}
55 -- ----------------------------------------------------------------------------
56 Procedure update_dml
57 (p_rec in out nocopy hxc_lck_shd.g_rec_type
58 ) is
59 --
60 l_proc varchar2(72);
61 --
62 Begin
63
64
65 if g_debug then
66 l_proc := g_package||'update_dml';
67 hr_utility.set_location('Entering:'||l_proc, 5);
68 end if;
69 --
70 --
71 --
72 --
73 -- Update the hxc_locker_types Row
74 --
75 update hxc_locker_types
76 set
77 locker_type_id = p_rec.locker_type_id
78 ,locker_type = p_rec.locker_type
79 ,process_type = p_rec.process_type
80 ,last_updated_by = fnd_global.user_id
81 ,last_update_date = sysdate
82 ,last_update_login = fnd_global.login_id
83 where locker_type_id = p_rec.locker_type_id;
84 --
85 --
86 --
87 if g_debug then
88 hr_utility.set_location(' Leaving:'||l_proc, 10);
89 end if;
90 --
91 Exception
92 When hr_api.check_integrity_violated Then
93 -- A check constraint has been violated
94 --
95 hxc_lck_shd.constraint_error
96 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
97 When hr_api.parent_integrity_violated Then
98 -- Parent integrity has been violated
99 --
100 hxc_lck_shd.constraint_error
101 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
102 When hr_api.unique_integrity_violated Then
103 -- Unique integrity has been violated
104 --
105 hxc_lck_shd.constraint_error
106 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
107 When Others Then
108 --
109 Raise;
110 End update_dml;
111 --
112 -- ----------------------------------------------------------------------------
113 -- |------------------------------< pre_update >------------------------------|
114 -- ----------------------------------------------------------------------------
115 -- {Start Of Comments}
116 --
117 -- Description:
118 -- This private procedure contains any processing which is required before
119 -- the update dml.
120 --
121 -- Prerequisites:
122 -- This is an internal procedure which is called from the upd procedure.
123 --
124 -- In Parameters:
125 -- A Pl/Sql record structure.
126 --
127 -- Post Success:
128 -- Processing continues.
129 --
130 -- Post Failure:
131 -- If an error has occurred, an error message and exception wil be raised
132 -- but not handled.
133 --
134 -- Developer Implementation Notes:
135 -- Any pre-processing required before the update dml is issued should be
136 -- coded within this procedure. It is important to note that any 3rd party
137 -- maintenance should be reviewed before placing in this procedure.
138 --
139 -- Access Status:
140 -- Internal Row Handler Use Only.
141 --
142 -- {End Of Comments}
143 -- ----------------------------------------------------------------------------
144 Procedure pre_update
145 (p_rec in hxc_lck_shd.g_rec_type
146 ) is
147 --
148 l_proc varchar2(72);
149 --
150 Begin
151
152
153 if g_debug then
154 l_proc := g_package||'pre_update';
155 hr_utility.set_location('Entering:'||l_proc, 5);
156 --
157 hr_utility.set_location(' Leaving:'||l_proc, 10);
158 end if;
159 End pre_update;
160 --
161 -- ----------------------------------------------------------------------------
162 -- |-----------------------------< post_update >------------------------------|
163 -- ----------------------------------------------------------------------------
164 -- {Start Of Comments}
165 --
166 -- Description:
167 -- This private procedure contains any processing which is required after
168 -- the update dml.
169 --
170 -- Prerequisites:
171 -- This is an internal procedure which is called from the upd procedure.
172 --
173 -- In Parameters:
174 -- A Pl/Sql record structure.
175 --
176 -- Post Success:
177 -- Processing continues.
178 --
179 -- Post Failure:
180 -- If an error has occurred, an error message and exception will be raised
181 -- but not handled.
182 --
183 -- Developer Implementation Notes:
184 -- Any post-processing required after the update dml is issued should be
185 -- coded within this procedure. It is important to note that any 3rd party
186 -- maintenance should be reviewed before placing in this procedure.
187 --
188 -- Access Status:
189 -- Internal Row Handler Use Only.
190 --
191 -- {End Of Comments}
192 -- ----------------------------------------------------------------------------
193 Procedure post_update
194 (p_rec in hxc_lck_shd.g_rec_type
195 ) is
196 --
197 l_proc varchar2(72);
198 --
199 Begin
200
201
202 if g_debug then
203 l_proc := g_package||'post_update';
204 hr_utility.set_location('Entering:'||l_proc, 5);
205 end if;
206 begin
207 --
208 hxc_lck_rku.after_update
209 (p_locker_type_id
210 => p_rec.locker_type_id
211 ,p_locker_type
212 => p_rec.locker_type
213 ,p_process_type
214 => p_rec.process_type
215 ,p_locker_type_o
216 => hxc_lck_shd.g_old_rec.locker_type
217 ,p_process_type_o
218 => hxc_lck_shd.g_old_rec.process_type
219 );
220
221 --
222 exception
223 --
224 when hr_api.cannot_find_prog_unit then
225 --
226 hr_api.cannot_find_prog_unit_error
227 (p_module_name => 'HXC_LOCKER_TYPES'
228 ,p_hook_type => 'AU');
229 --
230 end;
231 --
232 if g_debug then
233 hr_utility.set_location(' Leaving:'||l_proc, 10);
234 end if;
235 End post_update;
236 --
237 -- ----------------------------------------------------------------------------
238 -- |-----------------------------< convert_defs >-----------------------------|
239 -- ----------------------------------------------------------------------------
240 -- {Start Of Comments}
241 --
242 -- Description:
243 -- The Convert_Defs procedure has one very important function:
244 -- It must return the record structure for the row with all system defaulted
245 -- values converted into its corresponding parameter value for update. When
246 -- we attempt to update a row through the Upd process , certain
247 -- parameters can be defaulted which enables flexibility in the calling of
248 -- the upd process (e.g. only attributes which need to be updated need to be
249 -- specified). For the upd process to determine which attributes
250 -- have NOT been specified we need to check if the parameter has a reserved
251 -- system default value. Therefore, for all parameters which have a
252 -- corresponding reserved system default mechanism specified we need to
253 -- check if a system default is being used. If a system default is being
254 -- used then we convert the defaulted value into its corresponding attribute
255 -- value held in the g_old_rec data structure.
256 --
257 -- Prerequisites:
258 -- This private function can only be called from the upd process.
259 --
260 -- In Parameters:
261 -- A Pl/Sql record structure.
262 --
263 -- Post Success:
264 -- The record structure will be returned with all system defaulted parameter
265 -- values converted into its current row attribute value.
266 --
267 -- Post Failure:
268 -- No direct error handling is required within this function. Any possible
269 -- errors within this procedure will be a PL/SQL value error due to
270 -- conversion of datatypes or data lengths.
271 --
272 -- Developer Implementation Notes:
273 -- None.
274 --
275 -- Access Status:
276 -- Internal Row Handler Use Only.
277 --
278 -- {End Of Comments}
279 -- ----------------------------------------------------------------------------
280 Procedure convert_defs
281 (p_rec in out nocopy hxc_lck_shd.g_rec_type
282 ) is
283 --
284 Begin
285 --
286 -- We must now examine each argument value in the
287 -- p_rec plsql record structure
288 -- to see if a system default is being used. If a system default
289 -- is being used then we must set to the 'current' argument value.
290 --
291 If (p_rec.locker_type = hr_api.g_varchar2) then
292 p_rec.locker_type :=
293 hxc_lck_shd.g_old_rec.locker_type;
294 End If;
295 If (p_rec.process_type = hr_api.g_varchar2) then
296 p_rec.process_type :=
297 hxc_lck_shd.g_old_rec.process_type;
298 End If;
299 --
300 End convert_defs;
301 --
302 -- ----------------------------------------------------------------------------
303 -- |---------------------------------< upd >----------------------------------|
304 -- ----------------------------------------------------------------------------
305 Procedure upd
306 (p_rec in out nocopy hxc_lck_shd.g_rec_type
307 ) is
308 --
309 l_proc varchar2(72);
310 --
311 Begin
312 g_debug := hr_utility.debug_enabled;
313
314 if g_debug then
315 l_proc := g_package||'upd';
316 hr_utility.set_location('Entering:'||l_proc, 5);
317 end if;
318 --
319 -- We must lock the row which we need to update.
320 --
321 hxc_lck_shd.lck
322 (p_rec.locker_type_id
323 );
324 --
325 -- 1. During an update system defaults are used to determine if
326 -- arguments have been defaulted or not. We must therefore
327 -- derive the full record structure values to be updated.
328 --
329 -- 2. Call the supporting update validate operations.
330 --
331 convert_defs(p_rec);
332 hxc_lck_bus.update_validate
333 (p_rec
334 );
335 --
336 -- Call to raise any errors on multi-message list
337 hr_multi_message.end_validation_set;
338 --
339 -- Call the supporting pre-update operation
340 --
341 hxc_lck_upd.pre_update(p_rec);
342 --
343 -- Update the row.
344 --
345 hxc_lck_upd.update_dml(p_rec);
346 --
347 -- Call the supporting post-update operation
348 --
349 hxc_lck_upd.post_update
350 (p_rec
351 );
352 --
353 -- Call to raise any errors on multi-message list
354 hr_multi_message.end_validation_set;
355 End upd;
356 --
357 -- ----------------------------------------------------------------------------
358 -- |---------------------------------< upd >----------------------------------|
359 -- ----------------------------------------------------------------------------
360 Procedure upd
361 (p_locker_type_id in number
362 ,p_locker_type in varchar2 default hr_api.g_varchar2
363 ,p_process_type in varchar2 default hr_api.g_varchar2
364 ) is
365 --
366 l_rec hxc_lck_shd.g_rec_type;
367 l_proc varchar2(72);
368 --
369 Begin
370 g_debug := hr_utility.debug_enabled;
371
372 if g_debug then
373 l_proc := g_package||'upd';
374 hr_utility.set_location('Entering:'||l_proc, 5);
375 end if;
376 --
377 -- Call conversion function to turn arguments into the
378 -- l_rec structure.
379 --
380 l_rec :=
381 hxc_lck_shd.convert_args
382 (p_locker_type_id
383 ,p_locker_type
384 ,p_process_type
385 );
386 --
387 -- Having converted the arguments into the
388 -- plsql record structure we call the corresponding record
389 -- business process.
390 --
391 hxc_lck_upd.upd
392 (l_rec
393 );
394 --
395 --
396 if g_debug then
397 hr_utility.set_location(' Leaving:'||l_proc, 10);
398 end if;
399 End upd;
400 --
401 end hxc_lck_upd;