DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_OBJ_SHD

Source


1 Package Body per_obj_shd as
2 /* $Header: peobjrhi.pkb 120.16.12010000.4 2008/11/05 05:52:10 rvagvala ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_obj_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_OBJECTIVES_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_OBJECTIVES_FK2') Then
26     hr_utility.set_message(801,'HR_52054_OBJ_APR_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_OBJECTIVES_PK') Then
31     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
32     hr_utility.set_message_token('PROCEDURE', l_proc);
33     hr_utility.set_message_token('STEP','15');
34     hr_utility.raise_error;
35   Else
36     hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
37     hr_utility.set_message_token('PROCEDURE', l_proc);
38     hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
39     hr_utility.raise_error;
40   End If;
41   --
42   hr_utility.set_location(' Leaving:'||l_proc, 10);
43 End constraint_error;
44 --
45 -- ----------------------------------------------------------------------------
46 -- |-----------------------------< api_updating >-----------------------------|
47 -- ----------------------------------------------------------------------------
48 Function api_updating
49   (
50   p_objective_id                       in number,
51   p_object_version_number              in number
52   )      Return Boolean Is
53 --
54   --
55   -- Cursor selects the 'current' row from the HR Schema
56   --
57   Cursor C_Sel1 is
58     select
59 	objective_id,
60 	name,
61 	target_date,
62 	start_date,
63 	business_group_id,
64 	object_version_number,
65 	owning_person_id,
66 	achievement_date,
67 	detail,
68 	comments,
69 	success_criteria,
70 	appraisal_id,
71 	attribute_category,
72 	attribute1,
73 	attribute2,
74 	attribute3,
75 	attribute4,
76 	attribute5,
77 	attribute6,
78 	attribute7,
79 	attribute8,
80 	attribute9,
81 	attribute10,
82 	attribute11,
83 	attribute12,
84 	attribute13,
85 	attribute14,
86 	attribute15,
87 	attribute16,
88 	attribute17,
89 	attribute18,
90 	attribute19,
91 	attribute20,
92 	attribute21,
93 	attribute22,
94 	attribute23,
95 	attribute24,
96 	attribute25,
97 	attribute26,
98 	attribute27,
99 	attribute28,
100 	attribute29,
101 	attribute30,
102 
103         scorecard_id,
104         copied_from_library_id,
105         copied_from_objective_id,
106         aligned_with_objective_id,
107 
108         next_review_date,
109         group_code,
110         priority_code,
111         appraise_flag,
112         verified_flag,
113 
114         target_value,
115         actual_value,
116         weighting_percent,
117         complete_percent,
118         uom_code,
119 
120         measurement_style_code,
121         measure_name,
122         measure_type_code,
123         measure_comments ,
124         sharing_access_code
125 
126     from	per_objectives
127     where	objective_id = p_objective_id;
128 --
129   l_proc	varchar2(72)	:= g_package||'api_updating';
130   l_fct_ret	boolean;
131 --
132 Begin
133   hr_utility.set_location('Entering:'||l_proc, 5);
134   --
135   If (
136 	p_objective_id is null and
137 	p_object_version_number is null
138      ) Then
139     --
140     -- One of the primary key arguments is null therefore we must
141     -- set the returning function value to false
142     --
143     l_fct_ret := false;
144   Else
145     If (
146 	p_objective_id = g_old_rec.objective_id and
147 	p_object_version_number = g_old_rec.object_version_number
148        ) Then
149       hr_utility.set_location(l_proc, 10);
150       --
151       -- The g_old_rec is current therefore we must
152       -- set the returning function to true
153       --
154       l_fct_ret := true;
155     Else
156       --
157       -- Select the current row into g_old_rec
158       --
159       Open C_Sel1;
160       Fetch C_Sel1 Into g_old_rec;
161       If C_Sel1%notfound Then
162         Close C_Sel1;
163         --
164         -- The primary key is invalid therefore we must error
165         --
166         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
167         hr_utility.raise_error;
168       else
169         Close C_Sel1;
170       End If;
171       If (p_object_version_number <> g_old_rec.object_version_number) Then
172         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
173         hr_utility.raise_error;
174       End If;
175       hr_utility.set_location(l_proc, 15);
176       l_fct_ret := true;
177     End If;
178   End If;
179   hr_utility.set_location(' Leaving:'||l_proc, 20);
180   Return (l_fct_ret);
181 --
182 End api_updating;
183 --
184 -- ----------------------------------------------------------------------------
185 -- |---------------------------------< lck >----------------------------------|
186 -- ----------------------------------------------------------------------------
187 Procedure lck
188   (
189   p_objective_id                       in number,
190   p_object_version_number              in number
191   ) is
192 --
193 -- Cursor selects the 'current' row from the HR Schema
194 --
195   Cursor C_Sel1 is
196     select
197         objective_id,
198 	name,
199 	target_date,
200 	start_date,
201 	business_group_id,
202 	object_version_number,
203 	owning_person_id,
204 	achievement_date,
205 	detail,
206 	comments,
207 	success_criteria,
208 	appraisal_id,
209 	attribute_category,
210 	attribute1,
211 	attribute2,
212 	attribute3,
213 	attribute4,
214 	attribute5,
215 	attribute6,
216 	attribute7,
217 	attribute8,
218 	attribute9,
219 	attribute10,
220 	attribute11,
221 	attribute12,
222 	attribute13,
223 	attribute14,
224 	attribute15,
225 	attribute16,
226 	attribute17,
227 	attribute18,
228 	attribute19,
229 	attribute20,
230 
231 	attribute21,
232 	attribute22,
233 	attribute23,
234 	attribute24,
235 	attribute25,
236 	attribute26,
237 	attribute27,
238 	attribute28,
239 	attribute29,
240 	attribute30,
241 
242         scorecard_id,
243         copied_from_library_id,
244         copied_from_objective_id,
245         aligned_with_objective_id,
246 
247         next_review_date,
248         group_code,
249         priority_code,
250         appraise_flag,
251         verified_flag,
252 
253         target_value,
254         actual_value,
255         weighting_percent,
256         complete_percent,
257         uom_code,
258 
259         measurement_style_code,
260         measure_name,
261         measure_type_code,
262         measure_comments ,
263         sharing_access_code
264 
265     from	per_objectives
266     where	objective_id = p_objective_id
267     for	update nowait;
268 --
269   l_proc	varchar2(72) := g_package||'lck';
270 --
271 Begin
272   hr_utility.set_location('Entering:'||l_proc, 5);
273   --
274   -- Add any mandatory argument checking here:
275   -- Example:
276   -- hr_api.mandatory_arg_error
277   --   (p_api_name       => l_proc,
278   --    p_argument       => 'object_version_number',
279   --    p_argument_value => p_object_version_number);
280   --
281   Open  C_Sel1;
282   Fetch C_Sel1 Into g_old_rec;
283   If C_Sel1%notfound then
284     Close C_Sel1;
285     --
286     -- The primary key is invalid therefore we must error
287     --
288     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
289     hr_utility.raise_error;
290   else
291     Close C_Sel1;
292   End If;
293 
294   If (p_object_version_number <> g_old_rec.object_version_number) Then
295         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
296         hr_utility.raise_error;
297       End If;
298 --
299   hr_utility.set_location(' Leaving:'||l_proc, 10);
300 --
301 -- We need to trap the ORA LOCK exception
302 --
303 Exception
304   When HR_Api.Object_Locked then
305     --
306     -- The object is locked therefore we need to supply a meaningful
307     -- error message.
308     --
309     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
310     hr_utility.set_message_token('TABLE_NAME', 'per_objectives');
311     hr_utility.raise_error;
312 End lck;
313 --
314 -- ----------------------------------------------------------------------------
315 -- |-----------------------------< convert_args >-----------------------------|
316 -- ----------------------------------------------------------------------------
317 Function convert_args
318 	(
319 	p_objective_id                  in number,
320 	p_name                          in varchar2,
321 	p_target_date                   in date,
322 	p_start_date                    in date,
323 	p_business_group_id             in number,
324 	p_object_version_number         in number,
325 	p_owning_person_id              in number,
326 	p_achievement_date              in date,
327 	p_detail                        in varchar2,
328 	p_comments                      in varchar2,
329 	p_success_criteria              in varchar2,
330 	p_appraisal_id                  in number,
331 	p_attribute_category            in varchar2,
332 	p_attribute1                    in varchar2,
333 	p_attribute2                    in varchar2,
334 	p_attribute3                    in varchar2,
335 	p_attribute4                    in varchar2,
336 	p_attribute5                    in varchar2,
337 	p_attribute6                    in varchar2,
338 	p_attribute7                    in varchar2,
339 	p_attribute8                    in varchar2,
340 	p_attribute9                    in varchar2,
341 	p_attribute10                   in varchar2,
342 	p_attribute11                   in varchar2,
343 	p_attribute12                   in varchar2,
344 	p_attribute13                   in varchar2,
345 	p_attribute14                   in varchar2,
346 	p_attribute15                   in varchar2,
347 	p_attribute16                   in varchar2,
348 	p_attribute17                   in varchar2,
349 	p_attribute18                   in varchar2,
350 	p_attribute19                   in varchar2,
351 	p_attribute20                   in varchar2,
352 
353         p_attribute21                   in varchar2,
354         p_attribute22                   in varchar2,
355         p_attribute23                   in varchar2,
356         p_attribute24                   in varchar2,
357         p_attribute25                   in varchar2,
358         p_attribute26                   in varchar2,
359         p_attribute27                   in varchar2,
360         p_attribute28                   in varchar2,
361         p_attribute29                   in varchar2,
362         p_attribute30                   in varchar2,
363 
364         p_scorecard_id                  in  number,
365         p_copied_from_library_id        in  number,
366         p_copied_from_objective_id      in number,
367         p_aligned_with_objective_id     in number,
368 
369         p_next_review_date              in date,
370         p_group_code                    in varchar2,
371         p_priority_code                 in varchar2,
372         p_appraise_flag                 in varchar2,
373         p_verified_flag                 in varchar2,
374 
375         p_target_value                  in number,
376         p_actual_value                  in number,
377         p_weighting_percent             in number,
378         p_complete_percent              in number,
379         p_uom_code                      in varchar2,
380 
381         p_measurement_style_code        in varchar2,
382         p_measure_name                  in varchar2,
383         p_measure_type_code             in varchar2,
384         p_measure_comments              in varchar2,
385         p_sharing_access_code           in varchar2
386 
387 	)
388 	Return g_rec_type is
389 --
390   l_rec	  g_rec_type;
391   l_proc  varchar2(72) := g_package||'convert_args';
392 --
393 Begin
394   --
395   hr_utility.set_location('Entering:'||l_proc, 5);
396   --
397   -- Convert arguments into local l_rec structure.
398   --
399   l_rec.objective_id                     := p_objective_id;
400   l_rec.name                             := p_name;
401   l_rec.target_date                      := p_target_date;
402   l_rec.start_date                       := p_start_date;
403   l_rec.business_group_id                := p_business_group_id;
404   l_rec.object_version_number            := p_object_version_number;
405   l_rec.owning_person_id                 := p_owning_person_id;
406   l_rec.achievement_date                 := p_achievement_date;
407   l_rec.detail                           := p_detail;
408   l_rec.comments                         := p_comments;
409   l_rec.success_criteria                 := p_success_criteria;
410   l_rec.appraisal_id                     := p_appraisal_id;
411   l_rec.attribute_category               := p_attribute_category;
412   l_rec.attribute1                       := p_attribute1;
413   l_rec.attribute2                       := p_attribute2;
414   l_rec.attribute3                       := p_attribute3;
415   l_rec.attribute4                       := p_attribute4;
416   l_rec.attribute5                       := p_attribute5;
417   l_rec.attribute6                       := p_attribute6;
418   l_rec.attribute7                       := p_attribute7;
419   l_rec.attribute8                       := p_attribute8;
420   l_rec.attribute9                       := p_attribute9;
421   l_rec.attribute10                      := p_attribute10;
422   l_rec.attribute11                      := p_attribute11;
423   l_rec.attribute12                      := p_attribute12;
424   l_rec.attribute13                      := p_attribute13;
425   l_rec.attribute14                      := p_attribute14;
426   l_rec.attribute15                      := p_attribute15;
427   l_rec.attribute16                      := p_attribute16;
428   l_rec.attribute17                      := p_attribute17;
429   l_rec.attribute18                      := p_attribute18;
430   l_rec.attribute19                      := p_attribute19;
431   l_rec.attribute20                      := p_attribute20;
432 
433   l_rec.attribute21                      := p_attribute21;
434   l_rec.attribute22                      := p_attribute22;
435   l_rec.attribute23                      := p_attribute23;
436   l_rec.attribute24                      := p_attribute24;
437   l_rec.attribute25                      := p_attribute25;
438   l_rec.attribute26                      := p_attribute26;
439   l_rec.attribute27                      := p_attribute27;
440   l_rec.attribute28                      := p_attribute28;
441   l_rec.attribute29                      := p_attribute29;
442   l_rec.attribute30                      := p_attribute30;
443 
444   l_rec.scorecard_id                     := p_scorecard_id;
445   l_rec.copied_from_library_id           := p_copied_from_library_id;
446   l_rec.copied_from_objective_id         := p_copied_from_objective_id;
447   l_rec.aligned_with_objective_id        := p_aligned_with_objective_id;
448 
449   l_rec.next_review_date                 := p_next_review_date;
450   l_rec.group_code                       := p_group_code;
451   l_rec.priority_code                    := p_priority_code;
452   l_rec.appraise_flag                    := p_appraise_flag;
453   l_rec.verified_flag                    := p_verified_flag;
454 
455   l_rec.target_value                     := p_target_value;
456   l_rec.actual_value                     := p_actual_value;
457   l_rec.weighting_percent                := p_weighting_percent;
458   l_rec.complete_percent                 := p_complete_percent;
459   l_rec.uom_code                         := p_uom_code;
460 
461   l_rec.measurement_style_code           := p_measurement_style_code;
462   l_rec.measure_name                     := p_measure_name;
463   l_rec.measure_type_code                := p_measure_type_code;
464   l_rec.measure_comments                 := p_measure_comments;
465   l_rec.sharing_access_code              := p_sharing_access_code;
466 
467   --
468   -- Return the plsql record structure.
469   --
470   hr_utility.set_location(' Leaving:'||l_proc, 10);
471   Return(l_rec);
472 --
473 End convert_args;
474 --
475 end per_obj_shd;