DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_RAA_SHD

Source


1 Package Body per_raa_shd as
2 /* $Header: peraarhi.pkb 115.20 2003/11/21 02:05:11 vvayanip ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  per_raa_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_RECRUITMENT_ACTIVITIES_FK1') 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   ElsIf (p_constraint_name = 'PER_RECRUITMENT_ACTIVITIES_FK3') Then
27     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
28     fnd_message.set_token('PROCEDURE', l_proc);
29     fnd_message.set_token('STEP','10');
30     fnd_message.raise_error;
31   ElsIf (p_constraint_name = 'PER_RECRUITMENT_ACTIVITIES_FK5') Then
32     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
33     fnd_message.set_token('PROCEDURE', l_proc);
34     fnd_message.set_token('STEP','15');
35     fnd_message.raise_error;
36   ElsIf (p_constraint_name = 'PER_RECRUITMENT_ACTIVITIES_FK6') Then
37     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
38     fnd_message.set_token('PROCEDURE', l_proc);
39     fnd_message.set_token('STEP','20');
40     fnd_message.raise_error;
41   ElsIf (p_constraint_name = 'PER_RECRUITMENT_ACTIVITIES_PK') Then
42     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
43     fnd_message.set_token('PROCEDURE', l_proc);
44     fnd_message.set_token('STEP','25');
45     fnd_message.raise_error;
46   ElsIf (p_constraint_name = 'PER_RECRUITMENT_ACTIVITIES_UK2') Then
47     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
48     fnd_message.set_token('PROCEDURE', l_proc);
49     fnd_message.set_token('STEP','30');
50     fnd_message.raise_error;
51   Else
52     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
53     fnd_message.set_token('PROCEDURE', l_proc);
54     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
55     fnd_message.raise_error;
56   End If;
57   --
58 End constraint_error;
59 --
60 -- ----------------------------------------------------------------------------
61 -- |-----------------------------< api_updating >-----------------------------|
62 -- ----------------------------------------------------------------------------
63 Function api_updating
64   (p_recruitment_activity_id              in     number
65   ,p_object_version_number                in     number
66   )
67   Return Boolean Is
68   --
69   --
70   -- Cursor selects the 'current' row from the HR Schema
71   --
72   Cursor C_Sel1 is
73     select
74        recruitment_activity_id
75       ,business_group_id
76       ,authorising_person_id
77       ,run_by_organization_id
78       ,internal_contact_person_id
79       ,parent_recruitment_activity_id
80       ,currency_code
81       ,date_start
82       ,name
83       ,actual_cost
84       ,comments
85       ,contact_telephone_number
86       ,date_closing
87       ,date_end
88       ,external_contact
89       ,planned_cost
90       ,recruiting_site_id
91       ,dbms_lob.substr(recruiting_site_response)
92       ,last_posted_date
93       ,type
94       ,request_id
95       ,program_application_id
96       ,program_id
97       ,program_update_date
98       ,attribute_category
99       ,attribute1
100       ,attribute2
101       ,attribute3
102       ,attribute4
103       ,attribute5
104       ,attribute6
105       ,attribute7
106       ,attribute8
107       ,attribute9
108       ,attribute10
109       ,attribute11
110       ,attribute12
111       ,attribute13
112       ,attribute14
113       ,attribute15
114       ,attribute16
115       ,attribute17
116       ,attribute18
117       ,attribute19
118       ,attribute20
119       ,posting_content_id
120       ,status
121       ,object_version_number
122     from        per_recruitment_activities
123     where       recruitment_activity_id = p_recruitment_activity_id;
124   --
125   l_fct_ret     boolean;
126   --
127 Begin
128   --
129   If (p_recruitment_activity_id is null and
130       p_object_version_number is null
131      ) Then
132     --
133     -- One of the primary key arguments is null therefore we must
134     -- set the returning function value to false
135     --
136     l_fct_ret := false;
137   Else
138     If (p_recruitment_activity_id
139         = per_raa_shd.g_old_rec.recruitment_activity_id and
140         p_object_version_number
141         = per_raa_shd.g_old_rec.object_version_number
142        ) Then
143       --
144       -- The g_old_rec is current therefore we must
145       -- set the returning function to true
146       --
147       l_fct_ret := true;
148     Else
149       --
150       -- Select the current row into g_old_rec
151       --
152       Open C_Sel1;
153       Fetch C_Sel1 Into per_raa_shd.g_old_rec;
154       If C_Sel1%notfound Then
155         Close C_Sel1;
156         --
157         -- The primary key is invalid therefore we must error
158         --
159         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
160         fnd_message.raise_error;
161       End If;
162       Close C_Sel1;
163       If (p_object_version_number
164           <> per_raa_shd.g_old_rec.object_version_number) Then
165         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
166         fnd_message.raise_error;
167       End If;
168       l_fct_ret := true;
169     End If;
170   End If;
171   Return (l_fct_ret);
172 --
173 End api_updating;
174 --
175 -- ----------------------------------------------------------------------------
176 -- |---------------------------------< lck >----------------------------------|
177 -- ----------------------------------------------------------------------------
178 Procedure lck
179   (p_recruitment_activity_id              in     number
180   ,p_object_version_number                in     number
181   ) is
182 --
183 -- Cursor selects the 'current' row from the HR Schema
184 --
185   Cursor C_Sel1 is
186     select
187        recruitment_activity_id
188       ,business_group_id
189       ,authorising_person_id
190       ,run_by_organization_id
191       ,internal_contact_person_id
192       ,parent_recruitment_activity_id
193       ,currency_code
194       ,date_start
195       ,name
196       ,actual_cost
197       ,comments
198       ,contact_telephone_number
199       ,date_closing
200       ,date_end
201       ,external_contact
202       ,planned_cost
203       ,recruiting_site_id
204       ,dbms_lob.substr(recruiting_site_response)
205       ,last_posted_date
206       ,type
207       ,request_id
208       ,program_application_id
209       ,program_id
210       ,program_update_date
211       ,attribute_category
212       ,attribute1
213       ,attribute2
214       ,attribute3
215       ,attribute4
216       ,attribute5
217       ,attribute6
218       ,attribute7
219       ,attribute8
220       ,attribute9
221       ,attribute10
222       ,attribute11
223       ,attribute12
224       ,attribute13
225       ,attribute14
226       ,attribute15
227       ,attribute16
228       ,attribute17
229       ,attribute18
230       ,attribute19
231       ,attribute20
232       ,posting_content_id
233       ,status
234       ,object_version_number
235     from        per_recruitment_activities
236     where       recruitment_activity_id = p_recruitment_activity_id
237     for update nowait;
238 --
239   l_proc        varchar2(72) := g_package||'lck';
240 --
241 Begin
242   hr_utility.set_location('Entering:'||l_proc, 5);
243   --
244   hr_api.mandatory_arg_error
245     (p_api_name           => l_proc
246     ,p_argument           => 'RECRUITMENT_ACTIVITY_ID'
247     ,p_argument_value     => p_recruitment_activity_id
248     );
249   hr_utility.set_location(l_proc,6);
250   hr_api.mandatory_arg_error
251     (p_api_name           => l_proc
252     ,p_argument           => 'OBJECT_VERSION_NUMBER'
253     ,p_argument_value     => p_object_version_number
254     );
255   --
256   Open  C_Sel1;
257   Fetch C_Sel1 Into per_raa_shd.g_old_rec;
258   If C_Sel1%notfound then
259     Close C_Sel1;
260     --
261     -- The primary key is invalid therefore we must error
262     --
263     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
264     fnd_message.raise_error;
265   End If;
266   Close C_Sel1;
267   If (p_object_version_number
268       <> per_raa_shd.g_old_rec.object_version_number) Then
269         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
270         fnd_message.raise_error;
271   End If;
272   --
273   hr_utility.set_location(' Leaving:'||l_proc, 10);
274   --
275   -- We need to trap the ORA LOCK exception
276   --
277 Exception
278   When HR_Api.Object_Locked then
279     --
280     -- The object is locked therefore we need to supply a meaningful
281     -- error message.
282     --
283     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
284     fnd_message.set_token('TABLE_NAME', 'per_recruitment_activities');
285     fnd_message.raise_error;
286 End lck;
287 --
288 -- ----------------------------------------------------------------------------
289 -- |-----------------------------< convert_args >-----------------------------|
290 -- ----------------------------------------------------------------------------
291 Function convert_args
292   (p_recruitment_activity_id        in number
293   ,p_business_group_id              in number
294   ,p_authorising_person_id          in number
295   ,p_run_by_organization_id         in number
296   ,p_internal_contact_person_id     in number
297   ,p_parent_recruitment_activity    in number
298   ,p_currency_code                  in varchar2
299   ,p_date_start                     in date
300   ,p_name                           in varchar2
301   ,p_actual_cost                    in varchar2
302   ,p_comments                       in varchar2
303   ,p_contact_telephone_number       in varchar2
304   ,p_date_closing                   in date
305   ,p_date_end                       in date
306   ,p_external_contact               in varchar2
307   ,p_planned_cost                   in varchar2
308   ,p_recruiting_site_id             in number
309   ,p_recruiting_site_response       in varchar2
310   ,p_last_posted_date               in date
311   ,p_type                           in varchar2
312   ,p_request_id                     in number
313   ,p_program_application_id         in number
314   ,p_program_id                     in number
315   ,p_program_update_date            in date
316   ,p_attribute_category             in varchar2
317   ,p_attribute1                     in varchar2
318   ,p_attribute2                     in varchar2
319   ,p_attribute3                     in varchar2
320   ,p_attribute4                     in varchar2
321   ,p_attribute5                     in varchar2
322   ,p_attribute6                     in varchar2
323   ,p_attribute7                     in varchar2
324   ,p_attribute8                     in varchar2
325   ,p_attribute9                     in varchar2
326   ,p_attribute10                    in varchar2
327   ,p_attribute11                    in varchar2
328   ,p_attribute12                    in varchar2
329   ,p_attribute13                    in varchar2
330   ,p_attribute14                    in varchar2
331   ,p_attribute15                    in varchar2
332   ,p_attribute16                    in varchar2
333   ,p_attribute17                    in varchar2
334   ,p_attribute18                    in varchar2
335   ,p_attribute19                    in varchar2
336   ,p_attribute20                    in varchar2
337   ,p_posting_content_id             in number
338   ,p_status                         in varchar2
339   ,p_object_version_number          in number
340   )
341   Return g_rec_type is
342 --
343   l_rec   g_rec_type;
344 --
345   l_proc        varchar2(72) := g_package||'convert_args';
346 Begin
347   --
348   hr_utility.set_location('Entering:'||l_proc, 5);
349   --
350   -- Convert arguments into local l_rec structure.
351   --
352   l_rec.recruitment_activity_id          := p_recruitment_activity_id;
353   l_rec.business_group_id                := p_business_group_id;
354   l_rec.authorising_person_id            := p_authorising_person_id;
355   l_rec.run_by_organization_id           := p_run_by_organization_id;
356   l_rec.internal_contact_person_id       := p_internal_contact_person_id;
357   l_rec.parent_recruitment_activity_id   := p_parent_recruitment_activity;
358   l_rec.currency_code                    := p_currency_code;
359   l_rec.date_start                       := p_date_start;
360   l_rec.name                             := p_name;
361   l_rec.actual_cost                      := p_actual_cost;
362   l_rec.comments                         := p_comments;
363   l_rec.contact_telephone_number         := p_contact_telephone_number;
364   l_rec.date_closing                     := p_date_closing;
365   l_rec.date_end                         := p_date_end;
366   l_rec.external_contact                 := p_external_contact;
367   l_rec.planned_cost                     := p_planned_cost;
368   l_rec.recruiting_site_id               := p_recruiting_site_id;
369   l_rec.recruiting_site_response         := p_recruiting_site_response;
370   l_rec.last_posted_date                 := p_last_posted_date;
371   l_rec.type                             := p_type;
372   l_rec.request_id                       := p_request_id;
373   l_rec.program_application_id           := p_program_application_id;
374   l_rec.program_id                       := p_program_id;
375   l_rec.program_update_date              := p_program_update_date;
376   l_rec.attribute_category               := p_attribute_category;
377   l_rec.attribute1                       := p_attribute1;
378   l_rec.attribute2                       := p_attribute2;
379   l_rec.attribute3                       := p_attribute3;
380   l_rec.attribute4                       := p_attribute4;
381   l_rec.attribute5                       := p_attribute5;
382   l_rec.attribute6                       := p_attribute6;
383   l_rec.attribute7                       := p_attribute7;
384   l_rec.attribute8                       := p_attribute8;
385   l_rec.attribute9                       := p_attribute9;
386   l_rec.attribute10                      := p_attribute10;
387   l_rec.attribute11                      := p_attribute11;
388   l_rec.attribute12                      := p_attribute12;
389   l_rec.attribute13                      := p_attribute13;
390   l_rec.attribute14                      := p_attribute14;
391   l_rec.attribute15                      := p_attribute15;
392   l_rec.attribute16                      := p_attribute16;
393   l_rec.attribute17                      := p_attribute17;
394   l_rec.attribute18                      := p_attribute18;
395   l_rec.attribute19                      := p_attribute19;
396   l_rec.attribute20                      := p_attribute20;
397   l_rec.posting_content_id               := p_posting_content_id;
398   l_rec.status                           := p_status;
399   l_rec.object_version_number            := p_object_version_number;
400   --
401   hr_utility.set_location(' Leaving:'||l_proc, 10);
402   --
403   -- Return the plsql record structure.
404   --
405   Return(l_rec);
406 --
407 End convert_args;
408 --
409 end per_raa_shd;