DBA Data[Home] [Help]

PACKAGE BODY: APPS.IRC_RAV_BUS

Source


1 Package Body irc_rav_bus as
2 /* $Header: irravrhi.pkb 120.2 2011/01/05 04:43:06 avarri noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  irc_rav_bus.';  -- Global package name
9 --
10 -- The following two global variables are only to be
11 -- used by the return_legislation_code function.
12 --
13 g_vac_rec_area_id             number         default null;
14 --
15 -- ----------------------------------------------------------------------------
16 -- |-------------------------< chk_hierarchy_version_id >---------------------|
17 -- ----------------------------------------------------------------------------
18 -- {Start Of Comments}
19 --
20 -- Description:
21 --   This procedure ensures a valid Hierarchy Version Id is entered
22 -- Pre Conditions:
23 --   g_old_rec has been populated with details of the values currently in
24 --   the database.
25 --
26 -- In Arguments:
27 --   p_hierarchy_version_id
28 --
29 --
30 -- Post Success:
31 --   Processing continues if Hierarchy Version Id is valid
32 --
33 -- Post Failure:
34 --   An application error is raised if Hierarchy Version Id is not valid
35 --
36 -- {End Of Comments}
37 -- ----------------------------------------------------------------------------
38 Procedure chk_hierarchy_version_id
39   (p_hierarchy_version_id in irc_vac_rec_area_values.hierarchy_version_id%TYPE
40   )
41   IS
42 --
43   l_proc         varchar2(72) := g_package || 'chk_hierarchy_version_id';
44   l_hierarchy_version_id  irc_vac_rec_area_values.hierarchy_version_id%TYPE;
45 --
46   cursor csr_chk_hierarchy_version_id is
47     select 1
48       from per_gen_hierarchy_versions
49      where hierarchy_version_id = p_hierarchy_version_id;
50 --
51 Begin
52   hr_utility.set_location('Entering:'||l_proc,10);
53   --
54   hr_api.mandatory_arg_error
55   (p_api_name       => l_proc
56   ,p_argument       => 'hierarchy_version_id'
57   ,p_argument_value => p_hierarchy_version_id
58   );
59   --
60   open csr_chk_hierarchy_version_id;
61   fetch csr_chk_hierarchy_version_id into l_hierarchy_version_id;
62   --
63   hr_utility.set_location(l_proc,15);
64   if (csr_chk_hierarchy_version_id%notfound) then
65     close csr_chk_hierarchy_version_id;
66     fnd_message.set_name('PER','IRC_412659_INV_HIERARCHY_ID');
67     fnd_message.raise_error;
68   end if;
69   --
70   close csr_chk_hierarchy_version_id;
71   --
72   hr_utility.set_location(' Leaving:'||l_proc,20);
73 exception
74   when app_exception.application_exception then
75     if hr_multi_message.exception_add
76        (p_associated_column1      => 'IRC_VAC_REC_AREA_VALUES.HIERARCHY_VERSION_ID'
77         ) then
78       hr_utility.set_location(' Leaving:'|| l_proc, 25);
79       raise;
80     end if;
81     hr_utility.set_location(' Leaving:'|| l_proc, 30);
82 End chk_hierarchy_version_id;
83 --
84 -- ----------------------------------------------------------------------------
85 -- |-------------------------< chk_duplicate_vac_rec_area >-------------------|
86 -- ----------------------------------------------------------------------------
87 -- {Start Of Comments}
88 --
89 -- Description:
90 --   This procedure ensures unique location preference for an object is entered
91 -- Pre Conditions:
92 --   g_old_rec has been populated with details of the values currently in
93 --   the database.
94 --
95 -- In Arguments:
96 --   p_vacancy_id
97 --   p_hierarchy_version_id
98 --
99 --
100 -- Post Success:
101 --   Processing continues if Hierarchy Version Id is valid
102 --
103 -- Post Failure:
104 --   An application error is raised if Hierarchy Version Id is not valid
105 --
106 -- {End Of Comments}
107 -- ----------------------------------------------------------------------------
108 Procedure chk_duplicate_vac_rec_area
109   (p_vacancy_id             in irc_vac_rec_area_values.vacancy_id%TYPE
110   ,p_hierarchy_version_id   in irc_vac_rec_area_values.hierarchy_version_id%TYPE
111   )
112   IS
113 --
114   l_proc      varchar2(72) := g_package || 'chk_duplicate_vac_rec_area';
115   l_count     number;
116 --
117   cursor csr_chk_duplicate_rec_area is
118     select 1
119       from irc_vac_rec_area_values
120      where vacancy_id            = p_vacancy_id
121        and hierarchy_version_id  = p_hierarchy_version_id;
122 --
123 Begin
124   hr_utility.set_location('Entering:'||l_proc,10);
125   --
126   open csr_chk_duplicate_rec_area;
127   fetch csr_chk_duplicate_rec_area into l_count;
128   --
129   hr_utility.set_location(l_proc,15);
130   if (csr_chk_duplicate_rec_area%found) then
131     close csr_chk_duplicate_rec_area;
132     fnd_message.set_name('PER','IRC_412660_DUP_REC_AREAS');
133     fnd_message.raise_error;
134   end if;
135   --
136   close csr_chk_duplicate_rec_area;
137   --
138   hr_utility.set_location(' Leaving:'||l_proc,20);
139 exception
140   when app_exception.application_exception then
141     if hr_multi_message.exception_add
142        (p_associated_column1      => 'IRC_VAC_REC_AREA_VALUES.VACANCY_ID'
143        ,p_associated_column2      => 'IRC_VAC_REC_AREA_VALUES.HIERARCHY_VERSION_ID'
144         ) then
145       hr_utility.set_location(' Leaving:'|| l_proc, 25);
146       raise;
147     end if;
148     hr_utility.set_location(' Leaving:'|| l_proc, 30);
149 End chk_duplicate_vac_rec_area;
150 --
151 -- ----------------------------------------------------------------------------
152 -- |-----------------------< chk_non_updateable_args >------------------------|
153 -- ----------------------------------------------------------------------------
154 -- {Start Of Comments}
155 --
156 -- Description:
157 --   This procedure is used to ensure that non updateable attributes have
158 --   not been updated. If an attribute has been updated an error is generated.
159 --
160 -- Pre Conditions:
161 --   g_old_rec has been populated with details of the values currently in
162 --   the database.
163 --
164 -- In Arguments:
165 --   p_rec has been populated with the updated values the user would like the
166 --   record set to.
167 --
168 -- Post Success:
169 --   Processing continues if all the non updateable attributes have not
170 --   changed.
171 --
172 -- Post Failure:
173 --   An application error is raised if any of the non updatable attributes
174 --   have been altered.
175 --
176 -- {End Of Comments}
177 -- ----------------------------------------------------------------------------
178 Procedure chk_non_updateable_args
179   (p_effective_date               in date
180   ,p_rec in irc_rav_shd.g_rec_type
181   ) IS
182 --
183   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
184 --
185 Begin
186   --
187   -- Only proceed with the validation if a row exists for the current
188   -- record in the HR Schema.
189   --
190   IF NOT irc_rav_shd.api_updating
191       (p_vac_rec_area_id                   => p_rec.vac_rec_area_id
192       ,p_object_version_number             => p_rec.object_version_number
193       ) THEN
194      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
195      fnd_message.set_token('PROCEDURE ', l_proc);
196      fnd_message.set_token('STEP ', '5');
197      fnd_message.raise_error;
198   END IF;
199   --
200   -- EDIT_HERE: Add checks to ensure non-updateable args have
201   --            not been updated.
202   --
203 End chk_non_updateable_args;
204 --
205 -- ----------------------------------------------------------------------------
206 -- |---------------------------< insert_validate >----------------------------|
207 -- ----------------------------------------------------------------------------
208 Procedure insert_validate
209   (p_effective_date               in date
210   ,p_rec                          in irc_rav_shd.g_rec_type
211   ) is
212 --
213   l_proc  varchar2(72) := g_package||'insert_validate';
214 --
215 Begin
216   hr_utility.set_location('Entering:'||l_proc, 5);
217   --
218   -- Call all supporting business operations
219   --
220   --
221   -- EDIT_HERE: As this table does not have a mandatory business_group_id
222   -- column, ensure client_info is populated by calling a suitable
223   -- ???_???_bus.set_security_group_id procedure, or add one of the following
224   -- comments:
225   -- "-- No business group context.  HR_STANDARD_LOOKUPS used for validation."
226   -- "-- CLIENT_INFO not set.  No lookup validation or joins to HR_LOOKUPS."
227   --
228   -- Validate Dependent Attributes
229   --
230   --
231   hr_utility.set_location(l_proc, 10);
232   --
233   irc_rav_bus.chk_hierarchy_version_id
234     (p_hierarchy_version_id   => p_rec.hierarchy_version_id
235     );
236   --
237  /* irc_rav_bus.chk_duplicate_vac_rec_area
238     ( p_vacancy_id           => p_rec.vacancy_id
239      ,p_hierarchy_version_id => p_rec.hierarchy_version_id
240     ); */
241   hr_utility.set_location(' Leaving:'||l_proc, 15);
242 End insert_validate;
243 --
244 -- ----------------------------------------------------------------------------
245 -- |---------------------------< update_validate >----------------------------|
246 -- ----------------------------------------------------------------------------
247 Procedure update_validate
248   (p_effective_date               in date
249   ,p_rec                          in irc_rav_shd.g_rec_type
250   ) is
251 --
252   l_proc  varchar2(72) := g_package||'update_validate';
253 --
254 Begin
255   hr_utility.set_location('Entering:'||l_proc, 5);
256   --
257   -- Call all supporting business operations
258   --
259   --
260   -- EDIT_HERE: As this table does not have a mandatory business_group_id
261   -- column, ensure client_info is populated by calling a suitable
262   -- ???_???_bus.set_security_group_id procedure, or add one of the following
263   -- comments:
264   -- "-- No business group context.  HR_STANDARD_LOOKUPS used for validation."
265   -- "-- CLIENT_INFO not set.  No lookup validation or joins to HR_LOOKUPS."
266   --
267   -- Validate Dependent Attributes
268   --
269   chk_non_updateable_args
270     (p_effective_date     => p_effective_date
271     ,p_rec                => p_rec
272     );
273   --
274   --
275   hr_utility.set_location(' Leaving:'||l_proc, 10);
276 End update_validate;
277 --
278 -- ----------------------------------------------------------------------------
279 -- |---------------------------< delete_validate >----------------------------|
280 -- ----------------------------------------------------------------------------
281 Procedure delete_validate
282   (p_rec                          in irc_rav_shd.g_rec_type
283   ) is
284 --
285   l_proc  varchar2(72) := g_package||'delete_validate';
286 --
287 Begin
288   hr_utility.set_location('Entering:'||l_proc, 5);
289   --
290   -- Call all supporting business operations
291   --
292   hr_utility.set_location(' Leaving:'||l_proc, 10);
293 End delete_validate;
294 --
295 end irc_rav_bus;