DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_PJU_SHD

Source


1 Package Body per_pju_shd as
2 /* $Header: pepjurhi.pkb 115.14 2002/12/04 10:55:38 eumenyio ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  per_pju_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_JOBS_USAGES_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_job_usage_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_job_usage_id
50       ,assignment_id
51       ,previous_employer_id
52       ,previous_job_id
53       ,start_date
54       ,end_date
55       ,period_years
56       ,period_months
57       ,period_days
58       ,pju_attribute_category
59       ,pju_attribute1
60       ,pju_attribute2
61       ,pju_attribute3
62       ,pju_attribute4
63       ,pju_attribute5
67       ,pju_attribute9
64       ,pju_attribute6
65       ,pju_attribute7
66       ,pju_attribute8
68       ,pju_attribute10
69       ,pju_attribute11
70       ,pju_attribute12
71       ,pju_attribute13
72       ,pju_attribute14
73       ,pju_attribute15
74       ,pju_attribute16
75       ,pju_attribute17
76       ,pju_attribute18
77       ,pju_attribute19
78       ,pju_attribute20
79       ,pju_information_category
80       ,pju_information1
81       ,pju_information2
82       ,pju_information3
83       ,pju_information4
84       ,pju_information5
85       ,pju_information6
86       ,pju_information7
87       ,pju_information8
88       ,pju_information9
89       ,pju_information10
90       ,pju_information11
91       ,pju_information12
92       ,pju_information13
93       ,pju_information14
94       ,pju_information15
95       ,pju_information16
96       ,pju_information17
97       ,pju_information18
98       ,pju_information19
99       ,pju_information20
100       ,object_version_number
101     from        per_previous_job_usages
102     where       previous_job_usage_id = p_previous_job_usage_id;
103   --
104   l_fct_ret     boolean;
105   --
106 Begin
107   --
108   If (p_previous_job_usage_id is null and
109       p_object_version_number is null
110      ) Then
111     --
112     -- One of the primary key arguments is null therefore we must
113     -- set the returning function value to false
114     --
115     l_fct_ret := false;
116   Else
117     If (p_previous_job_usage_id
118         = per_pju_shd.g_old_rec.previous_job_usage_id and
119         p_object_version_number
120         = per_pju_shd.g_old_rec.object_version_number
121        ) Then
122       --
123       -- The g_old_rec is current therefore we must
124       -- set the returning function to true
125       --
126       l_fct_ret := true;
127     Else
128       --
129       -- Select the current row into g_old_rec
130       --
131       Open C_Sel1;
132       Fetch C_Sel1 Into per_pju_shd.g_old_rec;
133       If C_Sel1%notfound Then
134         Close C_Sel1;
135         --
136         -- The primary key is invalid therefore we must error
137         --
138         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
139         fnd_message.raise_error;
140       End If;
141       Close C_Sel1;
142       If (p_object_version_number
143           <> per_pju_shd.g_old_rec.object_version_number) Then
144         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
145         fnd_message.raise_error;
146       End If;
147       l_fct_ret := true;
148     End If;
149   End If;
150   Return (l_fct_ret);
151 --
152 End api_updating;
153 --
154 -- ----------------------------------------------------------------------------
155 -- |---------------------------------< lck >----------------------------------|
156 -- ----------------------------------------------------------------------------
157 Procedure lck
158   (p_previous_job_usage_id                in     number
159   ,p_object_version_number                in     number
160   ) is
161 --
162 -- Cursor selects the 'current' row from the HR Schema
163 --
164   Cursor C_Sel1 is
165     select
166        previous_job_usage_id
167       ,assignment_id
168       ,previous_employer_id
169       ,previous_job_id
170       ,start_date
171       ,end_date
172       ,period_years
173       ,period_months
174       ,period_days
175       ,pju_attribute_category
176       ,pju_attribute1
177       ,pju_attribute2
178       ,pju_attribute3
179       ,pju_attribute4
180       ,pju_attribute5
181       ,pju_attribute6
182       ,pju_attribute7
183       ,pju_attribute8
184       ,pju_attribute9
185       ,pju_attribute10
186       ,pju_attribute11
187       ,pju_attribute12
188       ,pju_attribute13
189       ,pju_attribute14
190       ,pju_attribute15
191       ,pju_attribute16
192       ,pju_attribute17
193       ,pju_attribute18
194       ,pju_attribute19
195       ,pju_attribute20
196       ,pju_information_category
197       ,pju_information1
198       ,pju_information2
199       ,pju_information3
200       ,pju_information4
201       ,pju_information5
202       ,pju_information6
203       ,pju_information7
204       ,pju_information8
205       ,pju_information9
206       ,pju_information10
207       ,pju_information11
208       ,pju_information12
209       ,pju_information13
210       ,pju_information14
211       ,pju_information15
212       ,pju_information16
213       ,pju_information17
214       ,pju_information18
215       ,pju_information19
216       ,pju_information20
217       ,object_version_number
218     from        per_previous_job_usages
219     where       previous_job_usage_id = p_previous_job_usage_id
220     for update nowait;
221 --
222   l_proc        varchar2(72) := g_package||'lck';
223 --
224 Begin
225   hr_utility.set_location('Entering:'||l_proc, 5);
226   --
227   hr_api.mandatory_arg_error
228     (p_api_name           => l_proc
229     ,p_argument           => 'PREVIOUS_JOB_USAGE_ID'
230     ,p_argument_value     => p_previous_job_usage_id
234     (p_api_name           => l_proc
231     );
232   hr_utility.set_location(l_proc,6);
233   hr_api.mandatory_arg_error
235     ,p_argument           => 'OBJECT_VERSION_NUMBER'
236     ,p_argument_value     => p_object_version_number
237     );
238   --
239   Open  C_Sel1;
240   Fetch C_Sel1 Into per_pju_shd.g_old_rec;
241   If C_Sel1%notfound then
242     Close C_Sel1;
243     --
244     -- The primary key is invalid therefore we must error
245     --
246     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
247     fnd_message.raise_error;
248   End If;
249   Close C_Sel1;
250   If (p_object_version_number
251       <> per_pju_shd.g_old_rec.object_version_number) Then
252         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
253         fnd_message.raise_error;
254   End If;
255   --
256   hr_utility.set_location(' Leaving:'||l_proc, 10);
257   --
258   -- We need to trap the ORA LOCK exception
259   --
260 Exception
261   When HR_Api.Object_Locked then
262     --
263     -- The object is locked therefore we need to supply a meaningful
264     -- error message.
265     --
266     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
267     fnd_message.set_token('TABLE_NAME', 'per_previous_job_usages');
268     fnd_message.raise_error;
269 End lck;
270 --
271 -- ----------------------------------------------------------------------------
272 -- |-----------------------------< convert_args >-----------------------------|
273 -- ----------------------------------------------------------------------------
274 Function convert_args
275   (p_previous_job_usage_id          in number
276   ,p_assignment_id                  in number
277   ,p_previous_employer_id           in number
278   ,p_previous_job_id                in number
279   ,p_start_date                     in date
280   ,p_end_date                       in date
281   ,p_period_years                   in number
282   ,p_period_months                  in number
283   ,p_period_days                    in number
284   ,p_pju_attribute_category         in varchar2
285   ,p_pju_attribute1                 in varchar2
286   ,p_pju_attribute2                 in varchar2
287   ,p_pju_attribute3                 in varchar2
288   ,p_pju_attribute4                 in varchar2
289   ,p_pju_attribute5                 in varchar2
290   ,p_pju_attribute6                 in varchar2
291   ,p_pju_attribute7                 in varchar2
292   ,p_pju_attribute8                 in varchar2
293   ,p_pju_attribute9                 in varchar2
294   ,p_pju_attribute10                in varchar2
295   ,p_pju_attribute11                in varchar2
296   ,p_pju_attribute12                in varchar2
297   ,p_pju_attribute13                in varchar2
298   ,p_pju_attribute14                in varchar2
299   ,p_pju_attribute15                in varchar2
300   ,p_pju_attribute16                in varchar2
301   ,p_pju_attribute17                in varchar2
302   ,p_pju_attribute18                in varchar2
303   ,p_pju_attribute19                in varchar2
304   ,p_pju_attribute20                in varchar2
305   ,p_pju_information_category       in varchar2
306   ,p_pju_information1               in varchar2
307   ,p_pju_information2               in varchar2
308   ,p_pju_information3               in varchar2
309   ,p_pju_information4               in varchar2
310   ,p_pju_information5               in varchar2
311   ,p_pju_information6               in varchar2
312   ,p_pju_information7               in varchar2
313   ,p_pju_information8               in varchar2
314   ,p_pju_information9               in varchar2
315   ,p_pju_information10              in varchar2
316   ,p_pju_information11              in varchar2
317   ,p_pju_information12              in varchar2
318   ,p_pju_information13              in varchar2
319   ,p_pju_information14              in varchar2
320   ,p_pju_information15              in varchar2
321   ,p_pju_information16              in varchar2
322   ,p_pju_information17              in varchar2
323   ,p_pju_information18              in varchar2
324   ,p_pju_information19              in varchar2
325   ,p_pju_information20              in varchar2
326   ,p_object_version_number          in number
327   )
328   Return g_rec_type is
329 --
330   l_rec   g_rec_type;
331 --
332 Begin
333   --
334   -- Convert arguments into local l_rec structure.
335   --
336   l_rec.previous_job_usage_id            := p_previous_job_usage_id;
337   l_rec.assignment_id                    := p_assignment_id;
338   l_rec.previous_employer_id             := p_previous_employer_id;
339   l_rec.previous_job_id                  := p_previous_job_id;
340   l_rec.start_date                       := p_start_date;
341   l_rec.end_date                         := p_end_date;
342   l_rec.period_years                     := p_period_years;
343   l_rec.period_months                    := p_period_months;
344   l_rec.period_days                      := p_period_days;
345   l_rec.pju_attribute_category           := p_pju_attribute_category;
346   l_rec.pju_attribute1                   := p_pju_attribute1;
347   l_rec.pju_attribute2                   := p_pju_attribute2;
348   l_rec.pju_attribute3                   := p_pju_attribute3;
349   l_rec.pju_attribute4                   := p_pju_attribute4;
350   l_rec.pju_attribute5                   := p_pju_attribute5;
351   l_rec.pju_attribute6                   := p_pju_attribute6;
352   l_rec.pju_attribute7                   := p_pju_attribute7;
353   l_rec.pju_attribute8                   := p_pju_attribute8;
354   l_rec.pju_attribute9                   := p_pju_attribute9;
355   l_rec.pju_attribute10                  := p_pju_attribute10;
356   l_rec.pju_attribute11                  := p_pju_attribute11;
357   l_rec.pju_attribute12                  := p_pju_attribute12;
358   l_rec.pju_attribute13                  := p_pju_attribute13;
359   l_rec.pju_attribute14                  := p_pju_attribute14;
360   l_rec.pju_attribute15                  := p_pju_attribute15;
361   l_rec.pju_attribute16                  := p_pju_attribute16;
362   l_rec.pju_attribute17                  := p_pju_attribute17;
363   l_rec.pju_attribute18                  := p_pju_attribute18;
364   l_rec.pju_attribute19                  := p_pju_attribute19;
365   l_rec.pju_attribute20                  := p_pju_attribute20;
366   l_rec.pju_information_category         := p_pju_information_category;
367   l_rec.pju_information1                 := p_pju_information1;
368   l_rec.pju_information2                 := p_pju_information2;
369   l_rec.pju_information3                 := p_pju_information3;
370   l_rec.pju_information4                 := p_pju_information4;
371   l_rec.pju_information5                 := p_pju_information5;
372   l_rec.pju_information6                 := p_pju_information6;
373   l_rec.pju_information7                 := p_pju_information7;
374   l_rec.pju_information8                 := p_pju_information8;
375   l_rec.pju_information9                 := p_pju_information9;
376   l_rec.pju_information10                := p_pju_information10;
377   l_rec.pju_information11                := p_pju_information11;
378   l_rec.pju_information12                := p_pju_information12;
379   l_rec.pju_information13                := p_pju_information13;
380   l_rec.pju_information14                := p_pju_information14;
381   l_rec.pju_information15                := p_pju_information15;
382   l_rec.pju_information16                := p_pju_information16;
383   l_rec.pju_information17                := p_pju_information17;
384   l_rec.pju_information18                := p_pju_information18;
385   l_rec.pju_information19                := p_pju_information19;
386   l_rec.pju_information20                := p_pju_information20;
387   l_rec.object_version_number            := p_object_version_number;
388   --
389   -- Return the plsql record structure.
390   --
391   Return(l_rec);
392 --
393 End convert_args;
394 --
395 end per_pju_shd;