[Home] [Help]
PACKAGE BODY: APPS.HXC_HPH_SHD
Source
1 Package Body hxc_hph_shd as
2 /* $Header: hxchphrhi.pkb 120.2.12000000.2 2007/03/16 13:22:54 rchennur noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hxc_hph_shd.'; -- Global package name
9 g_debug boolean := hr_utility.debug_enabled;
10 --
11 -- ----------------------------------------------------------------------------
12 -- |---------------------------< constraint_error >---------------------------|
13 -- ----------------------------------------------------------------------------
14 Procedure constraint_error
15 (p_constraint_name in all_constraints.constraint_name%TYPE
16 ) Is
17 --
18 l_proc varchar2(72) := g_package||'constraint_error';
19 --
20 Begin
21 --
22 If (p_constraint_name = 'HXC_PREF_HIERARCHIES_FK1') Then
23 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
24 fnd_message.set_token('PROCEDURE', l_proc);
25 fnd_message.set_token('STEP','5');
26 fnd_message.raise_error;
27 ElsIf (p_constraint_name = 'HXC_PREF_HIERARCHIES_FK2') Then
28 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
29 fnd_message.set_token('PROCEDURE', l_proc);
30 fnd_message.set_token('STEP','10');
31 fnd_message.raise_error;
32 ElsIf (p_constraint_name = 'HXC_PREF_HIERARCHIES_PK') 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','15');
36 fnd_message.raise_error;
37 Else
38 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
39 fnd_message.set_token('PROCEDURE', l_proc);
40 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
41 fnd_message.raise_error;
42 End If;
43 --
44 End constraint_error;
45 --
46 -- ----------------------------------------------------------------------------
47 -- |-----------------------------< api_updating >-----------------------------|
48 -- ----------------------------------------------------------------------------
49 Function api_updating
50 (p_pref_hierarchy_id in number
51 ,p_object_version_number in number
52 )
53 Return Boolean Is
54 --
55 --
56 -- Cursor selects the 'current' row from the HR Schema
57 --
58 Cursor C_Sel1 is
59 select
60 pref_hierarchy_id
61 ,type
62 ,name
63 ,business_group_id
64 ,legislation_code
65 ,parent_pref_hierarchy_id
66 ,edit_allowed
67 ,displayed
68 ,pref_definition_id
69 ,attribute_category
70 ,attribute1
71 ,attribute2
72 ,attribute3
73 ,attribute4
74 ,attribute5
75 ,attribute6
76 ,attribute7
77 ,attribute8
78 ,attribute9
79 ,attribute10
80 ,attribute11
81 ,attribute12
82 ,attribute13
83 ,attribute14
84 ,attribute15
85 ,attribute16
86 ,attribute17
87 ,attribute18
88 ,attribute19
89 ,attribute20
90 ,attribute21
91 ,attribute22
92 ,attribute23
93 ,attribute24
94 ,attribute25
95 ,attribute26
96 ,attribute27
97 ,attribute28
98 ,attribute29
99 ,attribute30
100 ,object_version_number
101 ,orig_pref_hierarchy_id
102 ,orig_parent_hierarchy_id -- Added the columns
103 ,top_level_parent_id -- Preformance Fix
104 ,code
105 from hxc_pref_hierarchies
106 where pref_hierarchy_id = p_pref_hierarchy_id;
107 --
108 l_fct_ret boolean;
109 --
110 Begin
111 --
112 If (p_pref_hierarchy_id is null and
113 p_object_version_number is null
114 ) Then
115 --
116 -- One of the primary key arguments is null therefore we must
117 -- set the returning function value to false
118 --
119 l_fct_ret := false;
120 Else
121 If (p_pref_hierarchy_id
122 = hxc_hph_shd.g_old_rec.pref_hierarchy_id and
123 p_object_version_number
124 = hxc_hph_shd.g_old_rec.object_version_number
125 ) Then
126 --
127 -- The g_old_rec is current therefore we must
128 -- set the returning function to true
129 --
130 l_fct_ret := true;
131 Else
132 --
133 -- Select the current row into g_old_rec
134 --
135 Open C_Sel1;
136 Fetch C_Sel1 Into hxc_hph_shd.g_old_rec;
137 If C_Sel1%notfound Then
138 Close C_Sel1;
139 --
140 -- The primary key is invalid therefore we must error
141 --
142 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
143 fnd_message.raise_error;
144 End If;
145 Close C_Sel1;
146 If (p_object_version_number
147 <> hxc_hph_shd.g_old_rec.object_version_number) Then
148 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
149 fnd_message.raise_error;
150 End If;
151 l_fct_ret := true;
152 End If;
153 End If;
154 Return (l_fct_ret);
155 --
156 End api_updating;
157 --
158 -- ----------------------------------------------------------------------------
159 -- |---------------------------------< lck >----------------------------------|
160 -- ----------------------------------------------------------------------------
161 Procedure lck
162 (p_pref_hierarchy_id in number
163 ,p_object_version_number in number
164 ) is
165 --
166 -- Cursor selects the 'current' row from the HR Schema
167 --
168 Cursor C_Sel1 is
169 select
170 pref_hierarchy_id
171 ,type
172 ,name
173 ,business_group_id
174 ,legislation_code
175 ,parent_pref_hierarchy_id
176 ,edit_allowed
177 ,displayed
178 ,pref_definition_id
179 ,attribute_category
180 ,attribute1
181 ,attribute2
182 ,attribute3
183 ,attribute4
184 ,attribute5
185 ,attribute6
186 ,attribute7
187 ,attribute8
188 ,attribute9
189 ,attribute10
190 ,attribute11
191 ,attribute12
192 ,attribute13
193 ,attribute14
194 ,attribute15
195 ,attribute16
196 ,attribute17
197 ,attribute18
198 ,attribute19
199 ,attribute20
200 ,attribute21
201 ,attribute22
202 ,attribute23
203 ,attribute24
204 ,attribute25
205 ,attribute26
206 ,attribute27
207 ,attribute28
208 ,attribute29
209 ,attribute30
210 ,object_version_number
211 ,orig_pref_hierarchy_id
212 ,orig_parent_hierarchy_id
213 ,top_level_parent_id --Performance Fix
214 ,code
215 from hxc_pref_hierarchies
216 where pref_hierarchy_id = p_pref_hierarchy_id
217 for update nowait;
218 --
219 l_proc varchar2(72);
220 --
221 Begin
222 g_debug:=hr_utility.debug_enabled;
223 if g_debug then
224 l_proc := g_package||'lck';
225 hr_utility.set_location('Entering:'||l_proc, 5);
226 end if;
227 --
228 hr_api.mandatory_arg_error
229 (p_api_name => l_proc
230 ,p_argument => 'PREF_HIERARCHY_ID'
231 ,p_argument_value => p_pref_hierarchy_id
232 );
233 --
234 Open C_Sel1;
235 Fetch C_Sel1 Into hxc_hph_shd.g_old_rec;
236 If C_Sel1%notfound then
237 Close C_Sel1;
238 --
239 -- The primary key is invalid therefore we must error
240 --
241 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
242 fnd_message.raise_error;
243 End If;
244 Close C_Sel1;
245 If (p_object_version_number
246 <> hxc_hph_shd.g_old_rec.object_version_number) Then
247 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
248 fnd_message.raise_error;
249 End If;
250 --
251 if g_debug then
252 hr_utility.set_location(' Leaving:'||l_proc, 10);
253 end if;
254 --
255 -- We need to trap the ORA LOCK exception
256 --
257 Exception
258 When HR_Api.Object_Locked then
259 --
260 -- The object is locked therefore we need to supply a meaningful
261 -- error message.
262 --
263 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
264 fnd_message.set_token('TABLE_NAME', 'hxc_pref_hierarchies');
265 fnd_message.raise_error;
266 End lck;
267 --
268 -- ----------------------------------------------------------------------------
269 -- |-----------------------------< convert_args >-----------------------------|
270 -- ----------------------------------------------------------------------------
271 Function convert_args
272 (p_pref_hierarchy_id in number
273 ,p_type in varchar2
274 ,p_name in varchar2
275 ,p_business_group_id in number
276 ,p_legislation_code in varchar2
277 ,p_parent_pref_hierarchy_id in number
278 ,p_edit_allowed in varchar2
279 ,p_displayed in varchar2
280 ,p_pref_definition_id in number
281 ,p_attribute_category in varchar2
282 ,p_attribute1 in varchar2
283 ,p_attribute2 in varchar2
284 ,p_attribute3 in varchar2
285 ,p_attribute4 in varchar2
286 ,p_attribute5 in varchar2
287 ,p_attribute6 in varchar2
288 ,p_attribute7 in varchar2
289 ,p_attribute8 in varchar2
290 ,p_attribute9 in varchar2
291 ,p_attribute10 in varchar2
292 ,p_attribute11 in varchar2
293 ,p_attribute12 in varchar2
294 ,p_attribute13 in varchar2
295 ,p_attribute14 in varchar2
296 ,p_attribute15 in varchar2
297 ,p_attribute16 in varchar2
298 ,p_attribute17 in varchar2
299 ,p_attribute18 in varchar2
300 ,p_attribute19 in varchar2
301 ,p_attribute20 in varchar2
302 ,p_attribute21 in varchar2
303 ,p_attribute22 in varchar2
304 ,p_attribute23 in varchar2
305 ,p_attribute24 in varchar2
306 ,p_attribute25 in varchar2
307 ,p_attribute26 in varchar2
308 ,p_attribute27 in varchar2
309 ,p_attribute28 in varchar2
310 ,p_attribute29 in varchar2
311 ,p_attribute30 in varchar2
312 ,p_object_version_number in number
313 ,p_orig_pref_hierarchy_id in number
314 ,p_orig_parent_hierarchy_id in number
315 ,p_top_level_parent_id in number
316 ,p_code in varchar2 -- performance fix
317 )
318 Return g_rec_type is
319 --
320 l_rec g_rec_type;
321 --
322 Begin
323 --
324 -- Convert arguments into local l_rec structure.
325 --
326 l_rec.pref_hierarchy_id := p_pref_hierarchy_id;
327 l_rec.type := p_type;
328 l_rec.name := p_name;
329 l_rec.business_group_id := p_business_group_id;
330 l_rec.legislation_code := p_legislation_code;
331 l_rec.parent_pref_hierarchy_id := p_parent_pref_hierarchy_id;
332 l_rec.edit_allowed := p_edit_allowed;
333 l_rec.displayed := p_displayed;
334 l_rec.pref_definition_id := p_pref_definition_id;
335 l_rec.attribute_category := p_attribute_category;
336 l_rec.attribute1 := p_attribute1;
337 l_rec.attribute2 := p_attribute2;
338 l_rec.attribute3 := p_attribute3;
339 l_rec.attribute4 := p_attribute4;
340 l_rec.attribute5 := p_attribute5;
341 l_rec.attribute6 := p_attribute6;
342 l_rec.attribute7 := p_attribute7;
343 l_rec.attribute8 := p_attribute8;
344 l_rec.attribute9 := p_attribute9;
345 l_rec.attribute10 := p_attribute10;
346 l_rec.attribute11 := p_attribute11;
347 l_rec.attribute12 := p_attribute12;
348 l_rec.attribute13 := p_attribute13;
349 l_rec.attribute14 := p_attribute14;
350 l_rec.attribute15 := p_attribute15;
351 l_rec.attribute16 := p_attribute16;
352 l_rec.attribute17 := p_attribute17;
353 l_rec.attribute18 := p_attribute18;
354 l_rec.attribute19 := p_attribute19;
355 l_rec.attribute20 := p_attribute20;
356 l_rec.attribute21 := p_attribute21;
357 l_rec.attribute22 := p_attribute22;
358 l_rec.attribute23 := p_attribute23;
359 l_rec.attribute24 := p_attribute24;
360 l_rec.attribute25 := p_attribute25;
361 l_rec.attribute26 := p_attribute26;
362 l_rec.attribute27 := p_attribute27;
363 l_rec.attribute28 := p_attribute28;
364 l_rec.attribute29 := p_attribute29;
365 l_rec.attribute30 := p_attribute30;
366 l_rec.object_version_number := p_object_version_number;
367 l_rec.orig_pref_hierarchy_id := p_orig_pref_hierarchy_id;
368 l_rec.orig_parent_hierarchy_id := p_orig_parent_hierarchy_id;
369 l_rec.top_level_parent_id := p_top_level_parent_id; --Performance Fix
370 l_rec.code := p_code;
371 --
372 -- Return the plsql record structure.
373 --
374 Return(l_rec);
375 --
376 End convert_args;
377 --
378 end hxc_hph_shd;