[Home] [Help]
PACKAGE BODY: APPS.PER_APT_INS
Source
1 Package Body per_apt_ins as
2 /* $Header: peaptrhi.pkb 120.4.12010000.3 2008/08/06 08:57:55 ubhat ship $ */
3
4 -- ---------------------------------------------------------------------------+
5 -- | Private Global Definitions |
6 -- ---------------------------------------------------------------------------+
7
8 g_package varchar2(33) := ' per_apt_ins.'; -- Global package name
9 --
10 -- The following global variables are only to be used by
11 -- the set_base_key_value and pre_insert procedures.
12 --
13 g_appraisal_template_id_i number default null;
14 --
15 --
16 -- ----------------------------------------------------------------------------
17 -- |------------------------< set_base_key_value >----------------------------|
18 -- ----------------------------------------------------------------------------
19 procedure set_base_key_value
20 (p_appraisal_template_id in number) is
21 --
22 l_proc varchar2(72) := g_package||'set_base_key_value';
23 --
24 Begin
25 hr_utility.set_location('Entering:'||l_proc, 10);
26 --
27 per_apt_ins.g_appraisal_template_id_i := p_appraisal_template_id;
28 --
29 hr_utility.set_location(' Leaving:'||l_proc, 20);
30 End set_base_key_value;
31 --
32 --
33
34 -- ---------------------------------------------------------------------------+
35 -- |------------------------------< insert_dml >------------------------------|
36 -- ---------------------------------------------------------------------------+
37 -- {Start Of Comments}
38
39 -- Description:
40 -- This procedure controls the actual dml insert logic. The processing of
41 -- this procedure are as follows:
42 -- 1) Initialise the object_version_number to 1 if the object_version_number
43 -- is defined as an attribute for this entity.
44 -- 2) To insert the row into the schema.
45 -- 3) To trap any constraint violations that may have occurred.
46 -- 4) To raise any other errors.
47
48 -- Pre Conditions:
49 -- This is an internal private procedure which must be called from the ins
50 -- procedure and must have all mandatory attributes set (except the
51 -- object_version_number which is initialised within this procedure).
52
53 -- In Parameters:
54 -- A Pl/Sql record structre.
55
56 -- Post Success:
57 -- The specified row will be inserted into the schema.
58
59 -- Post Failure:
60 -- If a check, unique or parent integrity constraint violation is raised the
61 -- constraint_error procedure will be called.
62
63 -- Developer Implementation Notes:
64 -- None.
65
66 -- Access Status:
67 -- Internal Table Handler Use Only.
68
69 -- {End Of Comments}
70 -- ---------------------------------------------------------------------------+
71 Procedure insert_dml(p_rec in out nocopy per_apt_shd.g_rec_type) is
72
73 l_proc varchar2(72) := g_package||'insert_dml';
74
75 Begin
76 hr_utility.set_location('Entering:'||l_proc, 5);
77 p_rec.object_version_number := 1; -- Initialise the object version
78
79
80 -- Insert the row into: per_appraisal_templates
81
82 insert into per_appraisal_templates
83 ( appraisal_template_id,
84 business_group_id,
85 object_version_number,
86 name,
87 description,
88 instructions,
89 date_from,
90 date_to,
91 assessment_type_id,
92 rating_scale_id,
93 questionnaire_template_id,
94 attribute_category,
95 attribute1,
96 attribute2,
97 attribute3,
98 attribute4,
99 attribute5,
100 attribute6,
101 attribute7,
102 attribute8,
103 attribute9,
104 attribute10,
105 attribute11,
106 attribute12,
107 attribute13,
108 attribute14,
109 attribute15,
110 attribute16,
111 attribute17,
112 attribute18,
113 attribute19,
114 attribute20,
115 objective_asmnt_type_id,
116 ma_quest_template_id,
117 link_appr_to_learning_path,
118 final_score_formula_id,
119 update_personal_comp_profile,
120 comp_profile_source_type,
121 show_competency_ratings,
122 show_objective_ratings,
123 show_overall_ratings,
124 show_overall_comments,
125 provide_overall_feedback,
126 show_participant_details,
127 allow_add_participant,
128 show_additional_details,
129 show_participant_names,
130 show_participant_ratings,
131 available_flag,
132 show_questionnaire_info,
133 ma_off_template_code,
134 appraisee_off_template_code,
135 other_part_off_template_code,
136 part_app_off_template_code,
137 part_rev_off_template_code
138 )
139 Values
140 ( p_rec.appraisal_template_id,
141 p_rec.business_group_id,
142 p_rec.object_version_number,
143 p_rec.name,
144 p_rec.description,
145 p_rec.instructions,
146 p_rec.date_from,
147 p_rec.date_to,
148 p_rec.assessment_type_id,
149 p_rec.rating_scale_id,
150 p_rec.questionnaire_template_id,
151 p_rec.attribute_category,
152 p_rec.attribute1,
153 p_rec.attribute2,
154 p_rec.attribute3,
155 p_rec.attribute4,
156 p_rec.attribute5,
157 p_rec.attribute6,
158 p_rec.attribute7,
159 p_rec.attribute8,
160 p_rec.attribute9,
161 p_rec.attribute10,
162 p_rec.attribute11,
163 p_rec.attribute12,
164 p_rec.attribute13,
165 p_rec.attribute14,
166 p_rec.attribute15,
167 p_rec.attribute16,
168 p_rec.attribute17,
169 p_rec.attribute18,
170 p_rec.attribute19,
171 p_rec.attribute20,
172 p_rec.objective_asmnt_type_id,
173 p_rec.ma_quest_template_id,
174 p_rec.link_appr_to_learning_path,
175 p_rec.final_score_formula_id,
176 p_rec.update_personal_comp_profile,
177 p_rec.comp_profile_source_type,
178 p_rec.show_competency_ratings,
179 p_rec.show_objective_ratings,
180 p_rec.show_overall_ratings,
181 p_rec.show_overall_comments,
182 p_rec.provide_overall_feedback,
183 p_rec.show_participant_details,
184 p_rec.allow_add_participant,
185 p_rec.show_additional_details,
186 p_rec.show_participant_names,
187 p_rec.show_participant_ratings,
188 p_rec.available_flag,
189 p_rec.show_questionnaire_info,
190 p_rec.ma_off_template_code,
191 p_rec.appraisee_off_template_code,
192 p_rec.other_part_off_template_code,
193 p_rec.part_app_off_template_code,
194 p_rec.part_rev_off_template_code
195 );
196
197 hr_utility.set_location(' Leaving:'||l_proc, 10);
198 Exception
199 When hr_api.check_integrity_violated Then
200 -- A check constraint has been violated
201 per_apt_shd.constraint_error
202 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
203 When hr_api.parent_integrity_violated Then
204 -- Parent integrity has been violated
205 per_apt_shd.constraint_error
206 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
207 When hr_api.unique_integrity_violated Then
208 -- Unique integrity has been violated
209 per_apt_shd.constraint_error
210 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
211 When Others Then
212 Raise;
213 End insert_dml;
214
215 -- ---------------------------------------------------------------------------+
216 -- |------------------------------< pre_insert >------------------------------|
217 -- ---------------------------------------------------------------------------+
218 -- {Start Of Comments}
219
220 -- Description:
221 -- This private procedure contains any processing which is required before
222 -- the insert dml. Presently, if the entity has a corresponding primary
223 -- key which is maintained by an associating sequence, the primary key for
224 -- the entity will be populated with the next sequence value in
225 -- preparation for the insert dml.
226
227 -- Pre Conditions:
228 -- This is an internal procedure which is called from the ins procedure.
229
230 -- In Parameters:
231 -- A Pl/Sql record structre.
232
233 -- Post Success:
234 -- Processing continues.
235
236 -- Post Failure:
237 -- If an error has occurred, an error message and exception will be raised
238 -- but not handled.
239
240 -- Developer Implementation Notes:
241 -- Any pre-processing required before the insert dml is issued should be
242 -- coded within this procedure. As stated above, a good example is the
243 -- generation of a primary key number via a corresponding sequence.
244 -- It is important to note that any 3rd party maintenance should be reviewed
245 -- before placing in this procedure.
246
247 -- Access Status:
248 -- Internal Table Handler Use Only.
249
250 -- {End Of Comments}
251 -- ---------------------------------------------------------------------------+
252 Procedure pre_insert(p_rec in out nocopy per_apt_shd.g_rec_type) is
253
254 l_proc varchar2(72) := g_package||'pre_insert';
255 l_exists varchar2(1);
256
257 Cursor C_Sel1 is select per_appraisal_templates_s.nextval from sys.dual;
258
259 Cursor C_Sel2 is
260 select null from per_appraisal_templates
261 where appraisal_template_id = per_apt_ins.g_appraisal_template_id_i;
262
263 Begin
264 hr_utility.set_location('Entering:'||l_proc, 5);
265
266
267 -- Select the next sequence number
268 if (per_apt_ins.g_appraisal_template_id_i is not null ) then
269 Open C_Sel2;
270 Fetch C_Sel2 Into l_exists;
271 if C_Sel2%Found then
272 Close C_Sel2;
273 --
274 -- The primary key values are already in use.
275 --
276 fnd_message.set_name('PER','PER_289391_KEY_ALREADY_USED');
277 fnd_message.set_token('TABLE_NAME','PER_APPRAISAL_TEMPLATES');
278 fnd_message.raise_error;
279 End If;
280 Close C_Sel2;
281 --
282 -- Use registered key values and clear globals
283 --
284 p_rec.appraisal_template_id := per_apt_ins.g_appraisal_template_id_i;
285 per_apt_ins.g_appraisal_template_id_i := null;
286
287 Else
288 Open C_Sel1;
289 Fetch C_Sel1 Into p_rec.appraisal_template_id;
290 Close C_Sel1;
291 end if;
292 hr_utility.set_location(' Leaving:'||l_proc, 10);
293 End pre_insert;
294
295 -- ---------------------------------------------------------------------------+
296 -- |-----------------------------< post_insert >------------------------------|
297 -- ---------------------------------------------------------------------------+
298 -- {Start Of Comments}
299
300 -- Description:
301 -- This private procedure contains any processing which is required after the
302 -- insert dml.
303
304 -- Pre Conditions:
305 -- This is an internal procedure which is called from the ins procedure.
306
307 -- In Parameters:
308 -- A Pl/Sql record structre.
309
310 -- Post Success:
311 -- Processing continues.
312
313 -- Post Failure:
314 -- If an error has occurred, an error message and exception will be raised
315 -- but not handled.
316
317 -- Developer Implementation Notes:
318 -- Any post-processing required after the insert dml is issued should be
319 -- coded within this procedure. It is important to note that any 3rd party
320 -- maintenance should be reviewed before placing in this procedure.
321
322 -- Access Status:
323 -- Internal Table Handler Use Only.
324
325 -- {End Of Comments}
326 -- ---------------------------------------------------------------------------+
327 Procedure post_insert(p_rec in per_apt_shd.g_rec_type) is
328
329 l_proc varchar2(72) := g_package||'post_insert';
330
331 Begin
332 hr_utility.set_location('Entering:'||l_proc, 5);
333
334 -- This is a hook point and the user hook for post_insert is called here.
335
336 begin
337 per_apt_rki.after_insert (
338 p_appraisal_template_id => p_rec.appraisal_template_id ,
339 p_business_group_id => p_rec.business_group_id ,
340 p_object_version_number => p_rec.object_version_number ,
341 p_name => p_rec.name ,
342 p_description => p_rec.description ,
343 p_instructions => p_rec.instructions ,
344 p_date_from => p_rec.date_from ,
345 p_date_to => p_rec.date_to ,
346 p_assessment_type_id => p_rec.assessment_type_id ,
347 p_rating_scale_id => p_rec.rating_scale_id ,
348 p_questionnaire_template_id => p_rec.questionnaire_template_id ,
349 p_attribute_category => p_rec.attribute_category ,
350 p_attribute1 => p_rec.attribute1 ,
351 p_attribute2 => p_rec.attribute2 ,
352 p_attribute3 => p_rec.attribute3 ,
353 p_attribute4 => p_rec.attribute4 ,
354 p_attribute5 => p_rec.attribute5 ,
355 p_attribute6 => p_rec.attribute6 ,
356 p_attribute7 => p_rec.attribute7 ,
357 p_attribute8 => p_rec.attribute8 ,
358 p_attribute9 => p_rec.attribute9 ,
359 p_attribute10 => p_rec.attribute10 ,
360 p_attribute11 => p_rec.attribute11 ,
361 p_attribute12 => p_rec.attribute12 ,
362 p_attribute13 => p_rec.attribute13 ,
363 p_attribute14 => p_rec.attribute14 ,
364 p_attribute15 => p_rec.attribute15 ,
365 p_attribute16 => p_rec.attribute16 ,
366 p_attribute17 => p_rec.attribute17 ,
367 p_attribute18 => p_rec.attribute18 ,
368 p_attribute19 => p_rec.attribute19 ,
369 p_attribute20 => p_rec.attribute20 ,
370 p_objective_asmnt_type_id => p_rec.objective_asmnt_type_id,
371 p_ma_quest_template_id => p_rec.ma_quest_template_id,
372 p_link_appr_to_learning_path => p_rec.link_appr_to_learning_path,
373 p_final_score_formula_id => p_rec.final_score_formula_id,
374 p_update_personal_comp_profile => p_rec.update_personal_comp_profile,
375 p_comp_profile_source_type => p_rec.comp_profile_source_type,
376 p_show_competency_ratings => p_rec.show_competency_ratings,
377 p_show_objective_ratings => p_rec.show_objective_ratings,
378 p_show_overall_ratings => p_rec.show_overall_ratings,
379 p_show_overall_comments => p_rec.show_overall_comments,
380 p_provide_overall_feedback => p_rec.provide_overall_feedback,
381 p_show_participant_details => p_rec.show_participant_details,
382 p_allow_add_participant => p_rec.allow_add_participant,
383 p_show_additional_details => p_rec.show_additional_details,
384 p_show_participant_names => p_rec.show_participant_names,
385 p_show_participant_ratings => p_rec.show_participant_ratings,
386 p_available_flag => p_rec.available_flag,
387 p_show_questionnaire_info => p_rec.show_questionnaire_info,
388 p_ma_off_template_code => p_rec.ma_off_template_code,
389 p_appraisee_off_template_code => p_rec.appraisee_off_template_code,
390 p_other_part_off_template_code => p_rec.other_part_off_template_code,
391 p_part_app_off_template_code => p_rec.part_app_off_template_code,
392 p_part_rev_off_template_code => p_rec.part_rev_off_template_code
393 );
394 exception
395 when hr_api.cannot_find_prog_unit then
396 hr_api.cannot_find_prog_unit_error
397 ( p_module_name => 'PER_APPRAISAL_TEMPLATES'
398 ,p_hook_type => 'AI'
399 );
400 end;
401 -- End of API User Hook for post_insert.
402
403 hr_utility.set_location(' Leaving:'||l_proc, 10);
404 End post_insert;
405
406 -- ---------------------------------------------------------------------------+
407 -- |---------------------------------< ins >----------------------------------|
408 -- ---------------------------------------------------------------------------+
409 Procedure ins
410 (
411 p_rec in out nocopy per_apt_shd.g_rec_type,
412 p_effective_date in date ,
413 p_validate in boolean default false
414 ) is
415
416 l_proc varchar2(72) := g_package||'ins';
417
418 Begin
419 hr_utility.set_location('Entering:'||l_proc, 5);
420
421 -- Determine if the business process is to be validated.
422
423 If p_validate then
424
425 -- Issue the savepoint.
426
427 SAVEPOINT ins_per_apt;
428 End If;
429
430 -- Call the supporting insert validate operations
431
432 per_apt_bus.insert_validate(p_rec,p_effective_date);
433
434 -- Call the supporting pre-insert operation
435
436 pre_insert(p_rec);
437
438 -- Insert the row
439
440 insert_dml(p_rec);
441
442 -- Call the supporting post-insert operation
443
444 post_insert(p_rec);
445
446 -- If we are validating then raise the Validate_Enabled exception
447
448 If p_validate then
449 Raise HR_Api.Validate_Enabled;
450 End If;
451
452 hr_utility.set_location(' Leaving:'||l_proc, 10);
453 Exception
454 When HR_Api.Validate_Enabled Then
455
456 -- As the Validate_Enabled exception has been raised
457 -- we must rollback to the savepoint
458
459 ROLLBACK TO ins_per_apt;
460 end ins;
461
462 -- ---------------------------------------------------------------------------+
463 -- |---------------------------------< ins >----------------------------------|
464 -- ---------------------------------------------------------------------------+
465 Procedure ins
466 (
467 p_appraisal_template_id out nocopy number,
468 p_business_group_id in number,
469 p_object_version_number out nocopy number,
470 p_name in varchar2,
471 p_description in varchar2 default null,
472 p_instructions in varchar2 default null,
473 p_date_from in date default null,
474 p_date_to in date default null,
475 p_assessment_type_id in number default null,
476 p_rating_scale_id in number default null,
477 p_questionnaire_template_id in number default null,
478 p_attribute_category in varchar2 default null,
479 p_attribute1 in varchar2 default null,
480 p_attribute2 in varchar2 default null,
481 p_attribute3 in varchar2 default null,
482 p_attribute4 in varchar2 default null,
483 p_attribute5 in varchar2 default null,
484 p_attribute6 in varchar2 default null,
485 p_attribute7 in varchar2 default null,
486 p_attribute8 in varchar2 default null,
487 p_attribute9 in varchar2 default null,
488 p_attribute10 in varchar2 default null,
489 p_attribute11 in varchar2 default null,
490 p_attribute12 in varchar2 default null,
491 p_attribute13 in varchar2 default null,
492 p_attribute14 in varchar2 default null,
493 p_attribute15 in varchar2 default null,
494 p_attribute16 in varchar2 default null,
495 p_attribute17 in varchar2 default null,
496 p_attribute18 in varchar2 default null,
497 p_attribute19 in varchar2 default null,
498 p_attribute20 in varchar2 default null,
499 p_objective_asmnt_type_id in number default null,
500 p_ma_quest_template_id in number default null,
501 p_link_appr_to_learning_path in varchar2 default null,
502 p_final_score_formula_id in number default null,
503 p_update_personal_comp_profile in varchar2 default null,
504 p_comp_profile_source_type in varchar2 default null,
505 p_show_competency_ratings in varchar2 default null,
506 p_show_objective_ratings in varchar2 default null,
507 p_show_overall_ratings in varchar2 default null,
508 p_show_overall_comments in varchar2 default null,
509 p_provide_overall_feedback in varchar2 default null,
510 p_show_participant_details in varchar2 default null,
511 p_allow_add_participant in varchar2 default null,
512 p_show_additional_details in varchar2 default null,
513 p_show_participant_names in varchar2 default null,
514 p_show_participant_ratings in varchar2 default null,
515 p_available_flag in varchar2 default null,
516 p_show_questionnaire_info in varchar2 default null,
517 p_effective_date in date
518 ,p_ma_off_template_code in varchar2 default null
519 ,p_appraisee_off_template_code in varchar2 default null
520 ,p_other_part_off_template_code in varchar2 default null
521 ,p_part_app_off_template_code in varchar2 default null
522 ,p_part_rev_off_template_code in varchar2 default null,
523 p_validate in boolean default false
524 ) is
525
526 l_rec per_apt_shd.g_rec_type;
527 l_proc varchar2(72) := g_package||'ins';
528
529 Begin
530 hr_utility.set_location('Entering:'||l_proc, 5);
531
532 -- Call conversion function to turn arguments into the
533 -- p_rec structure.
534
535 l_rec :=
536 per_apt_shd.convert_args
537 (
538 null,
539 p_business_group_id,
540 null,
541 p_name,
542 p_description,
543 p_instructions,
544 p_date_from,
545 p_date_to,
546 p_assessment_type_id,
547 p_rating_scale_id,
548 p_questionnaire_template_id,
549 p_attribute_category,
550 p_attribute1,
551 p_attribute2,
552 p_attribute3,
553 p_attribute4,
554 p_attribute5,
555 p_attribute6,
556 p_attribute7,
557 p_attribute8,
558 p_attribute9,
559 p_attribute10,
560 p_attribute11,
561 p_attribute12,
562 p_attribute13,
563 p_attribute14,
564 p_attribute15,
565 p_attribute16,
566 p_attribute17,
567 p_attribute18,
568 p_attribute19,
569 p_attribute20,
570 p_objective_asmnt_type_id,
571 p_ma_quest_template_id,
572 p_link_appr_to_learning_path,
573 p_final_score_formula_id,
574 p_update_personal_comp_profile,
575 p_comp_profile_source_type,
576 p_show_competency_ratings,
577 p_show_objective_ratings,
578 p_show_overall_ratings,
579 p_show_overall_comments,
580 p_provide_overall_feedback,
581 p_show_participant_details,
582 p_allow_add_participant,
583 p_show_additional_details,
584 p_show_participant_names,
585 p_show_participant_ratings,
586 p_available_flag,
587 p_show_questionnaire_info,
588 p_ma_off_template_code,
589 p_appraisee_off_template_code,
590 p_other_part_off_template_code,
591 p_part_app_off_template_code,
592 p_part_rev_off_template_code
593 );
594
595 -- Having converted the arguments into the per_apt_rec
596 -- plsql record structure we call the corresponding record business process.
597
598 ins(l_rec,p_effective_date, p_validate);
599
600 -- As the primary key argument(s)
601 -- are specified as an OUT's we must set these values.
602
603 p_appraisal_template_id := l_rec.appraisal_template_id;
604 p_object_version_number := l_rec.object_version_number;
605
606 hr_utility.set_location(' Leaving:'||l_proc, 10);
607 End ins;
608
609 end per_apt_ins;