DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_VAC_SHD

Source


1 Package Body per_vac_shd as
2 /* $Header: pevacrhi.pkb 120.0 2005/05/31 22:51:12 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  per_vac_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 Function return_api_dml_status Return Boolean Is
14 --
15 Begin
16 --
17   Return (nvl(g_api_dml, false));
18   --
19 End return_api_dml_status;
20 --
21 -- ----------------------------------------------------------------------------
22 -- |---------------------------< constraint_error >---------------------------|
23 -- ----------------------------------------------------------------------------
24 Procedure constraint_error
25   (p_constraint_name in all_constraints.constraint_name%TYPE
26   ) Is
27 --
28   l_proc        varchar2(72) := g_package||'constraint_error';
29 --
30 Begin
31   --
32   if (p_constraint_name = 'PER_VACANCIES_FK1') then
33     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
34     fnd_message.set_token('PROCEDURE', l_proc);
35     fnd_message.set_token('STEP','5');
36     fnd_message.raise_error;
37   ElsIf (p_constraint_name = 'PER_VACANCIES_FK3') then
38     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
39     fnd_message.set_token('PROCEDURE', l_proc);
40     fnd_message.set_token('STEP','10');
41     fnd_message.raise_error;
42   ElsIf (p_constraint_name = 'PER_VACANCIES_FK4') then
43     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
44     fnd_message.set_token('PROCEDURE', l_proc);
45     fnd_message.set_token('STEP','15');
46     fnd_message.raise_error;
47   ElsIf (p_constraint_name = 'PER_VACANCIES_FK5') then
48     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
49     fnd_message.set_token('PROCEDURE', l_proc);
50     fnd_message.set_token('STEP','20');
51     fnd_message.raise_error;
52   ElsIf (p_constraint_name = 'PER_VACANCIES_FK6') then
53     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
54     fnd_message.set_token('PROCEDURE', l_proc);
55     fnd_message.set_token('STEP','25');
56     fnd_message.raise_error;
57   ElsIf (p_constraint_name = 'PER_VACANCIES_FK7') then
58     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
59     fnd_message.set_token('PROCEDURE', l_proc);
60     fnd_message.set_token('STEP','30');
61     fnd_message.raise_error;
62   ElsIf (p_constraint_name = 'PER_VACANCIES_FK8') then
63     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
64     fnd_message.set_token('PROCEDURE', l_proc);
65     fnd_message.set_token('STEP','35');
66     fnd_message.raise_error;
67   ElsIf (p_constraint_name = 'PER_VACANCIES_PK') then
68     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
69     fnd_message.set_token('PROCEDURE', l_proc);
70     fnd_message.set_token('STEP','40');
71     fnd_message.raise_error;
72   ElsIf (p_constraint_name = 'PER_VACANCIES_UK2') then
73     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
74     fnd_message.set_token('PROCEDURE', l_proc);
75     fnd_message.set_token('STEP','45');
76     fnd_message.raise_error;
77   Else
78     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
79     fnd_message.set_token('PROCEDURE', l_proc);
80     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
81     fnd_message.raise_error;
82   end if;
83   --
84 End constraint_error;
85 --
86 -- ----------------------------------------------------------------------------
87 -- |-----------------------------< api_updating >-----------------------------|
88 -- ----------------------------------------------------------------------------
89 Function api_updating
90   (p_vacancy_id                           in     number
91   ,p_object_version_number                in     number
92   )
93   Return Boolean Is
94   --
95   --
96   -- Cursor selects the 'current' row from the HR Schema
97   --
98   Cursor C_Sel1 is
99     select
100        vacancy_id
101       ,business_group_id
102       ,position_id
103       ,job_id
104       ,grade_id
105       ,organization_id
106       ,requisition_id
107       ,people_group_id
108       ,location_id
109       ,recruiter_id
110       ,date_from
111       ,name
112       ,comments
113       ,date_to
114       ,description
115       ,number_of_openings
116       ,status
117       ,request_id
118       ,program_application_id
119       ,program_id
120       ,program_update_date
121       ,attribute_category
122       ,attribute1
123       ,attribute2
124       ,attribute3
125       ,attribute4
126       ,attribute5
127       ,attribute6
128       ,attribute7
129       ,attribute8
130       ,attribute9
131       ,attribute10
132       ,attribute11
133       ,attribute12
134       ,attribute13
135       ,attribute14
136       ,attribute15
137       ,attribute16
138       ,attribute17
139       ,attribute18
140       ,attribute19
141       ,attribute20
142       ,vacancy_category
143       ,budget_measurement_type
144       ,budget_measurement_value
145       ,manager_id
146       ,security_method
147       ,primary_posting_id
148       ,assessment_id
149       ,object_version_number
150     from        per_all_vacancies
151     where       vacancy_id = p_vacancy_id;
152   --
153   l_fct_ret     boolean;
154   --
155 Begin
156   --
157   if (p_vacancy_id is null and
158       p_object_version_number is null
159      ) then
160     --
161     -- One of the primary key arguments is null therefore we must
162     -- set the returning function value to false
163     --
164     l_fct_ret := false;
165   Else
166     if (p_vacancy_id
167         = per_vac_shd.g_old_rec.vacancy_id and
168         p_object_version_number
169         = per_vac_shd.g_old_rec.object_version_number
170        ) then
171       --
172       -- The g_old_rec is current therefore we must
173       -- set the returning function to true
174       --
175       l_fct_ret := true;
176     Else
177       --
178       -- Select the current row into g_old_rec
179       --
180       Open C_Sel1;
181       Fetch C_Sel1 Into per_vac_shd.g_old_rec;
182       if C_Sel1%notfound then
183         Close C_Sel1;
184         --
185         -- The primary key is invalid therefore we must error
186         --
187         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
188         fnd_message.raise_error;
189       end if;
190       Close C_Sel1;
191       if (p_object_version_number
192           <> per_vac_shd.g_old_rec.object_version_number) then
193         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
194         fnd_message.raise_error;
195       end if;
196       l_fct_ret := true;
197     end if;
198   end if;
199   Return (l_fct_ret);
200 --
201 End api_updating;
202 --
203 -- ----------------------------------------------------------------------------
204 -- |---------------------------------< lck >----------------------------------|
205 -- ----------------------------------------------------------------------------
206 Procedure lck
207   (p_vacancy_id                           in     number
208   ,p_object_version_number                in     number
209   ) is
210 --
211 -- Cursor selects the 'current' row from the HR Schema
212 --
213   Cursor C_Sel1 is
214     select
215        vacancy_id
216       ,business_group_id
217       ,position_id
218       ,job_id
219       ,grade_id
220       ,organization_id
221       ,requisition_id
222       ,people_group_id
223       ,location_id
224       ,recruiter_id
225       ,date_from
226       ,name
227       ,comments
228       ,date_to
229       ,description
230       ,number_of_openings
231       ,status
232       ,request_id
233       ,program_application_id
234       ,program_id
235       ,program_update_date
236       ,attribute_category
237       ,attribute1
238       ,attribute2
239       ,attribute3
240       ,attribute4
241       ,attribute5
242       ,attribute6
243       ,attribute7
244       ,attribute8
245       ,attribute9
246       ,attribute10
247       ,attribute11
248       ,attribute12
249       ,attribute13
250       ,attribute14
251       ,attribute15
252       ,attribute16
253       ,attribute17
254       ,attribute18
255       ,attribute19
256       ,attribute20
257       ,vacancy_category
258       ,budget_measurement_type
259       ,budget_measurement_value
260       ,manager_id
261       ,security_method
262       ,primary_posting_id
263       ,assessment_id
264       ,object_version_number
265     from        per_all_vacancies
266     where       vacancy_id = p_vacancy_id
267     for update nowait;
268 --
269   l_proc        varchar2(72) := g_package||'lck';
270 --
271 Begin
272   hr_utility.set_location('Entering:'||l_proc, 5);
273   --
274   hr_api.mandatory_arg_error
275     (p_api_name           => l_proc
276     ,p_argument           => 'VACANCY_ID'
277     ,p_argument_value     => p_vacancy_id
278     );
279   hr_utility.set_location(l_proc,6);
280   hr_api.mandatory_arg_error
281     (p_api_name           => l_proc
282     ,p_argument           => 'OBJECT_VERSION_NUMBER'
283     ,p_argument_value     => p_object_version_number
284     );
285   --
286   Open  C_Sel1;
287   Fetch C_Sel1 Into per_vac_shd.g_old_rec;
288   if C_Sel1%notfound then
289     Close C_Sel1;
290     --
291     -- The primary key is invalid therefore we must error
292     --
293     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
294     fnd_message.raise_error;
295   end if;
296   Close C_Sel1;
297   if (p_object_version_number
298       <> per_vac_shd.g_old_rec.object_version_number) then
299         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
300         fnd_message.raise_error;
301   end if;
302   --
303   hr_utility.set_location(' Leaving:'||l_proc, 10);
304   --
305   -- We need to trap the ORA LOCK exception
306   --
307 Exception
308   When HR_Api.Object_Locked then
309     --
310     -- The object is locked therefore we need to supply a meaningful
311     -- error message.
312     --
313     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
314     fnd_message.set_token('TABLE_NAME', 'per_all_vacancies');
315     fnd_message.raise_error;
316 End lck;
317 --
318 -- ----------------------------------------------------------------------------
319 -- |-----------------------------< convert_args >-----------------------------|
320 -- ----------------------------------------------------------------------------
321 Function convert_args
322   (p_vacancy_id                     in number
323   ,p_business_group_id              in number
324   ,p_position_id                    in number
325   ,p_job_id                         in number
326   ,p_grade_id                       in number
327   ,p_organization_id                in number
328   ,p_requisition_id                 in number
329   ,p_people_group_id                in number
330   ,p_location_id                    in number
331   ,p_recruiter_id                   in number
332   ,p_date_from                      in date
333   ,p_name                           in varchar2
334   ,p_comments                       in varchar2
335   ,p_date_to                        in date
336   ,p_description                    in varchar2
337   ,p_number_of_openings             in number
338   ,p_status                         in varchar2
339   ,p_request_id                     in number
340   ,p_program_application_id         in number
341   ,p_program_id                     in number
342   ,p_program_update_date            in date
343   ,p_attribute_category             in varchar2
344   ,p_attribute1                     in varchar2
345   ,p_attribute2                     in varchar2
346   ,p_attribute3                     in varchar2
347   ,p_attribute4                     in varchar2
348   ,p_attribute5                     in varchar2
349   ,p_attribute6                     in varchar2
350   ,p_attribute7                     in varchar2
351   ,p_attribute8                     in varchar2
352   ,p_attribute9                     in varchar2
353   ,p_attribute10                    in varchar2
354   ,p_attribute11                    in varchar2
355   ,p_attribute12                    in varchar2
356   ,p_attribute13                    in varchar2
357   ,p_attribute14                    in varchar2
358   ,p_attribute15                    in varchar2
359   ,p_attribute16                    in varchar2
360   ,p_attribute17                    in varchar2
361   ,p_attribute18                    in varchar2
362   ,p_attribute19                    in varchar2
363   ,p_attribute20                    in varchar2
364   ,p_vacancy_category               in varchar2
365   ,p_budget_measurement_type        in varchar2
366   ,p_budget_measurement_value       in number
367   ,p_manager_id                     in number
368   ,p_security_method                in varchar2
369   ,p_primary_posting_id             in number
370   ,p_assessment_id                  in number
371   ,p_object_version_number          in number
372   )
373   Return g_rec_type is
374 --
375   l_rec   g_rec_type;
376 --
377 Begin
378   --
379   -- Convert arguments into local l_rec structure.
380   --
381   l_rec.vacancy_id                       := p_vacancy_id;
382   l_rec.business_group_id                := p_business_group_id;
383   l_rec.position_id                      := p_position_id;
384   l_rec.job_id                           := p_job_id;
385   l_rec.grade_id                         := p_grade_id;
386   l_rec.organization_id                  := p_organization_id;
387   l_rec.requisition_id                   := p_requisition_id;
388   l_rec.people_group_id                  := p_people_group_id;
389   l_rec.location_id                      := p_location_id;
390   l_rec.recruiter_id                     := p_recruiter_id;
391   l_rec.date_from                        := p_date_from;
392   l_rec.name                             := p_name;
393   l_rec.comments                         := p_comments;
394   l_rec.date_to                          := p_date_to;
395   l_rec.description                      := p_description;
396   l_rec.number_of_openings               := p_number_of_openings;
397   l_rec.status                           := p_status;
398   l_rec.request_id                       := p_request_id;
399   l_rec.program_application_id           := p_program_application_id;
400   l_rec.program_id                       := p_program_id;
401   l_rec.program_update_date              := p_program_update_date;
402   l_rec.attribute_category               := p_attribute_category;
403   l_rec.attribute1                       := p_attribute1;
404   l_rec.attribute2                       := p_attribute2;
405   l_rec.attribute3                       := p_attribute3;
406   l_rec.attribute4                       := p_attribute4;
407   l_rec.attribute5                       := p_attribute5;
408   l_rec.attribute6                       := p_attribute6;
409   l_rec.attribute7                       := p_attribute7;
410   l_rec.attribute8                       := p_attribute8;
411   l_rec.attribute9                       := p_attribute9;
412   l_rec.attribute10                      := p_attribute10;
416   l_rec.attribute14                      := p_attribute14;
413   l_rec.attribute11                      := p_attribute11;
414   l_rec.attribute12                      := p_attribute12;
415   l_rec.attribute13                      := p_attribute13;
417   l_rec.attribute15                      := p_attribute15;
418   l_rec.attribute16                      := p_attribute16;
419   l_rec.attribute17                      := p_attribute17;
420   l_rec.attribute18                      := p_attribute18;
421   l_rec.attribute19                      := p_attribute19;
422   l_rec.attribute20                      := p_attribute20;
423   l_rec.vacancy_category                 := p_vacancy_category;
424   l_rec.budget_measurement_type          := p_budget_measurement_type;
425   l_rec.budget_measurement_value         := p_budget_measurement_value;
426   l_rec.manager_id                       := p_manager_id;
427   l_rec.security_method                  := p_security_method;
428   l_rec.primary_posting_id               := p_primary_posting_id;
429   l_rec.assessment_id                    := p_assessment_id;
430   l_rec.object_version_number            := p_object_version_number;
431   --
432   -- Return the plsql record structure.
433   --
434   Return(l_rec);
435 --
436 End convert_args;
437 --
438 end per_vac_shd;