DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_UCX_BUS

Source


1 Package Body hr_ucx_bus as
2 /* $Header: hrucxrhi.pkb 120.0 2005/05/31 03:38 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  hr_ucx_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_legislation_code            varchar2(150)  default null;
14 g_ui_context_id               number         default null;
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 hr_ucx_shd.g_rec_type
44   ) IS
45 --
46   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
47 --
48 Begin
49   --
50   -- Only proceed with the validation if a row exists for the current
51   -- record in the HR Schema.
52   --
53   IF NOT hr_ucx_shd.api_updating
54       (p_ui_context_id                     => p_rec.ui_context_id
55       ,p_object_version_number             => p_rec.object_version_number
56       ) THEN
57      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
58      fnd_message.set_token('PROCEDURE ', l_proc);
59      fnd_message.set_token('STEP ', '5');
60      fnd_message.raise_error;
61   END IF;
62   --
63   -- EDIT_HERE: Add checks to ensure non-updateable args have
64   --            not been updated.
65   --
66 End chk_non_updateable_args;
67 
68 
69 -- ----------------------------------------------------------------------------
70 -- |-----------------------< CHK_UI_CONTEXT_KEY>------------------------------|
71 -- ----------------------------------------------------------------------------
72 -- {Start Of Comments}
73 --
74 -- Description:
75 --   This procedure ensures a valid UI context key is entered
76 -- Pre Conditions:
77 --   g_old_rec has been populated with details of the values currently in
78 --   the database.
79 --
80 -- In Arguments:
81 --   p_lalel,p_user_interface_id
82 -- Post Success:
83 --   Processing continues if UI context key is not null and unique
84 --
85 -- Post Failure:
86 --   An application error is raised if UI context key is null or exists already
87 --
88 -- {End Of Comments}
89 -- ----------------------------------------------------------------------------
90 Procedure CHK_UI_CONTEXT_KEY
91   (
92      p_label           in varchar2
93     ,p_user_interface_id  in number
94 
95   ) IS
96 --
97   l_proc     varchar2(72) := g_package || 'CHK_UI_CONTEXT_KEY';
98   l_key      varchar2(1) ;
99   l_gen_ui_context_key  varchar2(205);
100   cursor csr_key(p_gen_ui_context_key varchar2) is
101          select null
102            from hr_ki_ui_contexts
103           where  ui_context_key = p_gen_ui_context_key;
104 
105 
106 --
107 Begin
108   hr_utility.set_location('Entering:'||l_proc,10);
109   --
110   -- Check value has been passed
111   --
112   hr_api.mandatory_arg_error
113   (p_api_name           => l_proc
114   ,p_argument           => 'UI_CONTEXT_KEY'
115   ,p_argument_value     => p_label
116   );
117 
118   hr_utility.set_location('Converting'||l_proc,20);
119 
120 
121   hr_ucx_shd.construct_ui_context_key
122     (
123      p_user_interface_id
124     ,p_label
125     ,l_gen_ui_context_key
126     );
127 
128   hr_utility.set_location('Opening cursor'||l_proc,30);
129 
130     open csr_key(l_gen_ui_context_key);
131     fetch csr_key into l_key;
132     if (csr_key%found)
133     then
134       close csr_key;
135       fnd_message.set_name('PER','PER_449945_UCX_UI_KEY_DUP');
136       fnd_message.raise_error;
137     end if;
138     close csr_key;
139 
140   hr_utility.set_location(' Leaving:'||l_proc,40);
141   exception
142   when app_exception.application_exception then
143     if hr_multi_message.exception_add
144     (p_associated_column1 => 'HR_KI_UI_CONTEXTS.UI_CONTEXT_KEY'
145     )then
146       hr_utility.set_location(' Leaving:'||l_proc, 50);
147       raise;
148     end if;
149     hr_utility.set_location(' Leaving:'||l_proc,60);
150 End CHK_UI_CONTEXT_KEY;
151 
152 
153 -- ----------------------------------------------------------------------------
154 -- |-----------------------< CHK_USER_INTERFACE_ID>---------------------------|
155 -- ----------------------------------------------------------------------------
156 -- {Start Of Comments}
157 --
158 -- Description:
159 --   This procedure ensures user_interface_id is present in hr_ki_ui_contexts
160 --   and it is mandatory.
161 -- Pre Conditions:
162 --   g_old_rec has been populated with details of the values currently in
163 --   the database.
164 --
165 -- In Arguments:
166 --   p_user_interface_id
167 --
168 -- Post Success:
169 --   Processing continues if user_interface_id is valid
170 --
171 -- Post Failure:
172 --   An application error is raised if user_interface_id is invalid
173 --
174 -- {End Of Comments}
175 -- ----------------------------------------------------------------------------
176 
177 Procedure CHK_USER_INTERFACE_ID
178   (p_user_interface_id     in number
179   ) IS
180 --
181   l_proc     varchar2(72) := g_package || 'chk_user_interface_id';
182   l_key     varchar2(30) ;
183   cursor csr_int is
184          select user_interface_id
185            from hr_ki_user_interfaces
186           where  user_interface_id = p_user_interface_id;
187 
188 
189 --
190 Begin
191   hr_utility.set_location('Entering:'||l_proc,10);
192 
193 --user_interface_id should not be null
194 
195     hr_api.mandatory_arg_error
196         (p_api_name           => l_proc
197         ,p_argument           => 'USER_INTERFACE_ID'
198         ,p_argument_value     => p_user_interface_id
199     );
200 
201 
202   hr_utility.set_location('Validating:'||l_proc,20);
203 
204 
205     open csr_int;
206     fetch csr_int into l_key;
207     hr_utility.set_location('After fetching :'||l_proc,30);
208     if (csr_int%notfound) then
209       close csr_int;
210       fnd_message.set_name('PER','PER_449569_UCX_UI_ID_ABSENT');
211       fnd_message.raise_error;
212     end if;
213     close csr_int;
214 
215   hr_utility.set_location(' Leaving:'||l_proc,40);
216   exception
217   when app_exception.application_exception then
218     if hr_multi_message.exception_add
219     (p_associated_column1 => 'HR_KI_UI_CONTEXTS.USER_INTERFACE_ID'
220     )then
221       hr_utility.set_location(' Leaving:'||l_proc, 50);
222       raise;
223     end if;
224     hr_utility.set_location(' Leaving:'||l_proc,60);
225 End CHK_USER_INTERFACE_ID;
226 
227 
228 
229 --
230 -- ----------------------------------------------------------------------------
231 -- |---------------------------< insert_validate >----------------------------|
232 -- ----------------------------------------------------------------------------
233 Procedure insert_validate
234   (p_rec                          in hr_ucx_shd.g_rec_type
235   ) is
236 --
237   l_proc  varchar2(72) := g_package||'insert_validate';
238 --
239 Begin
240   hr_utility.set_location('Entering:'||l_proc, 5);
241   --
242   -- Call all supporting business operations
243   --
244   --
245   -- No business group context.  HR_STANDARD_LOOKUPS used for validation."
246   -- CLIENT_INFO not set.  No lookup validation or joins to HR_LOOKUPS."
247   --
248   -- Validate Dependent Attributes
249   --
250   --
251   CHK_USER_INTERFACE_ID
252     (
253      p_user_interface_id  => p_rec.user_interface_id
254     );
255   CHK_UI_CONTEXT_KEY
256     (
257      p_label           => p_rec.label
258     ,p_user_interface_id  => p_rec.user_interface_id
259     );
260 
261   hr_utility.set_location(' Leaving:'||l_proc, 10);
262 End insert_validate;
263 --
264 -- ----------------------------------------------------------------------------
265 -- |---------------------------< update_validate >----------------------------|
266 -- ----------------------------------------------------------------------------
267 Procedure update_validate
268   (p_rec                          in hr_ucx_shd.g_rec_type
269   ) is
270 --
271   l_proc  varchar2(72) := g_package||'update_validate';
272 --
273 Begin
274   hr_utility.set_location('Entering:'||l_proc, 5);
275   --
276   -- Call all supporting business operations
277   --
278   --
279   -- "-- No business group context.  HR_STANDARD_LOOKUPS used for validation."
280   -- "-- CLIENT_INFO not set.  No lookup validation or joins to HR_LOOKUPS."
281   --
282   -- Validate Dependent Attributes
283   --
284   chk_non_updateable_args
285     (p_rec              => p_rec
286     );
287   --
288   --
289   hr_utility.set_location(' Leaving:'||l_proc, 10);
290 End update_validate;
291 --
292 -- ----------------------------------------------------------------------------
293 -- |---------------------------< delete_validate >----------------------------|
294 -- ----------------------------------------------------------------------------
295 Procedure delete_validate
296   (p_rec                          in hr_ucx_shd.g_rec_type
297   ) is
298 --
299   l_proc  varchar2(72) := g_package||'delete_validate';
300 --
301 Begin
302   hr_utility.set_location('Entering:'||l_proc, 5);
303   --
304   -- Call all supporting business operations
305   --
306   hr_utility.set_location(' Leaving:'||l_proc, 10);
307 End delete_validate;
308 --
309 end hr_ucx_bus;