[Home] [Help]
PACKAGE BODY: APPS.PER_EVT_SHD
Source
1 Package Body per_evt_shd as
2 /* $Header: peevtrhi.pkb 120.2 2008/04/30 11:32:10 uuddavol ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_evt_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_EVENTS_FK1') Then
33 fnd_message.set_name('PER', 'HR_289313_NO_SUCH_ORGANIZATION');
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_EVENTS_FK2') Then
38 fnd_message.set_name('PER', 'HR_289317_NO_SUCH_LOCATION');
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_EVENTS_FK4') Then
43 fnd_message.set_name('PER', 'HR_289313_NO_SUCH_ORGANIZATION');
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_EVENTS_PK') Then
48 fnd_message.set_name('PAY', 'HR_289322_EVENT_EXISTS');
49 fnd_message.set_token('PROCEDURE', l_proc);
50 fnd_message.set_token('STEP','20');
51 fnd_message.raise_error;
52 Else
53 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
54 fnd_message.set_token('PROCEDURE', l_proc);
55 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
56 fnd_message.raise_error;
57 End If;
58 --
59 End constraint_error;
60 --
61 -- ----------------------------------------------------------------------------
62 -- |-----------------------------< api_updating >-----------------------------|
63 -- ----------------------------------------------------------------------------
64 Function api_updating
65 (p_event_id in number
66 ,p_object_version_number in number
67 )
68 Return Boolean Is
69 --
70 --
71 -- Cursor selects the 'current' row from the HR Schema
72 --
73 Cursor C_Sel1 is
74 select
75 event_id
76 ,business_group_id
77 ,location_id
78 ,internal_contact_person_id
79 ,organization_run_by_id
80 ,assignment_id
81 ,date_start
82 ,type
83 ,comments
84 ,contact_telephone_number
85 ,date_end
86 ,emp_or_apl
87 ,event_or_interview
88 ,external_contact
89 ,time_end
90 ,time_start
91 ,request_id
92 ,program_application_id
93 ,program_id
94 ,program_update_date
95 ,attribute_category
96 ,attribute1
97 ,attribute2
98 ,attribute3
99 ,attribute4
100 ,attribute5
101 ,attribute6
102 ,attribute7
103 ,attribute8
104 ,attribute9
105 ,attribute10
106 ,attribute11
107 ,attribute12
108 ,attribute13
109 ,attribute14
110 ,attribute15
111 ,attribute16
112 ,attribute17
113 ,attribute18
114 ,attribute19
115 ,attribute20
116 ,party_id
117 ,object_version_number
118 from per_events
119 where event_id = p_event_id;
120 --
121 l_fct_ret boolean;
122 --
123 Begin
124 --
125 If (p_event_id is null and
126 p_object_version_number is null
127 ) Then
128 --
129 -- One of the primary key arguments is null therefore we must
130 -- set the returning function value to false
131 --
132 l_fct_ret := false;
133 Else
134 If (p_event_id
135 = per_evt_shd.g_old_rec.event_id and
136 p_object_version_number
137 = per_evt_shd.g_old_rec.object_version_number
138 ) Then
139 --
140 -- The g_old_rec is current therefore we must
141 -- set the returning function to true
142 --
143 l_fct_ret := true;
144 Else
145 --
146 -- Select the current row into g_old_rec
147 --
148 Open C_Sel1;
149 Fetch C_Sel1 Into per_evt_shd.g_old_rec;
150 If C_Sel1%notfound Then
151 Close C_Sel1;
152 --
153 -- The primary key is invalid therefore we must error
154 --
155 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
156 fnd_message.raise_error;
157 End If;
158 Close C_Sel1;
159 If (p_object_version_number
160 <> per_evt_shd.g_old_rec.object_version_number) Then
161 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
162 fnd_message.raise_error;
163 End If;
164 l_fct_ret := true;
165 End If;
166 End If;
167 Return (l_fct_ret);
168 --
169 End api_updating;
170 --
171 -- ----------------------------------------------------------------------------
172 -- |---------------------------------< lck >----------------------------------|
173 -- ----------------------------------------------------------------------------
174 Procedure lck
175 (p_event_id in number
176 ,p_object_version_number in number
177 ) is
178 --
179 -- Cursor selects the 'current' row from the HR Schema
180 --
181 Cursor C_Sel1 is
182 select
183 event_id
184 ,business_group_id
185 ,location_id
186 ,internal_contact_person_id
187 ,organization_run_by_id
188 ,assignment_id
189 ,date_start
190 ,type
191 ,comments
192 ,contact_telephone_number
193 ,date_end
194 ,emp_or_apl
195 ,event_or_interview
196 ,external_contact
197 ,time_end
198 ,time_start
199 ,request_id
200 ,program_application_id
201 ,program_id
202 ,program_update_date
203 ,attribute_category
204 ,attribute1
205 ,attribute2
206 ,attribute3
207 ,attribute4
208 ,attribute5
209 ,attribute6
210 ,attribute7
211 ,attribute8
212 ,attribute9
213 ,attribute10
214 ,attribute11
215 ,attribute12
216 ,attribute13
217 ,attribute14
218 ,attribute15
219 ,attribute16
220 ,attribute17
221 ,attribute18
222 ,attribute19
223 ,attribute20
224 ,party_id
225 ,object_version_number
226 from per_events
227 where event_id = p_event_id
228 for update nowait;
229 --
230 l_proc varchar2(72) := g_package||'lck';
231 --
232 Begin
233 hr_utility.set_location('Entering:'||l_proc, 10);
234 --
235 hr_api.mandatory_arg_error
236 (p_api_name => l_proc
237 ,p_argument => 'EVENT_ID'
238 ,p_argument_value => p_event_id
239 );
240 hr_utility.set_location(l_proc,20);
241 hr_api.mandatory_arg_error
242 (p_api_name => l_proc
243 ,p_argument => 'OBJECT_VERSION_NUMBER'
244 ,p_argument_value => p_object_version_number
245 );
246 --
247 Open C_Sel1;
248 Fetch C_Sel1 Into per_evt_shd.g_old_rec;
249 If C_Sel1%notfound then
250 Close C_Sel1;
251 --
252 -- The primary key is invalid therefore we must error
253 --
254 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
255 fnd_message.raise_error;
256 End If;
257 Close C_Sel1;
258 If (p_object_version_number
259 <> per_evt_shd.g_old_rec.object_version_number) Then
260 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
261 fnd_message.raise_error;
262 End If;
263 --
264 hr_utility.set_location(' Leaving:'||l_proc, 30);
265 --
266 -- We need to trap the ORA LOCK exception
267 --
268 Exception
269 When HR_Api.Object_Locked then
270 --
271 -- The object is locked therefore we need to supply a meaningful
272 -- error message.
273 --
274 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
275 fnd_message.set_token('TABLE_NAME', 'per_events');
276 fnd_message.raise_error;
277 End lck;
278 --
279 -- ----------------------------------------------------------------------------
280 -- |-----------------------------< convert_args >-----------------------------|
281 -- ----------------------------------------------------------------------------
282 Function convert_args
283 (p_event_id in number
284 ,p_business_group_id in number
285 ,p_location_id in number
286 ,p_internal_contact_person_id in number
287 ,p_organization_run_by_id in number
288 ,p_assignment_id in number
289 ,p_date_start in date
290 ,p_type in varchar2
291 ,p_comments in varchar2
292 ,p_contact_telephone_number in varchar2
293 ,p_date_end in date
294 ,p_emp_or_apl in varchar2
295 ,p_event_or_interview in varchar2
296 ,p_external_contact in varchar2
297 ,p_time_end in varchar2
298 ,p_time_start in varchar2
299 ,p_request_id in number
300 ,p_program_application_id in number
301 ,p_program_id in number
302 ,p_program_update_date in date
303 ,p_attribute_category in varchar2
304 ,p_attribute1 in varchar2
305 ,p_attribute2 in varchar2
306 ,p_attribute3 in varchar2
307 ,p_attribute4 in varchar2
308 ,p_attribute5 in varchar2
309 ,p_attribute6 in varchar2
310 ,p_attribute7 in varchar2
311 ,p_attribute8 in varchar2
312 ,p_attribute9 in varchar2
313 ,p_attribute10 in varchar2
314 ,p_attribute11 in varchar2
315 ,p_attribute12 in varchar2
316 ,p_attribute13 in varchar2
317 ,p_attribute14 in varchar2
318 ,p_attribute15 in varchar2
319 ,p_attribute16 in varchar2
320 ,p_attribute17 in varchar2
321 ,p_attribute18 in varchar2
322 ,p_attribute19 in varchar2
323 ,p_attribute20 in varchar2
324 ,p_party_id in number default null
325 ,p_object_version_number in number
326 )
327 Return g_rec_type is
328 --
329 l_rec g_rec_type;
330 --
331 Begin
332 --
333 -- Convert arguments into local l_rec structure.
334 --
335 l_rec.event_id := p_event_id;
336 l_rec.business_group_id := p_business_group_id;
337 l_rec.location_id := p_location_id;
338 l_rec.internal_contact_person_id := p_internal_contact_person_id;
339 l_rec.organization_run_by_id := p_organization_run_by_id;
340 l_rec.assignment_id := p_assignment_id;
341 l_rec.date_start := p_date_start;
342 l_rec.type := p_type;
343 l_rec.comments := p_comments;
344 l_rec.contact_telephone_number := p_contact_telephone_number;
345 l_rec.date_end := p_date_end;
346 l_rec.emp_or_apl := p_emp_or_apl;
347 l_rec.event_or_interview := p_event_or_interview;
348 l_rec.external_contact := p_external_contact;
349 l_rec.time_end := p_time_end;
350 l_rec.time_start := p_time_start;
351 l_rec.request_id := p_request_id;
352 l_rec.program_application_id := p_program_application_id;
353 l_rec.program_id := p_program_id;
354 l_rec.program_update_date := p_program_update_date;
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.party_id := p_party_id;
377 l_rec.object_version_number := p_object_version_number;
378 --
379 -- Return the plsql record structure.
380 --
381 Return(l_rec);
382 --
383 End convert_args;
384 --
385 end per_evt_shd;