1 Package Body hr_ctx_bus as
2 /* $Header: hrctxrhi.pkb 120.0 2005/05/30 23:30 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hr_ctx_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_context_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_ctx_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_ctx_shd.api_updating
55 (p_context_id => p_rec.context_id
56 ,p_object_version_number => p_rec.object_version_number
57 ) THEN
58 fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
59 fnd_message.set_token('PROCEDURE ', l_proc);
60 fnd_message.set_token('STEP ', '5');
61 fnd_message.raise_error;
62 END IF;
63 --
64 -- EDIT_HERE: Add checks to ensure non-updateable args have
65 -- not been updated.
66 --
67 End chk_non_updateable_args;
68
69 -- ----------------------------------------------------------------------------
70 -- |-----------------------< CHK_VIEW_NAME>-----------------------------------|
71 -- ----------------------------------------------------------------------------
72 -- {Start Of Comments}
73 --
74 -- Description:
75 -- This procedure ensures a view exists in apps schema.
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_view_name
82 -- Post Success:
83 -- Processing continues if view exists
84 --
85 -- Post Failure:
86 -- An application error is raised if view does not exists.
87 --
88 -- {End Of Comments}
89 -- ----------------------------------------------------------------------------
90 Procedure chk_view_name
91 (p_view_name in varchar2
92
93 ) IS
94 --
95 l_proc varchar2(72) := g_package || 'CHK_VIEW_NAME';
96 l_key varchar2(1) ;
97 cursor csr_name is
98 select null from user_objects
99 where object_type='VIEW'
100 and object_name =p_view_name;
101
102 --
103 Begin
104 hr_utility.set_location('Entering:'||l_proc,10);
105 --
106 -- Check value has been passed
107 --
108 hr_api.mandatory_arg_error
109 (p_api_name => l_proc
110 ,p_argument => 'VIEW_NAME'
111 ,p_argument_value => p_view_name
112 );
113
114 hr_utility.set_location('Entering:'||l_proc,20);
115 open csr_name;
116 fetch csr_name into l_key;
117 if (csr_name%notfound)
118 then
119 close csr_name;
120 fnd_message.set_name('PER','PER_449961_CTX_VIEW_NA_ABSENT');
121 fnd_message.raise_error;
122 end if;
123 close csr_name;
124
125 hr_utility.set_location(' Validated:'||l_proc,30);
126 exception
127 when app_exception.application_exception then
128 if hr_multi_message.exception_add
129 (p_associated_column1 => 'HR_KI_CONTEXTS.VIEW_NAME'
130 )then
131 hr_utility.set_location(' Leaving:'||l_proc, 40);
132 raise;
133 end if;
134 hr_utility.set_location(' Leaving:'||l_proc,50);
135 End chk_view_name;
136
137 --
138 -- ----------------------------------------------------------------------------
139 -- |---------------------------< insert_validate >----------------------------|
140 -- ----------------------------------------------------------------------------
141 Procedure insert_validate
142 (p_rec in hr_ctx_shd.g_rec_type
143 ) is
144 --
145 l_proc varchar2(72) := g_package||'insert_validate';
146 --
147 Begin
148 hr_utility.set_location('Entering:'||l_proc, 5);
149 --
150 -- Call all supporting business operations
151 --
152 --
153 -- "-- No business group context. HR_STANDARD_LOOKUPS used for validation."
154 -- "-- CLIENT_INFO not set. No lookup validation or joins to HR_LOOKUPS."
155 --
156 -- Validate Dependent Attributes
157 --
158 --
159 chk_view_name(p_view_name => p_rec.view_name);
160 --
161 hr_utility.set_location(' Leaving:'||l_proc, 10);
162 End insert_validate;
163 --
164 -- ----------------------------------------------------------------------------
165 -- |---------------------------< update_validate >----------------------------|
166 -- ----------------------------------------------------------------------------
167 Procedure update_validate
168 (p_rec in hr_ctx_shd.g_rec_type
169 ) is
170 --
171 l_proc varchar2(72) := g_package||'update_validate';
172 --
173 Begin
174 hr_utility.set_location('Entering:'||l_proc, 5);
175 --
176 -- Call all supporting business operations
177 --
178 --
179 -- "-- No business group context. HR_STANDARD_LOOKUPS used for validation."
180 -- "-- CLIENT_INFO not set. No lookup validation or joins to HR_LOOKUPS."
181 --
182 -- Validate Dependent Attributes
183 --
184 chk_non_updateable_args
185 (p_rec => p_rec
186 );
187
188 chk_view_name(p_view_name => p_rec.view_name);
189 --
190 --
191 hr_utility.set_location(' Leaving:'||l_proc, 10);
192 End update_validate;
193 --
194 -- ----------------------------------------------------------------------------
195 -- |---------------------------< delete_validate >----------------------------|
196 -- ----------------------------------------------------------------------------
197 Procedure delete_validate
198 (p_rec in hr_ctx_shd.g_rec_type
199 ) is
200 --
201 l_proc varchar2(72) := g_package||'delete_validate';
202 --
203 Begin
204 hr_utility.set_location('Entering:'||l_proc, 5);
205 --
206 -- Call all supporting business operations
207 --
208 hr_utility.set_location(' Leaving:'||l_proc, 10);
209 End delete_validate;
210 --
211 end hr_ctx_bus;