DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_PTI_BUS

Source


1 Package Body pqh_pti_bus as
2 /* $Header: pqptirhi.pkb 120.2 2005/10/12 20:18:49 srajakum noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  pqh_pti_bus.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------< chk_information_type >------|
12 -- ----------------------------------------------------------------------------
13 --
14 -- Description
15 --   This procedure is used to check that the primary key for the table
16 --   is created properly. It should be null on insert and
17 --   should not be able to be updated.
18 --
19 -- Pre Conditions
20 --   None.
21 --
22 -- In Parameters
23 --   information_type PK of record being inserted or updated.
24 --   object_version_number Object version number of record being
25 --                         inserted or updated.
26 --
27 -- Post Success
28 --   Processing continues
29 --
30 -- Post Failure
31 --   Errors handled by the procedure
32 --
33 -- Access Status
34 --   Internal table handler use only.
35 --
36 Procedure chk_information_type(p_information_type                in number,
37                            p_object_version_number       in number) is
38   --
39   l_proc         varchar2(72) := g_package||'chk_information_type';
40   l_api_updating boolean;
41   --
42 Begin
43   --
44   hr_utility.set_location('Entering:'||l_proc, 5);
45   --
46   l_api_updating := pqh_pti_shd.api_updating
47     (p_information_type                => p_information_type,
48      p_object_version_number       => p_object_version_number);
49   --
50   if (l_api_updating
51      and nvl(p_information_type,hr_api.g_number)
52      <>  pqh_pti_shd.g_old_rec.information_type) then
53     --
54     -- raise error as PK has changed
55     --
56     pqh_pti_shd.constraint_error('PQH_PTX_INFO_TYPES_PK');
57     --
58   elsif not l_api_updating then
59     --
60     -- check if PK is null
61     --
62     if p_information_type is not null then
63       --
64       -- raise error as PK is not null
65       --
66       pqh_pti_shd.constraint_error('PQH_PTX_INFO_TYPES_PK');
67       --
68     end if;
69     --
70   end if;
71   --
72   hr_utility.set_location('Leaving:'||l_proc, 10);
73   --
74 End chk_information_type;
75 --
76 -- ----------------------------------------------------------------------------
77 -- |------< chk_multiple_occurences_flag >------|
78 -- ----------------------------------------------------------------------------
79 --
80 -- Description
81 --   This procedure is used to check that the lookup value is valid.
82 --
83 -- Pre Conditions
84 --   None.
85 --
86 -- In Parameters
87 --   information_type PK of record being inserted or updated.
88 --   multiple_occurences_flag Value of lookup code.
89 --   effective_date effective date
90 --   object_version_number Object version number of record being
91 --                         inserted or updated.
92 --
93 -- Post Success
94 --   Processing continues
95 --
96 -- Post Failure
97 --   Error handled by procedure
98 --
99 -- Access Status
100 --   Internal table handler use only.
101 --
102 Procedure chk_multiple_occurences_flag(p_information_type                in number,
103                             p_multiple_occurences_flag               in varchar2,
104                             p_effective_date              in date,
105                             p_object_version_number       in number) is
106   --
107   l_proc         varchar2(72) := g_package||'chk_multiple_occurences_flag';
108   l_api_updating boolean;
109   --
110 Begin
111   --
112   hr_utility.set_location('Entering:'||l_proc, 5);
113   --
114   l_api_updating := pqh_pti_shd.api_updating
115     (p_information_type                => p_information_type,
116      p_object_version_number       => p_object_version_number);
117   --
118   if (l_api_updating
119       and p_multiple_occurences_flag
120       <> nvl(pqh_pti_shd.g_old_rec.multiple_occurences_flag,hr_api.g_varchar2)
121       or not l_api_updating) then
122     --
123     -- check if value of lookup falls within lookup type.
124     --
125     --
126     if hr_api.not_exists_in_hr_lookups
127           (p_lookup_type    => 'ENTER-LKP-TYPE',
128            p_lookup_code    => p_multiple_occurences_flag,
129            p_effective_date => p_effective_date) then
130       --
131       -- raise error as does not exist as lookup
132       --
133       hr_utility.set_message(801,'HR_LOOKUP_DOES_NOT_EXIST');
134       hr_utility.raise_error;
135       --
136     end if;
137     --
138   end if;
139   --
140   hr_utility.set_location('Leaving:'||l_proc,10);
141   --
142 end chk_multiple_occurences_flag;
143 --
144 -- ----------------------------------------------------------------------------
145 -- |------< chk_active_inactive_flag >------|
146 -- ----------------------------------------------------------------------------
147 --
148 -- Description
149 --   This procedure is used to check that the lookup value is valid.
150 --
151 -- Pre Conditions
152 --   None.
153 --
154 -- In Parameters
155 --   information_type PK of record being inserted or updated.
156 --   active_inactive_flag Value of lookup code.
157 --   effective_date effective date
158 --   object_version_number Object version number of record being
159 --                         inserted or updated.
160 --
161 -- Post Success
162 --   Processing continues
163 --
164 -- Post Failure
165 --   Error handled by procedure
166 --
167 -- Access Status
168 --   Internal table handler use only.
169 --
170 Procedure chk_active_inactive_flag(p_information_type                in number,
171                             p_active_inactive_flag               in varchar2,
172                             p_effective_date              in date,
173                             p_object_version_number       in number) is
174   --
175   l_proc         varchar2(72) := g_package||'chk_active_inactive_flag';
176   l_api_updating boolean;
177   --
178 Begin
179   --
180   hr_utility.set_location('Entering:'||l_proc, 5);
181   --
182   l_api_updating := pqh_pti_shd.api_updating
183     (p_information_type                => p_information_type,
184      p_object_version_number       => p_object_version_number);
185   --
186   if (l_api_updating
187       and p_active_inactive_flag
188       <> nvl(pqh_pti_shd.g_old_rec.active_inactive_flag,hr_api.g_varchar2)
189       or not l_api_updating) then
190     --
191     -- check if value of lookup falls within lookup type.
192     --
193     --
194     if hr_api.not_exists_in_hr_lookups
195           (p_lookup_type    => 'ENTER-LKP-TYPE',
196            p_lookup_code    => p_active_inactive_flag,
197            p_effective_date => p_effective_date) then
198       --
199       -- raise error as does not exist as lookup
200       --
201       hr_utility.set_message(801,'HR_LOOKUP_DOES_NOT_EXIST');
202       hr_utility.raise_error;
203       --
204     end if;
205     --
206   end if;
207   --
208   hr_utility.set_location('Leaving:'||l_proc,10);
209   --
210 end chk_active_inactive_flag;
211 --
212 -- ----------------------------------------------------------------------------
213 -- |---------------------------< insert_validate >----------------------------|
214 -- ----------------------------------------------------------------------------
215 Procedure insert_validate(p_rec in pqh_pti_shd.g_rec_type
216                          ,p_effective_date in date) is
217 --
218   l_proc  varchar2(72) := g_package||'insert_validate';
219 --
220 Begin
221   hr_utility.set_location('Entering:'||l_proc, 5);
222   --
223   -- Call all supporting business operations
224   --
225   chk_information_type
226   (p_information_type          => p_rec.information_type,
227    p_object_version_number => p_rec.object_version_number);
228   --
229   chk_multiple_occurences_flag
230   (p_information_type          => p_rec.information_type,
231    p_multiple_occurences_flag         => p_rec.multiple_occurences_flag,
232    p_effective_date        => p_effective_date,
233    p_object_version_number => p_rec.object_version_number);
234   --
235   chk_active_inactive_flag
236   (p_information_type          => p_rec.information_type,
237    p_active_inactive_flag         => p_rec.active_inactive_flag,
238    p_effective_date        => p_effective_date,
239    p_object_version_number => p_rec.object_version_number);
240   --
241   --
242   --
243   hr_utility.set_location(' Leaving:'||l_proc, 10);
244 End insert_validate;
245 --
246 -- ----------------------------------------------------------------------------
247 -- |---------------------------< update_validate >----------------------------|
248 -- ----------------------------------------------------------------------------
249 Procedure update_validate(p_rec in pqh_pti_shd.g_rec_type
250                          ,p_effective_date in date) 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   chk_information_type
260   (p_information_type          => p_rec.information_type,
261    p_object_version_number => p_rec.object_version_number);
262   --
263   chk_multiple_occurences_flag
264   (p_information_type          => p_rec.information_type,
265    p_multiple_occurences_flag         => p_rec.multiple_occurences_flag,
266    p_effective_date        => p_effective_date,
267    p_object_version_number => p_rec.object_version_number);
268   --
269   chk_active_inactive_flag
270   (p_information_type          => p_rec.information_type,
271    p_active_inactive_flag         => p_rec.active_inactive_flag,
272    p_effective_date        => p_effective_date,
273    p_object_version_number => p_rec.object_version_number);
274   --
275   --
276   --
277   hr_utility.set_location(' Leaving:'||l_proc, 10);
278 End update_validate;
279 --
280 -- ----------------------------------------------------------------------------
281 -- |---------------------------< delete_validate >----------------------------|
282 -- ----------------------------------------------------------------------------
283 Procedure delete_validate(p_rec in pqh_pti_shd.g_rec_type
284                          ,p_effective_date in date) is
285 --
286   l_proc  varchar2(72) := g_package||'delete_validate';
287 --
288 Begin
289   hr_utility.set_location('Entering:'||l_proc, 5);
290   --
291   -- Call all supporting business operations
292   --
293   hr_utility.set_location(' Leaving:'||l_proc, 10);
294 End delete_validate;
295 --
296 end pqh_pti_bus;