[Home] [Help]
PACKAGE BODY: APPS.HR_INT_INS
Source
1 Package Body hr_int_ins as
2 /* $Header: hrintrhi.pkb 115.0 2004/01/09 01:40 vkarandi noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hr_int_ins.'; -- Global package name
9 --
10 -- The following global variables are only to be used by
11 -- the set_base_key_value and pre_insert procedures.
12 --
13 g_integration_id_i number default null;
14 --
15 -- ----------------------------------------------------------------------------
16 -- |------------------------< set_base_key_value >----------------------------|
17 -- ----------------------------------------------------------------------------
18 procedure set_base_key_value
19 (p_integration_id in number) is
20 --
21 l_proc varchar2(72) := g_package||'set_base_key_value';
22 --
23 Begin
24 hr_utility.set_location('Entering:'||l_proc, 10);
25 --
26 hr_int_ins.g_integration_id_i := p_integration_id;
27 --
28 hr_utility.set_location(' Leaving:'||l_proc, 20);
29 End set_base_key_value;
30 --
31 --
32 -- ----------------------------------------------------------------------------
33 -- |------------------------------< insert_dml >------------------------------|
37 -- Description:
34 -- ----------------------------------------------------------------------------
35 -- {Start Of Comments}
36 --
38 -- This procedure controls the actual dml insert logic. The processing of
39 -- this procedure are as follows:
40 -- 1) Initialise the object_version_number to 1 if the object_version_number
41 -- is defined as an attribute for this entity.
42 -- 2) To set and unset the g_api_dml status as required (as we are about to
43 -- perform dml).
44 -- 3) To insert the row into the schema.
45 -- 4) To trap any constraint violations that may have occurred.
46 -- 5) To raise any other errors.
47 --
48 -- Prerequisites:
49 -- This is an internal private procedure which must be called from the ins
50 -- procedure and must have all mandatory attributes set (except the
51 -- object_version_number which is initialised within this procedure).
52 --
53 -- In Parameters:
54 -- A Pl/Sql record structre.
55 --
56 -- Post Success:
57 -- The specified row will be inserted into the schema.
58 --
59 -- Post Failure:
60 -- On the insert dml failure it is important to note that we always reset the
61 -- g_api_dml status to false.
62 -- If a check, unique or parent integrity constraint violation is raised the
63 -- constraint_error procedure will be called.
64 -- If any other error is reported, the error will be raised after the
65 -- g_api_dml status is reset.
66 --
67 -- Developer Implementation Notes:
68 -- None.
69 --
70 -- Access Status:
71 -- Internal Row Handler Use Only.
72 --
73 -- {End Of Comments}
74 -- ----------------------------------------------------------------------------
75 Procedure insert_dml
76 (p_rec in out nocopy hr_int_shd.g_rec_type
77 ) is
78 --
79 l_proc varchar2(72) := g_package||'insert_dml';
80 --
81 Begin
82 hr_utility.set_location('Entering:'||l_proc, 5);
83 p_rec.object_version_number := 1; -- Initialise the object version
84 --
85 --
86 --
87 -- Insert the row into: hr_ki_integrations
88 --
89 insert into hr_ki_integrations
90 (integration_id
91 ,integration_key
92 ,party_type
93 ,party_name
94 ,party_site_name
95 ,transaction_type
96 ,transaction_subtype
97 ,standard_code
98 ,ext_trans_type
99 ,ext_trans_subtype
100 ,trans_direction
101 ,url
102 ,synched
103 ,ext_application_id
104 ,application_name
105 ,application_type
106 ,application_url
107 ,logout_url
108 ,user_field
109 ,password_field
110 ,authentication_needed
111 ,field_name1
112 ,field_value1
113 ,field_name2
114 ,field_value2
115 ,field_name3
116 ,field_value3
117 ,field_name4
118 ,field_value4
119 ,field_name5
120 ,field_value5
121 ,field_name6
122 ,field_value6
123 ,field_name7
124 ,field_value7
125 ,field_name8
126 ,field_value8
127 ,field_name9
128 ,field_value9
129 ,object_version_number
130 )
131 Values
132 (p_rec.integration_id
133 ,p_rec.integration_key
134 ,p_rec.party_type
135 ,p_rec.party_name
136 ,p_rec.party_site_name
137 ,p_rec.transaction_type
138 ,p_rec.transaction_subtype
139 ,p_rec.standard_code
140 ,p_rec.ext_trans_type
141 ,p_rec.ext_trans_subtype
142 ,p_rec.trans_direction
143 ,p_rec.url
144 ,p_rec.synched
145 ,p_rec.ext_application_id
146 ,p_rec.application_name
147 ,p_rec.application_type
148 ,p_rec.application_url
149 ,p_rec.logout_url
150 ,p_rec.user_field
151 ,p_rec.password_field
152 ,p_rec.authentication_needed
153 ,p_rec.field_name1
154 ,p_rec.field_value1
155 ,p_rec.field_name2
156 ,p_rec.field_value2
157 ,p_rec.field_name3
158 ,p_rec.field_value3
159 ,p_rec.field_name4
160 ,p_rec.field_value4
161 ,p_rec.field_name5
162 ,p_rec.field_value5
163 ,p_rec.field_name6
164 ,p_rec.field_value6
165 ,p_rec.field_name7
166 ,p_rec.field_value7
167 ,p_rec.field_name8
168 ,p_rec.field_value8
169 ,p_rec.field_name9
170 ,p_rec.field_value9
171 ,p_rec.object_version_number
172 );
173 --
174 --
175 --
176 hr_utility.set_location(' Leaving:'||l_proc, 10);
177 Exception
178 When hr_api.check_integrity_violated Then
179 -- A check constraint has been violated
180 --
181 hr_int_shd.constraint_error
182 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
183 When hr_api.parent_integrity_violated Then
184 -- Parent integrity has been violated
185 --
186 hr_int_shd.constraint_error
187 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
188 When hr_api.unique_integrity_violated Then
189 -- Unique integrity has been violated
190 --
191 hr_int_shd.constraint_error
192 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
193 When Others Then
194 --
195 Raise;
196 End insert_dml;
197 --
198 -- ----------------------------------------------------------------------------
202 --
199 -- |------------------------------< pre_insert >------------------------------|
200 -- ----------------------------------------------------------------------------
201 -- {Start Of Comments}
203 -- Description:
204 -- This private procedure contains any processing which is required before
205 -- the insert dml. Presently, if the entity has a corresponding primary
206 -- key which is maintained by an associating sequence, the primary key for
207 -- the entity will be populated with the next sequence value in
208 -- preparation for the insert dml.
209 --
210 -- Prerequisites:
211 -- This is an internal procedure which is called from the ins procedure.
212 --
213 -- In Parameters:
214 -- A Pl/Sql record structure.
215 --
216 -- Post Success:
217 -- Processing continues.
218 --
219 -- Post Failure:
220 -- If an error has occurred, an error message and exception will be raised
221 -- but not handled.
222 --
223 -- Developer Implementation Notes:
224 -- Any pre-processing required before the insert dml is issued should be
225 -- coded within this procedure. As stated above, a good example is the
226 -- generation of a primary key number via a corresponding sequence.
227 -- It is important to note that any 3rd party maintenance should be reviewed
228 -- before placing in this procedure.
229 --
230 -- Access Status:
231 -- Internal Row Handler Use Only.
232 --
233 -- {End Of Comments}
234 -- ----------------------------------------------------------------------------
235 Procedure pre_insert
236 (p_rec in out nocopy hr_int_shd.g_rec_type
237 ) is
238 --
239 Cursor C_Sel1 is select hr_ki_integrations_s.nextval from sys.dual;
240 --
241 Cursor C_Sel2 is
242 Select null
243 from hr_ki_integrations
244 where integration_id =
245 hr_int_ins.g_integration_id_i;
246 --
247 l_proc varchar2(72) := g_package||'pre_insert';
248 l_exists varchar2(1);
249 --
250 Begin
251 hr_utility.set_location('Entering:'||l_proc, 5);
252 --
253 If (hr_int_ins.g_integration_id_i is not null) Then
254 --
255 -- Verify registered primary key values not already in use
256 --
257 Open C_Sel2;
258 Fetch C_Sel2 into l_exists;
259 If C_Sel2%found Then
260 Close C_Sel2;
261 --
262 -- The primary key values are already in use.
263 --
264 fnd_message.set_name('PER','PER_289391_KEY_ALREADY_USED');
265 fnd_message.set_token('TABLE_NAME','hr_ki_integrations');
266 fnd_message.raise_error;
267 End If;
268 Close C_Sel2;
269 --
270 -- Use registered key values and clear globals
271 --
272 p_rec.integration_id :=
273 hr_int_ins.g_integration_id_i;
274 hr_int_ins.g_integration_id_i := null;
275 Else
276 --
277 -- No registerd key values, so select the next sequence number
278 --
279 --
280 -- Select the next sequence number
281 --
282 Open C_Sel1;
283 Fetch C_Sel1 Into p_rec.integration_id;
284 Close C_Sel1;
285 End If;
286 --
287 hr_utility.set_location(' Leaving:'||l_proc, 10);
288 End pre_insert;
289 --
290 -- ----------------------------------------------------------------------------
291 -- |-----------------------------< post_insert >------------------------------|
292 -- ----------------------------------------------------------------------------
293 -- {Start Of Comments}
294 --
295 -- Description:
296 -- This private procedure contains any processing which is required after
297 -- the insert dml.
298 --
299 -- Prerequisites:
300 -- This is an internal procedure which is called from the ins procedure.
301 --
302 -- In Parameters:
303 -- A Pl/Sql record structre.
304 --
305 -- Post Success:
306 -- Processing continues.
307 --
308 -- Post Failure:
309 -- If an error has occurred, an error message and exception will be raised
310 -- but not handled.
311 --
312 -- Developer Implementation Notes:
313 -- Any post-processing required after the insert dml is issued should be
314 -- coded within this procedure. It is important to note that any 3rd party
315 -- maintenance should be reviewed before placing in this procedure.
316 --
317 -- Access Status:
318 -- Internal Row Handler Use Only.
319 --
320 -- {End Of Comments}
321 -- ----------------------------------------------------------------------------
322 Procedure post_insert
323 (p_rec in hr_int_shd.g_rec_type
324 ) is
325 --
326 l_proc varchar2(72) := g_package||'post_insert';
327 --
328 Begin
329 hr_utility.set_location('Entering:'||l_proc, 5);
330 begin
331 --
332 hr_int_rki.after_insert
333 (p_integration_id
334 => p_rec.integration_id
335 ,p_integration_key
336 => p_rec.integration_key
337 ,p_party_type
338 => p_rec.party_type
339 ,p_party_name
340 => p_rec.party_name
341 ,p_party_site_name
342 => p_rec.party_site_name
343 ,p_transaction_type
344 => p_rec.transaction_type
345 ,p_transaction_subtype
346 => p_rec.transaction_subtype
347 ,p_standard_code
348 => p_rec.standard_code
349 ,p_ext_trans_type
350 => p_rec.ext_trans_type
351 ,p_ext_trans_subtype
352 => p_rec.ext_trans_subtype
353 ,p_trans_direction
354 => p_rec.trans_direction
355 ,p_url
356 => p_rec.url
357 ,p_synched
358 => p_rec.synched
359 ,p_ext_application_id
360 => p_rec.ext_application_id
361 ,p_application_name
362 => p_rec.application_name
363 ,p_application_type
364 => p_rec.application_type
365 ,p_application_url
366 => p_rec.application_url
367 ,p_logout_url
368 => p_rec.logout_url
369 ,p_user_field
370 => p_rec.user_field
371 ,p_password_field
372 => p_rec.password_field
373 ,p_authentication_needed
374 => p_rec.authentication_needed
375 ,p_field_name1
376 => p_rec.field_name1
377 ,p_field_value1
378 => p_rec.field_value1
379 ,p_field_name2
380 => p_rec.field_name2
381 ,p_field_value2
382 => p_rec.field_value2
383 ,p_field_name3
384 => p_rec.field_name3
385 ,p_field_value3
386 => p_rec.field_value3
387 ,p_field_name4
388 => p_rec.field_name4
389 ,p_field_value4
390 => p_rec.field_value4
391 ,p_field_name5
392 => p_rec.field_name5
393 ,p_field_value5
394 => p_rec.field_value5
395 ,p_field_name6
396 => p_rec.field_name6
397 ,p_field_value6
398 => p_rec.field_value6
399 ,p_field_name7
400 => p_rec.field_name7
401 ,p_field_value7
402 => p_rec.field_value7
403 ,p_field_name8
404 => p_rec.field_name8
405 ,p_field_value8
406 => p_rec.field_value8
407 ,p_field_name9
408 => p_rec.field_name9
409 ,p_field_value9
410 => p_rec.field_value9
411 ,p_object_version_number
412 => p_rec.object_version_number
413 );
414 --
415 exception
416 --
417 when hr_api.cannot_find_prog_unit then
418 --
419 hr_api.cannot_find_prog_unit_error
420 (p_module_name => 'HR_KI_INTEGRATIONS'
421 ,p_hook_type => 'AI');
422 --
423 end;
424 --
425 hr_utility.set_location(' Leaving:'||l_proc, 10);
426 End post_insert;
427 --
428 -- ----------------------------------------------------------------------------
429 -- |---------------------------------< ins >----------------------------------|
430 -- ----------------------------------------------------------------------------
431 Procedure ins
432 (p_rec in out nocopy hr_int_shd.g_rec_type
433 ) is
434 --
435 l_proc varchar2(72) := g_package||'ins';
436 --
437 Begin
438 hr_utility.set_location('Entering:'||l_proc, 5);
439 --
440 -- Call the supporting insert validate operations
441 --
442 hr_int_bus.insert_validate
443 (p_rec
444 );
445 --
446 -- Call to raise any errors on multi-message list
447 hr_multi_message.end_validation_set;
448 --
449 -- Call the supporting pre-insert operation
450 --
451 hr_int_ins.pre_insert(p_rec);
452 --
453 -- Insert the row
454 --
455 hr_int_ins.insert_dml(p_rec);
456 --
457 -- Call the supporting post-insert operation
458 --
459 hr_int_ins.post_insert
460 (p_rec
461 );
462 --
463 -- Call to raise any errors on multi-message list
464 hr_multi_message.end_validation_set;
465 --
466 hr_utility.set_location('Leaving:'||l_proc, 20);
467 end ins;
468 --
469 -- ----------------------------------------------------------------------------
470 -- |---------------------------------< ins >----------------------------------|
471 -- ----------------------------------------------------------------------------
472 Procedure ins
473 (p_integration_key in varchar2
474 ,p_party_type in varchar2 default null
475 ,p_party_name in varchar2 default null
476 ,p_party_site_name in varchar2 default null
477 ,p_transaction_type in varchar2 default null
478 ,p_transaction_subtype in varchar2 default null
479 ,p_standard_code in varchar2 default null
480 ,p_ext_trans_type in varchar2 default null
481 ,p_ext_trans_subtype in varchar2 default null
482 ,p_trans_direction in varchar2 default null
483 ,p_url in varchar2 default null
484 ,p_ext_application_id in number default null
485 ,p_application_name in varchar2 default null
486 ,p_application_type in varchar2 default null
487 ,p_application_url in varchar2 default null
488 ,p_logout_url in varchar2 default null
489 ,p_user_field in varchar2 default null
490 ,p_password_field in varchar2 default null
491 ,p_authentication_needed in varchar2 default null
492 ,p_field_name1 in varchar2 default null
493 ,p_field_value1 in varchar2 default null
494 ,p_field_name2 in varchar2 default null
495 ,p_field_value2 in varchar2 default null
496 ,p_field_name3 in varchar2 default null
497 ,p_field_value3 in varchar2 default null
498 ,p_field_name4 in varchar2 default null
499 ,p_field_value4 in varchar2 default null
500 ,p_field_name5 in varchar2 default null
501 ,p_field_value5 in varchar2 default null
502 ,p_field_name6 in varchar2 default null
503 ,p_field_value6 in varchar2 default null
504 ,p_field_name7 in varchar2 default null
505 ,p_field_value7 in varchar2 default null
506 ,p_field_name8 in varchar2 default null
507 ,p_field_value8 in varchar2 default null
508 ,p_field_name9 in varchar2 default null
509 ,p_field_value9 in varchar2 default null
510 ,p_integration_id out nocopy number
511 ,p_object_version_number out nocopy number
512 ) is
513 --
514 l_rec hr_int_shd.g_rec_type;
515 l_proc varchar2(72) := g_package||'ins';
516 --
517 Begin
518 hr_utility.set_location('Entering:'||l_proc, 5);
519 --
520 -- Call conversion function to turn arguments into the
521 -- p_rec structure.
522 --
523 l_rec :=
524 hr_int_shd.convert_args
525 (null
526 ,p_integration_key
527 ,p_party_type
528 ,p_party_name
529 ,p_party_site_name
530 ,p_transaction_type
531 ,p_transaction_subtype
532 ,p_standard_code
533 ,p_ext_trans_type
534 ,p_ext_trans_subtype
535 ,p_trans_direction
536 ,p_url
537 ,null
538 ,p_ext_application_id
539 ,p_application_name
540 ,p_application_type
541 ,p_application_url
542 ,p_logout_url
543 ,p_user_field
544 ,p_password_field
545 ,p_authentication_needed
546 ,p_field_name1
547 ,p_field_value1
548 ,p_field_name2
549 ,p_field_value2
550 ,p_field_name3
551 ,p_field_value3
552 ,p_field_name4
553 ,p_field_value4
554 ,p_field_name5
555 ,p_field_value5
556 ,p_field_name6
557 ,p_field_value6
558 ,p_field_name7
559 ,p_field_value7
560 ,p_field_name8
561 ,p_field_value8
562 ,p_field_name9
563 ,p_field_value9
564 ,null
565 );
566 --
567 -- Having converted the arguments into the hr_int_rec
568 -- plsql record structure we call the corresponding record business process.
569 --
570 hr_int_ins.ins
571 (l_rec
572 );
573 --
574 -- As the primary key argument(s)
575 -- are specified as an OUT's we must set these values.
576 --
577 p_integration_id := l_rec.integration_id;
578 p_object_version_number := l_rec.object_version_number;
579 --
580 hr_utility.set_location(' Leaving:'||l_proc, 10);
581 End ins;
582 --
583 end hr_int_ins;