[Home] [Help]
PACKAGE BODY: APPS.PER_VAC_SHD
Source
4 -- ----------------------------------------------------------------------------
1 Package Body per_vac_shd as
2 /* $Header: pevacrhi.pkb 120.2 2010/12/24 11:51:11 avarri ship $ */
3 --
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 -- ----------------------------------------------------------------------------
90 (p_vacancy_id in number
87 -- |-----------------------------< api_updating >-----------------------------|
88 -- ----------------------------------------------------------------------------
89 Function api_updating
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 ,vacancy_region_type
144 ,budget_measurement_type
145 ,budget_measurement_value
146 ,manager_id
147 ,security_method
148 ,primary_posting_id
149 ,assessment_id
150 ,object_version_number
151 from per_all_vacancies
152 where vacancy_id = p_vacancy_id;
153 --
154 l_fct_ret boolean;
155 --
156 Begin
157 --
158 if (p_vacancy_id is null and
159 p_object_version_number is null
160 ) then
161 --
162 -- One of the primary key arguments is null therefore we must
163 -- set the returning function value to false
164 --
165 l_fct_ret := false;
166 Else
167 if (p_vacancy_id
168 = per_vac_shd.g_old_rec.vacancy_id and
169 p_object_version_number
170 = per_vac_shd.g_old_rec.object_version_number
171 ) then
172 --
173 -- The g_old_rec is current therefore we must
174 -- set the returning function to true
175 --
176 l_fct_ret := true;
177 Else
178 --
182 Fetch C_Sel1 Into per_vac_shd.g_old_rec;
179 -- Select the current row into g_old_rec
180 --
181 Open C_Sel1;
183 if C_Sel1%notfound then
184 Close C_Sel1;
185 --
186 -- The primary key is invalid therefore we must error
187 --
188 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
189 fnd_message.raise_error;
190 end if;
191 Close C_Sel1;
192 if (p_object_version_number
193 <> per_vac_shd.g_old_rec.object_version_number) then
194 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
195 fnd_message.raise_error;
196 end if;
197 l_fct_ret := true;
198 end if;
199 end if;
200 Return (l_fct_ret);
201 --
202 End api_updating;
203 --
204 -- ----------------------------------------------------------------------------
205 -- |---------------------------------< lck >----------------------------------|
206 -- ----------------------------------------------------------------------------
207 Procedure lck
208 (p_vacancy_id in number
209 ,p_object_version_number in number
210 ) is
211 --
212 -- Cursor selects the 'current' row from the HR Schema
213 --
214 Cursor C_Sel1 is
215 select
216 vacancy_id
217 ,business_group_id
218 ,position_id
219 ,job_id
220 ,grade_id
221 ,organization_id
222 ,requisition_id
223 ,people_group_id
224 ,location_id
225 ,recruiter_id
226 ,date_from
227 ,name
228 ,comments
229 ,date_to
230 ,description
231 ,number_of_openings
235 ,program_id
232 ,status
233 ,request_id
234 ,program_application_id
236 ,program_update_date
237 ,attribute_category
238 ,attribute1
239 ,attribute2
240 ,attribute3
241 ,attribute4
242 ,attribute5
243 ,attribute6
244 ,attribute7
245 ,attribute8
246 ,attribute9
247 ,attribute10
248 ,attribute11
249 ,attribute12
250 ,attribute13
251 ,attribute14
252 ,attribute15
253 ,attribute16
254 ,attribute17
255 ,attribute18
256 ,attribute19
257 ,attribute20
258 ,vacancy_category
259 ,vacancy_region_type
260 ,budget_measurement_type
261 ,budget_measurement_value
262 ,manager_id
263 ,security_method
264 ,primary_posting_id
265 ,assessment_id
266 ,object_version_number
267 from per_all_vacancies
268 where vacancy_id = p_vacancy_id
269 for update nowait;
270 --
271 l_proc varchar2(72) := g_package||'lck';
272 --
273 Begin
274 hr_utility.set_location('Entering:'||l_proc, 5);
275 --
276 hr_api.mandatory_arg_error
277 (p_api_name => l_proc
278 ,p_argument => 'VACANCY_ID'
279 ,p_argument_value => p_vacancy_id
280 );
281 hr_utility.set_location(l_proc,6);
282 hr_api.mandatory_arg_error
283 (p_api_name => l_proc
284 ,p_argument => 'OBJECT_VERSION_NUMBER'
285 ,p_argument_value => p_object_version_number
286 );
287 --
288 Open C_Sel1;
289 Fetch C_Sel1 Into per_vac_shd.g_old_rec;
290 if C_Sel1%notfound then
291 Close C_Sel1;
292 --
293 -- The primary key is invalid therefore we must error
294 --
295 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
296 fnd_message.raise_error;
297 end if;
298 Close C_Sel1;
299 if (p_object_version_number
300 <> per_vac_shd.g_old_rec.object_version_number) then
301 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
302 fnd_message.raise_error;
303 end if;
304 --
305 hr_utility.set_location(' Leaving:'||l_proc, 10);
306 --
307 -- We need to trap the ORA LOCK exception
308 --
309 Exception
310 When HR_Api.Object_Locked then
311 --
312 -- The object is locked therefore we need to supply a meaningful
313 -- error message.
314 --
315 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
316 fnd_message.set_token('TABLE_NAME', 'per_all_vacancies');
317 fnd_message.raise_error;
318 End lck;
319 --
320 -- ----------------------------------------------------------------------------
321 -- |-----------------------------< convert_args >-----------------------------|
322 -- ----------------------------------------------------------------------------
323 Function convert_args
324 (p_vacancy_id in number
325 ,p_business_group_id in number
326 ,p_position_id in number
327 ,p_job_id in number
328 ,p_grade_id in number
329 ,p_organization_id in number
330 ,p_requisition_id in number
331 ,p_people_group_id in number
332 ,p_location_id in number
333 ,p_recruiter_id in number
334 ,p_date_from in date
335 ,p_name in varchar2
336 ,p_comments in varchar2
337 ,p_date_to in date
338 ,p_description in varchar2
339 ,p_number_of_openings in number
340 ,p_status in varchar2
341 ,p_request_id in number
342 ,p_program_application_id in number
343 ,p_program_id in number
344 ,p_program_update_date in date
345 ,p_attribute_category in varchar2
346 ,p_attribute1 in varchar2
347 ,p_attribute2 in varchar2
348 ,p_attribute3 in varchar2
349 ,p_attribute4 in varchar2
350 ,p_attribute5 in varchar2
351 ,p_attribute6 in varchar2
352 ,p_attribute7 in varchar2
353 ,p_attribute8 in varchar2
354 ,p_attribute9 in varchar2
355 ,p_attribute10 in varchar2
356 ,p_attribute11 in varchar2
357 ,p_attribute12 in varchar2
358 ,p_attribute13 in varchar2
359 ,p_attribute14 in varchar2
360 ,p_attribute15 in varchar2
361 ,p_attribute16 in varchar2
362 ,p_attribute17 in varchar2
363 ,p_attribute18 in varchar2
364 ,p_attribute19 in varchar2
365 ,p_attribute20 in varchar2
366 ,p_vacancy_category in varchar2
367 ,p_vacancy_region_type in varchar2
368 ,p_budget_measurement_type in varchar2
369 ,p_budget_measurement_value in number
370 ,p_manager_id in number
371 ,p_security_method in varchar2
375 )
372 ,p_primary_posting_id in number
373 ,p_assessment_id in number
374 ,p_object_version_number in number
376 Return g_rec_type is
377 --
378 l_rec g_rec_type;
379 --
380 Begin
381 --
382 -- Convert arguments into local l_rec structure.
383 --
384 l_rec.vacancy_id := p_vacancy_id;
385 l_rec.business_group_id := p_business_group_id;
386 l_rec.position_id := p_position_id;
387 l_rec.job_id := p_job_id;
388 l_rec.grade_id := p_grade_id;
389 l_rec.organization_id := p_organization_id;
390 l_rec.requisition_id := p_requisition_id;
391 l_rec.people_group_id := p_people_group_id;
392 l_rec.location_id := p_location_id;
393 l_rec.recruiter_id := p_recruiter_id;
394 l_rec.date_from := p_date_from;
395 l_rec.name := p_name;
396 l_rec.comments := p_comments;
397 l_rec.date_to := p_date_to;
398 l_rec.description := p_description;
399 l_rec.number_of_openings := p_number_of_openings;
400 l_rec.status := p_status;
401 l_rec.request_id := p_request_id;
402 l_rec.program_application_id := p_program_application_id;
403 l_rec.program_id := p_program_id;
404 l_rec.program_update_date := p_program_update_date;
405 l_rec.attribute_category := p_attribute_category;
406 l_rec.attribute1 := p_attribute1;
407 l_rec.attribute2 := p_attribute2;
408 l_rec.attribute3 := p_attribute3;
409 l_rec.attribute4 := p_attribute4;
410 l_rec.attribute5 := p_attribute5;
411 l_rec.attribute6 := p_attribute6;
412 l_rec.attribute7 := p_attribute7;
413 l_rec.attribute8 := p_attribute8;
414 l_rec.attribute9 := p_attribute9;
415 l_rec.attribute10 := p_attribute10;
416 l_rec.attribute11 := p_attribute11;
417 l_rec.attribute12 := p_attribute12;
418 l_rec.attribute13 := p_attribute13;
419 l_rec.attribute14 := p_attribute14;
420 l_rec.attribute15 := p_attribute15;
421 l_rec.attribute16 := p_attribute16;
422 l_rec.attribute17 := p_attribute17;
423 l_rec.attribute18 := p_attribute18;
424 l_rec.attribute19 := p_attribute19;
425 l_rec.attribute20 := p_attribute20;
426 l_rec.vacancy_category := p_vacancy_category;
427 l_rec.vacancy_region_type := p_vacancy_region_type;
428 l_rec.budget_measurement_type := p_budget_measurement_type;
429 l_rec.budget_measurement_value := p_budget_measurement_value;
430 l_rec.manager_id := p_manager_id;
431 l_rec.security_method := p_security_method;
432 l_rec.primary_posting_id := p_primary_posting_id;
433 l_rec.assessment_id := p_assessment_id;
434 l_rec.object_version_number := p_object_version_number;
435 --
436 -- Return the plsql record structure.
437 --
438 Return(l_rec);
439 --
440 End convert_args;
441 --
442 end per_vac_shd;