DBA Data[Home] [Help]

PACKAGE BODY: APPS.GHR_CCL_UPD

Source


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