DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_TKS_UPD

Source


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