DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_EGL_SHD

Source


1 Package Body ben_egl_shd as
2 /* $Header: beeglrhi.pkb 120.9 2006/06/19 12:07:41 swjain noship $ */
3 
4 --
5 -- ----------------------------------------------------------------------------
6 -- |                     Private Global Definitions                           |
7 -- ----------------------------------------------------------------------------
8 --
9 g_package  varchar2(33)	:= '  ben_egl_shd.';  -- Global package name
10 --
11 -- ----------------------------------------------------------------------------
12 -- |------------------------< return_api_dml_status >-------------------------|
13 -- ----------------------------------------------------------------------------
14 Function return_api_dml_status Return Boolean Is
15 --
16   l_proc 	varchar2(72) := g_package||'return_api_dml_status';
17 --
18 Begin
19   hr_utility.set_location('Entering:'||l_proc, 5);
20   --
21   Return (nvl(g_api_dml, false));
22   --
23   hr_utility.set_location(' Leaving:'||l_proc, 10);
24 End return_api_dml_status;
25 --
26 -- ----------------------------------------------------------------------------
27 -- |---------------------------< constraint_error >---------------------------|
28 -- ----------------------------------------------------------------------------
29 Procedure constraint_error
30             (p_constraint_name in all_constraints.constraint_name%TYPE) Is
31 --
32   l_proc 	varchar2(72) := g_package||'constraint_error';
33 --
34 Begin
35   hr_utility.set_location('Entering:'||l_proc, 5);
36   --
37   If (p_constraint_name = 'BEN_eligy_criteria_FK1') Then
38     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
39     hr_utility.set_message_token('PROCEDURE', l_proc);
40     hr_utility.set_message_token('STEP','5');
41     hr_utility.raise_error;
42   ElsIf (p_constraint_name = 'BEN_eligy_criteria_PK') 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','10');
46     hr_utility.raise_error;
47 
48   Else
49     hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
50     hr_utility.set_message_token('PROCEDURE', l_proc);
51     hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
52     hr_utility.raise_error;
53   End If;
54   --
55   hr_utility.set_location(' Leaving:'||l_proc, 10);
56 End constraint_error;
57 --
58 -- ----------------------------------------------------------------------------
59 -- |-----------------------------< api_updating >-----------------------------|
60 -- ----------------------------------------------------------------------------
61 Function api_updating
62   (
63   p_eligy_criteria_id                  in number,
64   p_object_version_number              in number
65   )      Return Boolean Is
66 --
67   --
68   -- Cursor selects the 'current' row from the HR Schema
69   --
70   Cursor C_Sel1 is
71     select
72   eligy_criteria_id,
73 name,
74 short_code,
75 description,
76 criteria_type,
77 crit_col1_val_type_cd,
78 crit_col1_datatype,
79 col1_lookup_type,
80 col1_value_set_id,
81 access_table_name1,
82 access_column_name1,
83 time_entry_access_table_name1,
84 time_entry_access_col_name1,
85 crit_col2_val_type_cd,
86 crit_col2_datatype,
87 col2_lookup_type,
88 col2_value_set_id,
89 access_table_name2,
90 access_column_name2,
91 time_entry_access_table_name2,
92 time_entry_access_col_name2,
93 access_calc_rule,
94 allow_range_validation_flag,
95 user_defined_flag,
96 business_group_id,
97 legislation_code,
98 egl_attribute_category,
99 egl_attribute1,
100 egl_attribute2,
101 egl_attribute3,
102 egl_attribute4,
103 egl_attribute5,
104 egl_attribute6,
105 egl_attribute7,
106 egl_attribute8,
107 egl_attribute9,
108 egl_attribute10,
109 egl_attribute11,
110 egl_attribute12,
111 egl_attribute13,
112 egl_attribute14,
113 egl_attribute15,
114 egl_attribute16,
115 egl_attribute17,
116 egl_attribute18,
117 egl_attribute19,
118 egl_attribute20,
119 egl_attribute21,
120 egl_attribute22,
121 egl_attribute23,
122 egl_attribute24,
123 egl_attribute25,
124 egl_attribute26,
125 egl_attribute27,
126 egl_attribute28,
127 egl_attribute29,
128 egl_attribute30,
129 object_version_number,
130 allow_range_validation_flag2,
131 access_calc_rule2,
132 time_access_calc_rule1,
133 time_access_calc_rule2
134     from	ben_eligy_criteria
135     where	eligy_criteria_id = p_eligy_criteria_id;
136 --
137   l_proc	varchar2(72)	:= g_package||'api_updating';
138   l_fct_ret	boolean;
139 --
140 Begin
141   hr_utility.set_location('Entering:'||l_proc, 5);
142   --
143   If (
144 	p_eligy_criteria_id is null and
145 	p_object_version_number is null
146      ) Then
147     --
148     -- One of the primary key arguments is null therefore we must
149     -- set the returning function value to false
150     --
151     l_fct_ret := false;
152   Else
153     If (
154 	p_eligy_criteria_id = g_old_rec.eligy_criteria_id and
155 	p_object_version_number = g_old_rec.object_version_number
156        ) Then
157 
158       --
159       -- The g_old_rec is current therefore we must
160       -- set the returning function to true
161       --
162       l_fct_ret := true;
163     Else
164       --
165       -- Select the current row into g_old_rec
166       --
167       Open C_Sel1;
168       Fetch C_Sel1 Into g_old_rec;
169       If C_Sel1%notfound Then
170         Close C_Sel1;
171         --
172         -- The primary key is invalid therefore we must error
173         --
174         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
175         hr_utility.raise_error;
176       End If;
177       Close C_Sel1;
178       If (p_object_version_number <> g_old_rec.object_version_number) Then
179         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
180         hr_utility.raise_error;
181       End If;
182 
183       l_fct_ret := true;
184     End If;
185   End If;
186   hr_utility.set_location(' Leaving:'||l_proc, 20);
187   Return (l_fct_ret);
188 --
189 End api_updating;
190 --
191 -- ----------------------------------------------------------------------------
192 -- |---------------------------------< lck >----------------------------------|
193 -- ----------------------------------------------------------------------------
194 Procedure lck
195   (
196   p_eligy_criteria_id                  in number,
197   p_object_version_number              in number
198   ) is
199 --
200 -- Cursor selects the 'current' row from the HR Schema
201 --
202   Cursor C_Sel1 is
203     select
204     eligy_criteria_id,
205     name,
206     short_code,
207     description,
208     criteria_type,
209     crit_col1_val_type_cd,
210     crit_col1_datatype,
211     col1_lookup_type,
212     col1_value_set_id,
213     access_table_name1,
214     access_column_name1,
215     time_entry_access_table_name1,
216     time_entry_access_col_name1,
217     crit_col2_val_type_cd,
218     crit_col2_datatype,
219     col2_lookup_type,
220     col2_value_set_id,
221     access_table_name2,
222     access_column_name2,
223     time_entry_access_table_name2,
224     time_entry_access_col_name2,
225     access_calc_rule,
226     allow_range_validation_flag,
227     user_defined_flag,
228     business_group_id,
229     legislation_code,
230     egl_attribute_category,
231     egl_attribute1,
232     egl_attribute2,
233     egl_attribute3,
234     egl_attribute4,
235     egl_attribute5,
236     egl_attribute6,
237     egl_attribute7,
238     egl_attribute8,
239     egl_attribute9,
240     egl_attribute10,
241     egl_attribute11,
242     egl_attribute12,
243     egl_attribute13,
244     egl_attribute14,
245     egl_attribute15,
246     egl_attribute16,
247     egl_attribute17,
248     egl_attribute18,
249     egl_attribute19,
250     egl_attribute20,
251     egl_attribute21,
252     egl_attribute22,
253     egl_attribute23,
254     egl_attribute24,
255     egl_attribute25,
256     egl_attribute26,
257     egl_attribute27,
258     egl_attribute28,
259     egl_attribute29,
260     egl_attribute30,
261     object_version_number,
262     allow_range_validation_flag2,
263     access_calc_rule2,
264     time_access_calc_rule1,
265     time_access_calc_rule2
266     from	ben_eligy_criteria
267     where	eligy_criteria_id = p_eligy_criteria_id
268     for	update nowait;
269 --
270   l_proc	varchar2(72) := g_package||'lck';
271 --
272 Begin
273   hr_utility.set_location('Entering:'||l_proc, 5);
274   --
275 
276   -- Add any mandatory argument checking here:
277   -- Example:
278    hr_api.mandatory_arg_error
279     (p_api_name       => l_proc,
280      p_argument       => 'object_version_number',
281      p_argument_value => p_object_version_number);
282   --
283 
284   Open  C_Sel1;
285   Fetch C_Sel1 Into g_old_rec;
286   If C_Sel1%notfound then
287     Close C_Sel1;
288     --
289     -- The primary key is invalid therefore we must error
290     --
291 
292     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
293     hr_utility.raise_error;
294   End If;
295   Close C_Sel1;
296 
297   If (p_object_version_number <> g_old_rec.object_version_number) Then
298         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
299         hr_utility.raise_error;
300       End If;
301 --
302   hr_utility.set_location(' Leaving:'||l_proc, 10);
303 --
304 -- We need to trap the ORA LOCK exception
305 --
306 Exception
307   When HR_Api.Object_Locked then
308     --
309     -- The object is locked therefore we need to supply a meaningful
310     -- error message.
311     --
312     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
313     hr_utility.set_message_token('TABLE_NAME', 'ben_eligy_criteria');
314     hr_utility.raise_error;
315 End lck;
316 --
317 -- ----------------------------------------------------------------------------
318 -- |-----------------------------< convert_args >-----------------------------|
319 -- ----------------------------------------------------------------------------
320 Function convert_args
321 	(
322 	p_eligy_criteria_id              in  number,
323 	p_name                           in  varchar2,
324 	p_short_code                     in  varchar2,
325 	p_description                    in  varchar2,
326 	p_criteria_type		         in  varchar2,
327 	p_crit_col1_val_type_cd	         in  varchar2,
328 	p_crit_col1_datatype	    	 in  varchar2,
329 	p_col1_lookup_type		 in  varchar2,
330 	p_col1_value_set_id              in  number,
331 	p_access_table_name1             in  varchar2,
332 	p_access_column_name1	         in  varchar2,
333 	p_time_entry_access_tab_nam1     in  varchar2,
334 	p_time_entry_access_col_nam1     in  varchar2,
335 	p_crit_col2_val_type_cd	         in  varchar2,
336 	p_crit_col2_datatype		 in  varchar2,
337 	p_col2_lookup_type		 in  varchar2,
338 	p_col2_value_set_id              in  number,
339 	p_access_table_name2		 in  varchar2,
340 	p_access_column_name2	         in  varchar2,
341 	p_time_entry_access_tab_nam2     in  varchar2,
342 	p_time_entry_access_col_nam2     in  varchar2,
343 	p_access_calc_rule		 in  number,
344 	p_allow_range_validation_flg     in  varchar2,
345 	p_user_defined_flag              in  varchar2,
346 	p_business_group_id 	    	 in  number,
347 	p_legislation_code 	    	 in  varchar2,
348 	p_egl_attribute_category         in  varchar2,
349 	p_egl_attribute1                 in  varchar2,
350 	p_egl_attribute2                 in  varchar2,
351 	p_egl_attribute3                 in  varchar2,
352 	p_egl_attribute4                 in  varchar2,
353 	p_egl_attribute5                 in  varchar2,
354 	p_egl_attribute6                 in  varchar2,
355 	p_egl_attribute7                 in  varchar2,
356 	p_egl_attribute8                 in  varchar2,
357 	p_egl_attribute9                 in  varchar2,
358 	p_egl_attribute10                in  varchar2,
359 	p_egl_attribute11                in  varchar2,
360 	p_egl_attribute12                in  varchar2,
361 	p_egl_attribute13                in  varchar2,
362 	p_egl_attribute14                in  varchar2,
363 	p_egl_attribute15                in  varchar2,
364 	p_egl_attribute16                in  varchar2,
365 	p_egl_attribute17                in  varchar2,
366 	p_egl_attribute18                in  varchar2,
367 	p_egl_attribute19                in  varchar2,
368 	p_egl_attribute20                in  varchar2,
369 	p_egl_attribute21                in  varchar2,
370 	p_egl_attribute22                in  varchar2,
371 	p_egl_attribute23                in  varchar2,
372 	p_egl_attribute24                in  varchar2,
373 	p_egl_attribute25                in  varchar2,
374 	p_egl_attribute26                in  varchar2,
375 	p_egl_attribute27                in  varchar2,
376 	p_egl_attribute28                in  varchar2,
377 	p_egl_attribute29                in  varchar2,
378 	p_egl_attribute30                in  varchar2,
379 	p_object_version_number          in  number  ,
380         p_allow_range_validation_flag2   in  varchar2,
381         p_access_calc_rule2              in  number ,
382         p_time_access_calc_rule1         in  number,
383         p_time_access_calc_rule2         in  number
384 	)
385 	Return g_rec_type is
386 --
387   l_rec	  g_rec_type;
388   l_proc  varchar2(72) := g_package||'convert_args';
389 --
390 Begin
391   --
392   hr_utility.set_location('Entering:'||l_proc, 5);
393   --
394   -- Convert arguments into local l_rec structure.
395   --
396   l_rec.eligy_criteria_id                :=  p_eligy_criteria_id;
397   l_rec.name                             :=  p_name;
398   l_rec.short_code                       :=  p_short_code;
399   l_rec.description                      :=  p_description;
400   l_rec.criteria_type		         :=  p_criteria_type;
401   l_rec.crit_col1_val_type_cd	         :=  p_crit_col1_val_type_cd;
402   l_rec.crit_col1_datatype	    	 :=  p_crit_col1_datatype;
403   l_rec.col1_lookup_type		 :=  p_col1_lookup_type;
404   l_rec.col1_value_set_id                :=  p_col1_value_set_id;
405   l_rec.access_table_name1               :=  p_access_table_name1;
406   l_rec.access_column_name1	         :=  p_access_column_name1;
407   l_rec.time_entry_access_tab_nam1       :=  p_time_entry_access_tab_nam1;
408   l_rec.time_entry_access_col_nam1       :=  p_time_entry_access_col_nam1;
409   l_rec.crit_col2_val_type_cd	         :=  p_crit_col2_val_type_cd;
410   l_rec.crit_col2_datatype		 :=  p_crit_col2_datatype;
411   l_rec.col2_lookup_type		 :=  p_col2_lookup_type;
412   l_rec.col2_value_set_id                :=  p_col2_value_set_id;
413   l_rec.access_table_name2		 :=  p_access_table_name2;
414   l_rec.access_column_name2	         :=  p_access_column_name2;
415   l_rec.time_entry_access_tab_nam2       :=  p_time_entry_access_tab_nam2;
416   l_rec.time_entry_access_col_nam2       :=  p_time_entry_access_col_nam2;
417   l_rec.access_calc_rule		 :=  p_access_calc_rule;
418   l_rec.allow_range_validation_flg       :=  p_allow_range_validation_flg;
419   l_rec.user_defined_flag                :=  p_user_defined_flag;
420   l_rec.business_group_id 	    	 :=  p_business_group_id;
421   l_rec.legislation_code 	    	 :=  p_legislation_code;
422   l_rec.egl_attribute_category           :=  p_egl_attribute_category;
423   l_rec.egl_attribute1                   :=  p_egl_attribute1;
424   l_rec.egl_attribute2                   :=  p_egl_attribute2;
425   l_rec.egl_attribute3                   :=  p_egl_attribute3;
426   l_rec.egl_attribute4                   :=  p_egl_attribute4;
427   l_rec.egl_attribute5                   :=  p_egl_attribute5;
428   l_rec.egl_attribute6                   :=  p_egl_attribute6;
429   l_rec.egl_attribute7                   :=  p_egl_attribute7;
430   l_rec.egl_attribute8                   :=  p_egl_attribute8;
431   l_rec.egl_attribute9                   :=  p_egl_attribute9;
432   l_rec.egl_attribute10              	 :=  p_egl_attribute10;
433   l_rec.egl_attribute11              	 :=  p_egl_attribute11;
434   l_rec.egl_attribute12              	 :=  p_egl_attribute12;
435   l_rec.egl_attribute13              	 :=  p_egl_attribute13;
436   l_rec.egl_attribute14              	 :=  p_egl_attribute14;
437   l_rec.egl_attribute15              	 :=  p_egl_attribute15;
438   l_rec.egl_attribute16              	 :=  p_egl_attribute16;
439   l_rec.egl_attribute17              	 :=  p_egl_attribute17;
440   l_rec.egl_attribute18              	 :=  p_egl_attribute18;
441   l_rec.egl_attribute19              	 :=  p_egl_attribute19;
442   l_rec.egl_attribute20              	 :=  p_egl_attribute20;
443   l_rec.egl_attribute21              	 :=  p_egl_attribute21;
444   l_rec.egl_attribute22              	 :=  p_egl_attribute22;
445   l_rec.egl_attribute23              	 :=  p_egl_attribute23;
446   l_rec.egl_attribute24              	 :=  p_egl_attribute24;
447   l_rec.egl_attribute25              	 :=  p_egl_attribute25;
448   l_rec.egl_attribute26              	 :=  p_egl_attribute26;
449   l_rec.egl_attribute27              	 :=  p_egl_attribute27;
450   l_rec.egl_attribute28              	 :=  p_egl_attribute28;
451   l_rec.egl_attribute29              	 :=  p_egl_attribute29;
452   l_rec.egl_attribute30              	 :=  p_egl_attribute30;
453   l_rec.object_version_number        	 :=  p_object_version_number;
454   l_rec.allow_range_validation_flag2     :=  p_allow_range_validation_flag2;
455   l_rec.access_calc_rule2              	 :=  p_access_calc_rule2;
456   l_Rec.time_access_calc_rule1         	 :=  p_time_access_calc_rule1;
457   l_rec.time_access_calc_rule2         	 :=  p_time_access_calc_rule2;
458 
459   --
460   -- Return the plsql record structure.
461   --
462   hr_utility.set_location(' Leaving:'||l_proc, 10);
463   Return(l_rec);
464 --
465 End convert_args;
466 --
467 end ben_egl_shd;
468