DBA Data[Home] [Help]

PACKAGE BODY: APPS.AME_CAL_BUS

Source


4 -- ----------------------------------------------------------------------------
1 Package Body ame_cal_bus as
2 /* $Header: amcalrhi.pkb 120.2 2006/01/03 22:52 tkolla noship $ */
3 --
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  ame_cal_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_application_id              number         default null;
15 g_language                    varchar2(4)    default null;
16 --
17 -- ----------------------------------------------------------------------------
18 -- |-----------------------< CHK_FND_APPLICATION_ID >-------------------------|
19 -- ----------------------------------------------------------------------------
20 -- {Start Of Comments}
21 --
22 -- Description:
23 --   This procedure checks whether a valid Application ID has been
24 --   provided. The ID must be defined in the AME_CALLING_APPS table.
25 --
26 -- Pre-Requisites:
27 --   None
28 --
29 -- In Parameters:
30 --   p_application_id
31 --
32 -- Post Success:
33 --   Processing continues if a valid Application ID is found.
34 --
35 -- Post Failure:
36 --   An application error is raised either if the p_application_id is not
37 --   defined or if the value is not found in AME_CALLING_APPS table.
38 --
39 -- Access Status:
40 --   Internal Row Handler Use Only.
41 --
42 -- {End Of Comments}
43 -- ----------------------------------------------------------------------------
44 procedure chk_application_id(p_application_id           in   number
45                             ,p_effective_date           in   date
46                             ) IS
47 --
48   cursor csr_application_id is
49     select null
50       from ame_calling_apps
51      where application_id = p_application_id
52        and p_effective_date between start_date
53              and nvl(end_date - ame_util.oneSecond, p_effective_date);
54   --
55   l_proc     varchar2(72) := g_package || 'CHK_APPLICATION_ID';
56   l_key      varchar2(1);
57 --
58   Begin
59     hr_utility.set_location('Entering:'||l_proc,10);
60     hr_api.mandatory_arg_error(p_api_name           => l_proc
61                               ,p_argument           => 'APPLICATION_ID'
62                               ,p_argument_value     => p_application_id
63                               );
64     open csr_application_id;
65     fetch csr_application_id into l_key;
69       fnd_message.raise_error;
66     if(csr_application_id%notfound) then
67       close csr_application_id;
68       fnd_message.set_name('AME', 'INVALID_APPLICATION_ID');
70     else
71       close csr_application_id;
72     end if;
73     hr_utility.set_location(' Leaving:'||l_proc,30);
74   exception
75     when app_exception.application_exception then
76       if hr_multi_message.exception_add
77                (p_associated_column1 => 'AME_CALLING_APPS_TL.APPLICATION_ID'
78                ) then
79         hr_utility.set_location(' Leaving:'||l_proc, 40);
80         raise;
81       end if;
82       hr_utility.set_location(' Leaving:'||l_proc,50);
83   End chk_application_id;
84 --
85 -- ----------------------------------------------------------------------------
86 -- |------------------------< CHK_APPLICATION_NAME >--------------------------|
87 -- ----------------------------------------------------------------------------
88 -- {Start Of Comments}
89 --
90 -- Description:
91 --   This procedure checks whether a value is defined for APPLICATION_NAME and
92 --   is unique.
93 --
94 -- Pre-Requisites:
95 --   None
96 --
97 -- In Parameters:
98 --   p_application_name
99 --
100 -- Post Success:
101 --   Processing continues if a valid unique Application Name is found.
102 --
103 -- Post Failure:
104 --   An application error is raised if the Application Name is not defined.
105 --
106 -- Access Status:
107 --   Internal Row Handler Use Only.
108 --
109 -- {End Of Comments}
110 -- ----------------------------------------------------------------------------
111 procedure chk_application_name(p_application_name            in   varchar2
112                                ,p_language                    in   varchar2) IS
113 --
114   l_proc     varchar2(72) := g_package || 'CHK_APPLICATION_NAME';
115   l_key      varchar2(1);
116   l_exists varchar2(1);
117   cursor dup_app_name is
118     select null
119       from ame_calling_apps_tl cal
120        where cal.application_name = p_application_name
121        and cal.language = p_language;
122 --
123   Begin
124     hr_utility.set_location('Entering:'||l_proc,10);
125     hr_api.mandatory_arg_error(p_api_name           => l_proc
126                               ,p_argument           => 'APPLICATION_NAME'
127                               ,p_argument_value     => p_application_name
128                               );
129     hr_utility.set_location(' Leaving:'||l_proc,30);
130   open dup_app_name;
131   fetch dup_app_name into l_exists;
132    if dup_app_name%found then
133      close dup_app_name;
134        fnd_message.set_name('PER','AME_400748_TTY_NAME_IN_USE');
135        fnd_message.raise_error;
136    end if;
137   close dup_app_name;
138   exception
139     when app_exception.application_exception then
140       if hr_multi_message.exception_add
141                (p_associated_column1 => 'AME_CALLING_APPS_TL.APPLICATION_NAME'
142                ) then
143         hr_utility.set_location(' Leaving:'||l_proc, 40);
144         raise;
145       end if;
146       hr_utility.set_location(' Leaving:'||l_proc,50);
147   End chk_application_name;
148 --
149 --  ---------------------------------------------------------------------------
150 --  |----------------------< set_security_group_id >--------------------------|
151 --  ---------------------------------------------------------------------------
152 --
153 Procedure set_security_group_id
154   (p_application_id                       in number
155   ,p_associated_column1                   in varchar2 default null
156   ) is
157 begin
158   null;
159 end set_security_group_id;
160 --
161 --  ---------------------------------------------------------------------------
162 --  |---------------------< return_legislation_code >-------------------------|
163 --  ---------------------------------------------------------------------------
164 --
165 Function return_legislation_code
169   Return Varchar2 Is
166   (p_application_id                       in     number
167   ,p_language                             in     varchar2
168   )
170 Begin
171   return null;
172 end return_legislation_code;
173 
174 
175 
176 
177 --
178 -- ----------------------------------------------------------------------------
179 -- |-----------------------< chk_non_updateable_args >------------------------|
180 -- ----------------------------------------------------------------------------
181 -- {Start Of Comments}
182 --
183 -- Description:
184 --   This procedure is used to ensure that non updateable attributes have
188 --   g_old_rec has been populated with details of the values currently in
185 --   not been updated. If an attribute has been updated an error is generated.
186 --
187 -- Pre Conditions:
189 --   the database.
190 --
191 -- In Arguments:
192 --   p_rec has been populated with the updated values the user would like the
193 --   record set to.
194 --
195 -- Post Success:
196 --   Processing continues if all the non updateable attributes have not
197 --   changed.
198 --
199 -- Post Failure:
200 --   An application error is raised if any of the non updatable attributes
201 --   have been altered.
202 --
203 -- {End Of Comments}
204 -- ----------------------------------------------------------------------------
205 Procedure chk_non_updateable_args
206   (p_rec in ame_cal_shd.g_rec_type
207   ) IS
208 --
209   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
210 --
211 Begin
212   --
213   -- Only proceed with the validation if a row exists for the current
214   -- record in the HR Schema.
215   --
216   IF NOT ame_cal_shd.api_updating
217       (p_application_id                    => p_rec.application_id
218       ,p_language                          => p_rec.language
219       ) THEN
220      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
221      fnd_message.set_token('PROCEDURE ', l_proc);
222      fnd_message.set_token('STEP ', '5');
223      fnd_message.raise_error;
224   END IF;
225   --
226   -- EDIT_HERE: Add checks to ensure non-updateable args have
227   --            not been updated.
228   --
229   -- Check to see whether the transaction type name modified already exist
230   -- or not, if its already exist then throw an error
231 
232 End chk_non_updateable_args;
233 --
234 -- ----------------------------------------------------------------------------
235 -- |---------------------------< insert_validate >----------------------------|
236 -- ----------------------------------------------------------------------------
237 Procedure insert_validate
238   (p_rec                          in ame_cal_shd.g_rec_type
239   ) is
240 --
241   l_proc  varchar2(72) := g_package||'insert_validate';
242 --
243 Begin
244   hr_utility.set_location('Entering:'||l_proc, 5);
245   --
246   -- Call all supporting business operations
247   --
248   --
249   -- EDIT_HERE: As this table does not have a mandatory business_group_id
250   -- column, ensure client_info is populated by calling a suitable
251   -- ???_???_bus.set_security_group_id procedure, or add one of the following
252   -- comments:
253   -- "-- No business group context.  HR_STANDARD_LOOKUPS used for validation."
254   -- "-- CLIENT_INFO not set.  No lookup validation or joins to HR_LOOKUPS."
255   --
256   -- Validate Dependent Attributes
257   --
258   chk_application_id(p_application_id  => p_rec.application_id
259                     ,p_effective_date  => sysdate
260                     );
261   chk_application_name(p_application_name  => p_rec.application_name
262                        ,p_language         => p_rec.language);
263   --
264   hr_utility.set_location(' Leaving:'||l_proc, 10);
265 End insert_validate;
266 --
267 -- ----------------------------------------------------------------------------
268 -- |---------------------------< update_validate >----------------------------|
269 -- ----------------------------------------------------------------------------
270 Procedure update_validate
271   (p_rec                          in ame_cal_shd.g_rec_type
272   ) is
273 --
274   l_proc  varchar2(72) := g_package||'update_validate';
275 --
276 Begin
277   hr_utility.set_location('Entering:'||l_proc, 5);
278   --
279   -- Call all supporting business operations
280   --
281   --
282   -- EDIT_HERE: As this table does not have a mandatory business_group_id
283   -- column, ensure client_info is populated by calling a suitable
284   -- ???_???_bus.set_security_group_id procedure, or add one of the following
285   -- comments:
286   -- "-- No business group context.  HR_STANDARD_LOOKUPS used for validation."
287   -- "-- CLIENT_INFO not set.  No lookup validation or joins to HR_LOOKUPS."
288   --
289   -- Validate Dependent Attributes
290   --
291   chk_non_updateable_args
292     (p_rec              => p_rec
293     );
294 if (ame_cal_shd.g_old_rec.application_name <> p_rec.application_name) then
295   chk_application_name(p_application_name  => p_rec.application_name
296                        ,p_language         => p_rec.language);
297 end if;
298   --
299   --
300   hr_utility.set_location(' Leaving:'||l_proc, 10);
301 End update_validate;
302 --
303 -- ----------------------------------------------------------------------------
304 -- |---------------------------< delete_validate >----------------------------|
305 -- ----------------------------------------------------------------------------
306 Procedure delete_validate
307   (p_rec                          in ame_cal_shd.g_rec_type
308   ) is
309 --
310   l_proc  varchar2(72) := g_package||'delete_validate';
311 --
312 Begin
313   hr_utility.set_location('Entering:'||l_proc, 5);
314   --
315   -- Call all supporting business operations
316   --
317   hr_utility.set_location(' Leaving:'||l_proc, 10);
318 End delete_validate;
319 --
320 end ame_cal_bus;