DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_PEM_SHD

Source


1 Package Body per_pem_shd as
2 /* $Header: pepemrhi.pkb 120.1.12010000.2 2008/08/06 09:21:48 ubhat ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  per_pem_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_PREVIOUS_EMPLOYERS_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_previous_employer_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        previous_employer_id
50       ,business_group_id
51       ,person_id
52       ,party_id
53       ,start_date
54       ,end_date
55       ,period_years
56       ,period_days
57       ,employer_name
58       ,employer_country
59       ,employer_address
60       ,employer_type
61       ,employer_subtype
62       ,description
63       ,pem_attribute_category
64       ,pem_attribute1
65       ,pem_attribute2
66       ,pem_attribute3
67       ,pem_attribute4
68       ,pem_attribute5
69       ,pem_attribute6
70       ,pem_attribute7
71       ,pem_attribute8
72       ,pem_attribute9
73       ,pem_attribute10
74       ,pem_attribute11
75       ,pem_attribute12
76       ,pem_attribute13
77       ,pem_attribute14
78       ,pem_attribute15
79       ,pem_attribute16
80       ,pem_attribute17
81       ,pem_attribute18
82       ,pem_attribute19
83       ,pem_attribute20
84       ,pem_attribute21
85       ,pem_attribute22
86       ,pem_attribute23
87       ,pem_attribute24
88       ,pem_attribute25
89       ,pem_attribute26
90       ,pem_attribute27
91       ,pem_attribute28
92       ,pem_attribute29
93       ,pem_attribute30
94       ,pem_information_category
95       ,pem_information1
96       ,pem_information2
97       ,pem_information3
98       ,pem_information4
99       ,pem_information5
100       ,pem_information6
101       ,pem_information7
102       ,pem_information8
103       ,pem_information9
104       ,pem_information10
105       ,pem_information11
106       ,pem_information12
107       ,pem_information13
108       ,pem_information14
109       ,pem_information15
110       ,pem_information16
111       ,pem_information17
112       ,pem_information18
113       ,pem_information19
114       ,pem_information20
115       ,pem_information21
116       ,pem_information22
117       ,pem_information23
118       ,pem_information24
119       ,pem_information25
120       ,pem_information26
121       ,pem_information27
122       ,pem_information28
123       ,pem_information29
124       ,pem_information30
125       ,object_version_number
126       ,all_assignments
127       ,period_months
128     from        per_previous_employers
129     where       previous_employer_id = p_previous_employer_id;
130   --
131   l_fct_ret     boolean;
132   --
133 Begin
134   --
135   If (p_previous_employer_id is null and
136       p_object_version_number is null
137      ) Then
138     --
139     -- One of the primary key arguments is null therefore we must
140     -- set the returning function value to false
141     --
142     l_fct_ret := false;
143   Else
144     If (p_previous_employer_id
145         = per_pem_shd.g_old_rec.previous_employer_id and
146         p_object_version_number
147         = per_pem_shd.g_old_rec.object_version_number
148        ) Then
149       --
150       -- The g_old_rec is current therefore we must
151       -- set the returning function to true
152       --
153       l_fct_ret := true;
154     Else
155       --
156       -- Select the current row into g_old_rec
157       --
158       Open C_Sel1;
159       Fetch C_Sel1 Into per_pem_shd.g_old_rec;
160       If C_Sel1%notfound Then
161         Close C_Sel1;
162         --
163         -- The primary key is invalid therefore we must error
164         --
165         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
166         fnd_message.raise_error;
167       End If;
168       Close C_Sel1;
169       If (p_object_version_number
170           <> per_pem_shd.g_old_rec.object_version_number) Then
171         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
172         fnd_message.raise_error;
173       End If;
174       l_fct_ret := true;
175     End If;
176   End If;
177   Return (l_fct_ret);
178 --
179 End api_updating;
180 --
181 -- ----------------------------------------------------------------------------
182 -- |---------------------------------< lck >----------------------------------|
183 -- ----------------------------------------------------------------------------
184 Procedure lck
185   (p_previous_employer_id                 in     number
186   ,p_object_version_number                in     number
187   ) is
188 --
189 -- Cursor selects the 'current' row from the HR Schema
190 --
191   Cursor C_Sel1 is
192     select
193        previous_employer_id
194       ,business_group_id
195       ,person_id
196       ,party_id
197       ,start_date
198       ,end_date
199       ,period_years
200       ,period_days
201       ,employer_name
202       ,employer_country
203       ,employer_address
204       ,employer_type
205       ,employer_subtype
206       ,description
207       ,pem_attribute_category
208       ,pem_attribute1
209       ,pem_attribute2
210       ,pem_attribute3
211       ,pem_attribute4
212       ,pem_attribute5
213       ,pem_attribute6
214       ,pem_attribute7
215       ,pem_attribute8
216       ,pem_attribute9
217       ,pem_attribute10
218       ,pem_attribute11
219       ,pem_attribute12
220       ,pem_attribute13
221       ,pem_attribute14
222       ,pem_attribute15
223       ,pem_attribute16
224       ,pem_attribute17
225       ,pem_attribute18
226       ,pem_attribute19
227       ,pem_attribute20
228       ,pem_attribute21
229       ,pem_attribute22
230       ,pem_attribute23
231       ,pem_attribute24
232       ,pem_attribute25
233       ,pem_attribute26
234       ,pem_attribute27
235       ,pem_attribute28
236       ,pem_attribute29
237       ,pem_attribute30
238       ,pem_information_category
239       ,pem_information1
240       ,pem_information2
241       ,pem_information3
242       ,pem_information4
243       ,pem_information5
244       ,pem_information6
245       ,pem_information7
246       ,pem_information8
247       ,pem_information9
248       ,pem_information10
249       ,pem_information11
250       ,pem_information12
251       ,pem_information13
252       ,pem_information14
253       ,pem_information15
254       ,pem_information16
255       ,pem_information17
256       ,pem_information18
257       ,pem_information19
258       ,pem_information20
259       ,pem_information21
260       ,pem_information22
261       ,pem_information23
262       ,pem_information24
263       ,pem_information25
264       ,pem_information26
265       ,pem_information27
266       ,pem_information28
267       ,pem_information29
268       ,pem_information30
269       ,object_version_number
270       ,all_assignments
271       ,period_months
272     from        per_previous_employers
273     where       previous_employer_id = p_previous_employer_id
274     for update nowait;
275 --
276   l_proc        varchar2(72) := g_package||'lck';
277 --
278 Begin
279   hr_utility.set_location('Entering:'||l_proc, 5);
280   --
281   hr_api.mandatory_arg_error
282     (p_api_name           => l_proc
283     ,p_argument           => 'PREVIOUS_EMPLOYER_ID'
284     ,p_argument_value     => p_previous_employer_id
285     );
286   hr_utility.set_location(l_proc,6);
287   hr_api.mandatory_arg_error
288     (p_api_name           => l_proc
289     ,p_argument           => 'OBJECT_VERSION_NUMBER'
290     ,p_argument_value     => p_object_version_number
291     );
292   --
293   Open  C_Sel1;
294   Fetch C_Sel1 Into per_pem_shd.g_old_rec;
295   If C_Sel1%notfound then
296     Close C_Sel1;
297     --
298     -- The primary key is invalid therefore we must error
299     --
300     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
301     fnd_message.raise_error;
302   End If;
303   Close C_Sel1;
304   If (p_object_version_number
305       <> per_pem_shd.g_old_rec.object_version_number) Then
306         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
307         fnd_message.raise_error;
308   End If;
309   --
310   hr_utility.set_location(' Leaving:'||l_proc, 10);
311   --
312   -- We need to trap the ORA LOCK exception
313   --
314 Exception
315   When HR_Api.Object_Locked then
316     --
317     -- The object is locked therefore we need to supply a meaningful
318     -- error message.
319     --
320     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
321     fnd_message.set_token('TABLE_NAME', 'per_previous_employers');
322     fnd_message.raise_error;
323 End lck;
324 --
325 -- ----------------------------------------------------------------------------
326 -- |-----------------------------< convert_args >-----------------------------|
327 -- ----------------------------------------------------------------------------
328 Function convert_args
329   (p_previous_employer_id           in number
330   ,p_business_group_id              in number
331   ,p_person_id                      in number
332   ,p_party_id                       in number
333   ,p_start_date                     in date
334   ,p_end_date                       in date
335   ,p_period_years                   in number
336   ,p_period_days                    in number
337   ,p_employer_name                  in varchar2
338   ,p_employer_country               in varchar2
339   ,p_employer_address               in varchar2
340   ,p_employer_type                  in varchar2
341   ,p_employer_subtype               in varchar2
342   ,p_description                    in varchar2
343   ,p_pem_attribute_category         in varchar2
344   ,p_pem_attribute1                 in varchar2
345   ,p_pem_attribute2                 in varchar2
346   ,p_pem_attribute3                 in varchar2
347   ,p_pem_attribute4                 in varchar2
348   ,p_pem_attribute5                 in varchar2
349   ,p_pem_attribute6                 in varchar2
350   ,p_pem_attribute7                 in varchar2
351   ,p_pem_attribute8                 in varchar2
352   ,p_pem_attribute9                 in varchar2
353   ,p_pem_attribute10                in varchar2
354   ,p_pem_attribute11                in varchar2
355   ,p_pem_attribute12                in varchar2
356   ,p_pem_attribute13                in varchar2
357   ,p_pem_attribute14                in varchar2
358   ,p_pem_attribute15                in varchar2
359   ,p_pem_attribute16                in varchar2
360   ,p_pem_attribute17                in varchar2
361   ,p_pem_attribute18                in varchar2
362   ,p_pem_attribute19                in varchar2
363   ,p_pem_attribute20                in varchar2
364   ,p_pem_attribute21                in varchar2
365   ,p_pem_attribute22                in varchar2
366   ,p_pem_attribute23                in varchar2
367   ,p_pem_attribute24                in varchar2
368   ,p_pem_attribute25                in varchar2
369   ,p_pem_attribute26                in varchar2
370   ,p_pem_attribute27                in varchar2
371   ,p_pem_attribute28                in varchar2
372   ,p_pem_attribute29                in varchar2
373   ,p_pem_attribute30                in varchar2
374   ,p_pem_information_category       in varchar2
375   ,p_pem_information1               in varchar2
376   ,p_pem_information2               in varchar2
377   ,p_pem_information3               in varchar2
378   ,p_pem_information4               in varchar2
379   ,p_pem_information5               in varchar2
380   ,p_pem_information6               in varchar2
381   ,p_pem_information7               in varchar2
382   ,p_pem_information8               in varchar2
383   ,p_pem_information9               in varchar2
384   ,p_pem_information10              in varchar2
385   ,p_pem_information11              in varchar2
386   ,p_pem_information12              in varchar2
387   ,p_pem_information13              in varchar2
388   ,p_pem_information14              in varchar2
389   ,p_pem_information15              in varchar2
390   ,p_pem_information16              in varchar2
391   ,p_pem_information17              in varchar2
392   ,p_pem_information18              in varchar2
393   ,p_pem_information19              in varchar2
394   ,p_pem_information20              in varchar2
395   ,p_pem_information21              in varchar2
396   ,p_pem_information22              in varchar2
397   ,p_pem_information23              in varchar2
398   ,p_pem_information24              in varchar2
399   ,p_pem_information25              in varchar2
400   ,p_pem_information26              in varchar2
401   ,p_pem_information27              in varchar2
402   ,p_pem_information28              in varchar2
403   ,p_pem_information29              in varchar2
404   ,p_pem_information30              in varchar2
405   ,p_object_version_number          in number
406   ,p_all_assignments                in varchar2
407   ,p_period_months                  in number
408   )
409   Return g_rec_type is
410 --
411   l_rec   g_rec_type;
412 --
413 Begin
414   --
415   -- Convert arguments into local l_rec structure.
416   --
417   l_rec.previous_employer_id             := p_previous_employer_id;
418   l_rec.business_group_id                := p_business_group_id;
419   l_rec.person_id                        := p_person_id;
420   l_rec.party_id                         := p_party_id;
421   l_rec.start_date                       := p_start_date;
422   l_rec.end_date                         := p_end_date;
423   l_rec.period_years                     := p_period_years;
424   l_rec.period_days                      := p_period_days;
425   l_rec.employer_name                    := p_employer_name;
426   l_rec.employer_country                 := p_employer_country;
427   l_rec.employer_address                 := p_employer_address;
428   l_rec.employer_type                    := p_employer_type;
429   l_rec.employer_subtype                 := p_employer_subtype;
430   l_rec.description                      := p_description;
431   l_rec.pem_attribute_category           := p_pem_attribute_category;
432   l_rec.pem_attribute1                   := p_pem_attribute1;
433   l_rec.pem_attribute2                   := p_pem_attribute2;
434   l_rec.pem_attribute3                   := p_pem_attribute3;
435   l_rec.pem_attribute4                   := p_pem_attribute4;
436   l_rec.pem_attribute5                   := p_pem_attribute5;
437   l_rec.pem_attribute6                   := p_pem_attribute6;
438   l_rec.pem_attribute7                   := p_pem_attribute7;
439   l_rec.pem_attribute8                   := p_pem_attribute8;
440   l_rec.pem_attribute9                   := p_pem_attribute9;
441   l_rec.pem_attribute10                  := p_pem_attribute10;
442   l_rec.pem_attribute11                  := p_pem_attribute11;
443   l_rec.pem_attribute12                  := p_pem_attribute12;
444   l_rec.pem_attribute13                  := p_pem_attribute13;
445   l_rec.pem_attribute14                  := p_pem_attribute14;
446   l_rec.pem_attribute15                  := p_pem_attribute15;
447   l_rec.pem_attribute16                  := p_pem_attribute16;
448   l_rec.pem_attribute17                  := p_pem_attribute17;
449   l_rec.pem_attribute18                  := p_pem_attribute18;
450   l_rec.pem_attribute19                  := p_pem_attribute19;
451   l_rec.pem_attribute20                  := p_pem_attribute20;
452   l_rec.pem_attribute21                  := p_pem_attribute21;
453   l_rec.pem_attribute22                  := p_pem_attribute22;
454   l_rec.pem_attribute23                  := p_pem_attribute23;
455   l_rec.pem_attribute24                  := p_pem_attribute24;
456   l_rec.pem_attribute25                  := p_pem_attribute25;
457   l_rec.pem_attribute26                  := p_pem_attribute26;
458   l_rec.pem_attribute27                  := p_pem_attribute27;
459   l_rec.pem_attribute28                  := p_pem_attribute28;
460   l_rec.pem_attribute29                  := p_pem_attribute29;
461   l_rec.pem_attribute30                  := p_pem_attribute30;
462   l_rec.pem_information_category         := p_pem_information_category;
463   l_rec.pem_information1                 := p_pem_information1;
464   l_rec.pem_information2                 := p_pem_information2;
465   l_rec.pem_information3                 := p_pem_information3;
466   l_rec.pem_information4                 := p_pem_information4;
467   l_rec.pem_information5                 := p_pem_information5;
468   l_rec.pem_information6                 := p_pem_information6;
469   l_rec.pem_information7                 := p_pem_information7;
470   l_rec.pem_information8                 := p_pem_information8;
471   l_rec.pem_information9                 := p_pem_information9;
472   l_rec.pem_information10                := p_pem_information10;
473   l_rec.pem_information11                := p_pem_information11;
474   l_rec.pem_information12                := p_pem_information12;
475   l_rec.pem_information13                := p_pem_information13;
476   l_rec.pem_information14                := p_pem_information14;
477   l_rec.pem_information15                := p_pem_information15;
478   l_rec.pem_information16                := p_pem_information16;
479   l_rec.pem_information17                := p_pem_information17;
480   l_rec.pem_information18                := p_pem_information18;
481   l_rec.pem_information19                := p_pem_information19;
482   l_rec.pem_information20                := p_pem_information20;
483   l_rec.pem_information21                := p_pem_information21;
484   l_rec.pem_information22                := p_pem_information22;
485   l_rec.pem_information23                := p_pem_information23;
486   l_rec.pem_information24                := p_pem_information24;
487   l_rec.pem_information25                := p_pem_information25;
488   l_rec.pem_information26                := p_pem_information26;
489   l_rec.pem_information27                := p_pem_information27;
490   l_rec.pem_information28                := p_pem_information28;
491   l_rec.pem_information29                := p_pem_information29;
492   l_rec.pem_information30                := p_pem_information30;
493   l_rec.object_version_number            := p_object_version_number;
494   l_rec.all_assignments                  := p_all_assignments;
495   l_rec.period_months                    := p_period_months;
496   --
497   -- Return the plsql record structure.
498   --
499   Return(l_rec);
500 --
501 End convert_args;
502 --
503 end per_pem_shd;