DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_PMA_SHD

Source


1 Package Body per_pma_shd as
2 /* $Header: pepmarhi.pkb 120.4.12010000.3 2009/10/23 13:48:57 schowdhu ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  per_pma_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_APPRAISAL_PERIODS_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_appraisal_period_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        appraisal_period_id
50       ,object_version_number
51       ,plan_id
52       ,appraisal_template_id
53       ,start_date
54       ,end_date
55       ,task_start_date
56       ,task_end_date
57       ,initiator_code
58       ,appraisal_system_type
59       ,appraisal_type
60       ,appraisal_assmt_status
61       ,auto_conc_process
62       ,days_before_task_st_dt
63       ,participation_type
64       ,questionnaire_template_id
65       ,attribute_category
66       ,attribute1
67       ,attribute2
68       ,attribute3
69       ,attribute4
70       ,attribute5
71       ,attribute6
72       ,attribute7
73       ,attribute8
74       ,attribute9
75       ,attribute10
76       ,attribute11
77       ,attribute12
78       ,attribute13
79       ,attribute14
80       ,attribute15
81       ,attribute16
82       ,attribute17
83       ,attribute18
84       ,attribute19
85       ,attribute20
86       ,attribute21
87       ,attribute22
88       ,attribute23
89       ,attribute24
90       ,attribute25
91       ,attribute26
92       ,attribute27
93       ,attribute28
94       ,attribute29
95       ,attribute30
96     from        per_appraisal_periods
97     where       appraisal_period_id = p_appraisal_period_id;
98   --
99   l_fct_ret     boolean;
100   --
101 Begin
102   --
103   If (p_appraisal_period_id is null and
104       p_object_version_number is null
105      ) Then
106     --
107     -- One of the primary key arguments is null therefore we must
108     -- set the returning function value to false
109     --
110     l_fct_ret := false;
111   Else
112     If (p_appraisal_period_id
113         = per_pma_shd.g_old_rec.appraisal_period_id and
114         p_object_version_number
115         = per_pma_shd.g_old_rec.object_version_number
116        ) Then
117       --
118       -- The g_old_rec is current therefore we must
119       -- set the returning function to true
120       --
121       l_fct_ret := true;
122     Else
123       --
124       -- Select the current row into g_old_rec
125       --
126       Open C_Sel1;
127       Fetch C_Sel1 Into per_pma_shd.g_old_rec;
128       If C_Sel1%notfound Then
129         Close C_Sel1;
130         --
131         -- The primary key is invalid therefore we must error
132         --
133         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
134         fnd_message.raise_error;
135       End If;
136       Close C_Sel1;
137       If (p_object_version_number
138           <> per_pma_shd.g_old_rec.object_version_number) Then
139         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
140         fnd_message.raise_error;
141       End If;
142       l_fct_ret := true;
143     End If;
144   End If;
145   Return (l_fct_ret);
146 --
147 End api_updating;
148 --
149 -- ----------------------------------------------------------------------------
150 -- |---------------------------------< lck >----------------------------------|
151 -- ----------------------------------------------------------------------------
152 Procedure lck
153   (p_appraisal_period_id                  in     number
154   ,p_object_version_number                in     number
155   ) is
156 --
157 -- Cursor selects the 'current' row from the HR Schema
158 --
159   Cursor C_Sel1 is
160     select
161        appraisal_period_id
162       ,object_version_number
163       ,plan_id
164       ,appraisal_template_id
165       ,start_date
166       ,end_date
167       ,task_start_date
168       ,task_end_date
169       ,initiator_code
173       ,auto_conc_process
170       ,appraisal_system_type
171       ,appraisal_type
172       ,appraisal_assmt_status
174       ,days_before_task_st_dt
175       ,participation_type
176       ,questionnaire_template_id
177       ,attribute_category
178       ,attribute1
179       ,attribute2
180       ,attribute3
181       ,attribute4
182       ,attribute5
183       ,attribute6
184       ,attribute7
185       ,attribute8
186       ,attribute9
187       ,attribute10
188       ,attribute11
189       ,attribute12
190       ,attribute13
191       ,attribute14
192       ,attribute15
193       ,attribute16
194       ,attribute17
195       ,attribute18
196       ,attribute19
197       ,attribute20
198       ,attribute21
199       ,attribute22
200       ,attribute23
201       ,attribute24
202       ,attribute25
203       ,attribute26
204       ,attribute27
205       ,attribute28
206       ,attribute29
207       ,attribute30
208     from        per_appraisal_periods
209     where       appraisal_period_id = p_appraisal_period_id
210     for update nowait;
211 --
212   l_proc        varchar2(72) := g_package||'lck';
213 --
214 Begin
215   hr_utility.set_location('Entering:'||l_proc, 5);
216   --
217   hr_api.mandatory_arg_error
218     (p_api_name           => l_proc
219     ,p_argument           => 'APPRAISAL_PERIOD_ID'
220     ,p_argument_value     => p_appraisal_period_id
221     );
222   hr_utility.set_location(l_proc,6);
223   hr_api.mandatory_arg_error
224     (p_api_name           => l_proc
225     ,p_argument           => 'OBJECT_VERSION_NUMBER'
226     ,p_argument_value     => p_object_version_number
227     );
228   --
229   Open  C_Sel1;
230   Fetch C_Sel1 Into per_pma_shd.g_old_rec;
231   If C_Sel1%notfound then
232     Close C_Sel1;
233     --
234     -- The primary key is invalid therefore we must error
235     --
236     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
237     fnd_message.raise_error;
238   End If;
239   Close C_Sel1;
240   If (p_object_version_number
241       <> per_pma_shd.g_old_rec.object_version_number) Then
242         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
243         fnd_message.raise_error;
244   End If;
245   --
246   hr_utility.set_location(' Leaving:'||l_proc, 10);
247   --
248   -- We need to trap the ORA LOCK exception
249   --
250 Exception
251   When HR_Api.Object_Locked then
252     --
253     -- The object is locked therefore we need to supply a meaningful
254     -- error message.
255     --
256     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
257     fnd_message.set_token('TABLE_NAME', 'per_appraisal_periods');
258     fnd_message.raise_error;
259 End lck;
260 --
261 -- ----------------------------------------------------------------------------
262 -- |-----------------------------< convert_args >-----------------------------|
263 -- ----------------------------------------------------------------------------
264 Function convert_args
265   (p_appraisal_period_id            in number
266   ,p_object_version_number          in number
267   ,p_plan_id                        in number
268   ,p_appraisal_template_id          in number
269   ,p_start_date                     in date
270   ,p_end_date                       in date
271   ,p_task_start_date                in date
272   ,p_task_end_date                  in date
273   ,p_initiator_code                 in varchar2
274   ,p_appraisal_system_type          in varchar2
275   ,p_appraisal_type                 in varchar2
276   ,p_appraisal_assmt_status         in varchar2
277   ,p_auto_conc_process              in varchar2
278   ,p_days_before_task_st_dt         in number
279   ,p_participation_type           in varchar2
280   ,p_questionnaire_template_id   in number
281   ,p_attribute_category             in varchar2
282   ,p_attribute1                     in varchar2
283   ,p_attribute2                     in varchar2
284   ,p_attribute3                     in varchar2
285   ,p_attribute4                     in varchar2
286   ,p_attribute5                     in varchar2
287   ,p_attribute6                     in varchar2
288   ,p_attribute7                     in varchar2
289   ,p_attribute8                     in varchar2
290   ,p_attribute9                     in varchar2
291   ,p_attribute10                    in varchar2
292   ,p_attribute11                    in varchar2
293   ,p_attribute12                    in varchar2
294   ,p_attribute13                    in varchar2
295   ,p_attribute14                    in varchar2
296   ,p_attribute15                    in varchar2
297   ,p_attribute16                    in varchar2
298   ,p_attribute17                    in varchar2
299   ,p_attribute18                    in varchar2
300   ,p_attribute19                    in varchar2
301   ,p_attribute20                    in varchar2
302   ,p_attribute21                    in varchar2
303   ,p_attribute22                    in varchar2
304   ,p_attribute23                    in varchar2
305   ,p_attribute24                    in varchar2
306   ,p_attribute25                    in varchar2
307   ,p_attribute26                    in varchar2
308   ,p_attribute27                    in varchar2
309   ,p_attribute28                    in varchar2
310   ,p_attribute29                    in varchar2
311   ,p_attribute30                    in varchar2
312   )
313   Return g_rec_type is
314 --
315   l_rec   g_rec_type;
316 --
317 Begin
318   --
319   -- Convert arguments into local l_rec structure.
320   --
321   l_rec.appraisal_period_id              := p_appraisal_period_id;
322   l_rec.object_version_number            := p_object_version_number;
323   l_rec.plan_id                          := p_plan_id;
324   l_rec.appraisal_template_id            := p_appraisal_template_id;
325   l_rec.start_date                       := p_start_date;
326   l_rec.end_date                         := p_end_date;
327   l_rec.task_start_date                  := p_task_start_date;
328   l_rec.task_end_date                    := p_task_end_date;
329   l_rec.initiator_code                   := p_initiator_code;
330   l_rec.appraisal_system_type            := p_appraisal_system_type;
331   l_rec.appraisal_type                   := p_appraisal_type;
332   l_rec.appraisal_assmt_status           := p_appraisal_assmt_status;
333   l_rec.auto_conc_process                := p_auto_conc_process;
334   l_rec.days_before_task_st_dt           := p_days_before_task_st_dt;
335   l_rec.participation_type           := p_participation_type;
336   l_rec.questionnaire_template_id           := p_questionnaire_template_id;
337   l_rec.attribute_category               := p_attribute_category;
338   l_rec.attribute1                       := p_attribute1;
339   l_rec.attribute2                       := p_attribute2;
340   l_rec.attribute3                       := p_attribute3;
341   l_rec.attribute4                       := p_attribute4;
342   l_rec.attribute5                       := p_attribute5;
343   l_rec.attribute6                       := p_attribute6;
344   l_rec.attribute7                       := p_attribute7;
345   l_rec.attribute8                       := p_attribute8;
346   l_rec.attribute9                       := p_attribute9;
347   l_rec.attribute10                      := p_attribute10;
348   l_rec.attribute11                      := p_attribute11;
349   l_rec.attribute12                      := p_attribute12;
350   l_rec.attribute13                      := p_attribute13;
351   l_rec.attribute14                      := p_attribute14;
352   l_rec.attribute15                      := p_attribute15;
353   l_rec.attribute16                      := p_attribute16;
354   l_rec.attribute17                      := p_attribute17;
355   l_rec.attribute18                      := p_attribute18;
356   l_rec.attribute19                      := p_attribute19;
357   l_rec.attribute20                      := p_attribute20;
358   l_rec.attribute21                      := p_attribute21;
359   l_rec.attribute22                      := p_attribute22;
360   l_rec.attribute23                      := p_attribute23;
361   l_rec.attribute24                      := p_attribute24;
362   l_rec.attribute25                      := p_attribute25;
363   l_rec.attribute26                      := p_attribute26;
364   l_rec.attribute27                      := p_attribute27;
365   l_rec.attribute28                      := p_attribute28;
366   l_rec.attribute29                      := p_attribute29;
367   l_rec.attribute30                      := p_attribute30;
368   --
369   -- Return the plsql record structure.
370   --
371   Return(l_rec);
372 --
373 End convert_args;
374 --
375 end per_pma_shd;