DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_APT_SHD

Source


1 Package Body per_apt_shd 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_shd.';  -- Global package name
9 -- ---------------------------------------------------------------------------+
10 -- |---------------------------< constraint_error >---------------------------|
11 -- ---------------------------------------------------------------------------+
12 Procedure constraint_error
13             (p_constraint_name in all_constraints.constraint_name%TYPE) Is
14 
15   l_proc 	varchar2(72) := g_package||'constraint_error';
16 
17 Begin
18   hr_utility.set_location('Entering:'||l_proc, 5);
19 
20   If (p_constraint_name = 'PER_APPRAISAL_TEMPLATES_FK1') Then
21     hr_utility.set_message(801, 'HR_7208_API_BUS_GRP_INVALID');
22     hr_utility.set_message_token('PROCEDURE', l_proc);
23     hr_utility.set_message_token('STEP','5');
24     hr_utility.raise_error;
25   ElsIf (p_constraint_name = 'PER_APPRAISAL_TEMPLATES_FK2') Then
26     hr_utility.set_message(801, 'HR_51912_APT_AST_NOT_EXIST');
27     hr_utility.set_message_token('PROCEDURE', l_proc);
28     hr_utility.set_message_token('STEP','10');
29     hr_utility.raise_error;
30   ElsIf (p_constraint_name = 'PER_APPRAISAL_TEMPLATES_FK3') Then
31     hr_utility.set_message(801, 'HR_51928_APT_RSC_NOT_EXIST');
32     hr_utility.set_message_token('PROCEDURE', l_proc);
33     hr_utility.set_message_token('STEP','15');
34     hr_utility.raise_error;
35   ElsIf (p_constraint_name = 'PER_APPRAISAL_TEMPLATES_FK4') Then
36     hr_utility.set_message(801, 'HR_51915_APT_QST_NOT_EXIST');
37     hr_utility.set_message_token('PROCEDURE', l_proc);
38     hr_utility.set_message_token('STEP','20');
39     hr_utility.raise_error;
40   ElsIf (p_constraint_name = 'PER_APPRAISAL_TEMPLATES_FK5') Then
41     fnd_message.set_name(801, 'HR_6153_ALL_PROCEDURE_FAIL');
42     fnd_message.set_token('PROCEDURE', l_proc);
43     fnd_message.set_token('STEP','25');
44     fnd_message.raise_error;
45   ElsIf (p_constraint_name = 'PER_APPRAISAL_TEMPLATES_FK6') Then
46     fnd_message.set_name(801, 'HR_6153_ALL_PROCEDURE_FAIL');
47     fnd_message.set_token('PROCEDURE', l_proc);
48     fnd_message.set_token('STEP','30');
49     fnd_message.raise_error;
50   ElsIf (p_constraint_name = 'PER_APPRAISAL_TEMPLATES_PK') Then
51     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
52     hr_utility.set_message_token('PROCEDURE', l_proc);
53     hr_utility.set_message_token('STEP','25');
54     hr_utility.raise_error;
55   ElsIf (p_constraint_name = 'PER_APPRAISAL_TEMPLATES_UK2') Then
56     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
57     hr_utility.set_message_token('PROCEDURE', l_proc);
58     hr_utility.set_message_token('STEP','30');
59     hr_utility.raise_error;
60   Else
61     hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
62     hr_utility.set_message_token('PROCEDURE', l_proc);
63     hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
64     hr_utility.raise_error;
65   End If;
66 
67   hr_utility.set_location(' Leaving:'||l_proc, 10);
68 End constraint_error;
69 
70 -- ---------------------------------------------------------------------------+
71 -- |-----------------------------< api_updating >-----------------------------|
72 -- ---------------------------------------------------------------------------+
73 Function api_updating
74   (
75   p_appraisal_template_id              in number,
76   p_object_version_number              in number
77   )      Return Boolean Is
78 
79 
80   -- Cursor selects the 'current' row from the HR Schema
81 
82   Cursor C_Sel1 is
83     select
84 		appraisal_template_id,
85 	business_group_id,
86 	object_version_number,
87 	name,
88 	description,
89 	instructions,
90 	date_from,
91 	date_to,
92 	assessment_type_id,
93 	rating_scale_id,
94 	questionnaire_template_id,
95 	attribute_category,
96 	attribute1,
97 	attribute2,
98 	attribute3,
99 	attribute4,
100 	attribute5,
101 	attribute6,
102 	attribute7,
103 	attribute8,
104 	attribute9,
105 	attribute10,
106 	attribute11,
107 	attribute12,
108 	attribute13,
109 	attribute14,
110 	attribute15,
111 	attribute16,
112 	attribute17,
113 	attribute18,
114 	attribute19,
115 	attribute20,
116 	objective_asmnt_type_id,
117     ma_quest_template_id,
118     link_appr_to_learning_path,
119     final_score_formula_id,
120     update_personal_comp_profile,
121     comp_profile_source_type,
122     show_competency_ratings,
123     show_objective_ratings,
124     show_overall_ratings,
125     show_overall_comments,
126     provide_overall_feedback,
127     show_participant_details,
128     allow_add_participant,
129     show_additional_details,
130     show_participant_names,
131     show_participant_ratings,
132     available_flag,
133 	  show_questionnaire_info,
134     ma_off_template_code,
135 	  appraisee_off_template_code,
136 	  other_part_off_template_code,
137 	  part_rev_off_template_code,
138 	  part_app_off_template_code
139     from	per_appraisal_templates
140     where	appraisal_template_id = p_appraisal_template_id;
141 
142   l_proc	varchar2(72)	:= g_package||'api_updating';
143   l_fct_ret	boolean;
144 
145 Begin
146   hr_utility.set_location('Entering:'||l_proc, 5);
147 
148   If (
149 	p_appraisal_template_id is null and
150 	p_object_version_number is null
151      ) Then
152 
153     -- One of the primary key arguments is null therefore we must
154     -- set the returning function value to false
155 
156     l_fct_ret := false;
157   Else
158     If (
159 	p_appraisal_template_id = g_old_rec.appraisal_template_id and
160 	p_object_version_number = g_old_rec.object_version_number
161        ) Then
162       hr_utility.set_location(l_proc, 10);
163 
164       -- The g_old_rec is current therefore we must
165       -- set the returning function to true
166 
167       l_fct_ret := true;
168     Else
169 
170       -- Select the current row into g_old_rec
171 
172       Open C_Sel1;
173       Fetch C_Sel1 Into g_old_rec;
174       If C_Sel1%notfound Then
175         Close C_Sel1;
176 
177         -- The primary key is invalid therefore we must error
178 
179         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
180         hr_utility.raise_error;
181       End If;
182       Close C_Sel1;
183       If (p_object_version_number <> g_old_rec.object_version_number) Then
184         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
185         hr_utility.raise_error;
186       End If;
187       hr_utility.set_location(l_proc, 15);
188       l_fct_ret := true;
189     End If;
190   End If;
191   hr_utility.set_location(' Leaving:'||l_proc, 20);
192   Return (l_fct_ret);
193 
194 End api_updating;
195 
196 -- ---------------------------------------------------------------------------+
197 -- |---------------------------------< lck >----------------------------------|
198 -- ---------------------------------------------------------------------------+
199 Procedure lck
200   (
201   p_appraisal_template_id              in number,
202   p_object_version_number              in number
203   ) is
204 
205 -- Cursor selects the 'current' row from the HR Schema
206 
207   Cursor C_Sel1 is
208     select 	appraisal_template_id,
209 	business_group_id,
210 	object_version_number,
211 	name,
212 	description,
213 	instructions,
214 	date_from,
215 	date_to,
216 	assessment_type_id,
217 	rating_scale_id,
218 	questionnaire_template_id,
219 	attribute_category,
220 	attribute1,
221 	attribute2,
222 	attribute3,
223 	attribute4,
224 	attribute5,
225 	attribute6,
226 	attribute7,
227 	attribute8,
228 	attribute9,
229 	attribute10,
230 	attribute11,
231 	attribute12,
232 	attribute13,
233 	attribute14,
234 	attribute15,
235 	attribute16,
236 	attribute17,
237 	attribute18,
238 	attribute19,
239 	attribute20,
240 	objective_asmnt_type_id,
241     ma_quest_template_id,
242     link_appr_to_learning_path,
243     final_score_formula_id,
244     update_personal_comp_profile,
245     comp_profile_source_type,
246     show_competency_ratings,
247     show_objective_ratings,
248     show_overall_ratings,
249     show_overall_comments,
250     provide_overall_feedback,
251     show_participant_details,
252     allow_add_participant,
253     show_additional_details,
254     show_participant_names,
255     show_participant_ratings,
256     available_flag,
257 	  show_questionnaire_info,
258     ma_off_template_code,
259 	  appraisee_off_template_code,
260 	  other_part_off_template_code,
261 	  part_rev_off_template_code,
262 	  part_app_off_template_code
263     from	per_appraisal_templates
264     where	appraisal_template_id = p_appraisal_template_id
265     for	update nowait;
266 
267   l_proc	varchar2(72) := g_package||'lck';
268 
269 Begin
270   hr_utility.set_location('Entering:'||l_proc, 5);
271 
272   -- Add any mandatory argument checking here:
273   -- Example:
274   -- hr_api.mandatory_arg_error
275   --   (p_api_name       => l_proc,
276   --    p_argument       => 'object_version_number',
277   --    p_argument_value => p_object_version_number);
278 
279   Open  C_Sel1;
280   Fetch C_Sel1 Into g_old_rec;
281   If C_Sel1%notfound then
282     Close C_Sel1;
283 
284     -- The primary key is invalid therefore we must error
285 
286     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
287     hr_utility.raise_error;
288   End If;
289   Close C_Sel1;
290   If (p_object_version_number <> g_old_rec.object_version_number) Then
291         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
292         hr_utility.raise_error;
293       End If;
294 
295   hr_utility.set_location(' Leaving:'||l_proc, 10);
296 
297 -- We need to trap the ORA LOCK exception
298 
299 Exception
300   When HR_Api.Object_Locked then
301 
302     -- The object is locked therefore we need to supply a meaningful
303     -- error message.
304 
305     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
306     hr_utility.set_message_token('TABLE_NAME', 'per_appraisal_templates');
307     hr_utility.raise_error;
308 End lck;
309 
310 -- ---------------------------------------------------------------------------+
311 -- |-----------------------------< convert_args >-----------------------------|
312 -- ---------------------------------------------------------------------------+
313 Function convert_args
314 	(
315 p_appraisal_template_id         in number,
316 	p_business_group_id             in number,
317 	p_object_version_number         in number,
318 	p_name                          in varchar2,
319 	p_description                   in varchar2,
320 	p_instructions                  in varchar2,
321 	p_date_from                     in date,
322 	p_date_to                       in date,
323 	p_assessment_type_id            in number,
324 	p_rating_scale_id               in number,
325 	p_questionnaire_template_id     in number,
326 	p_attribute_category            in varchar2,
327 	p_attribute1                    in varchar2,
328 	p_attribute2                    in varchar2,
329 	p_attribute3                    in varchar2,
330 	p_attribute4                    in varchar2,
331 	p_attribute5                    in varchar2,
332 	p_attribute6                    in varchar2,
333 	p_attribute7                    in varchar2,
334 	p_attribute8                    in varchar2,
335 	p_attribute9                    in varchar2,
336 	p_attribute10                   in varchar2,
337 	p_attribute11                   in varchar2,
338 	p_attribute12                   in varchar2,
339 	p_attribute13                   in varchar2,
340 	p_attribute14                   in varchar2,
341 	p_attribute15                   in varchar2,
342 	p_attribute16                   in varchar2,
343 	p_attribute17                   in varchar2,
344 	p_attribute18                   in varchar2,
345 	p_attribute19                   in varchar2,
346 	p_attribute20                   in varchar2
347    ,p_objective_asmnt_type_id        in number
348    ,p_ma_quest_template_id           in number
349   ,p_link_appr_to_learning_path     in varchar2
350   ,p_final_score_formula_id         in number
351   ,p_update_personal_comp_profile   in varchar2
352   ,p_comp_profile_source_type       in varchar2
353   ,p_show_competency_ratings        in varchar2
354   ,p_show_objective_ratings         in varchar2
355   ,p_show_overall_ratings           in varchar2
356   ,p_show_overall_comments          in varchar2
357   ,p_provide_overall_feedback       in varchar2
358   ,p_show_participant_details       in varchar2
359   ,p_allow_add_participant          in varchar2
360   ,p_show_additional_details        in varchar2
361   ,p_show_participant_names         in varchar2
362   ,p_show_participant_ratings       in varchar2
363   ,p_available_flag                 in varchar2
364   ,p_show_questionnaire_info        in varchar2
365   ,p_ma_off_template_code			      in varchar2
366   ,p_apraisee_off_template_code	 	  in varchar2
367   ,p_other_part_off_template_code  	in varchar2
368   ,p_part_app_off_template_code	  	in varchar2
369   ,p_part_rev_off_template_code 	  in varchar2
370 	)
371 	Return g_rec_type is
372 
373   l_rec	  g_rec_type;
374   l_proc  varchar2(72) := g_package||'convert_args';
375 
376 Begin
377 
378   hr_utility.set_location('Entering:'||l_proc, 5);
379 
380   -- Convert arguments into local l_rec structure.
381 
382   l_rec.appraisal_template_id            := p_appraisal_template_id;
383   l_rec.business_group_id                := p_business_group_id;
384   l_rec.object_version_number            := p_object_version_number;
385   l_rec.name                             := p_name;
386   l_rec.description                      := p_description;
387   l_rec.instructions                     := p_instructions;
388   l_rec.date_from                        := p_date_from;
389   l_rec.date_to                          := p_date_to;
390   l_rec.assessment_type_id               := p_assessment_type_id;
391   l_rec.rating_scale_id                  := p_rating_scale_id;
392   l_rec.questionnaire_template_id        := p_questionnaire_template_id;
393   l_rec.attribute_category               := p_attribute_category;
394   l_rec.attribute1                       := p_attribute1;
395   l_rec.attribute2                       := p_attribute2;
396   l_rec.attribute3                       := p_attribute3;
397   l_rec.attribute4                       := p_attribute4;
398   l_rec.attribute5                       := p_attribute5;
399   l_rec.attribute6                       := p_attribute6;
400   l_rec.attribute7                       := p_attribute7;
401   l_rec.attribute8                       := p_attribute8;
402   l_rec.attribute9                       := p_attribute9;
403   l_rec.attribute10                      := p_attribute10;
404   l_rec.attribute11                      := p_attribute11;
405   l_rec.attribute12                      := p_attribute12;
406   l_rec.attribute13                      := p_attribute13;
407   l_rec.attribute14                      := p_attribute14;
408   l_rec.attribute15                      := p_attribute15;
409   l_rec.attribute16                      := p_attribute16;
410   l_rec.attribute17                      := p_attribute17;
411   l_rec.attribute18                      := p_attribute18;
412   l_rec.attribute19                      := p_attribute19;
413   l_rec.attribute20                      := p_attribute20;
414   l_rec.objective_asmnt_type_id          := p_objective_asmnt_type_id;
415   l_rec.ma_quest_template_id             := p_ma_quest_template_id;
416   l_rec.link_appr_to_learning_path       := p_link_appr_to_learning_path;
417   l_rec.final_score_formula_id           := p_final_score_formula_id;
418   l_rec.update_personal_comp_profile     := p_update_personal_comp_profile;
419   l_rec.comp_profile_source_type         := p_comp_profile_source_type;
420   l_rec.show_competency_ratings          := p_show_competency_ratings;
421   l_rec.show_objective_ratings           := p_show_objective_ratings;
422   l_rec.show_overall_ratings             := p_show_overall_ratings;
423   l_rec.show_overall_comments            := p_show_overall_comments;
424   l_rec.provide_overall_feedback         := p_provide_overall_feedback;
425   l_rec.show_participant_details         := p_show_participant_details;
426   l_rec.allow_add_participant            := p_allow_add_participant;
427   l_rec.show_additional_details          := p_show_additional_details;
428   l_rec.show_participant_names           := p_show_participant_names;
429   l_rec.show_participant_ratings         := p_show_participant_ratings;
430   l_rec.available_flag                   := p_available_flag;
431   l_rec.show_questionnaire_info          := p_show_questionnaire_info;
432   l_rec.ma_off_template_code			       := p_ma_off_template_code;
433   l_rec.appraisee_off_template_code		   := p_apraisee_off_template_code;
434   l_rec.other_part_off_template_code	   := p_other_part_off_template_code;
435   l_rec.part_app_off_template_code		   := p_part_app_off_template_code;
436   l_rec.part_rev_off_template_code		   :=	p_part_rev_off_template_code;
437 
438   -- Return the plsql record structure.
439 
440   hr_utility.set_location(' Leaving:'||l_proc, 10);
441   Return(l_rec);
442 
443 End convert_args;
444 
445 end per_apt_shd;