DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_MCU_BUS

Source


1 Package Body hxc_mcu_bus as
2 /* $Header: hxcmcurhi.pkb 120.2 2005/09/23 08:44:11 nissharm noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hxc_mcu_bus.';  -- Global package name
9 
10 g_debug boolean := hr_utility.debug_enabled;
11 --
12 -- The following two global variables are only to be
13 -- used by the return_legislation_code function.
14 --
15 -- ----------------------------------------------------------------------------
16 -- |-----------------------< chk_non_updateable_args >------------------------|
17 -- ----------------------------------------------------------------------------
18 -- {Start Of Comments}
19 --
20 -- Description:
21 --   This procedure is used to ensure that non updateable attributes have
22 --   not been updated. If an attribute has been updated an error is generated.
23 --
24 -- Pre Conditions:
25 --   g_old_rec has been populated with details of the values currently in
26 --   the database.
27 --
28 -- In Arguments:
29 --   p_rec has been populated with the updated values the user would like the
30 --   record set to.
31 --
32 -- Post Success:
33 --   Processing continues if all the non updateable attributes have not
34 --   changed.
35 --
36 -- Post Failure:
37 --   An application error is raised if any of the non updatable attributes
38 --   have been altered.
39 --
40 -- {End Of Comments}
41 -- ----------------------------------------------------------------------------
42 Procedure chk_non_updateable_args
43   (p_rec in hxc_mcu_shd.g_rec_type
44   ) IS
45 --
46   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
47   l_error    EXCEPTION;
48   l_argument varchar2(30);
49 --
50 Begin
51   --
52   -- Only proceed with the validation if a row exists for the current
53   -- record in the HR Schema.
54   --
55   IF NOT hxc_mcu_shd.api_updating
56       (p_mapping_comp_usage_id                => p_rec.mapping_comp_usage_id
57       ,p_object_version_number                => p_rec.object_version_number
58       ) THEN
59      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
60      fnd_message.set_token('PROCEDURE ', l_proc);
61      fnd_message.set_token('STEP ', '5');
62      fnd_message.raise_error;
63   END IF;
64   --
65   -- EDIT_HERE: Add checks to ensure non-updateable args have
66   --            not been updated.
67   --
68   EXCEPTION
69     WHEN l_error THEN
70        hr_api.argument_changed_error
71          (p_api_name => l_proc
72          ,p_argument => l_argument);
73     WHEN OTHERS THEN
74        RAISE;
75 End chk_non_updateable_args;
76 --
77 -- ----------------------------------------------------------------------------
78 -- |-----------------------< chk_mapping_component_id >-----------------------|
79 -- ----------------------------------------------------------------------------
80 -- {Start Of Comments}
81 --
82 -- Description:
83 --   This procedure insures a valid mapping component id
84 --
85 -- Pre Conditions:
86 --   None
87 --
88 -- In Arguments:
89 --   mapping component id
90 --
91 -- Post Success:
92 --   Processing continues if the mapping component id business rules
93 --   have not been violated
94 --
95 -- Post Failure:
99 -- ----------------------------------------------------------------------------
96 --   An application error is raised if the mapping component id is not valid
97 --
98 -- {End Of Comments}
100 Procedure chk_mapping_component_id
101   (
102    p_mapping_component_id  in hxc_mapping_components.mapping_component_id%TYPE
103   ) IS
104 --
105   l_proc  varchar2(72);
106 --
107 -- cursor to check mapping_component_id is valid
108 --
109 CURSOR  csr_chk_mpc IS
110 SELECT 'error'
111 FROM	sys.dual
112 WHERE NOT EXISTS (
113 	SELECT	'x'
114 	FROM	hxc_mapping_components mpc
115 	WHERE	mpc.mapping_component_id = p_mapping_component_id );
116 --
117  l_error varchar2(5) := NULL;
118 --
119 BEGIN
120   g_debug := hr_utility.debug_enabled;
121 
122   if g_debug then
123   	l_proc := g_package||'chk_mapping_component_id';
124   	hr_utility.set_location('Entering:'||l_proc, 5);
125   end if;
126 --
127 -- check that the mapping component id  has been entered
128 --
129 IF p_mapping_component_id IS NULL
130 THEN
131 --
132       hr_utility.set_message(809, 'HXC_0031_MCU_MPC_ID_MAND');
133       hr_utility.raise_error;
134 --
135 END IF;
136   if g_debug then
137   	hr_utility.set_location('Processing:'||l_proc, 10);
138   end if;
139 --
140 -- check that mapping_component_id is valid
141 --
142   OPEN  csr_chk_mpc;
143   FETCH csr_chk_mpc INTO l_error;
144   CLOSE csr_chk_mpc;
145 --
146 IF l_error IS NOT NULL
147 THEN
148 --
149       hr_utility.set_message(809, 'HXC_0032_MCU_MPC_ID_INVLD');
150       hr_utility.raise_error;
151 --
152 END IF;
153 --
154 END chk_mapping_component_id;
155 --
156 -- ----------------------------------------------------------------------------
157 -- |-----------------------< chk_mapping_id >---------------------------------|
158 -- ----------------------------------------------------------------------------
159 -- {Start Of Comments}
160 --
161 -- Description:
162 --   This procedure insures a valid mapping id
163 --
164 -- Pre Conditions:
165 --   None
166 --
167 -- In Arguments:
168 --   mapping id
169 --
170 -- Post Success:
171 --   Processing continues if the mapping id business rules
172 --   have not been violated
173 --
174 -- Post Failure:
175 --   An application error is raised if the mapping id is not valid
176 --
177 -- {End Of Comments}
178 -- ----------------------------------------------------------------------------
179 Procedure chk_mapping_id
180   (
181    p_mapping_id  in hxc_mappings.mapping_id%TYPE
182   ) IS
183 --
184   l_proc  varchar2(72);
185 --
186 -- cursor to check mapping id is valid
187 --
188 CURSOR  csr_chk_map IS
189 SELECT 'error'
190 FROM	sys.dual
191 WHERE NOT EXISTS (
192 	SELECT	'x'
193 	FROM	hxc_mappings map
194 	WHERE	map.mapping_id = p_mapping_id );
195 --
196  l_error varchar2(5) := NULL;
197 --
198 BEGIN
199   g_debug := hr_utility.debug_enabled;
200 
201   if g_debug then
202   	l_proc := g_package||'chk_mapping_id';
203   	hr_utility.set_location('Entering:'||l_proc, 5);
204   end if;
205 --
206 -- check that the mapping id has been entered
207 --
208 IF p_mapping_id IS NULL
209 THEN
210 --
211       hr_utility.set_message(809, 'HXC_0034_MCU_MAP_ID_MAND');
212       hr_utility.raise_error;
213 --
214 END IF;
215   if g_debug then
216   	hr_utility.set_location('Processing:'||l_proc, 10);
217   end if;
218 --
219 -- check that mapping_component_id is valid
220 --
221   OPEN  csr_chk_map;
222   FETCH csr_chk_map INTO l_error;
223   CLOSE csr_chk_map;
224 --
225 IF l_error IS NOT NULL
226 THEN
227 --
228       hr_utility.set_message(809, 'HXC_0033_MCU_MAP_ID_INVLD');
229       hr_utility.raise_error;
230 --
231 END IF;
232 --
233   if g_debug then
234   	hr_utility.set_location('Leaving:'||l_proc, 20);
235   end if;
236 --
237 END chk_mapping_id;
238 --
239 -- ----------------------------------------------------------------------------
240 -- |-----------------------< chk_mcu_field_name>------------------------------|
241 -- ----------------------------------------------------------------------------
242 -- {Start Of Comments}
243 --
244 -- Description:
245 --   This procedure the field name is used onlyu once in a mapping
246 --
247 -- Pre Conditions:
248 --   None
249 --
250 -- In Arguments:
251 --   mapping component id
252 --   mapping id
253 --
254 -- Post Success:
255 --   Processing continues if the field name is not duplicated
256 --
257 -- Post Failure:
258 --   An application error is raised if the field name is duplicated
259 --
260 -- {End Of Comments}
261 -- ----------------------------------------------------------------------------
262 Procedure chk_mcu_field_name
263   (
264    p_mapping_id            in hxc_mappings.mapping_id%TYPE
265 ,  p_mapping_component_id  in hxc_mapping_components.mapping_component_id%TYPE
266   ) IS
267 --
268   l_proc  varchar2(72);
269 --
270 CURSOR csr_chk_field_name IS
271 SELECT 'error'
272 FROM	hxc_mapping_components mpc
273 WHERE	mpc.mapping_component_id = p_mapping_component_id
274 AND EXISTS (
275 	SELECT	'x'
276 	FROM	hxc_mapping_components mpc1
277 	,	hxc_mapping_comp_usages mcu
278 	WHERE	mcu.mapping_id	= p_mapping_id
279 	AND	mcu.mapping_component_id = mpc1.mapping_component_id
280 	AND	mpc1.mapping_component_id <> mpc.mapping_component_id
284 --
281 	AND	mpc1.field_name	= mpc.field_name );
282 --
283  l_error varchar2(5) := NULL;
285 BEGIN
286   g_debug := hr_utility.debug_enabled;
287 
288   if g_debug then
289   	l_proc := g_package||'chk_mcu_field_name';
290   	hr_utility.set_location('Entering:'||l_proc, 5);
291   end if;
292 --
293 -- check that field name is not used more than once in the mapping
294 --
295   OPEN  csr_chk_field_name;
296   FETCH csr_chk_field_name INTO l_error;
297   CLOSE csr_chk_field_name;
298 --
299 IF l_error IS NOT NULL
300 THEN
301 --
302       hr_utility.set_message(809, 'HXC_0035_MCU_DUP_FLD_NAME');
303       hr_utility.raise_error;
304 --
305 END IF;
306 --
307   if g_debug then
308   	hr_utility.set_location('Leaving:'||l_proc, 10);
309   end if;
310 --
311 END chk_mcu_field_name;
312 --
313 -- ----------------------------------------------------------------------------
314 -- |-----------------------< chk_mcu_composite_key>---------------------------|
315 -- ----------------------------------------------------------------------------
316 -- {Start Of Comments}
317 --
318 -- Description:
319 --   This procedure ensures the segment and bld blk info type are unique within
320 --   a mapping
321 --
322 -- Pre Conditions:
323 --   None
324 --
325 -- In Arguments:
326 --   mapping component id
327 --   mapping id
328 --
329 -- Post Success:
330 --   Processing continues if the key is not duplicated
331 --
332 -- Post Failure:
333 --   An application error is raised if the key is duplicated
334 --
335 -- {End Of Comments}
336 -- ----------------------------------------------------------------------------
337 Procedure chk_mcu_composite_key
338   (
339    p_mapping_id            in hxc_mappings.mapping_id%TYPE
340 ,  p_mapping_component_id  in hxc_mapping_components.mapping_component_id%TYPE
341   ) IS
342 --
343   l_proc  varchar2(72);
344 --
345 CURSOR csr_chk_composite_key IS
346 SELECT 'error'
347 FROM	hxc_mapping_components mpc
348 WHERE	mpc.mapping_component_id = p_mapping_component_id
349 AND EXISTS (
350 	SELECT	'x'
351 	FROM	hxc_mapping_components mpc1
352 	,	hxc_mapping_comp_usages mcu
353 	WHERE	mcu.mapping_id	= p_mapping_id
354 	AND	mcu.mapping_component_id = mpc1.mapping_component_id
355 	AND	mpc1.segment = mpc.segment
356 	AND     mpc1.bld_blk_info_type_id = mpc.bld_blk_info_type_id );
357 --
358  l_error varchar2(5) := NULL;
359 --
360 BEGIN
361   g_debug := hr_utility.debug_enabled;
362 
363   if g_debug then
364   	l_proc := g_package||'chk_mcu_composite_key';
365   	hr_utility.set_location('Entering:'||l_proc, 5);
366   end if;
367 --
368 -- check that composite key is not used more than once in the mapping
369 --
370   OPEN  csr_chk_composite_key;
371   FETCH csr_chk_composite_key INTO l_error;
372   CLOSE csr_chk_composite_key;
373 --
374 IF l_error IS NOT NULL
375 THEN
376 --
377       hr_utility.set_message(809, 'HXC_0036_MCU_DUP_TYPE_SEG');
378       hr_utility.raise_error;
379 --
380 END IF;
381 --
382   if g_debug then
383   	hr_utility.set_location('Leaving:'||l_proc, 10);
384   end if;
385 --
386 END chk_mcu_composite_key;
387 --
388 -- ----------------------------------------------------------------------------
389 -- |-----------------------< chk_delete >-------------------------------------|
390 -- ----------------------------------------------------------------------------
391 -- {Start Of Comments}
392 --
393 -- Description:
394 --
395 -- This procedure is the same as HXC_MAP_BUS's chk_delete.
396 -- See hxmaprhi.pkh for details
397 --
398 -- {End Of Comments}
399 -- ----------------------------------------------------------------------------
400 --
401 -- ----------------------------------------------------------------------------
402 -- |---------------------------< insert_validate >----------------------------|
403 -- ----------------------------------------------------------------------------
404 Procedure insert_validate
405   (p_rec                          in hxc_mcu_shd.g_rec_type
406   ) is
407 --
408   l_proc  varchar2(72);
409 --
410 Begin
411   g_debug := hr_utility.debug_enabled;
412 
413   if g_debug then
414   	l_proc := g_package||'insert_validate';
415   	hr_utility.set_location('Entering:'||l_proc, 5);
416   end if;
417   --
418   -- No business group context.  HR_STANDARD_LOOKUPS used for validation.
419   -- CLIENT_INFO not set.  No lookup validation or joins to HR_LOOKUPS.
420   --
421   -- Call all supporting business operations
422   --
423 	chk_mapping_component_id (
424 		p_mapping_component_id => p_rec.mapping_component_id );
425   --
426 	chk_mapping_id ( p_mapping_id => p_rec.mapping_id );
427   --
428 	chk_mcu_field_name ( p_mapping_id => p_rec.mapping_id
429 			   , p_mapping_component_id => p_rec.mapping_component_id);
430   --
431 	chk_mcu_composite_key ( p_mapping_id => p_rec.mapping_id
432 			   , p_mapping_component_id => p_rec.mapping_component_id);
433   --
434   if g_debug then
435   	hr_utility.set_location(' Leaving:'||l_proc, 10);
436   end if;
437 End insert_validate;
438 --
439 -- ----------------------------------------------------------------------------
440 -- |---------------------------< update_validate >----------------------------|
441 -- ----------------------------------------------------------------------------
445 --
442 Procedure update_validate
443   (p_rec                          in hxc_mcu_shd.g_rec_type
444   ) is
446   l_proc  varchar2(72);
447 --
448 Begin
449   g_debug := hr_utility.debug_enabled;
450 
451   if g_debug then
452   	l_proc := g_package||'update_validate';
453   	hr_utility.set_location('Entering:'||l_proc, 5);
454   end if;
455   --
456   -- No business group context.  HR_STANDARD_LOOKUPS used for validation.
457   -- CLIENT_INFO not set.  No lookup validation or joins to HR_LOOKUPS.
458   --
459   -- Call all supporting business operations
460   --
461 	chk_mapping_component_id (
462 		p_mapping_component_id => p_rec.mapping_component_id );
463   --
464 	chk_mapping_id ( p_mapping_id => p_rec.mapping_id );
465   --
466   chk_non_updateable_args
467     (p_rec              => p_rec
468     );
469   --
470   --
471   if g_debug then
472   	hr_utility.set_location(' Leaving:'||l_proc, 10);
473   end if;
474 End update_validate;
475 --
476 -- ----------------------------------------------------------------------------
477 -- |---------------------------< delete_validate >----------------------------|
478 -- ----------------------------------------------------------------------------
479 Procedure delete_validate
480   (p_rec                          in hxc_mcu_shd.g_rec_type
481   ) is
482 --
483   l_proc  varchar2(72);
484 --
485 Begin
486   g_debug := hr_utility.debug_enabled;
487 
488   if g_debug then
489   	l_proc := g_package||'delete_validate';
490   	hr_utility.set_location('Entering:'||l_proc, 5);
491   end if;
492   --
493   -- Call all supporting business operations
494   --
495   hxc_map_bus.chk_delete ( p_mapping_id => p_rec.mapping_id );
496   --
497   if g_debug then
498   	hr_utility.set_location(' Leaving:'||l_proc, 10);
499   end if;
500 End delete_validate;
501 --
502 end hxc_mcu_bus;