DBA Data[Home] [Help]

PACKAGE BODY: APPS.IRC_IDT_UPD

Source


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