[Home] [Help]
PACKAGE BODY: APPS.PER_ROL_SHD
Source
1 Package Body per_rol_shd as
2 /* $Header: perolrhi.pkb 120.0 2005/05/31 18:34:51 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_rol_shd.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |---------------------------< constraint_error >---------------------------|
12 -- ----------------------------------------------------------------------------
13 Procedure constraint_error
14 (p_constraint_name in all_constraints.constraint_name%TYPE
15 ) Is
16 --
17 l_proc varchar2(72) := g_package||'constraint_error';
18 --
19 Begin
20 --
21 If (p_constraint_name = 'PER_ROLES_FK1') Then
22 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
23 fnd_message.set_token('PROCEDURE', l_proc);
24 fnd_message.set_token('STEP','5');
25 fnd_message.raise_error;
26 ElsIf (p_constraint_name = 'PER_ROLES_PK') Then
27 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
28 fnd_message.set_token('PROCEDURE', l_proc);
29 fnd_message.set_token('STEP','10');
30 fnd_message.raise_error;
31 Else
32 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
33 fnd_message.set_token('PROCEDURE', l_proc);
34 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
35 fnd_message.raise_error;
36 End If;
37 --
38 End constraint_error;
39 --
40 -- ----------------------------------------------------------------------------
41 -- |-----------------------------< api_updating >-----------------------------|
42 -- ----------------------------------------------------------------------------
43 Function api_updating
44 (p_role_id in number
45 ,p_object_version_number in number
46 )
47 Return Boolean Is
48 --
49 --
50 -- Cursor selects the 'current' row from the HR Schema
51 --
52 Cursor C_Sel1 is
53 select
54 role_id
55 ,job_id
56 ,job_group_id
57 ,person_id
58 ,organization_id
59 ,start_date
60 ,end_date
61 ,confidential_date
62 ,emp_rights_flag
63 ,end_of_rights_date
64 ,primary_contact_flag
65 ,attribute_category
66 ,attribute1
67 ,attribute2
68 ,attribute3
69 ,attribute4
70 ,attribute5
71 ,attribute6
72 ,attribute7
73 ,attribute8
74 ,attribute9
75 ,attribute10
76 ,attribute11
77 ,attribute12
78 ,attribute13
79 ,attribute14
80 ,attribute15
81 ,attribute16
82 ,attribute17
83 ,attribute18
84 ,attribute19
85 ,attribute20
86 ,role_information_category
87 ,role_information1
88 ,role_information2
89 ,role_information3
90 ,role_information4
91 ,role_information5
92 ,role_information6
93 ,role_information7
94 ,role_information8
95 ,role_information9
96 ,role_information10
97 ,role_information11
98 ,role_information12
99 ,role_information13
100 ,role_information14
101 ,role_information15
102 ,role_information16
103 ,role_information17
104 ,role_information18
105 ,role_information19
106 ,role_information20
107 ,object_version_number
108 ,old_end_date -- fix 1370960
109 from per_roles
110 where role_id = p_role_id;
111 --
112 l_fct_ret boolean;
113 --
114 Begin
115 --
116 If (p_role_id is null and
117 p_object_version_number is null
118 ) Then
119 --
120 -- One of the primary key arguments is null therefore we must
121 -- set the returning function value to false
122 --
123 l_fct_ret := false;
124 Else
125 If (p_role_id
126 = per_rol_shd.g_old_rec.role_id and
127 p_object_version_number
128 = per_rol_shd.g_old_rec.object_version_number
129 ) Then
130 --
131 -- The g_old_rec is current therefore we must
132 -- set the returning function to true
133 --
134 l_fct_ret := true;
135 Else
136 --
137 -- Select the current row into g_old_rec
138 --
139 Open C_Sel1;
140 Fetch C_Sel1 Into per_rol_shd.g_old_rec;
141 If C_Sel1%notfound Then
142 Close C_Sel1;
143 --
144 -- The primary key is invalid therefore we must error
145 --
146 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
147 fnd_message.raise_error;
148 End If;
149 Close C_Sel1;
150 If (p_object_version_number
151 <> per_rol_shd.g_old_rec.object_version_number) Then
152 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
153 fnd_message.raise_error;
154 End If;
155 l_fct_ret := true;
156 End If;
157 End If;
158 Return (l_fct_ret);
159 --
160 End api_updating;
161 --
162 -- ----------------------------------------------------------------------------
163 -- |---------------------------------< lck >----------------------------------|
164 -- ----------------------------------------------------------------------------
165 Procedure lck
166 (p_role_id in number
167 ,p_object_version_number in number
168 ) is
169 --
170 -- Cursor selects the 'current' row from the HR Schema
171 --
172 Cursor C_Sel1 is
173 select
174 role_id
175 ,job_id
176 ,job_group_id
177 ,person_id
178 ,organization_id
179 ,start_date
180 ,end_date
181 ,confidential_date
182 ,emp_rights_flag
183 ,end_of_rights_date
184 ,primary_contact_flag
185 ,attribute_category
186 ,attribute1
187 ,attribute2
188 ,attribute3
189 ,attribute4
190 ,attribute5
191 ,attribute6
192 ,attribute7
193 ,attribute8
194 ,attribute9
195 ,attribute10
196 ,attribute11
197 ,attribute12
198 ,attribute13
199 ,attribute14
200 ,attribute15
201 ,attribute16
202 ,attribute17
203 ,attribute18
204 ,attribute19
205 ,attribute20
206 ,role_information_category
207 ,role_information1
208 ,role_information2
209 ,role_information3
210 ,role_information4
211 ,role_information5
212 ,role_information6
213 ,role_information7
214 ,role_information8
215 ,role_information9
216 ,role_information10
217 ,role_information11
218 ,role_information12
219 ,role_information13
220 ,role_information14
221 ,role_information15
222 ,role_information16
223 ,role_information17
224 ,role_information18
225 ,role_information19
226 ,role_information20
227 ,object_version_number
228 ,old_end_date -- fix 1370960
229 from per_roles
230 where role_id = p_role_id
231 for update nowait;
232 --
233 l_proc varchar2(72) := g_package||'lck';
234 --
235 Begin
236 hr_utility.set_location('Entering:'||l_proc, 5);
237 --
238 hr_api.mandatory_arg_error
239 (p_api_name => l_proc
240 ,p_argument => 'ROLE_ID'
241 ,p_argument_value => p_role_id
242 );
243 --
244 Open C_Sel1;
245 Fetch C_Sel1 Into per_rol_shd.g_old_rec;
246 If C_Sel1%notfound then
247 Close C_Sel1;
248 --
249 -- The primary key is invalid therefore we must error
250 --
251 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
252 fnd_message.raise_error;
253 End If;
254 Close C_Sel1;
255 If (p_object_version_number
256 <> per_rol_shd.g_old_rec.object_version_number) Then
257 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
258 fnd_message.raise_error;
259 End If;
260 --
261 hr_utility.set_location(' Leaving:'||l_proc, 10);
262 --
263 -- We need to trap the ORA LOCK exception
264 --
265 Exception
266 When HR_Api.Object_Locked then
267 --
268 -- The object is locked therefore we need to supply a meaningful
269 -- error message.
270 --
271 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
272 fnd_message.set_token('TABLE_NAME', 'per_roles');
273 fnd_message.raise_error;
274 End lck;
275 --
276 -- ----------------------------------------------------------------------------
277 -- |-----------------------------< convert_args >-----------------------------|
278 -- ----------------------------------------------------------------------------
279 Function convert_args
280 (p_role_id in number
281 ,p_job_id in number
282 ,p_job_group_id in number
283 ,p_person_id in number
284 ,p_organization_id in number
285 ,p_start_date in date
286 ,p_end_date in date
287 ,p_confidential_date in date
288 ,p_emp_rights_flag in varchar2
289 ,p_end_of_rights_date in date
290 ,p_primary_contact_flag in varchar2
291 ,p_attribute_category in varchar2
292 ,p_attribute1 in varchar2
293 ,p_attribute2 in varchar2
294 ,p_attribute3 in varchar2
295 ,p_attribute4 in varchar2
296 ,p_attribute5 in varchar2
297 ,p_attribute6 in varchar2
298 ,p_attribute7 in varchar2
299 ,p_attribute8 in varchar2
300 ,p_attribute9 in varchar2
301 ,p_attribute10 in varchar2
302 ,p_attribute11 in varchar2
303 ,p_attribute12 in varchar2
304 ,p_attribute13 in varchar2
305 ,p_attribute14 in varchar2
306 ,p_attribute15 in varchar2
307 ,p_attribute16 in varchar2
308 ,p_attribute17 in varchar2
309 ,p_attribute18 in varchar2
310 ,p_attribute19 in varchar2
311 ,p_attribute20 in varchar2
312 ,p_role_information_category in varchar2
313 ,p_role_information1 in varchar2
314 ,p_role_information2 in varchar2
315 ,p_role_information3 in varchar2
316 ,p_role_information4 in varchar2
317 ,p_role_information5 in varchar2
318 ,p_role_information6 in varchar2
319 ,p_role_information7 in varchar2
320 ,p_role_information8 in varchar2
321 ,p_role_information9 in varchar2
322 ,p_role_information10 in varchar2
323 ,p_role_information11 in varchar2
324 ,p_role_information12 in varchar2
325 ,p_role_information13 in varchar2
326 ,p_role_information14 in varchar2
327 ,p_role_information15 in varchar2
328 ,p_role_information16 in varchar2
329 ,p_role_information17 in varchar2
330 ,p_role_information18 in varchar2
331 ,p_role_information19 in varchar2
332 ,p_role_information20 in varchar2
333 ,p_object_version_number in number
334 ,p_old_end_date in date -- fix 1370960
335 )
336 Return g_rec_type is
337 --
338 l_rec g_rec_type;
339 --
340 Begin
341 --
342 -- Convert arguments into local l_rec structure.
343 --
344 l_rec.role_id := p_role_id;
345 l_rec.job_id := p_job_id;
346 l_rec.job_group_id := p_job_group_id;
347 l_rec.person_id := p_person_id;
348 l_rec.organization_id := p_organization_id;
349 l_rec.start_date := p_start_date;
350 l_rec.end_date := p_end_date;
351 l_rec.confidential_date := p_confidential_date;
352 l_rec.emp_rights_flag := p_emp_rights_flag;
353 l_rec.end_of_rights_date := p_end_of_rights_date;
354 l_rec.primary_contact_flag := p_primary_contact_flag;
355 l_rec.attribute_category := p_attribute_category;
356 l_rec.attribute1 := p_attribute1;
357 l_rec.attribute2 := p_attribute2;
358 l_rec.attribute3 := p_attribute3;
359 l_rec.attribute4 := p_attribute4;
360 l_rec.attribute5 := p_attribute5;
361 l_rec.attribute6 := p_attribute6;
362 l_rec.attribute7 := p_attribute7;
363 l_rec.attribute8 := p_attribute8;
364 l_rec.attribute9 := p_attribute9;
365 l_rec.attribute10 := p_attribute10;
366 l_rec.attribute11 := p_attribute11;
367 l_rec.attribute12 := p_attribute12;
368 l_rec.attribute13 := p_attribute13;
369 l_rec.attribute14 := p_attribute14;
370 l_rec.attribute15 := p_attribute15;
371 l_rec.attribute16 := p_attribute16;
372 l_rec.attribute17 := p_attribute17;
373 l_rec.attribute18 := p_attribute18;
374 l_rec.attribute19 := p_attribute19;
375 l_rec.attribute20 := p_attribute20;
376 l_rec.role_information_category := p_role_information_category;
377 l_rec.role_information1 := p_role_information1;
378 l_rec.role_information2 := p_role_information2;
379 l_rec.role_information3 := p_role_information3;
380 l_rec.role_information4 := p_role_information4;
381 l_rec.role_information5 := p_role_information5;
382 l_rec.role_information6 := p_role_information6;
383 l_rec.role_information7 := p_role_information7;
384 l_rec.role_information8 := p_role_information8;
385 l_rec.role_information9 := p_role_information9;
386 l_rec.role_information10 := p_role_information10;
387 l_rec.role_information11 := p_role_information11;
388 l_rec.role_information12 := p_role_information12;
389 l_rec.role_information13 := p_role_information13;
390 l_rec.role_information14 := p_role_information14;
391 l_rec.role_information15 := p_role_information15;
392 l_rec.role_information16 := p_role_information16;
393 l_rec.role_information17 := p_role_information17;
394 l_rec.role_information18 := p_role_information18;
395 l_rec.role_information19 := p_role_information19;
396 l_rec.role_information20 := p_role_information20;
397 l_rec.object_version_number := p_object_version_number;
398 l_rec.old_end_date := p_old_end_date; -- fix 1370960
399 --
400 -- Return the plsql record structure.
401 --
402 Return(l_rec);
403 --
404 End convert_args;
405 --
406 end per_rol_shd;