DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_APR_SHD

Source


1 Package Body per_apr_shd as
2 /* $Header: peaprrhi.pkb 120.8.12010000.4 2008/08/06 08:57:14 ubhat ship $ */
3 
4 -- ---------------------------------------------------------------------------+
5 -- |                     Private Global Definitions                           |
6 -- ---------------------------------------------------------------------------+
7 
8 g_package  varchar2(33)	:= '  per_apr_shd.';  -- Global package name
9 
10 -- ---------------------------------------------------------------------------+
11 -- |---------------------------< constraint_error >---------------------------|
12 -- ---------------------------------------------------------------------------+
13 Procedure constraint_error
14             (p_constraint_name in all_constraints.constraint_name%TYPE) Is
15 
16   l_proc 	varchar2(72) := g_package||'constraint_error';
17 
18 Begin
19   hr_utility.set_location('Entering:'||l_proc, 5);
20 
21   If (p_constraint_name = 'PER_APPRAISALS_FK1') Then
22     hr_utility.set_message(801, 'HR_7208_API_BUS_GRP_INVALID');
23     hr_utility.set_message_token('PROCEDURE', l_proc);
24     hr_utility.set_message_token('STEP','5');
25     hr_utility.raise_error;
26   ElsIf (p_constraint_name = 'PER_APPRAISALS_FK2') Then
27     hr_utility.set_message(801,'HR_52246_APR_TEMP_NOT_EXIST');
28     hr_utility.set_message_token('PROCEDURE', l_proc);
29     hr_utility.set_message_token('STEP','10');
30     hr_utility.raise_error;
31   ElsIf (p_constraint_name = 'PER_APPRAISALS_FK3') Then
32     hr_utility.set_message(801,'HR_51898_APR_NO_SUCH_LEVEL');
33     hr_utility.set_message_token('PROCEDURE', l_proc);
34     hr_utility.set_message_token('STEP','15');
35     hr_utility.raise_error;
36   ElsIf (p_constraint_name = 'PER_APPRAISALS_PK') Then
37     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
38     hr_utility.set_message_token('PROCEDURE', l_proc);
39     hr_utility.set_message_token('STEP','20');
40     hr_utility.raise_error;
41   Else
42     hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
43     hr_utility.set_message_token('PROCEDURE', l_proc);
44     hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
45     hr_utility.raise_error;
46   End If;
47 
48   hr_utility.set_location(' Leaving:'||l_proc, 10);
49 End constraint_error;
50 
51 -- ---------------------------------------------------------------------------+
52 -- |-----------------------------< api_updating >-----------------------------|
53 -- ---------------------------------------------------------------------------+
54 Function api_updating
55   (
56   p_appraisal_id                       in number,
57   p_object_version_number              in number
58   )      Return Boolean Is
59 
60 
61   -- Cursor selects the 'current' row from the HR Schema
62 
63   Cursor C_Sel1 is
64     select
65 	appraisal_id,
66 	business_group_id,
67 	object_version_number,
68 	appraisal_template_id,
69 	appraisee_person_id,
70 	appraiser_person_id,
71 	appraisal_date,
72 	appraisal_period_end_date,
73 	appraisal_period_start_date,
74 	type,
75 	next_appraisal_date,
76 	status,
77 	group_date,
78 	group_initiator_id,
79 	comments,
80 	overall_performance_level_id,
81 	open,
82 	attribute_category,
83 	attribute1,
84 	attribute2,
85 	attribute3,
86 	attribute4,
87 	attribute5,
88 	attribute6,
89 	attribute7,
90 	attribute8,
91 	attribute9,
92 	attribute10,
93 	attribute11,
94 	attribute12,
95 	attribute13,
96 	attribute14,
97 	attribute15,
98 	attribute16,
99 	attribute17,
100 	attribute18,
101 	attribute19,
102 	attribute20,
103 	system_type,
104 	system_params,
105 	appraisee_access,
106 	main_appraiser_id,
107 	assignment_id,
108 	assignment_start_date,
109 	assignment_business_group_id,
110 	assignment_organization_id  ,
111 	assignment_job_id           ,
112 	assignment_position_id      ,
113 	assignment_grade_id ,
114 	appraisal_system_status,
115 	potential_readiness_level,
116 	potential_short_term_workopp,
117 	potential_long_term_workopp,
118 	potential_details,
119 	event_id,
120         show_competency_ratings,
121         show_objective_ratings,
122         show_questionnaire_info,
123         show_participant_details,
124         show_participant_ratings,
125         show_participant_names,
126         show_overall_ratings,
127         show_overall_comments,
128         update_appraisal,
129         provide_overall_feedback,
130         appraisee_comments,
131         plan_id,
132         offline_status
133     from	per_appraisals
134     where	appraisal_id = p_appraisal_id;
135 
136   l_proc	varchar2(72)	:= g_package||'api_updating';
137   l_fct_ret	boolean;
138 
139 Begin
140   hr_utility.set_location('Entering:'||l_proc, 5);
141 
142   If (
143 	p_appraisal_id is null and
144 	p_object_version_number is null
145      ) Then
146 
147     -- One of the primary key arguments is null therefore we must
148     -- set the returning function value to false
149 
150     l_fct_ret := false;
151   Else
152     If (
153 	p_appraisal_id = g_old_rec.appraisal_id and
154 	p_object_version_number = g_old_rec.object_version_number
155        ) Then
156       hr_utility.set_location(l_proc, 10);
157 
158       -- The g_old_rec is current therefore we must
159       -- set the returning function to true
160 
161       l_fct_ret := true;
162     Else
163 
164       -- Select the current row into g_old_rec
165 
166       Open C_Sel1;
167       Fetch C_Sel1 Into g_old_rec;
168       If C_Sel1%notfound Then
169         Close C_Sel1;
170 
171         -- The primary key is invalid therefore we must error
172 
173         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
174         hr_utility.raise_error;
175       End If;
176       Close C_Sel1;
177       If (p_object_version_number <> g_old_rec.object_version_number) Then
178         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
179         hr_utility.raise_error;
180       End If;
181       hr_utility.set_location(l_proc, 15);
182       l_fct_ret := true;
183     End If;
184   End If;
185   hr_utility.set_location(' Leaving:'||l_proc, 20);
186   Return (l_fct_ret);
187 
188 End api_updating;
189 
190 -- ---------------------------------------------------------------------------+
191 -- |---------------------------------< lck >----------------------------------|
192 -- ---------------------------------------------------------------------------+
193 Procedure lck
194   (
195   p_appraisal_id                       in number,
196   p_object_version_number              in number
197   ) is
198 
199 -- Cursor selects the 'current' row from the HR Schema
200 
201   Cursor C_Sel1 is
202   select
203 	appraisal_id,
204 	business_group_id,
205 	object_version_number,
206 	appraisal_template_id,
207 	appraisee_person_id,
208 	appraiser_person_id,
209 	appraisal_date,
210 	appraisal_period_end_date,
211 	appraisal_period_start_date,
212 	type,
213 	next_appraisal_date,
214 	status,
215 	group_date,
216 	group_initiator_id,
217 	comments,
218 	overall_performance_level_id,
219 	open,
220 	attribute_category,
221 	attribute1,
222 	attribute2,
223 	attribute3,
224 	attribute4,
225 	attribute5,
226 	attribute6,
227 	attribute7,
228 	attribute8,
229 	attribute9,
230 	attribute10,
231 	attribute11,
232 	attribute12,
233 	attribute13,
234 	attribute14,
235 	attribute15,
236 	attribute16,
237 	attribute17,
238 	attribute18,
239 	attribute19,
240 	attribute20,
241 	system_type,
242 	system_params,
243 	appraisee_access,
244 	main_appraiser_id,
245 	assignment_id,
246 	assignment_start_date,
247 	assignment_business_group_id,
248 	assignment_organization_id  ,
249 	assignment_job_id           ,
250 	assignment_position_id      ,
251 	assignment_grade_id ,
252 	appraisal_system_status,
253 	potential_readiness_level ,
254 	potential_short_term_workopp ,
255 	potential_long_term_workopp ,
256 	potential_details ,
257         event_id,
258         show_competency_ratings,
259         show_objective_ratings,
260         show_questionnaire_info,
261         show_participant_details,
262         show_participant_ratings,
263         show_participant_names,
264         show_overall_ratings,
265         show_overall_comments,
266         update_appraisal,
267         provide_overall_feedback,
268         appraisee_comments,
269         plan_id,
270         offline_status
271     from	per_appraisals
272     where	appraisal_id = p_appraisal_id
273     for	update nowait;
274 
275   l_proc	varchar2(72) := g_package||'lck';
276 
277 Begin
278   hr_utility.set_location('Entering:'||l_proc, 5);
279 
280   -- Add any mandatory argument checking here:
281   -- Example:
282   -- hr_api.mandatory_arg_error
283   --   (p_api_name       => l_proc,
284   --    p_argument       => 'object_version_number',
285   --    p_argument_value => p_object_version_number);
286 
287   Open  C_Sel1;
288   Fetch C_Sel1 Into g_old_rec;
289   If C_Sel1%notfound then
290     Close C_Sel1;
291 
292     -- The primary key is invalid therefore we must error
293 
294     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
295     hr_utility.raise_error;
296   End If;
297   Close C_Sel1;
298   If (p_object_version_number <> g_old_rec.object_version_number) Then
299         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
300         hr_utility.raise_error;
301       End If;
302 
303   hr_utility.set_location(' Leaving:'||l_proc, 10);
304 
305 -- We need to trap the ORA LOCK exception
306 
307 Exception
308   When HR_Api.Object_Locked then
309 
310     -- The object is locked therefore we need to supply a meaningful
311     -- error message.
312 
313     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
314     hr_utility.set_message_token('TABLE_NAME', 'per_appraisals');
315     hr_utility.raise_error;
316 End lck;
317 
318 -- ---------------------------------------------------------------------------+
319 -- |-----------------------------< convert_args >-----------------------------|
320 -- ---------------------------------------------------------------------------+
321 Function convert_args
322 	(
323 	p_appraisal_id                  in number,
324 	p_business_group_id             in number,
325 	p_object_version_number         in number,
326 	p_appraisal_template_id         in number,
327 	p_appraisee_person_id           in number,
328 	p_appraiser_person_id           in number,
329 	p_appraisal_date                in date,
330 	p_appraisal_period_end_date     in date,
331 	p_appraisal_period_start_date   in date,
332 	p_type                          in varchar2,
333 	p_next_appraisal_date           in date,
334 	p_status                        in varchar2,
335 	p_group_date			in date,
336 	p_group_initiator_id		in number,
337 	p_comments                      in varchar2,
338 	p_overall_performance_level_id  in number,
339 	p_open                          in varchar2,
340 	p_attribute_category            in varchar2,
341 	p_attribute1                    in varchar2,
342 	p_attribute2                    in varchar2,
343 	p_attribute3                    in varchar2,
344 	p_attribute4                    in varchar2,
345 	p_attribute5                    in varchar2,
346 	p_attribute6                    in varchar2,
347 	p_attribute7                    in varchar2,
348 	p_attribute8                    in varchar2,
349 	p_attribute9                    in varchar2,
350 	p_attribute10                   in varchar2,
351 	p_attribute11                   in varchar2,
352 	p_attribute12                   in varchar2,
353 	p_attribute13                   in varchar2,
354 	p_attribute14                   in varchar2,
355 	p_attribute15                   in varchar2,
356 	p_attribute16                   in varchar2,
357 	p_attribute17                   in varchar2,
358 	p_attribute18                   in varchar2,
359 	p_attribute19                   in varchar2,
360 	p_attribute20                   in varchar2,
361 	p_system_type                   in varchar2,
362 	p_system_params                 in varchar2,
363 	p_appraisee_access              in varchar2,
364 	p_main_appraiser_id             in number,
365 	p_assignment_id                 in number,
366 	p_assignment_start_date         in date,
367 	p_asg_business_group_id         in number,
368 	p_assignment_organization_id    in number,
369 	p_assignment_job_id             in number,
370 	p_assignment_position_id        in number,
371 	p_assignment_grade_id           in number,
372 	p_appraisal_system_status       in varchar2,
373 	p_potential_readiness_level 	in varchar2,
374 	p_potential_short_term_workopp  in varchar2,
375 	p_potential_long_term_workopp   in varchar2,
376 	p_potential_details             in varchar2,
377 	p_event_id                      in number,
378         p_show_competency_ratings      in varchar2,
379         p_show_objective_ratings       in varchar2,
380         p_show_questionnaire_info      in varchar2,
381         p_show_participant_details     in varchar2,
382         p_show_participant_ratings     in varchar2,
383         p_show_participant_names       in varchar2,
384         p_show_overall_ratings         in varchar2,
385         p_show_overall_comments        in varchar2,
386         p_update_appraisal             in varchar2,
387         p_provide_overall_feedback     in varchar2,
388         p_appraisee_comments           in varchar2,
389         p_plan_id                      in number,
390         p_offline_status               in varchar2
391 	)
392 	Return g_rec_type is
393 
394   l_rec	  g_rec_type;
395   l_proc  varchar2(72) := g_package||'convert_args';
396 
397 Begin
398 
399   hr_utility.set_location('Entering:'||l_proc, 5);
400 
401   -- Convert arguments into local l_rec structure.
402 
403   l_rec.appraisal_id                     := p_appraisal_id;
404   l_rec.business_group_id                := p_business_group_id;
405   l_rec.object_version_number            := p_object_version_number;
406   l_rec.appraisal_template_id            := p_appraisal_template_id;
407   l_rec.appraisee_person_id              := p_appraisee_person_id;
408   l_rec.appraiser_person_id              := p_appraiser_person_id;
409   l_rec.appraisal_date                   := p_appraisal_date;
410   l_rec.appraisal_period_end_date        := p_appraisal_period_end_date;
411   l_rec.appraisal_period_start_date      := p_appraisal_period_start_date;
412 
413   l_rec.assignment_business_group_id     := p_asg_business_group_id;
414   l_rec.assignment_organization_id       := p_assignment_organization_id  ;
415   l_rec.assignment_job_id                := p_assignment_job_id           ;
416   l_rec.assignment_position_id           := p_assignment_position_id      ;
417   l_rec.assignment_grade_id              := p_assignment_grade_id         ;
418 
419   l_rec.type                             := p_type;
420   l_rec.next_appraisal_date              := p_next_appraisal_date;
421   l_rec.status                           := p_status;
422   l_rec.group_date			 := p_group_date;
423   l_rec.group_initiator_id		 := p_group_initiator_id;
424   l_rec.comments                         := p_comments;
425   l_rec.overall_performance_level_id     := p_overall_performance_level_id;
426   l_rec.open                             := p_open;
427   l_rec.attribute_category               := p_attribute_category;
428   l_rec.attribute1                       := p_attribute1;
429   l_rec.attribute2                       := p_attribute2;
430   l_rec.attribute3                       := p_attribute3;
431   l_rec.attribute4                       := p_attribute4;
432   l_rec.attribute5                       := p_attribute5;
433   l_rec.attribute6                       := p_attribute6;
434   l_rec.attribute7                       := p_attribute7;
435   l_rec.attribute8                       := p_attribute8;
436   l_rec.attribute9                       := p_attribute9;
437   l_rec.attribute10                      := p_attribute10;
438   l_rec.attribute11                      := p_attribute11;
439   l_rec.attribute12                      := p_attribute12;
440   l_rec.attribute13                      := p_attribute13;
441   l_rec.attribute14                      := p_attribute14;
442   l_rec.attribute15                      := p_attribute15;
443   l_rec.attribute16                      := p_attribute16;
444   l_rec.attribute17                      := p_attribute17;
445   l_rec.attribute18                      := p_attribute18;
446   l_rec.attribute19                      := p_attribute19;
447   l_rec.attribute20                      := p_attribute20;
448   l_rec.system_type                      := p_system_type;
449   l_rec.system_params                    := p_system_params;
450   l_rec.appraisee_access                 := p_appraisee_access;
451   l_rec.main_appraiser_id                := p_main_appraiser_id;
452   l_rec.assignment_id                    := p_assignment_id;
453   l_rec.assignment_start_date            := p_assignment_start_date;
454   l_rec.assignment_business_group_id     := p_asg_business_group_id;
455   l_rec.assignment_organization_id       := p_assignment_organization_id  ;
456   l_rec.assignment_job_id                := p_assignment_job_id           ;
457   l_rec.assignment_position_id           := p_assignment_position_id      ;
458   l_rec.assignment_grade_id              := p_assignment_grade_id ;
459   l_rec.appraisal_system_status          := p_appraisal_system_status;
460   l_rec.potential_readiness_level        := p_potential_readiness_level;
461   l_rec.potential_short_term_workopp     := p_potential_short_term_workopp  ;
462   l_rec.potential_long_term_workopp      := p_potential_long_term_workopp           ;
463   l_rec.potential_details                := p_potential_details      ;
464   l_rec.event_id                         := p_event_id ;
465   l_rec.show_competency_ratings          := p_show_competency_ratings;
466   l_rec.show_objective_ratings           := p_show_objective_ratings;
467   l_rec.show_questionnaire_info          := p_show_questionnaire_info;
468   l_rec.show_participant_details         := p_show_participant_details;
469   l_rec.show_participant_ratings         := p_show_participant_ratings;
470   l_rec.show_participant_names           := p_show_participant_names;
471   l_rec.show_overall_ratings             := p_show_overall_ratings;
472   l_rec.show_overall_comments            := p_show_overall_comments;
473   l_rec.update_appraisal                 := p_update_appraisal;
474   l_rec.provide_overall_feedback         := p_provide_overall_feedback;
475   l_rec.appraisee_comments               := p_appraisee_comments;
476   l_rec.plan_id                          := p_plan_id;
477   l_rec.offline_status                   := p_offline_status;
478 
479 
480   -- Return the plsql record structure.
481 
482   hr_utility.set_location(' Leaving:'||l_proc, 10);
483   Return(l_rec);
484 
485 End convert_args;
486 
487 end per_apr_shd;