DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_DPF_SHD

Source


4 -- ----------------------------------------------------------------------------
1 Package Body per_dpf_shd as
2 /* $Header: pedpfrhi.pkb 115.13 2002/12/05 10:20:52 pkakar ship $ */
3 --
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_dpf_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 Function return_api_dml_status Return Boolean Is
14 --
15   l_proc 	varchar2(72) := g_package||'return_api_dml_status';
16 --
17 Begin
18   hr_utility.set_location('Entering:'||l_proc, 5);
19   --
20   Return (nvl(g_api_dml, false));
21   --
22   hr_utility.set_location(' Leaving:'||l_proc, 10);
23 End return_api_dml_status;
24 --
25 -- ----------------------------------------------------------------------------
26 -- |---------------------------< constraint_error >---------------------------|
27 -- ----------------------------------------------------------------------------
28 Procedure constraint_error
29             (p_constraint_name in all_constraints.constraint_name%TYPE) Is
30 --
31   l_proc 	varchar2(72) := g_package||'constraint_error';
32 --
33 Begin
34   hr_utility.set_location('Entering:'||l_proc, 5);
35   --
36   If (p_constraint_name = 'PER_DEPLOYMENT_FACTORS_FK1') Then
37     hr_utility.set_message(801,'HR_52026_DPF_CHK_JOB_ID');
38     hr_utility.raise_error;
39   ElsIf (p_constraint_name = 'PER_DEPLOYMENT_FACTORS_FK2') Then
40     hr_utility.set_message(801,'HR_52024_DPF_CHK_POSITION_ID');
41     hr_utility.raise_error;
42   ElsIf (p_constraint_name = 'PER_DEPLOYMENT_FACTORS_FK3') Then
43     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
44     hr_utility.set_message_token('PROCEDURE', l_proc);
45     hr_utility.set_message_token('STEP','15');
46     hr_utility.raise_error;
47   ElsIf (p_constraint_name = 'PER_DEPLOYMENT_FACTORS_PK') Then
48     hr_utility.set_message(801, 'HR_52041_DPF_DEP_FACTOR_PK');
49     hr_utility.raise_error;
50   ElsIf (p_constraint_name = 'PER_DEPLOYMENT_FACTORS_UK') Then
51     hr_utility.set_message(801, 'HR_52043_DPF_DEP_FACTOR_UK');
52     hr_utility.raise_error;
53   ElsIf (p_constraint_name = 'PER_DPF_AVAILABLE_FOR_TRANSFER') Then
54     hr_utility.set_message(801, 'HR_52044_DPF_DEP_AVAIL_TRANS');
55     hr_utility.raise_error;
56   ElsIf (p_constraint_name = 'PER_DPF_ONLY_CURRENT_LOCATION') Then
57     hr_utility.set_message(801, 'HR_52045_DPF_ONLY_CUR_LOCATION');
58     hr_utility.raise_error;
59   ElsIf (p_constraint_name = 'PER_DPF_PASSPORT_REQUIRED') Then
60     hr_utility.set_message(801, 'HR_52046_DPF_PASSPORT_REQUIRED');
61     hr_utility.raise_error;
62   ElsIf (p_constraint_name = 'PER_DPF_RELOCATE_DOMESTICALLY') Then
63     hr_utility.set_message(801, 'HR_52047_DPF_RELOCATE_DOMESTIC');
64     hr_utility.raise_error;
65   ElsIf (p_constraint_name = 'PER_DPF_RELOCATE_INTERNATIONAL') Then
66     hr_utility.set_message(801, 'HR_52048_DPF_RELOCATE_INTERNAT');
67     hr_utility.raise_error;
68   ElsIf (p_constraint_name = 'PER_DPF_RELOCATION_REQUIRED') Then
69     hr_utility.set_message(801, 'HR_52049_DPF_RELOCATION_REQUIR');
70     hr_utility.raise_error;
71   ElsIf (p_constraint_name = 'PER_DPF_TRAVEL_REQUIRED') Then
72     hr_utility.set_message(801, 'HR_52050_DPF_TRAVEL_REQUIRED');
73     hr_utility.raise_error;
74   ElsIf (p_constraint_name = 'PER_DPF_VISIT_INTERNATIONALLY') Then
75     hr_utility.set_message(801, 'HR_52051_DPF_VISIT_INTER');
76     hr_utility.raise_error;
77   ElsIf (p_constraint_name = 'PER_DPF_WORK_ANY_COUNTRY') Then
81     hr_utility.set_message(801, 'HR_52053_DPF_WORK_ANY_LOCATION');
78     hr_utility.set_message(801, 'HR_52052_WORK_ANY_COUNTRY');
79     hr_utility.raise_error;
80   ElsIf (p_constraint_name = 'PER_DPF_WORK_ANY_LOCATION') Then
82     hr_utility.raise_error;
83   Else
84     hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
85     hr_utility.set_message_token('PROCEDURE', l_proc);
86     hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
87     hr_utility.raise_error;
88   End If;
89   --
90   hr_utility.set_location(' Leaving:'||l_proc, 10);
91 End constraint_error;
92 --
93 -- ----------------------------------------------------------------------------
94 -- |-----------------------------< api_updating >-----------------------------|
95 -- ----------------------------------------------------------------------------
96 Function api_updating
97   (
98   p_deployment_factor_id               in number,
99   p_object_version_number              in number
100   )      Return Boolean Is
101 --
102   --
103   -- Cursor selects the 'current' row from the HR Schema
104   --
105   Cursor C_Sel1 is
106     select
107 		deployment_factor_id,
108 	position_id,
109 	person_id,
110 	job_id,
111 	business_group_id,
112 	work_any_country,
113 	work_any_location,
114 	relocate_domestically,
115 	relocate_internationally,
116 	travel_required,
117 	country1,
118 	country2,
119 	country3,
120 	work_duration,
121 	work_schedule,
122 	work_hours,
123 	fte_capacity,
124 	visit_internationally,
125 	only_current_location,
126 	no_country1,
127 	no_country2,
128 	no_country3,
129 	comments,
130 	earliest_available_date,
131 	available_for_transfer,
132 	relocation_preference,
133 	relocation_required,
134 	passport_required,
135 	location1,
136 	location2,
137 	location3,
138 	other_requirements,
139 	service_minimum,
140 	object_version_number,
141 	attribute_category,
142 	attribute1,
143 	attribute2,
144 	attribute3,
145 	attribute4,
146 	attribute5,
147 	attribute6,
148 	attribute7,
149 	attribute8,
150 	attribute9,
151 	attribute10,
152 	attribute11,
153 	attribute12,
154 	attribute13,
155 	attribute14,
156 	attribute15,
157 	attribute16,
158 	attribute17,
159 	attribute18,
160 	attribute19,
161 	attribute20
162     from	per_deployment_factors
163     where	deployment_factor_id = p_deployment_factor_id;
164 --
165   l_proc	varchar2(72)	:= g_package||'api_updating';
166   l_fct_ret	boolean;
167 --
168 Begin
169   hr_utility.set_location('Entering:'||l_proc, 5);
170   --
171   If (
172 	p_deployment_factor_id is null and
173 	p_object_version_number is null
174      ) Then
175     --
176     -- One of the primary key arguments is null therefore we must
177     -- set the returning function value to false
178     --
179     l_fct_ret := false;
180   Else
181     If (
182 	p_deployment_factor_id = g_old_rec.deployment_factor_id and
183 	p_object_version_number = g_old_rec.object_version_number
184        ) Then
185       hr_utility.set_location(l_proc, 10);
186       --
187       -- The g_old_rec is current therefore we must
188       -- set the returning function to true
189       --
190       l_fct_ret := true;
191     Else
192       --
193       -- Select the current row into g_old_rec
194       --
195       Open C_Sel1;
196       Fetch C_Sel1 Into g_old_rec;
197       If C_Sel1%notfound Then
198         Close C_Sel1;
199         --
200         -- The primary key is invalid therefore we must error
201         --
202         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
203         hr_utility.raise_error;
204       End If;
205       Close C_Sel1;
206       If (p_object_version_number <> g_old_rec.object_version_number) Then
207         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
208         hr_utility.raise_error;
209       End If;
210       hr_utility.set_location(l_proc, 15);
211       l_fct_ret := true;
212     End If;
213   End If;
214   hr_utility.set_location(' Leaving:'||l_proc, 20);
215   Return (l_fct_ret);
216 --
217 End api_updating;
218 --
219 -- ----------------------------------------------------------------------------
220 -- |---------------------------------< lck >----------------------------------|
221 -- ----------------------------------------------------------------------------
222 Procedure lck
223   (
224   p_deployment_factor_id               in number,
225   p_object_version_number              in number
226   ) is
227 --
228 -- Cursor selects the 'current' row from the HR Schema
229 --
230   Cursor C_Sel1 is
231     select 	deployment_factor_id,
232 	position_id,
233 	person_id,
234 	job_id,
235 	business_group_id,
236 	work_any_country,
237 	work_any_location,
238 	relocate_domestically,
239 	relocate_internationally,
240 	travel_required,
241 	country1,
242 	country2,
243 	country3,
244 	work_duration,
245 	work_schedule,
246 	work_hours,
247 	fte_capacity,
248 	visit_internationally,
249 	only_current_location,
250 	no_country1,
251 	no_country2,
255 	available_for_transfer,
252 	no_country3,
253 	comments,
254 	earliest_available_date,
256 	relocation_preference,
257 	relocation_required,
258 	passport_required,
259 	location1,
260 	location2,
261 	location3,
262 	other_requirements,
263 	service_minimum,
264 	object_version_number,
265 	attribute_category,
266 	attribute1,
267 	attribute2,
268 	attribute3,
269 	attribute4,
270 	attribute5,
271 	attribute6,
272 	attribute7,
273 	attribute8,
274 	attribute9,
275 	attribute10,
276 	attribute11,
277 	attribute12,
278 	attribute13,
279 	attribute14,
280 	attribute15,
281 	attribute16,
282 	attribute17,
283 	attribute18,
284 	attribute19,
285 	attribute20
286     from	per_deployment_factors
287     where	deployment_factor_id = p_deployment_factor_id
288     for	update nowait;
289 --
290   l_proc	varchar2(72) := g_package||'lck';
291 --
292 Begin
293   hr_utility.set_location('Entering:'||l_proc, 5);
294   --
295   -- Add any mandatory argument checking here:
296   -- Example:
297   -- hr_api.mandatory_arg_error
298   --   (p_api_name       => l_proc,
299   --    p_argument       => 'object_version_number',
300   --    p_argument_value => p_object_version_number);
301   --
302   Open  C_Sel1;
303   Fetch C_Sel1 Into g_old_rec;
304   If C_Sel1%notfound then
305     Close C_Sel1;
306     --
307     -- The primary key is invalid therefore we must error
308     --
309     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
310     hr_utility.raise_error;
311   End If;
312   Close C_Sel1;
313   If (p_object_version_number <> g_old_rec.object_version_number) Then
314         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
315         hr_utility.raise_error;
316       End If;
317 --
318   hr_utility.set_location(' Leaving:'||l_proc, 10);
319 --
320 -- We need to trap the ORA LOCK exception
321 --
322 Exception
323   When HR_Api.Object_Locked then
324     --
325     -- The object is locked therefore we need to supply a meaningful
326     -- error message.
327     --
328     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
329     hr_utility.set_message_token('TABLE_NAME', 'per_deployment_factors');
330     hr_utility.raise_error;
331 End lck;
332 --
333 -- ----------------------------------------------------------------------------
334 -- |-----------------------------< convert_args >-----------------------------|
335 -- ----------------------------------------------------------------------------
336 Function convert_args
337 	(
338 	p_deployment_factor_id          in number,
339 	p_position_id                   in number,
340 	p_person_id                     in number,
341 	p_job_id                        in number,
342 	p_business_group_id             in number,
343 	p_work_any_country              in varchar2,
344 	p_work_any_location             in varchar2,
345 	p_relocate_domestically         in varchar2,
346 	p_relocate_internationally      in varchar2,
347 	p_travel_required               in varchar2,
348 	p_country1                      in varchar2,
349 	p_country2                      in varchar2,
350 	p_country3                      in varchar2,
351 	p_work_duration                 in varchar2,
352 	p_work_schedule                 in varchar2,
353 	p_work_hours                    in varchar2,
354 	p_fte_capacity                  in varchar2,
355 	p_visit_internationally         in varchar2,
356 	p_only_current_location         in varchar2,
357 	p_no_country1                   in varchar2,
358 	p_no_country2                   in varchar2,
359 	p_no_country3                   in varchar2,
360 	p_comments                      in varchar2,
361 	p_earliest_available_date       in date,
362 	p_available_for_transfer        in varchar2,
363 	p_relocation_preference         in varchar2,
364 	p_relocation_required           in varchar2,
365 	p_passport_required             in varchar2,
366 	p_location1                     in varchar2,
367 	p_location2                     in varchar2,
368 	p_location3                     in varchar2,
369 	p_other_requirements            in varchar2,
370 	p_service_minimum               in varchar2,
371 	p_object_version_number         in number,
372 	p_attribute_category            in varchar2,
373 	p_attribute1                    in varchar2,
374 	p_attribute2                    in varchar2,
375 	p_attribute3                    in varchar2,
376 	p_attribute4                    in varchar2,
377 	p_attribute5                    in varchar2,
378 	p_attribute6                    in varchar2,
379 	p_attribute7                    in varchar2,
380 	p_attribute8                    in varchar2,
381 	p_attribute9                    in varchar2,
382 	p_attribute10                   in varchar2,
383 	p_attribute11                   in varchar2,
384 	p_attribute12                   in varchar2,
385 	p_attribute13                   in varchar2,
386 	p_attribute14                   in varchar2,
387 	p_attribute15                   in varchar2,
388 	p_attribute16                   in varchar2,
389 	p_attribute17                   in varchar2,
390 	p_attribute18                   in varchar2,
391 	p_attribute19                   in varchar2,
392 	p_attribute20                   in varchar2
393 	)
394 	Return g_rec_type is
395 --
396   l_rec	  g_rec_type;
397   l_proc  varchar2(72) := g_package||'convert_args';
398 --
399 Begin
400   --
401   hr_utility.set_location('Entering:'||l_proc, 5);
405   l_rec.deployment_factor_id             := p_deployment_factor_id;
402   --
403   -- Convert arguments into local l_rec structure.
404   --
406   l_rec.position_id                      := p_position_id;
407   l_rec.person_id                        := p_person_id;
408   l_rec.job_id                           := p_job_id;
409   l_rec.business_group_id                := p_business_group_id;
410   l_rec.work_any_country                 := p_work_any_country;
411   l_rec.work_any_location                := p_work_any_location;
412   l_rec.relocate_domestically            := p_relocate_domestically;
413   l_rec.relocate_internationally         := p_relocate_internationally;
414   l_rec.travel_required                  := p_travel_required;
415   l_rec.country1                         := p_country1;
416   l_rec.country2                         := p_country2;
417   l_rec.country3                         := p_country3;
418   l_rec.work_duration                    := p_work_duration;
419   l_rec.work_schedule                    := p_work_schedule;
420   l_rec.work_hours                       := p_work_hours;
421   l_rec.fte_capacity                     := p_fte_capacity;
422   l_rec.visit_internationally            := p_visit_internationally;
423   l_rec.only_current_location            := p_only_current_location;
424   l_rec.no_country1                      := p_no_country1;
425   l_rec.no_country2                      := p_no_country2;
426   l_rec.no_country3                      := p_no_country3;
427   l_rec.comments                         := p_comments;
428   l_rec.earliest_available_date          := p_earliest_available_date;
429   l_rec.available_for_transfer           := p_available_for_transfer;
430   l_rec.relocation_preference            := p_relocation_preference;
431   l_rec.relocation_required              := p_relocation_required;
432   l_rec.passport_required                := p_passport_required;
433   l_rec.location1                        := p_location1;
434   l_rec.location2                        := p_location2;
435   l_rec.location3                        := p_location3;
436   l_rec.other_requirements               := p_other_requirements;
437   l_rec.service_minimum                  := p_service_minimum;
438   l_rec.object_version_number            := p_object_version_number;
439   l_rec.attribute_category               := p_attribute_category;
440   l_rec.attribute1                       := p_attribute1;
441   l_rec.attribute2                       := p_attribute2;
442   l_rec.attribute3                       := p_attribute3;
443   l_rec.attribute4                       := p_attribute4;
444   l_rec.attribute5                       := p_attribute5;
445   l_rec.attribute6                       := p_attribute6;
446   l_rec.attribute7                       := p_attribute7;
447   l_rec.attribute8                       := p_attribute8;
448   l_rec.attribute9                       := p_attribute9;
449   l_rec.attribute10                      := p_attribute10;
450   l_rec.attribute11                      := p_attribute11;
451   l_rec.attribute12                      := p_attribute12;
452   l_rec.attribute13                      := p_attribute13;
453   l_rec.attribute14                      := p_attribute14;
454   l_rec.attribute15                      := p_attribute15;
455   l_rec.attribute16                      := p_attribute16;
456   l_rec.attribute17                      := p_attribute17;
457   l_rec.attribute18                      := p_attribute18;
458   l_rec.attribute19                      := p_attribute19;
459   l_rec.attribute20                      := p_attribute20;
460   --
461   -- Return the plsql record structure.
462   --
463   hr_utility.set_location(' Leaving:'||l_proc, 10);
464   Return(l_rec);
465 --
466 End convert_args;
467 --
468 end per_dpf_shd;