DBA Data[Home] [Help]

PACKAGE BODY: APPS.GHR_CAH_UPD

Source


1 Package Body ghr_cah_upd as
2 /* $Header: ghcahrhi.pkb 115.1 2003/01/30 19:24:56 asubrahm noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  ghr_cah_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_cah_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_ca_headers Row
69   --
70   update ghr_compl_ca_headers
71     set
72      compl_ca_header_id              = p_rec.compl_ca_header_id
73     ,complaint_id                    = p_rec.complaint_id
74     ,ca_source                       = p_rec.ca_source
75     ,last_compliance_report          = p_rec.last_compliance_report
76     ,compliance_closed               = p_rec.compliance_closed
77     ,compl_docket_number             = p_rec.compl_docket_number
78     ,appeal_docket_number            = p_rec.appeal_docket_number
79     ,pfe_docket_number               = p_rec.pfe_docket_number
80     ,pfe_received                    = p_rec.pfe_received
81     ,agency_brief_pfe_due            = p_rec.agency_brief_pfe_due
82     ,agency_brief_pfe_date           = p_rec.agency_brief_pfe_date
83     ,decision_pfe_date               = p_rec.decision_pfe_date
84     ,decision_pfe                    = p_rec.decision_pfe
85     ,agency_recvd_pfe_decision       = p_rec.agency_recvd_pfe_decision
86     ,agency_pfe_brief_forwd          = p_rec.agency_pfe_brief_forwd
87     ,agency_notified_noncom          = p_rec.agency_notified_noncom
88     ,comrep_noncom_req               = p_rec.comrep_noncom_req
89     ,eeo_off_req_data_from_org       = p_rec.eeo_off_req_data_from_org
90     ,org_forwd_data_to_eeo_off       = p_rec.org_forwd_data_to_eeo_off
91     ,dec_implemented                 = p_rec.dec_implemented
92     ,complaint_reinstated            = p_rec.complaint_reinstated
93     ,stage_complaint_reinstated      = p_rec.stage_complaint_reinstated
94     ,object_version_number           = p_rec.object_version_number
95     where compl_ca_header_id = p_rec.compl_ca_header_id;
96   --
97   --
98   --
99   hr_utility.set_location(' Leaving:'||l_proc, 10);
100 --
101 Exception
102   When hr_api.check_integrity_violated Then
103     -- A check constraint has been violated
104     --
105     ghr_cah_shd.constraint_error
106       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
107   When hr_api.parent_integrity_violated Then
108     -- Parent integrity has been violated
109     --
110     ghr_cah_shd.constraint_error
111       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
112   When hr_api.unique_integrity_violated Then
113     -- Unique integrity has been violated
114     --
115     ghr_cah_shd.constraint_error
116       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
117   When Others Then
118     --
119     Raise;
120 End update_dml;
121 --
122 -- ----------------------------------------------------------------------------
123 -- |------------------------------< pre_update >------------------------------|
124 -- ----------------------------------------------------------------------------
125 -- {Start Of Comments}
126 --
127 -- Description:
128 --   This private procedure contains any processing which is required before
129 --   the update dml.
130 --
131 -- Prerequisites:
132 --   This is an internal procedure which is called from the upd procedure.
133 --
134 -- In Parameters:
135 --   A Pl/Sql record structure.
136 --
137 -- Post Success:
138 --   Processing continues.
139 --
140 -- Post Failure:
141 --   If an error has occurred, an error message and exception wil be raised
142 --   but not handled.
143 --
144 -- Developer Implementation Notes:
145 --   Any pre-processing required before the update dml is issued should be
146 --   coded within this procedure. It is important to note that any 3rd party
147 --   maintenance should be reviewed before placing in this procedure.
148 --
149 -- Access Status:
150 --   Internal Row Handler Use Only.
151 --
152 -- {End Of Comments}
153 -- ----------------------------------------------------------------------------
154 Procedure pre_update
155   (p_rec in ghr_cah_shd.g_rec_type
156   ) is
157 --
158   l_proc  varchar2(72) := g_package||'pre_update';
159 --
160 Begin
161   hr_utility.set_location('Entering:'||l_proc, 5);
162   --
163   hr_utility.set_location(' Leaving:'||l_proc, 10);
164 End pre_update;
165 --
166 -- ----------------------------------------------------------------------------
167 -- |-----------------------------< post_update >------------------------------|
168 -- ----------------------------------------------------------------------------
169 -- {Start Of Comments}
170 --
171 -- Description:
172 --   This private procedure contains any processing which is required after
173 --   the update dml.
174 --
175 -- Prerequisites:
176 --   This is an internal procedure which is called from the upd procedure.
177 --
178 -- In Parameters:
179 --   A Pl/Sql record structure.
180 --
181 -- Post Success:
182 --   Processing continues.
183 --
184 -- Post Failure:
185 --   If an error has occurred, an error message and exception will be raised
186 --   but not handled.
187 --
188 -- Developer Implementation Notes:
189 --   Any post-processing required after the update dml is issued should be
190 --   coded within this procedure. It is important to note that any 3rd party
191 --   maintenance should be reviewed before placing in this procedure.
192 --
193 -- Access Status:
194 --   Internal Row Handler Use Only.
195 --
196 -- {End Of Comments}
197 -- ----------------------------------------------------------------------------
198 Procedure post_update
199   (p_effective_date               in date
200   ,p_rec                          in ghr_cah_shd.g_rec_type
201   ) is
202 --
203   l_proc  varchar2(72) := g_package||'post_update';
204 --
205 Begin
206   hr_utility.set_location('Entering:'||l_proc, 5);
207   begin
208     --
209     ghr_cah_rku.after_update
210       (p_effective_date               => p_effective_date
211       ,p_compl_ca_header_id           => p_rec.compl_ca_header_id
212       ,p_complaint_id                 => p_rec.complaint_id
213       ,p_ca_source                    => p_rec.ca_source
214       ,p_last_compliance_report       => p_rec.last_compliance_report
215       ,p_compliance_closed            => p_rec.compliance_closed
216       ,p_compl_docket_number          => p_rec.compl_docket_number
217       ,p_appeal_docket_number         => p_rec.appeal_docket_number
218       ,p_pfe_docket_number            => p_rec.pfe_docket_number
219       ,p_pfe_received                 => p_rec.pfe_received
220       ,p_agency_brief_pfe_due         => p_rec.agency_brief_pfe_due
221       ,p_agency_brief_pfe_date        => p_rec.agency_brief_pfe_date
222       ,p_decision_pfe_date            => p_rec.decision_pfe_date
223       ,p_decision_pfe                 => p_rec.decision_pfe
224       ,p_agency_recvd_pfe_decision    => p_rec.agency_recvd_pfe_decision
225       ,p_agency_pfe_brief_forwd       => p_rec.agency_pfe_brief_forwd
226       ,p_agency_notified_noncom       => p_rec.agency_notified_noncom
227       ,p_comrep_noncom_req            => p_rec.comrep_noncom_req
228       ,p_eeo_off_req_data_from_org    => p_rec.eeo_off_req_data_from_org
229       ,p_org_forwd_data_to_eeo_off    => p_rec.org_forwd_data_to_eeo_off
230       ,p_dec_implemented              => p_rec.dec_implemented
231       ,p_complaint_reinstated         => p_rec.complaint_reinstated
232       ,p_stage_complaint_reinstated   => p_rec.stage_complaint_reinstated
233       ,p_object_version_number        => p_rec.object_version_number
234       ,p_complaint_id_o               => ghr_cah_shd.g_old_rec.complaint_id
235       ,p_ca_source_o                  => ghr_cah_shd.g_old_rec.ca_source
236       ,p_last_compliance_report_o     => ghr_cah_shd.g_old_rec.last_compliance_report
237       ,p_compliance_closed_o          => ghr_cah_shd.g_old_rec.compliance_closed
238       ,p_compl_docket_number_o        => ghr_cah_shd.g_old_rec.compl_docket_number
239       ,p_appeal_docket_number_o       => ghr_cah_shd.g_old_rec.appeal_docket_number
240       ,p_pfe_docket_number_o          => ghr_cah_shd.g_old_rec.pfe_docket_number
241       ,p_pfe_received_o               => ghr_cah_shd.g_old_rec.pfe_received
242       ,p_agency_brief_pfe_due_o       => ghr_cah_shd.g_old_rec.agency_brief_pfe_due
243       ,p_agency_brief_pfe_date_o      => ghr_cah_shd.g_old_rec.agency_brief_pfe_date
244       ,p_decision_pfe_date_o          => ghr_cah_shd.g_old_rec.decision_pfe_date
245       ,p_decision_pfe_o               => ghr_cah_shd.g_old_rec.decision_pfe
246       ,p_agency_recvd_pfe_decision_o  => ghr_cah_shd.g_old_rec.agency_recvd_pfe_decision
247       ,p_agency_pfe_brief_forwd_o     => ghr_cah_shd.g_old_rec.agency_pfe_brief_forwd
248       ,p_agency_notified_noncom_o     => ghr_cah_shd.g_old_rec.agency_notified_noncom
249       ,p_comrep_noncom_req_o          => ghr_cah_shd.g_old_rec.comrep_noncom_req
250       ,p_eeo_off_req_data_from_org_o  => ghr_cah_shd.g_old_rec.eeo_off_req_data_from_org
251       ,p_org_forwd_data_to_eeo_off_o  => ghr_cah_shd.g_old_rec.org_forwd_data_to_eeo_off
252       ,p_dec_implemented_o            => ghr_cah_shd.g_old_rec.dec_implemented
253       ,p_complaint_reinstated_o       => ghr_cah_shd.g_old_rec.complaint_reinstated
254       ,p_stage_complaint_reinstated_o => ghr_cah_shd.g_old_rec.stage_complaint_reinstated
255       ,p_object_version_number_o      => ghr_cah_shd.g_old_rec.object_version_number
256       );
257     --
258   exception
259     --
260     when hr_api.cannot_find_prog_unit then
261       --
262       hr_api.cannot_find_prog_unit_error
263         (p_module_name => 'GHR_COMPL_CA_HEADERS'
264         ,p_hook_type   => 'AU');
265       --
266   end;
267   --
268   hr_utility.set_location(' Leaving:'||l_proc, 10);
269 End post_update;
270 --
271 -- ----------------------------------------------------------------------------
272 -- |-----------------------------< convert_defs >-----------------------------|
273 -- ----------------------------------------------------------------------------
274 -- {Start Of Comments}
275 --
276 -- Description:
277 --   The Convert_Defs procedure has one very important function:
278 --   It must return the record structure for the row with all system defaulted
279 --   values converted into its corresponding parameter value for update. When
280 --   we attempt to update a row through the Upd process , certain
281 --   parameters can be defaulted which enables flexibility in the calling of
282 --   the upd process (e.g. only attributes which need to be updated need to be
283 --   specified). For the upd process to determine which attributes
284 --   have NOT been specified we need to check if the parameter has a reserved
285 --   system default value. Therefore, for all parameters which have a
286 --   corresponding reserved system default mechanism specified we need to
287 --   check if a system default is being used. If a system default is being
288 --   used then we convert the defaulted value into its corresponding attribute
289 --   value held in the g_old_rec data structure.
290 --
291 -- Prerequisites:
292 --   This private function can only be called from the upd process.
293 --
294 -- In Parameters:
295 --   A Pl/Sql record structure.
296 --
297 -- Post Success:
298 --   The record structure will be returned with all system defaulted parameter
299 --   values converted into its current row attribute value.
300 --
301 -- Post Failure:
302 --   No direct error handling is required within this function. Any possible
303 --   errors within this procedure will be a PL/SQL value error due to
304 --   conversion of datatypes or data lengths.
305 --
306 -- Developer Implementation Notes:
307 --   None.
308 --
309 -- Access Status:
310 --   Internal Row Handler Use Only.
311 --
312 -- {End Of Comments}
313 -- ----------------------------------------------------------------------------
314 Procedure convert_defs
315   (p_rec in out nocopy ghr_cah_shd.g_rec_type
316   ) is
317 --
318 Begin
319   --
320   -- We must now examine each argument value in the
321   -- p_rec plsql record structure
322   -- to see if a system default is being used. If a system default
323   -- is being used then we must set to the 'current' argument value.
324   --
325   If (p_rec.complaint_id = hr_api.g_number) then
326     p_rec.complaint_id :=
327     ghr_cah_shd.g_old_rec.complaint_id;
328   End If;
329   If (p_rec.ca_source = hr_api.g_varchar2) then
330     p_rec.ca_source :=
331     ghr_cah_shd.g_old_rec.ca_source;
332   End If;
333   If (p_rec.last_compliance_report = hr_api.g_date) then
334     p_rec.last_compliance_report :=
335     ghr_cah_shd.g_old_rec.last_compliance_report;
336   End If;
337   If (p_rec.compliance_closed = hr_api.g_date) then
338     p_rec.compliance_closed :=
339     ghr_cah_shd.g_old_rec.compliance_closed;
340   End If;
341   If (p_rec.compl_docket_number = hr_api.g_varchar2) then
342     p_rec.compl_docket_number :=
343     ghr_cah_shd.g_old_rec.compl_docket_number;
344   End If;
345   If (p_rec.appeal_docket_number = hr_api.g_varchar2) then
346     p_rec.appeal_docket_number :=
347     ghr_cah_shd.g_old_rec.appeal_docket_number;
348   End If;
349   If (p_rec.pfe_docket_number = hr_api.g_varchar2) then
350     p_rec.pfe_docket_number :=
351     ghr_cah_shd.g_old_rec.pfe_docket_number;
352   End If;
353   If (p_rec.pfe_received = hr_api.g_date) then
354     p_rec.pfe_received :=
355     ghr_cah_shd.g_old_rec.pfe_received;
356   End If;
357   If (p_rec.agency_brief_pfe_due = hr_api.g_date) then
358     p_rec.agency_brief_pfe_due :=
359     ghr_cah_shd.g_old_rec.agency_brief_pfe_due;
360   End If;
361   If (p_rec.agency_brief_pfe_date = hr_api.g_date) then
362     p_rec.agency_brief_pfe_date :=
363     ghr_cah_shd.g_old_rec.agency_brief_pfe_date;
364   End If;
365   If (p_rec.decision_pfe_date = hr_api.g_date) then
366     p_rec.decision_pfe_date :=
367     ghr_cah_shd.g_old_rec.decision_pfe_date;
368   End If;
369   If (p_rec.decision_pfe = hr_api.g_varchar2) then
370     p_rec.decision_pfe :=
371     ghr_cah_shd.g_old_rec.decision_pfe;
372   End If;
373   If (p_rec.agency_recvd_pfe_decision = hr_api.g_date) then
374     p_rec.agency_recvd_pfe_decision :=
375     ghr_cah_shd.g_old_rec.agency_recvd_pfe_decision;
376   End If;
377   If (p_rec.agency_pfe_brief_forwd = hr_api.g_date) then
378     p_rec.agency_pfe_brief_forwd :=
379     ghr_cah_shd.g_old_rec.agency_pfe_brief_forwd;
380   End If;
381   If (p_rec.agency_notified_noncom = hr_api.g_date) then
382     p_rec.agency_notified_noncom :=
383     ghr_cah_shd.g_old_rec.agency_notified_noncom;
384   End If;
385   If (p_rec.comrep_noncom_req = hr_api.g_varchar2) then
386     p_rec.comrep_noncom_req :=
387     ghr_cah_shd.g_old_rec.comrep_noncom_req;
388   End If;
389   If (p_rec.eeo_off_req_data_from_org = hr_api.g_date) then
390     p_rec.eeo_off_req_data_from_org :=
391     ghr_cah_shd.g_old_rec.eeo_off_req_data_from_org;
392   End If;
393   If (p_rec.org_forwd_data_to_eeo_off = hr_api.g_date) then
394     p_rec.org_forwd_data_to_eeo_off :=
395     ghr_cah_shd.g_old_rec.org_forwd_data_to_eeo_off;
396   End If;
397   If (p_rec.dec_implemented = hr_api.g_date) then
398     p_rec.dec_implemented :=
399     ghr_cah_shd.g_old_rec.dec_implemented;
400   End If;
401   If (p_rec.complaint_reinstated = hr_api.g_date) then
402     p_rec.complaint_reinstated :=
403     ghr_cah_shd.g_old_rec.complaint_reinstated;
404   End If;
405   If (p_rec.stage_complaint_reinstated = hr_api.g_varchar2) then
406     p_rec.stage_complaint_reinstated :=
407     ghr_cah_shd.g_old_rec.stage_complaint_reinstated;
408   End If;
409   --
410 End convert_defs;
411 --
412 -- ----------------------------------------------------------------------------
413 -- |---------------------------------< upd >----------------------------------|
414 -- ----------------------------------------------------------------------------
415 Procedure upd
416   (p_effective_date               in date
417   ,p_rec                          in out nocopy ghr_cah_shd.g_rec_type
418   ) is
419 --
420   l_proc  varchar2(72) := g_package||'upd';
421 --
422 Begin
423   hr_utility.set_location('Entering:'||l_proc, 5);
424   --
425   -- We must lock the row which we need to update.
426   --
427   ghr_cah_shd.lck
428     (p_rec.compl_ca_header_id
429     ,p_rec.object_version_number
430     );
431   --
432   -- 1. During an update system defaults are used to determine if
433   --    arguments have been defaulted or not. We must therefore
434   --    derive the full record structure values to be updated.
435   --
436   -- 2. Call the supporting update validate operations.
437   --
438   convert_defs(p_rec);
439   ghr_cah_bus.update_validate
440      (p_effective_date
441      ,p_rec
442      );
443   --
444   -- Call the supporting pre-update operation
445   --
446   ghr_cah_upd.pre_update(p_rec);
447   --
448   -- Update the row.
449   --
450   ghr_cah_upd.update_dml(p_rec);
451   --
452   -- Call the supporting post-update operation
453   --
454   ghr_cah_upd.post_update
455      (p_effective_date
456      ,p_rec
457      );
458 End upd;
459 --
460 -- ----------------------------------------------------------------------------
461 -- |---------------------------------< upd >----------------------------------|
462 -- ----------------------------------------------------------------------------
463 Procedure upd
464   (p_effective_date               in     date
465   ,p_compl_ca_header_id           in     number
466   ,p_object_version_number        in out nocopy number
467   ,p_complaint_id                 in     number    default hr_api.g_number
468   ,p_ca_source                    in     varchar2  default hr_api.g_varchar2
469   ,p_last_compliance_report       in     date      default hr_api.g_date
470   ,p_compliance_closed            in     date      default hr_api.g_date
471   ,p_compl_docket_number          in     varchar2  default hr_api.g_varchar2
472   ,p_appeal_docket_number         in     varchar2  default hr_api.g_varchar2
473   ,p_pfe_docket_number            in     varchar2  default hr_api.g_varchar2
474   ,p_pfe_received                 in     date      default hr_api.g_date
475   ,p_agency_brief_pfe_due         in     date      default hr_api.g_date
476   ,p_agency_brief_pfe_date        in     date      default hr_api.g_date
477   ,p_decision_pfe_date            in     date      default hr_api.g_date
478   ,p_decision_pfe                 in     varchar2  default hr_api.g_varchar2
479   ,p_agency_recvd_pfe_decision    in     date      default hr_api.g_date
480   ,p_agency_pfe_brief_forwd       in     date      default hr_api.g_date
481   ,p_agency_notified_noncom       in     date      default hr_api.g_date
482   ,p_comrep_noncom_req            in     varchar2  default hr_api.g_varchar2
483   ,p_eeo_off_req_data_from_org    in     date      default hr_api.g_date
484   ,p_org_forwd_data_to_eeo_off    in     date      default hr_api.g_date
485   ,p_dec_implemented              in     date      default hr_api.g_date
486   ,p_complaint_reinstated         in     date      default hr_api.g_date
487   ,p_stage_complaint_reinstated   in     varchar2  default hr_api.g_varchar2
488   ) is
489 --
490   l_rec   ghr_cah_shd.g_rec_type;
491   l_proc  varchar2(72) := g_package||'upd';
492 --
493 Begin
494   hr_utility.set_location('Entering:'||l_proc, 5);
495   --
496   -- Call conversion function to turn arguments into the
497   -- l_rec structure.
498   --
499   l_rec :=
500   ghr_cah_shd.convert_args
501   (p_compl_ca_header_id
502   ,p_complaint_id
503   ,p_ca_source
504   ,p_last_compliance_report
505   ,p_compliance_closed
506   ,p_compl_docket_number
507   ,p_appeal_docket_number
508   ,p_pfe_docket_number
509   ,p_pfe_received
510   ,p_agency_brief_pfe_due
511   ,p_agency_brief_pfe_date
512   ,p_decision_pfe_date
513   ,p_decision_pfe
514   ,p_agency_recvd_pfe_decision
515   ,p_agency_pfe_brief_forwd
516   ,p_agency_notified_noncom
517   ,p_comrep_noncom_req
518   ,p_eeo_off_req_data_from_org
519   ,p_org_forwd_data_to_eeo_off
520   ,p_dec_implemented
521   ,p_complaint_reinstated
522   ,p_stage_complaint_reinstated
523   ,p_object_version_number
524   );
525   --
526   -- Having converted the arguments into the
527   -- plsql record structure we call the corresponding record
528   -- business process.
529   --
530   ghr_cah_upd.upd
531      (p_effective_date
532      ,l_rec
533      );
534   p_object_version_number := l_rec.object_version_number;
535   --
536   hr_utility.set_location(' Leaving:'||l_proc, 10);
537 End upd;
538 --
539 end ghr_cah_upd;