1 Package Body per_fdl_ins as
2 /* $Header: pefdlrhi.pkb 120.0.12020000.1 2013/02/27 12:35:26 shpatro noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_fdl_ins.'; -- Global package name
9
10 --
11 -- The following global variables are only to be used by
12 -- the set_base_key_value and pre_insert procedures.
13 --
14
15 g_fnd_doc_link_id_i number default null;
16 --
17 -- ----------------------------------------------------------------------------
18 -- |------------------------< set_base_key_value >----------------------------|
19 -- ----------------------------------------------------------------------------
20 procedure set_base_key_value
21 (p_fnd_doc_link_id in number) is
22 --
23 l_proc varchar2(72) := g_package||'set_base_key_value';
24 --
25 Begin
26 hr_utility.set_location('Entering:'||l_proc, 10);
27 --
28
29 per_fdl_ins.g_fnd_doc_link_id_i := p_fnd_doc_link_id;
30 --
31 hr_utility.set_location(' Leaving:'||l_proc, 20);
32 End set_base_key_value;
33 --
34
35 --
36 -- ----------------------------------------------------------------------------
37 -- |------------------------------< insert_dml >------------------------------|
38 -- ----------------------------------------------------------------------------
39 -- {Start Of Comments}
40 --
41 -- Description:
42 -- This procedure controls the actual dml insert logic. The processing of
43 -- this procedure are as follows:
44 -- 1) Initialise the object_version_number to 1 if the object_version_number
45 -- is defined as an attribute for this entity.
46 -- 2) To set and unset the g_api_dml status as required (as we are about to
47 -- perform dml).
48 -- 3) To insert the row into the schema.
49 -- 4) To trap any constraint violations that may have occurred.
50 -- 5) To raise any other errors.
51 --
52 -- Prerequisites:
53 -- This is an internal private procedure which must be called from the ins
54 -- procedure and must have all mandatory attributes set (except the
55 -- object_version_number which is initialised within this procedure).
56 --
57 -- In Parameters:
58 -- A Pl/Sql record structre.
59 --
60 -- Post Success:
61 -- The specified row will be inserted into the schema.
62 --
63 -- Post Failure:
64 -- On the insert dml failure it is important to note that we always reset the
65 -- g_api_dml status to false.
66 -- If a check, unique or parent integrity constraint violation is raised the
67 -- constraint_error procedure will be called.
68 -- If any other error is reported, the error will be raised after the
69 -- g_api_dml status is reset.
70 --
71 -- Developer Implementation Notes:
72 -- None.
73 --
74 -- Access Status:
75 -- Internal Row Handler Use Only.
76 --
77 -- {End Of Comments}
78 -- ----------------------------------------------------------------------------
79 Procedure insert_dml
80 (p_rec in out nocopy per_fdl_shd.g_rec_type
81 ) is
82 --
83 l_proc varchar2(72) := g_package||'insert_dml';
84 --
85 Begin
86 hr_utility.set_location('Entering:'||l_proc, 5);
87 p_rec.object_version_number := 1; -- Initialise the object version
88 --
89 per_fdl_shd.g_api_dml := true; -- Set the api dml status
90 --
91 -- Insert the row into: per_fnd_doc_links
92 --
93 insert into per_fnd_doc_links
94 (fnd_doc_link_id
95 ,entity_name
96 ,sub_entity_name
97 ,entity_doc_id
98 ,fnd_doc_id
99 ,person_id
100 ,assignment_id
101 ,application_id
102 ,doc_upload_date
103 ,transaction_type
104 ,transaction_status
105 ,status
106 ,fdl_information_category
107 ,fdl_information1
108 ,fdl_information2
109 ,fdl_information3
110 ,fdl_information4
111 ,fdl_information5
112 ,fdl_information6
113 ,fdl_information7
114 ,fdl_information8
115 ,fdl_information9
116 ,fdl_information10
117 ,object_version_number
118 )
119 Values
120 (p_rec.fnd_doc_link_id
121 ,p_rec.entity_name
122 ,p_rec.sub_entity_name
123 ,p_rec.entity_doc_id
124 ,p_rec.fnd_doc_id
125 ,p_rec.person_id
126 ,p_rec.assignment_id
127 ,p_rec.application_id
128 ,p_rec.doc_upload_date
129 ,p_rec.transaction_type
130 ,p_rec.transaction_status
131 ,p_rec.status
132 ,p_rec.fdl_information_category
133 ,p_rec.fdl_information1
137 ,p_rec.fdl_information5
134 ,p_rec.fdl_information2
135 ,p_rec.fdl_information3
136 ,p_rec.fdl_information4
138 ,p_rec.fdl_information6
139 ,p_rec.fdl_information7
140 ,p_rec.fdl_information8
141 ,p_rec.fdl_information9
142 ,p_rec.fdl_information10
143 ,p_rec.object_version_number
144 );
145 --
146 per_fdl_shd.g_api_dml := false; -- Unset the api dml status
147
148 --
149 hr_utility.set_location(' Leaving:'||l_proc, 10);
150 Exception
151 When hr_api.check_integrity_violated Then
152 -- A check constraint has been violated
153 per_fdl_shd.g_api_dml := false; -- Unset the api dml status
154
155 per_fdl_shd.constraint_error
156 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
157 When hr_api.parent_integrity_violated Then
158 -- Parent integrity has been violated
159 per_fdl_shd.g_api_dml := false; -- Unset the api dml status
160
161 per_fdl_shd.constraint_error
162 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
163 When hr_api.unique_integrity_violated Then
164 -- Unique integrity has been violated
165 per_fdl_shd.g_api_dml := false; -- Unset the api dml status
166
167 per_fdl_shd.constraint_error
168 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
169 When Others Then
170 per_fdl_shd.g_api_dml := false; -- Unset the api dml status
171
172 Raise;
173 End insert_dml;
174
175 --
176 -- ----------------------------------------------------------------------------
177 -- |------------------------------< pre_insert >------------------------------|
178 -- ----------------------------------------------------------------------------
179 -- {Start Of Comments}
180 --
181 -- Description:
182 -- This private procedure contains any processing which is required before
183 -- the insert dml. Presently, if the entity has a corresponding primary
184 -- key which is maintained by an associating sequence, the primary key for
185 -- the entity will be populated with the next sequence value in
186 -- preparation for the insert dml.
187 --
188 -- Prerequisites:
189 -- This is an internal procedure which is called from the ins procedure.
190 --
191 -- In Parameters:
192 -- A Pl/Sql record structure.
193 --
194 -- Post Success:
195 -- Processing continues.
196 --
197 -- Post Failure:
198 -- If an error has occurred, an error message and exception will be raised
199 -- but not handled.
200 --
201 -- Developer Implementation Notes:
202 -- Any pre-processing required before the insert dml is issued should be
203 -- coded within this procedure. As stated above, a good example is the
204 -- generation of a primary key number via a corresponding sequence.
205 -- It is important to note that any 3rd party maintenance should be reviewed
206 -- before placing in this procedure.
207 --
208 -- Access Status:
209 -- Internal Row Handler Use Only.
210 --
211 -- {End Of Comments}
212 -- ----------------------------------------------------------------------------
213 Procedure pre_insert
214 (p_rec in out nocopy per_fdl_shd.g_rec_type
215 ) is
216 --
217 Cursor C_Sel1 is select per_fnd_doc_links_s.nextval from sys.dual;
218 --
219 Cursor C_Sel2 is
220 Select null
221 from per_fnd_doc_links
222 where fnd_doc_link_id =
223 per_fdl_ins.g_fnd_doc_link_id_i;
224 --
225 l_proc varchar2(72) := g_package||'pre_insert';
226 l_exists varchar2(1);
227 --
228 Begin
229 hr_utility.set_location('Entering:'||l_proc, 5);
230 --
231 If (per_fdl_ins.g_fnd_doc_link_id_i is not null) Then
232 --
233 -- Verify registered primary key values not already in use
234 --
235 Open C_Sel2;
236 Fetch C_Sel2 into l_exists;
237 If C_Sel2%found Then
238 Close C_Sel2;
239 --
240 -- The primary key values are already in use.
241 --
242 fnd_message.set_name('PER','PER_289391_KEY_ALREADY_USED');
243 fnd_message.set_token('TABLE_NAME','per_fnd_doc_links');
244 fnd_message.raise_error;
245 End If;
246 Close C_Sel2;
247 --
248 -- Use registered key values and clear globals
249 --
250
251 p_rec.fnd_doc_link_id :=
252 per_fdl_ins.g_fnd_doc_link_id_i;
253 per_fdl_ins.g_fnd_doc_link_id_i := null;
254 Else
255 --
256 -- No registerd key values, so select the next sequence number
257 --
258 --
259 -- Select the next sequence number
260 --
261 Open C_Sel1;
262 Fetch C_Sel1 Into p_rec.fnd_doc_link_id;
263 Close C_Sel1;
264 End If;
265 --
266 hr_utility.set_location(' Leaving:'||l_proc, 10);
267 End pre_insert;
268
269 --
270 -- ----------------------------------------------------------------------------
271 -- |-----------------------------< post_insert >------------------------------|
272 -- ----------------------------------------------------------------------------
273 -- {Start Of Comments}
274 --
275 -- Description:
276 -- This private procedure contains any processing which is required after
277 -- the insert dml.
278 --
279 -- Prerequisites:
280 -- This is an internal procedure which is called from the ins procedure.
281 --
282 -- In Parameters:
283 -- A Pl/Sql record structre.
284 --
285 -- Post Success:
286 -- Processing continues.
287 --
291 --
288 -- Post Failure:
289 -- If an error has occurred, an error message and exception will be raised
290 -- but not handled.
292 -- Developer Implementation Notes:
293 -- Any post-processing required after the insert dml is issued should be
294 -- coded within this procedure. It is important to note that any 3rd party
295 -- maintenance should be reviewed before placing in this procedure.
296 --
297 -- Access Status:
298 -- Internal Row Handler Use Only.
299 --
300 -- {End Of Comments}
301 -- ----------------------------------------------------------------------------
302 Procedure post_insert
303 (p_rec in per_fdl_shd.g_rec_type
304 ) is
305 --
306 l_proc varchar2(72) := g_package||'post_insert';
307 --
308 Begin
309 hr_utility.set_location('Entering:'||l_proc, 5);
310 begin
311
312 -- For Future Use
313
314 /*per_fdl_rki.after_insert
315 (p_fnd_doc_link_id
316 => p_rec.fnd_doc_link_id
317 ,p_entity_name
318 => p_rec.entity_name
319 ,p_sub_entity_name
320 => p_rec.sub_entity_name
321 ,p_entity_doc_id
322 => p_rec.entity_doc_id
323 ,p_fnd_doc_id
324 => p_rec.fnd_doc_id
325 ,p_person_id
326 => p_rec.person_id
327 ,p_assignment_id
328 => p_rec.assignment_id
329 ,p_application_id
330 => p_rec.application_id
331 ,p_doc_upload_date
332 => p_rec.doc_upload_date
333 ,p_transaction_type
334 => p_rec.transaction_type
335 ,p_transaction_status
336 => p_rec.transaction_status
337 ,p_status
338 => p_rec.status
339 ,p_fdl_information_category
340 => p_rec.fdl_information_category
341 ,p_fdl_information1
342 => p_rec.fdl_information1
343 ,p_fdl_information2
344 => p_rec.fdl_information2
345 ,p_fdl_information3
346 => p_rec.fdl_information3
347 ,p_fdl_information4
348 => p_rec.fdl_information4
349 ,p_fdl_information5
350 => p_rec.fdl_information5
351 ,p_fdl_information6
352 => p_rec.fdl_information6
353 ,p_fdl_information7
354 => p_rec.fdl_information7
355 ,p_fdl_information8
356 => p_rec.fdl_information8
357 ,p_fdl_information9
358 => p_rec.fdl_information9
359 ,p_fdl_information10
360 => p_rec.fdl_information10
361 ,p_object_version_number
362 => p_rec.object_version_number
363 );*/
364 NULL;
365 --
366 exception
367 --
368 when hr_api.cannot_find_prog_unit then
369 --
370 hr_api.cannot_find_prog_unit_error
371 (p_module_name => 'PER_FND_DOC_LINKS'
372 ,p_hook_type => 'AI');
373 --
374 end;
375
376 --
377 hr_utility.set_location(' Leaving:'||l_proc, 10);
378 End post_insert;
379
380 --
381 -- ----------------------------------------------------------------------------
382 -- |---------------------------------< ins >----------------------------------|
383 -- ----------------------------------------------------------------------------
384 Procedure ins
385 (p_rec in out nocopy per_fdl_shd.g_rec_type
386 ) is
387 --
388 l_proc varchar2(72) := g_package||'ins';
389 --
390 Begin
391 hr_utility.set_location('Entering:'||l_proc, 5);
392 --
393 -- Call the supporting insert validate operations
394 --
395 per_fdl_bus.insert_validate
396 (p_rec
397 );
398 --
399 -- Call to raise any errors on multi-message list
400 hr_multi_message.end_validation_set;
401 --
402 -- Call the supporting pre-insert operation
403 --
404 per_fdl_ins.pre_insert(p_rec);
405 --
406 -- Insert the row
407 --
408 per_fdl_ins.insert_dml(p_rec);
409 --
410 -- Call the supporting post-insert operation
411 --
412 per_fdl_ins.post_insert
413 (p_rec
414 );
415 --
416 -- Call to raise any errors on multi-message list
417 hr_multi_message.end_validation_set;
418 --
419 hr_utility.set_location('Leaving:'||l_proc, 20);
420 end ins;
421 --
422 -- ----------------------------------------------------------------------------
423 -- |---------------------------------< ins >----------------------------------|
424 -- ----------------------------------------------------------------------------
425 Procedure ins
426 (p_entity_name in varchar2
427 ,p_sub_entity_name in varchar2
428 ,p_person_id in number
429 ,p_doc_upload_date in date
430 ,p_transaction_type in varchar2
431 ,p_transaction_status in varchar2
432 ,p_status in varchar2
433 ,p_entity_doc_id in number default null
434 ,p_fnd_doc_id in number default null
435 ,p_assignment_id in number default null
436 ,p_application_id in number default null
437 ,p_fdl_information_category in varchar2 default null
438 ,p_fdl_information1 in varchar2 default null
439 ,p_fdl_information2 in varchar2 default null
440 ,p_fdl_information3 in varchar2 default null
441 ,p_fdl_information4 in varchar2 default null
442 ,p_fdl_information5 in varchar2 default null
443 ,p_fdl_information6 in varchar2 default null
444 ,p_fdl_information7 in varchar2 default null
445 ,p_fdl_information8 in varchar2 default null
446 ,p_fdl_information9 in varchar2 default null
447 ,p_fdl_information10 in varchar2 default null
448 ,p_fnd_doc_link_id out nocopy number
449 ,p_object_version_number out nocopy number
450 ) is
451 --
452 l_rec per_fdl_shd.g_rec_type;
453 l_proc varchar2(72) := g_package||'ins';
454 --
455 Begin
456 hr_utility.set_location('Entering:'||l_proc, 5);
457 --
458 -- Call conversion function to turn arguments into the
459 -- p_rec structure.
460 --
461 l_rec :=
462 per_fdl_shd.convert_args
463 (null
464 ,p_entity_name
465 ,p_sub_entity_name
466 ,p_entity_doc_id
467 ,p_fnd_doc_id
468 ,p_person_id
469 ,p_assignment_id
470 ,p_application_id
471 ,p_doc_upload_date
472 ,p_transaction_type
473 ,p_transaction_status
474 ,p_status
475 ,p_fdl_information_category
476 ,p_fdl_information1
477 ,p_fdl_information2
478 ,p_fdl_information3
479 ,p_fdl_information4
480 ,p_fdl_information5
481 ,p_fdl_information6
482 ,p_fdl_information7
483 ,p_fdl_information8
484 ,p_fdl_information9
485 ,p_fdl_information10
486 ,null
487 );
488 --
489 -- Having converted the arguments into the per_fdl_rec
490 -- plsql record structure we call the corresponding record business process.
491 --
492 per_fdl_ins.ins
493 (l_rec
494 );
495 --
496 -- As the primary key argument(s)
497 -- are specified as an OUT's we must set these values.
498 --
499 p_fnd_doc_link_id := l_rec.fnd_doc_link_id;
500 p_object_version_number := l_rec.object_version_number;
501 --
502 hr_utility.set_location(' Leaving:'||l_proc, 10);
503 End ins;
504
505 --
506 end per_fdl_ins;