DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_PMP_SHD

Source


1 Package Body per_pmp_shd as
2 /* $Header: pepmprhi.pkb 120.8 2006/07/28 22:03:57 svittal noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  per_pmp_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |---------------------------< constraint_error >---------------------------|
12 -- ----------------------------------------------------------------------------
13 Procedure constraint_error
14   (p_constraint_name in all_constraints.constraint_name%TYPE
15   ) Is
16 --
17   l_proc        varchar2(72) := g_package||'constraint_error';
18 --
19 Begin
20   --
21   If (p_constraint_name = 'PER_PERF_MGMT_PLANS_PK') Then
22     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
23     fnd_message.set_token('PROCEDURE', l_proc);
24     fnd_message.set_token('STEP','5');
25     fnd_message.raise_error;
26   Else
27     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
28     fnd_message.set_token('PROCEDURE', l_proc);
29     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
30     fnd_message.raise_error;
31   End If;
32   --
33 End constraint_error;
34 --
35 -- ----------------------------------------------------------------------------
36 -- |-----------------------------< api_updating >-----------------------------|
37 -- ----------------------------------------------------------------------------
38 Function api_updating
39   (p_plan_id                              in     number
40   ,p_object_version_number                in     number
41   )
42   Return Boolean Is
43   --
44   --
45   -- Cursor selects the 'current' row from the HR Schema
46   --
47   Cursor C_Sel1 is
48     select
49        plan_id
50       ,object_version_number
51       ,plan_name
52       ,administrator_person_id
53       ,previous_plan_id
54       ,start_date
55       ,end_date
56       ,status_code
57       ,hierarchy_type_code
58       ,supervisor_id
59       ,supervisor_assignment_id
60       ,organization_structure_id
61       ,org_structure_version_id
62       ,top_organization_id
63       ,position_structure_id
64       ,pos_structure_version_id
65       ,top_position_id
66       ,hierarchy_levels
67       ,automatic_enrollment_flag
68       ,assignment_types_code
69       ,primary_asg_only_flag
70       ,include_obj_setting_flag
71       ,obj_setting_start_date
72       ,obj_setting_deadline
73       ,obj_set_outside_period_flag
74       ,method_code
75       ,notify_population_flag
76       ,automatic_allocation_flag
77       ,copy_past_objectives_flag
78       ,sharing_alignment_task_flag
79       ,include_appraisals_flag
80       ,change_sc_status_flag
81       ,attribute_category
82       ,attribute1
83       ,attribute2
84       ,attribute3
85       ,attribute4
86       ,attribute5
87       ,attribute6
88       ,attribute7
89       ,attribute8
90       ,attribute9
91       ,attribute10
92       ,attribute11
93       ,attribute12
94       ,attribute13
95       ,attribute14
96       ,attribute15
97       ,attribute16
98       ,attribute17
99       ,attribute18
100       ,attribute19
101       ,attribute20
102       ,attribute21
103       ,attribute22
104       ,attribute23
105       ,attribute24
106       ,attribute25
107       ,attribute26
108       ,attribute27
109       ,attribute28
110       ,attribute29
111       ,attribute30
112     from        per_perf_mgmt_plans
113     where       plan_id = p_plan_id;
114   --
115   l_fct_ret     boolean;
116   --
117 Begin
118   --
119   If (p_plan_id is null and
120       p_object_version_number is null
121      ) Then
122     --
123     -- One of the primary key arguments is null therefore we must
124     -- set the returning function value to false
125     --
126     l_fct_ret := false;
127   Else
128     If (p_plan_id
129         = per_pmp_shd.g_old_rec.plan_id and
130         p_object_version_number
131         = per_pmp_shd.g_old_rec.object_version_number
132        ) Then
133       --
134       -- The g_old_rec is current therefore we must
135       -- set the returning function to true
136       --
137       l_fct_ret := true;
138     Else
139       --
140       -- Select the current row into g_old_rec
141       --
142       Open C_Sel1;
143       Fetch C_Sel1 Into per_pmp_shd.g_old_rec;
144       If C_Sel1%notfound Then
145         Close C_Sel1;
146         --
147         -- The primary key is invalid therefore we must error
148         --
149         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
150         fnd_message.raise_error;
151       End If;
152       Close C_Sel1;
153       If (p_object_version_number
154           <> per_pmp_shd.g_old_rec.object_version_number) Then
155         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
156         fnd_message.raise_error;
157       End If;
158       l_fct_ret := true;
159     End If;
160   End If;
161   Return (l_fct_ret);
162 --
163 End api_updating;
164 --
165 -- ----------------------------------------------------------------------------
166 -- |---------------------------------< lck >----------------------------------|
167 -- ----------------------------------------------------------------------------
168 Procedure lck
169   (p_plan_id                              in     number
170   ,p_object_version_number                in     number
171   ) is
172 --
173 -- Cursor selects the 'current' row from the HR Schema
174 --
175   Cursor C_Sel1 is
176     select
177        plan_id
178       ,object_version_number
179       ,plan_name
180       ,administrator_person_id
181       ,previous_plan_id
182       ,start_date
183       ,end_date
184       ,status_code
185       ,hierarchy_type_code
186       ,supervisor_id
187       ,supervisor_assignment_id
188       ,organization_structure_id
189       ,org_structure_version_id
190       ,top_organization_id
191       ,position_structure_id
192       ,pos_structure_version_id
193       ,top_position_id
194       ,hierarchy_levels
195       ,automatic_enrollment_flag
196       ,assignment_types_code
197       ,primary_asg_only_flag
198       ,include_obj_setting_flag
199       ,obj_setting_start_date
200       ,obj_setting_deadline
201       ,obj_set_outside_period_flag
202       ,method_code
203       ,notify_population_flag
204       ,automatic_allocation_flag
205       ,copy_past_objectives_flag
206       ,sharing_alignment_task_flag
207       ,include_appraisals_flag
208       ,change_sc_status_flag
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       ,attribute21
231       ,attribute22
232       ,attribute23
233       ,attribute24
234       ,attribute25
235       ,attribute26
236       ,attribute27
237       ,attribute28
238       ,attribute29
239       ,attribute30
240     from        per_perf_mgmt_plans
241     where       plan_id = p_plan_id
242     for update nowait;
243 --
244   l_proc        varchar2(72) := g_package||'lck';
245 --
246 Begin
247   hr_utility.set_location('Entering:'||l_proc, 5);
248   --
249   hr_api.mandatory_arg_error
250     (p_api_name           => l_proc
251     ,p_argument           => 'PLAN_ID'
252     ,p_argument_value     => p_plan_id
253     );
254   hr_utility.set_location(l_proc,6);
255   hr_api.mandatory_arg_error
256     (p_api_name           => l_proc
257     ,p_argument           => 'OBJECT_VERSION_NUMBER'
258     ,p_argument_value     => p_object_version_number
259     );
260   --
261   Open  C_Sel1;
262   Fetch C_Sel1 Into per_pmp_shd.g_old_rec;
263   If C_Sel1%notfound then
264     Close C_Sel1;
265     --
266     -- The primary key is invalid therefore we must error
267     --
268     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
269     fnd_message.raise_error;
270   End If;
271   Close C_Sel1;
272   If (p_object_version_number
273       <> per_pmp_shd.g_old_rec.object_version_number) Then
274         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
275         fnd_message.raise_error;
276   End If;
277   --
278   hr_utility.set_location(' Leaving:'||l_proc, 10);
279   --
280   -- We need to trap the ORA LOCK exception
281   --
282 Exception
283   When HR_Api.Object_Locked then
284     --
285     -- The object is locked therefore we need to supply a meaningful
286     -- error message.
287     --
288     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
289     fnd_message.set_token('TABLE_NAME', 'per_perf_mgmt_plans');
290     fnd_message.raise_error;
291 End lck;
292 --
293 -- ----------------------------------------------------------------------------
294 -- |-----------------------------< convert_args >-----------------------------|
295 -- ----------------------------------------------------------------------------
296 Function convert_args
297   (p_plan_id                        in number
298   ,p_object_version_number          in number
299   ,p_plan_name                      in varchar2
300   ,p_administrator_person_id        in number
301   ,p_previous_plan_id               in number
302   ,p_start_date                     in date
303   ,p_end_date                       in date
304   ,p_status_code                    in varchar2
305   ,p_hierarchy_type_code            in varchar2
306   ,p_supervisor_id                  in number
307   ,p_supervisor_assignment_id       in number
308   ,p_organization_structure_id      in number
309   ,p_org_structure_version_id       in number
310   ,p_top_organization_id            in number
311   ,p_position_structure_id          in number
312   ,p_pos_structure_version_id       in number
313   ,p_top_position_id                in number
314   ,p_hierarchy_levels               in number
315   ,p_automatic_enrollment_flag      in varchar2
316   ,p_assignment_types_code          in varchar2
317   ,p_primary_asg_only_flag          in varchar2
318   ,p_include_obj_setting_flag       in varchar2
319   ,p_obj_setting_start_date         in date
320   ,p_obj_setting_deadline           in date
321   ,p_obj_set_outside_period_flag    in varchar2
322   ,p_method_code                    in varchar2
323   ,p_notify_population_flag         in varchar2
324   ,p_automatic_allocation_flag      in varchar2
325   ,p_copy_past_objectives_flag      in varchar2
326   ,p_sharing_alignment_task_flag    in varchar2
327   ,p_include_appraisals_flag        in varchar2
328   ,p_change_sc_status_flag   in varchar2
329   ,p_attribute_category             in varchar2
330   ,p_attribute1                     in varchar2
331   ,p_attribute2                     in varchar2
332   ,p_attribute3                     in varchar2
333   ,p_attribute4                     in varchar2
334   ,p_attribute5                     in varchar2
335   ,p_attribute6                     in varchar2
336   ,p_attribute7                     in varchar2
337   ,p_attribute8                     in varchar2
338   ,p_attribute9                     in varchar2
339   ,p_attribute10                    in varchar2
340   ,p_attribute11                    in varchar2
341   ,p_attribute12                    in varchar2
342   ,p_attribute13                    in varchar2
343   ,p_attribute14                    in varchar2
344   ,p_attribute15                    in varchar2
345   ,p_attribute16                    in varchar2
346   ,p_attribute17                    in varchar2
347   ,p_attribute18                    in varchar2
348   ,p_attribute19                    in varchar2
349   ,p_attribute20                    in varchar2
350   ,p_attribute21                    in varchar2
351   ,p_attribute22                    in varchar2
352   ,p_attribute23                    in varchar2
353   ,p_attribute24                    in varchar2
354   ,p_attribute25                    in varchar2
355   ,p_attribute26                    in varchar2
356   ,p_attribute27                    in varchar2
357   ,p_attribute28                    in varchar2
358   ,p_attribute29                    in varchar2
359   ,p_attribute30                    in varchar2
360   )
361   Return g_rec_type is
362 --
363   l_rec   g_rec_type;
364 --
365 Begin
366   --
367   -- Convert arguments into local l_rec structure.
368   --
369   l_rec.plan_id                          := p_plan_id;
370   l_rec.object_version_number            := p_object_version_number;
371   l_rec.plan_name                        := p_plan_name;
372   l_rec.administrator_person_id          := p_administrator_person_id;
373   l_rec.previous_plan_id                 := p_previous_plan_id;
374   l_rec.start_date                       := p_start_date;
375   l_rec.end_date                         := p_end_date;
376   l_rec.status_code                      := p_status_code;
377   l_rec.hierarchy_type_code              := p_hierarchy_type_code;
378   l_rec.supervisor_id                    := p_supervisor_id;
379   l_rec.supervisor_assignment_id         := p_supervisor_assignment_id;
380   l_rec.organization_structure_id        := p_organization_structure_id;
384   l_rec.pos_structure_version_id         := p_pos_structure_version_id;
381   l_rec.org_structure_version_id         := p_org_structure_version_id;
382   l_rec.top_organization_id              := p_top_organization_id;
383   l_rec.position_structure_id            := p_position_structure_id;
385   l_rec.top_position_id                  := p_top_position_id;
386   l_rec.hierarchy_levels                 := p_hierarchy_levels;
387   l_rec.automatic_enrollment_flag        := p_automatic_enrollment_flag;
388   l_rec.assignment_types_code            := p_assignment_types_code;
389   l_rec.primary_asg_only_flag            := p_primary_asg_only_flag;
390   l_rec.include_obj_setting_flag         := p_include_obj_setting_flag;
391   l_rec.obj_setting_start_date           := p_obj_setting_start_date;
392   l_rec.obj_setting_deadline             := p_obj_setting_deadline;
393   l_rec.obj_set_outside_period_flag      := p_obj_set_outside_period_flag;
394   l_rec.method_code                      := p_method_code;
395   l_rec.notify_population_flag           := p_notify_population_flag;
396   l_rec.automatic_allocation_flag        := p_automatic_allocation_flag;
397   l_rec.copy_past_objectives_flag        := p_copy_past_objectives_flag;
398   l_rec.sharing_alignment_task_flag      := p_sharing_alignment_task_flag;
399   l_rec.include_appraisals_flag          := p_include_appraisals_flag;
400   l_rec.change_sc_status_flag     := p_change_sc_status_flag;
401   l_rec.attribute_category               := p_attribute_category;
402   l_rec.attribute1                       := p_attribute1;
403   l_rec.attribute2                       := p_attribute2;
404   l_rec.attribute3                       := p_attribute3;
405   l_rec.attribute4                       := p_attribute4;
406   l_rec.attribute5                       := p_attribute5;
407   l_rec.attribute6                       := p_attribute6;
408   l_rec.attribute7                       := p_attribute7;
409   l_rec.attribute8                       := p_attribute8;
410   l_rec.attribute9                       := p_attribute9;
411   l_rec.attribute10                      := p_attribute10;
412   l_rec.attribute11                      := p_attribute11;
413   l_rec.attribute12                      := p_attribute12;
414   l_rec.attribute13                      := p_attribute13;
415   l_rec.attribute14                      := p_attribute14;
416   l_rec.attribute15                      := p_attribute15;
417   l_rec.attribute16                      := p_attribute16;
418   l_rec.attribute17                      := p_attribute17;
419   l_rec.attribute18                      := p_attribute18;
420   l_rec.attribute19                      := p_attribute19;
421   l_rec.attribute20                      := p_attribute20;
422   l_rec.attribute21                      := p_attribute21;
423   l_rec.attribute22                      := p_attribute22;
424   l_rec.attribute23                      := p_attribute23;
425   l_rec.attribute24                      := p_attribute24;
426   l_rec.attribute25                      := p_attribute25;
427   l_rec.attribute26                      := p_attribute26;
428   l_rec.attribute27                      := p_attribute27;
429   l_rec.attribute28                      := p_attribute28;
430   l_rec.attribute29                      := p_attribute29;
431   l_rec.attribute30                      := p_attribute30;
432   --
433   -- Return the plsql record structure.
434   --
435   Return(l_rec);
436 --
437 End convert_args;
438 --
439 end per_pmp_shd;