1 Package Body irc_ipt_ins as
2 /* $Header: iriptrhi.pkb 120.0 2005/07/26 15:10:09 mbocutt noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' irc_ipt_ins.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------------< insert_dml >------------------------------|
12 -- ----------------------------------------------------------------------------
13 -- {Start Of Comments}
14 --
15 -- Description:
16 -- This procedure controls the actual dml insert logic. The processing of
17 -- this procedure are as follows:
18 -- 1) Initialise the object_version_number to 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 insert the row into the schema.
23 -- 4) To trap any constraint violations that may have occurred.
24 -- 5) To raise any other errors.
25 --
26 -- Prerequisites:
27 -- This is an internal private procedure which must be called from the ins
28 -- procedure and must have all mandatory attributes set (except the
29 -- object_version_number which is initialised within this procedure).
30 --
31 -- In Parameters:
32 -- A Pl/Sql record structre.
33 --
34 -- Post Success:
35 -- The specified row will be inserted into the schema.
36 --
37 -- Post Failure:
38 -- On the insert 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 -- None.
47 --
48 -- Access Status:
49 -- Internal Row Handler Use Only.
50 --
51 -- {End Of Comments}
52 -- ----------------------------------------------------------------------------
53 Procedure insert_dml
54 (p_rec in out nocopy irc_ipt_shd.g_rec_type
55 ) is
56 --
57 l_proc varchar2(72) := g_package||'insert_dml';
58 --
59 Begin
60 hr_utility.set_location('Entering:'||l_proc, 5);
61 --
62 --
63 --
64 --
65 -- Insert the row into: irc_posting_contents_tl
66 --
67 insert into irc_posting_contents_tl
68 (posting_content_id
69 ,language
70 ,source_language
71 ,name
72 ,org_name
73 ,org_description
74 ,job_title
75 ,brief_description
76 ,detailed_description
77 ,job_requirements
78 ,additional_details
79 ,how_to_apply
80 ,benefit_info
81 ,image_url
82 ,image_url_alt
83 )
84 Values
85 (p_rec.posting_content_id
86 ,p_rec.language
87 ,p_rec.source_language
88 ,p_rec.name
89 ,p_rec.org_name
90 ,empty_clob()
91 ,p_rec.job_title
92 ,empty_clob()
93 ,empty_clob()
94 ,empty_clob()
95 ,empty_clob()
96 ,empty_clob()
97 ,empty_clob()
98 ,empty_clob()
99 ,empty_clob()
100 );
101 --
102 --
103 --
104 irc_ipt_shd.clob_dml(p_rec => p_rec
105 ,p_api_updating => false);
106 hr_utility.set_location(' Leaving:'||l_proc, 10);
107 Exception
108 When hr_api.check_integrity_violated Then
109 -- A check constraint has been violated
110 --
111 irc_ipt_shd.constraint_error
112 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
113 When hr_api.parent_integrity_violated Then
114 -- Parent integrity has been violated
115 --
116 irc_ipt_shd.constraint_error
117 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
118 When hr_api.unique_integrity_violated Then
119 -- Unique integrity has been violated
120 --
121 irc_ipt_shd.constraint_error
122 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
123 When Others Then
124 --
125 Raise;
126 End insert_dml;
127 --
128 -- ----------------------------------------------------------------------------
129 -- |------------------------------< pre_insert >------------------------------|
130 -- ----------------------------------------------------------------------------
131 -- {Start Of Comments}
132 --
133 -- Description:
134 -- This private procedure contains any processing which is required before
135 -- the insert dml. Presently, if the entity has a corresponding primary
136 -- key which is maintained by an associating sequence, the primary key for
137 -- the entity will be populated with the next sequence value in
138 -- preparation for the insert dml.
139 --
140 -- Prerequisites:
141 -- This is an internal procedure which is called from the ins procedure.
142 --
143 -- In Parameters:
144 -- A Pl/Sql record structre.
145 --
146 -- Post Success:
147 -- Processing continues.
148 --
149 -- Post Failure:
150 -- If an error has occurred, an error message and exception will be raised
151 -- but not handled.
152 --
153 -- Developer Implementation Notes:
154 -- Any pre-processing required before the insert dml is issued should be
155 -- coded within this procedure. As stated above, a good example is the
156 -- generation of a primary key number via a corresponding sequence.
157 -- It is important to note that any 3rd party maintenance should be reviewed
158 -- before placing in this procedure.
159 --
160 -- Access Status:
161 -- Internal Row Handler Use Only.
162 --
163 -- {End Of Comments}
164 -- ----------------------------------------------------------------------------
165 Procedure pre_insert
166 (p_rec in out nocopy irc_ipt_shd.g_rec_type
167 ,p_posting_content_id in number
168 ) is
169 --
170 l_proc varchar2(72) := g_package||'pre_insert';
171 --
172 Begin
173 hr_utility.set_location('Entering:'||l_proc, 5);
174 --
175 p_rec.posting_content_id := p_posting_content_id;
176 --
177 hr_utility.set_location(' Leaving:'||l_proc, 10);
178 End pre_insert;
179 --
180 -- ----------------------------------------------------------------------------
181 -- |-----------------------------< post_insert >------------------------------|
182 -- ----------------------------------------------------------------------------
183 -- {Start Of Comments}
184 --
185 -- Description:
186 -- This private procedure contains any processing which is required after
187 -- the insert dml.
188 --
189 -- Prerequisites:
190 -- This is an internal procedure which is called from the ins procedure.
191 --
192 -- In Parameters:
193 -- A Pl/Sql record structre.
194 --
195 -- Post Success:
196 -- Processing continues.
197 --
198 -- Post Failure:
199 -- If an error has occurred, an error message and exception will be raised
200 -- but not handled.
201 --
202 -- Developer Implementation Notes:
203 -- Any post-processing required after the insert dml is issued should be
204 -- coded within this procedure. It is important to note that any 3rd party
205 -- maintenance should be reviewed before placing in this procedure.
206 --
207 -- Access Status:
208 -- Internal Row Handler Use Only.
209 --
210 -- {End Of Comments}
211 -- ----------------------------------------------------------------------------
212 Procedure post_insert
213 (p_rec in irc_ipt_shd.g_rec_type
214 ) is
215 --
216 l_proc varchar2(72) := g_package||'post_insert';
217 --
218 Begin
219 hr_utility.set_location('Entering:'||l_proc, 5);
220 begin
221 --
222 irc_ipt_rki.after_insert
223 (p_posting_content_id
224 => p_rec.posting_content_id
225 ,p_language
226 => p_rec.language
227 ,p_source_language
228 => p_rec.source_language
229 ,p_name
230 => p_rec.name
231 ,p_org_name
232 => p_rec.org_name
233 ,p_org_description
234 => p_rec.org_description
235 ,p_job_title
236 => p_rec.job_title
237 ,p_brief_description
238 => p_rec.brief_description
239 ,p_detailed_description
240 => p_rec.detailed_description
241 ,p_job_requirements
242 => p_rec.job_requirements
243 ,p_additional_details
244 => p_rec.additional_details
245 ,p_how_to_apply
246 => p_rec.how_to_apply
247 ,p_benefit_info
248 => p_rec.benefit_info
249 ,p_image_url
250 => p_rec.image_url
251 ,p_image_url_alt
252 => p_rec.image_url_alt
253 );
254 --
255 exception
256 --
257 when hr_api.cannot_find_prog_unit then
258 --
259 hr_api.cannot_find_prog_unit_error
260 (p_module_name => 'IRC_POSTING_CONTENTS_TL'
261 ,p_hook_type => 'AI');
262 --
263 end;
264 --
265 hr_utility.set_location(' Leaving:'||l_proc, 10);
266 End post_insert;
267 --
268 -- ----------------------------------------------------------------------------
269 -- |---------------------------------< ins >----------------------------------|
270 -- ----------------------------------------------------------------------------
271 Procedure ins
272 (p_rec in out nocopy irc_ipt_shd.g_rec_type
273 ,p_posting_content_id in number
274 ) is
275 --
276 l_proc varchar2(72) := g_package||'ins';
277 --
278 Begin
279 hr_utility.set_location('Entering:'||l_proc, 5);
280 --
281 -- Call the supporting insert validate operations
282 --
283 irc_ipt_bus.insert_validate
284 (p_rec
285 );
286 hr_multi_message.end_validation_set;
287 --
288 -- Call the supporting pre-insert operation
289 --
290 irc_ipt_ins.pre_insert
291 (p_rec => p_rec
292 ,p_posting_content_id => p_posting_content_id
293 );
294 --
295 -- Insert the row
296 --
297 irc_ipt_ins.insert_dml(p_rec);
298 --
299 -- Call the supporting post-insert operation
300 --
301 irc_ipt_ins.post_insert
302 (p_rec
303 );
304 hr_multi_message.end_validation_set;
305 --
306 hr_utility.set_location('Leaving:'||l_proc, 20);
307 end ins;
308 --
309 -- ----------------------------------------------------------------------------
310 -- |---------------------------------< ins >----------------------------------|
311 -- ----------------------------------------------------------------------------
312 Procedure ins
313 (p_posting_content_id in number
314 ,p_language in varchar2
315 ,p_source_language in varchar2
316 ,p_name in varchar2
317 ,p_org_name in varchar2
318 ,p_org_description in varchar2
319 ,p_job_title in varchar2
320 ,p_brief_description in varchar2
321 ,p_detailed_description in varchar2
322 ,p_job_requirements in varchar2
323 ,p_additional_details in varchar2
324 ,p_how_to_apply in varchar2
325 ,p_benefit_info in varchar2
326 ,p_image_url in varchar2
327 ,p_image_url_alt in varchar2
328 ) is
329 --
330 l_rec irc_ipt_shd.g_rec_type;
331 l_proc varchar2(72) := g_package||'ins';
332 --
333 Begin
334 hr_utility.set_location('Entering:'||l_proc, 5);
335 --
336 -- Call conversion function to turn arguments into the
337 -- p_rec structure.
338 --
339 l_rec :=
340 irc_ipt_shd.convert_args
341 (null
342 ,p_language
343 ,p_source_language
344 ,p_name
345 ,p_org_name
346 ,p_org_description
347 ,p_job_title
348 ,p_brief_description
349 ,p_detailed_description
350 ,p_job_requirements
351 ,p_additional_details
352 ,p_how_to_apply
353 ,p_benefit_info
354 ,p_image_url
355 ,p_image_url_alt
356 );
357 --
358 -- Having converted the arguments into the irc_ipt_rec
359 -- plsql record structure we call the corresponding record business process.
360 --
361 irc_ipt_ins.ins
362 (p_rec => l_rec
363 ,p_posting_content_id => p_posting_content_id
364 );
365 --
366 -- As the primary key argument(s)
367 -- are specified as an OUT's we must set these values.
368 --
369 --
370 --
371 hr_utility.set_location(' Leaving:'||l_proc, 10);
372 End ins;
373 --
374 -- ----------------------------------------------------------------------------
375 -- |------------------------------< ins_tl >----------------------------------|
376 -- ----------------------------------------------------------------------------
377 Procedure ins_tl
378 (p_language_code in varchar2
379 ,p_posting_content_id in number
380 ,p_name in varchar2
381 ,p_org_name in varchar2 default null
382 ,p_org_description in varchar2 default null
383 ,p_job_title in varchar2 default null
384 ,p_brief_description in varchar2 default null
385 ,p_detailed_description in varchar2 default null
386 ,p_job_requirements in varchar2 default null
387 ,p_additional_details in varchar2 default null
388 ,p_how_to_apply in varchar2 default null
389 ,p_benefit_info in varchar2 default null
390 ,p_image_url in varchar2 default null
391 ,p_image_url_alt in varchar2 default null
392 ) is
393 --
394 -- Cursor to obtain the list of base and installed languages
395 --
396 cursor csr_ins_langs is
397 select l.language_code
398 from fnd_languages l
399 where l.installed_flag in ('I','B')
400 and not exists (select null
401 from irc_posting_contents_tl ipt
402 where ipt.posting_content_id = p_posting_content_id
403 and ipt.language = l.language_code);
404 --
405 l_proc varchar2(72) := g_package || 'ins_tl';
406 --
407 Begin
408 hr_utility.set_location('Entering:'||l_proc,10);
409 --
410 -- Insert a row for the base language and every installed language.
411 --
412 for l_lang in csr_ins_langs loop
413 irc_ipt_ins.ins
414 (p_posting_content_id => p_posting_content_id
415 ,p_language => l_lang.language_code
416 ,p_source_language => p_language_code
417 ,p_name => p_name
418 ,p_org_name => p_org_name
419 ,p_org_description => p_org_description
420 ,p_job_title => p_job_title
421 ,p_brief_description => p_brief_description
422 ,p_detailed_description => p_detailed_description
423 ,p_job_requirements => p_job_requirements
424 ,p_additional_details => p_additional_details
425 ,p_how_to_apply => p_how_to_apply
426 ,p_benefit_info => p_benefit_info
427 ,p_image_url => p_image_url
428 ,p_image_url_alt => p_image_url_alt
429 );
430 end loop;
431 --
432 hr_utility.set_location('Leaving:'||l_proc,20);
433 End ins_tl;
434 --
435 end irc_ipt_ins;