1 Package Body hr_eap_bus as
2 /* $Header: hreaprhi.pkb 115.0 2004/01/09 00:17 vkarandi noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hr_eap_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_ext_application_id number default null;
15 --
16 -- ----------------------------------------------------------------------------
17 -- |-----------------------< chk_non_updateable_args >------------------------|
18 -- ----------------------------------------------------------------------------
19 -- {Start Of Comments}
20 --
21 -- Description:
22 -- This procedure is used to ensure that non updateable attributes have
23 -- not been updated. If an attribute has been updated an error is generated.
24 --
25 -- Pre Conditions:
26 -- g_old_rec has been populated with details of the values currently in
27 -- the database.
28 --
29 -- In Arguments:
30 -- p_rec has been populated with the updated values the user would like the
31 -- record set to.
32 --
33 -- Post Success:
34 -- Processing continues if all the non updateable attributes have not
35 -- changed.
36 --
37 -- Post Failure:
38 -- An application error is raised if any of the non updatable attributes
39 -- have been altered.
40 --
41 -- {End Of Comments}
42 -- ----------------------------------------------------------------------------
43 Procedure chk_non_updateable_args
44 (p_rec in hr_eap_shd.g_rec_type
45 ) IS
46 --
47 l_proc varchar2(72) := g_package || 'chk_non_updateable_args';
48 --
49 Begin
50 --
51 -- Only proceed with the validation if a row exists for the current
52 -- record in the HR Schema.
53 --
54 IF NOT hr_eap_shd.api_updating
55 (p_ext_application_id => p_rec.ext_application_id
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 -- Add checks to ensure non-updateable args have
64 -- not been updated.
65 --
66 if nvl(p_rec.external_application_id, hr_api.g_number) <>
67 nvl(hr_eap_shd.g_old_rec.external_application_id
68 ,hr_api.g_number
69 ) then
70 hr_api.argument_changed_error
71 (p_api_name => l_proc
72 ,p_argument => 'EXTERNAL_APPLICATION_ID'
73 ,p_base_table => hr_eap_shd.g_tab_nam
74 );
75 end if;
76
77
78 End chk_non_updateable_args;
79
80 -- ----------------------------------------------------------------------------
81 -- |------------------< CHK_EXTERNAL_APPLICATION_NAME>------------------------|
82 -- ----------------------------------------------------------------------------
83 -- {Start Of Comments}
84 --
85 -- Description:
86 -- This procedure ensures EXTERNAL_APPLICATION_NAME is not null and unique.
87 -- Pre Conditions:
88 -- g_old_rec has been populated with details of the values currently in
89 -- the database.
90 --
91 -- In Arguments:
92 -- P_EXTERNAL_APPLICATION_NAME
93 -- Post Success:
94 -- Processing continues if P_EXTERNAL_APPLICATION_NAME is not null and unique
95 --
96 -- Post Failure:
97 -- An application error is raised if P_EXTERNAL_APPLICATION_NAME is null
98 -- or exists already in table.
99 --
100 -- {End Of Comments}
101 -- ----------------------------------------------------------------------------
102 Procedure CHK_EXTERNAL_APPLICATION_NAME
103 (p_external_application_name in varchar2
104
105 ) IS
106 --
107 l_proc varchar2(72) := g_package || 'CHK_EXTERNAL_APPLICATION_NAME';
108 l_key varchar2(1) ;
109 cursor csr_name is
110 select null
111 from hr_ki_ext_applications
112 where external_application_name = p_external_application_name;
113 --
114 Begin
115 hr_utility.set_location('Entering:'||l_proc,10);
116 --
117 -- Check value has been passed
118 --
119 hr_api.mandatory_arg_error
120 (p_api_name => l_proc
121 ,p_argument => 'EXTERNAL_APPLICATION_NAME'
122 ,p_argument_value => p_external_application_name
123 );
124
125 hr_utility.set_location('Validating:'||l_proc,20);
126 open csr_name;
127 fetch csr_name into l_key;
128 if (csr_name%found)
129 then
130 close csr_name;
131 fnd_message.set_name('PER','PER_449985_EAP_EAPP_NAME_DUP');
132 fnd_message.raise_error;
133 end if;
134 close csr_name;
135
136 hr_utility.set_location(' Leaving:'||l_proc,30);
137 exception
138 when app_exception.application_exception then
139 if hr_multi_message.exception_add
140 (p_associated_column1 => 'hr_ki_ext_applications.EXTERNAL_APPLICATION_NAME'
141 )then
142 hr_utility.set_location(' Leaving:'||l_proc, 40);
143 raise;
144 end if;
145 hr_utility.set_location(' Leaving:'||l_proc,50);
146 End CHK_EXTERNAL_APPLICATION_NAME;
147
148 -- ----------------------------------------------------------------------------
149 -- |---------------< CHK_EXTERNAL_APP_NAME_UPD>-------------------------------|
150 -- ----------------------------------------------------------------------------
151 -- {Start Of Comments}
152 --
153 -- Description:
154 -- This procedure ensures EXTERNAL_APPLICATION_NAME is not null and unique.
155 -- If earlier procedure is used for update validation then error will be
156 -- thrown even if application name is unique and not null as earlier query
157 -- does not have addtional p_ext_application_id condition in the cursor.
158 -- We can not combine these 2 methods as p_ext_application_id is not
159 -- available at the time of insert_validation
160 --
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_EXTERNAL_APPLICATION_NAME
167 -- p_ext_application_id
168 -- Post Success:
169 -- Processing continues if P_EXTERNAL_APPLICATION_NAME is not null and unique
170 --
171 -- Post Failure:
172 -- An application error is raised if P_EXTERNAL_APPLICATION_NAME is null
173 -- or exists already in table.
174 --
175 -- {End Of Comments}
176 -- ----------------------------------------------------------------------------
177 Procedure CHK_EXTERNAL_APP_NAME_UPD
178 (p_external_application_name in varchar2
179 ,p_ext_application_id in number
180 ) IS
181 --
182 l_proc varchar2(72) := g_package || 'CHK_EXTERNAL_APP_NAME_UPD';
183 l_key varchar2(1) ;
184 cursor csr_name is
185 select null
186 from hr_ki_ext_applications
187 where external_application_name = p_external_application_name
188 and ext_application_id<>p_ext_application_id;
189 --
190 Begin
191 hr_utility.set_location('Entering:'||l_proc,10);
192 --
193 -- Check value has been passed
194 --
195 hr_api.mandatory_arg_error
196 (p_api_name => l_proc
197 ,p_argument => 'EXTERNAL_APPLICATION_NAME'
198 ,p_argument_value => p_external_application_name
199 );
200
201 hr_utility.set_location('Validating:'||l_proc,20);
202 open csr_name;
203 fetch csr_name into l_key;
204 if (csr_name%found)
205 then
206 close csr_name;
207 fnd_message.set_name('PER','PER_449985_EAP_EAPP_NAME_DUP');
208 fnd_message.raise_error;
209 end if;
210 close csr_name;
211
212 hr_utility.set_location(' Leaving:'||l_proc,30);
213 exception
214 when app_exception.application_exception then
215 if hr_multi_message.exception_add
216 (p_associated_column1 => 'hr_ki_ext_applications.EXTERNAL_APPLICATION_NAME'
217 )then
218 hr_utility.set_location(' Leaving:'||l_proc, 40);
219 raise;
220 end if;
221 hr_utility.set_location(' Leaving:'||l_proc,50);
222 End CHK_EXTERNAL_APP_NAME_UPD;
223 --
224 -- ----------------------------------------------------------------------------
225 -- |---------------------------< insert_validate >----------------------------|
226 -- ----------------------------------------------------------------------------
227 Procedure insert_validate
228 (p_rec in hr_eap_shd.g_rec_type
229 ) is
230 --
231 l_proc varchar2(72) := g_package||'insert_validate';
232 --
233 Begin
234 hr_utility.set_location('Entering:'||l_proc, 5);
235 --
236 -- Call all supporting business operations
237 --
238 --
239 -- "-- No business group context. HR_STANDARD_LOOKUPS used for validation."
240 -- "-- CLIENT_INFO not set. No lookup validation or joins to HR_LOOKUPS."
241 --
242 -- Validate Dependent Attributes
243 --
244 --
245 hr_utility.set_location(' Leaving:'||l_proc, 10);
246 End insert_validate;
247 --
248 -- ----------------------------------------------------------------------------
249 -- |---------------------------< update_validate >----------------------------|
250 -- ----------------------------------------------------------------------------
251 Procedure update_validate
252 (p_rec in hr_eap_shd.g_rec_type
253 ) is
254 --
255 l_proc varchar2(72) := g_package||'update_validate';
256 --
257 Begin
258 hr_utility.set_location('Entering:'||l_proc, 5);
259 --
260 -- Call all supporting business operations
261 --
262 --
263 -- "-- No business group context. HR_STANDARD_LOOKUPS used for validation."
264 -- "-- CLIENT_INFO not set. No lookup validation or joins to HR_LOOKUPS."
265 --
266 -- Validate Dependent Attributes
267 --
268 chk_non_updateable_args
269 (p_rec => p_rec
270 );
271
272 CHK_EXTERNAL_APP_NAME_UPD
273 (
274 p_external_application_name => p_rec.external_application_name
275 ,p_ext_application_id => p_rec.ext_application_id
276 );
277
278
279 --
280 --
281 hr_utility.set_location(' Leaving:'||l_proc, 10);
282 End update_validate;
283 --
284 -- ----------------------------------------------------------------------------
285 -- |---------------------------< delete_validate >----------------------------|
286 -- ----------------------------------------------------------------------------
287 Procedure delete_validate
288 (p_rec in hr_eap_shd.g_rec_type
289 ) is
290 --
291 l_proc varchar2(72) := g_package||'delete_validate';
292 --
293 Begin
294 hr_utility.set_location('Entering:'||l_proc, 5);
295 --
296 -- Call all supporting business operations
297 --
298 hr_utility.set_location(' Leaving:'||l_proc, 10);
299 End delete_validate;
300 --
301 end hr_eap_bus;