DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_FR_VALIDATION_EVENTS_API

Source


1 Package Body PQH_FR_VALIDATION_EVENTS_API as
2 /* $Header: pqvleapi.pkb 115.2 2002/12/05 00:31:10 rpasapul noship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := 'PQH_FR_VALIDATION_EVENTS_API.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |--------------------------< Insert_Validation_event >---------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure Insert_Validation_event
13   (p_effective_date               in     date
14   ,p_validation_id                  in     number
15   ,p_event_type                     in     varchar2
16   ,p_event_code                     in     varchar2
17   ,p_start_date                     in     date     default null
18   ,p_end_date                       in     date     default null
19   ,p_comments                       in     varchar2 default null
20   ,p_validation_event_id               out nocopy number
21   ,p_object_version_number             out nocopy number) is
22   --
23   -- Declare cursors and local variables
24   --
25 
26   l_proc  varchar2(72)       := g_package||'Insert_Validation_event';
27   l_object_Version_Number    PQH_FR_VALIDATION_EVENTS.OBJECT_VERSION_NUMBER%TYPE;
28   L_Effective_Date           Date;
29   l_validation_event_id 	PQH_FR_VALIDATION_EVENTS.VALIDATION_EVENT_ID%TYPE;
30 
31 
32 begin
33   hr_utility.set_location('Entering:'|| l_proc, 10);
34   --
35   -- Issue a savepoint
36   --
37   savepoint Insert_Validation_event;
38   --
39   -- Truncate the time portion from all IN date parameters
40   --
41      l_effective_date := Trunc(p_effective_Date);
42   --
43   -- Call Before Process User Hook
44   --
45   begin
46    PQH_FR_VALIDATION_EVENTS_BK1.Insert_Validation_event_b
47    (p_effective_date               => l_effective_date
48   ,p_validation_id                => p_validation_id
49   ,p_event_type                   => p_event_type
50   ,p_event_code                   => p_event_code
51   ,p_start_date                   => p_start_date
52   ,p_end_date                     => p_end_date
53   ,p_comments                     => p_comments);
54 
55 
56   exception
57     when hr_api.cannot_find_prog_unit then
58       hr_api.cannot_find_prog_unit_error
59         (p_module_name => 'PQH_FR_VALIDATION_EVENTS_API.Insert_Validation_event'
60         ,p_hook_type   => 'BP');
61   end;
62   --
63   -- Validation in addition to Row Handlers
64   --
65   --
66   -- Process Logic
67      pqh_vle_ins.ins
68      (p_effective_date               => l_effective_date
69   ,p_validation_id                => p_validation_id
70   ,p_event_type                   => p_event_type
71   ,p_event_code                   => p_event_code
72   ,p_start_date                   => p_start_date
73   ,p_end_date                     => p_end_date
74   ,p_comments                     => p_comments
75   ,p_validation_event_id          => l_validation_event_id
76   ,p_object_version_number        => l_object_version_number);
77 
78   --
79   -- Call After Process User Hook
80   --
81   begin
82      PQH_FR_VALIDATION_EVENTS_BK1.Insert_Validation_event_a
83      (p_effective_date               => l_effective_date
84   ,p_validation_id                => p_validation_id
85   ,p_event_type                   => p_event_type
86   ,p_event_code                   => p_event_code
87   ,p_start_date                   => p_start_date
88   ,p_end_date                     => p_end_date
89   ,p_comments                     => p_comments);
90 
91   exception
92     when hr_api.cannot_find_prog_unit then
93       hr_api.cannot_find_prog_unit_error
94         (p_module_name => 'PQH_FR_VALIDATION_EVENTS_API.Insert_Validation_event'
95         ,p_hook_type   => 'AP'
96         );
97   end;
98   --
99   -- When in validation only mode raise the Validate_Enabled exception
100   --
101 -- Removed p_validate from the generated code to facilitate
102 -- writing wrappers to selfservice easily.
103 --
104 --  if p_validate then
105 --    raise hr_api.validate_enabled;
106 --  end if;
107   --
108   -- Set all output arguments
109   --
110      p_validation_event_id := l_validation_event_id;
111      p_object_version_number := l_object_version_number;
112 
113 
114   --
115   hr_utility.set_location(' Leaving:'||l_proc, 70);
116 exception
117   when hr_api.validate_enabled then
118     --
119     -- As the Validate_Enabled exception has been raised
120     -- we must rollback to the savepoint
121     --
122     rollback to Insert_Validation_event;
123     --
124     -- Only set output warning arguments
125     -- (Any key or derived arguments must be set to null
126     -- when validation only mode is being used.)
127     --
128     hr_utility.set_location(' Leaving:'||l_proc, 80);
129 
130   when others then
131   p_validation_event_id := null;
132   p_object_version_number := null;
133     --
134     -- A validation or unexpected error has occured
135     --
136     rollback to Insert_Validation_event;
137     hr_utility.set_location(' Leaving:'||l_proc, 90);
138     raise;
139 end Insert_Validation_event;
140 
141 --
142 -- ----------------------------------------------------------------------------
143 -- |--------------------------< Update_Validation_event >---------------------|
144 -- ----------------------------------------------------------------------------
145 
146 procedure Update_Validation_event
147   (p_effective_date                in     date
148   ,p_validation_event_id          in     number
149   ,p_object_version_number        in out nocopy number
150   ,p_validation_id                in     number    default hr_api.g_number
151   ,p_event_type                   in     varchar2  default hr_api.g_varchar2
152   ,p_event_code                   in     varchar2  default hr_api.g_varchar2
153   ,p_start_date                   in     date      default hr_api.g_date
154   ,p_end_date                     in     date      default hr_api.g_date
155   ,p_comments                     in     varchar2  default hr_api.g_varchar2) Is
156 
157   l_proc  varchar2(72)    := g_package||'Update_Validation_event';
158   l_object_Version_Number PQH_FR_VALIDATION_EVENTS.OBJECT_VERSION_NUMBER%TYPE := P_Object_version_Number;
159   L_Effective_Date        Date;
160 
161 Begin
162   hr_utility.set_location('Entering:'|| l_proc, 10);
163   --
164   -- Issue a savepoint
165   --
166   savepoint Update_Validation_event;
167   --
168   -- Truncate the time portion from all IN date parameters
169   --
170      l_effective_date := Trunc(p_effective_Date);
171   --
172   -- Call Before Process User Hook
173   --
174   begin
175 
176    PQH_FR_VALIDATION_EVENTS_BK2.Update_Validation_event_b
177   (p_effective_date                => l_effective_date
178   ,p_validation_event_id        => p_validation_event_id
179   ,p_object_version_number      => p_object_version_number
180   ,p_validation_id              => p_validation_id
181   ,p_event_type                 => p_event_type
182   ,p_event_code                  => p_event_code
183   ,p_start_date                 => p_start_date
184   ,p_end_date                  => p_end_date
185   ,p_comments                  => p_comments);
186 
187  exception
188     when hr_api.cannot_find_prog_unit then
189       hr_api.cannot_find_prog_unit_error
190         (p_module_name => 'Update_Validation_event'
191         ,p_hook_type   => 'BP'
192         );
193   end;
194 
195   pqh_vle_upd.upd
196   (p_effective_date                => l_effective_date
197   ,p_validation_event_id        => p_validation_event_id
198   ,p_object_version_number      => l_object_version_number
199   ,p_validation_id              => p_validation_id
200   ,p_event_type                 => p_event_type
201   ,p_event_code                  => p_event_code
202   ,p_start_date                 => p_start_date
203   ,p_end_date                  => p_end_date
204   ,p_comments                  => p_comments);
205 
206 --
207 --
208   -- Call After Process User Hook
209   --
210   begin
211 
212    PQH_FR_VALIDATION_EVENTS_BK2.Update_Validation_event_a
213   (p_effective_date                => l_effective_date
214   ,p_validation_event_id        => p_validation_event_id
215   ,p_object_version_number      => l_object_version_number
216   ,p_validation_id              => p_validation_id
217   ,p_event_type                 => p_event_type
218   ,p_event_code                  => p_event_code
219   ,p_start_date                 => p_start_date
220   ,p_end_date                  => p_end_date
221   ,p_comments                  => p_comments);
222 
223   exception
224     when hr_api.cannot_find_prog_unit then
225       hr_api.cannot_find_prog_unit_error
226         (p_module_name => 'Update_Validation_event'
227         ,p_hook_type   => 'AP'
228         );
229   end;
230   --
231   -- When in validation only mode raise the Validate_Enabled exception
232   --
233 --  if p_validate then
234 --    raise hr_api.validate_enabled;
235 --  end if;
236   --
237   -- Set all output arguments
238   --
239 
240   p_object_version_number  := l_object_version_number;
241 
242   --
243   hr_utility.set_location(' Leaving:'||l_proc, 70);
244 exception
245   when hr_api.validate_enabled then
246     --
247     -- As the Validate_Enabled exception has been raised
248     -- we must rollback to the savepoint
249     --
250     rollback to Update_Validation_event;
251     --
252     -- Only set output warning arguments
253     -- (Any key or derived arguments must be set to null
254     -- when validation only mode is being used.)
255     --
256     hr_utility.set_location(' Leaving:'||l_proc, 80);
257 
258   when others then
259   p_object_version_number := l_object_version_number;
260     --
261     -- A validation or unexpected error has occured
262     --
263     rollback to Update_Validation_event;
264     hr_utility.set_location(' Leaving:'||l_proc, 90);
265     raise;
266 end Update_Validation_event;
267 
268 --
269 -- ----------------------------------------------------------------------------
270 -- |-------------------< delete_Validation_event>------------------------------|
271 -- ----------------------------------------------------------------------------
272 procedure delete_Validation_event
273   (
274   p_validation_event_id                        in     number
275   ,p_object_version_number                in     number
276   ) Is   --
277 
278   -- Declare cursors and local variables
279   --
280   l_proc           varchar2(72) := g_package||'delete_Validation_event';
281   --
282 begin
283   hr_utility.set_location('Entering:'|| l_proc, 10);
284   --
285   -- Issue a savepoint
286   --
287   savepoint delete_Validation_event;
291   begin
288   --
289   -- Call Before Process User Hook
290   --
292   PQH_FR_VALIDATION_EVENTS_BK3.Delete_Validation_event_b
293   (p_validation_event_id            => p_validation_event_id
294   ,p_object_version_number   => p_object_version_number
295   );
296   exception
297     when hr_api.cannot_find_prog_unit then
298       hr_api.cannot_find_prog_unit_error
299         (p_module_name => 'delete_Validation_event'
300         ,p_hook_type   => 'BP');
301   end;
302   --
303   -- Process Logic
304   --
305   pqh_vle_del.del
306     (p_validation_event_id            => p_validation_event_id
307   ,p_object_version_number   => p_object_version_number
308     );
309   --
310   -- Call After Process User Hook
311   --
312   begin
313 
314    PQH_FR_VALIDATION_EVENTS_BK3.Delete_Validation_event_a
315   (p_validation_event_id            => p_validation_event_id
316   ,p_object_version_number   => p_object_version_number
317   );
318 
319   exception
320     when hr_api.cannot_find_prog_unit then
321       hr_api.cannot_find_prog_unit_error
322         (p_module_name => 'delete_Validation_event'
323         ,p_hook_type   => 'AP');
324   end;
325   --
326   -- When in validation only mode raise the Validate_Enabled exception
327   --
328 --  if p_validate then
329 --    raise hr_api.validate_enabled;
330 --  end if;
331   --
332   -- Set all output arguments
333   --
334   hr_utility.set_location(' Leaving:'||l_proc, 70);
335 exception
336   when hr_api.validate_enabled then
337     --
338     -- As the Validate_Enabled exception has been raised
339     -- we must rollback to the savepoint
340     --
341     rollback to delete_Validation_event;
342     --
343     -- Only set output warning arguments
344     -- (Any key or derived arguments must be set to null
345     -- when validation only mode is being used.)
346     --
347     hr_utility.set_location(' Leaving:'||l_proc, 80);
348   when others then
349     --
350     -- A validation or unexpected error has occured
351     --
352     rollback to delete_Validation_event;
353     hr_utility.set_location(' Leaving:'||l_proc, 90);
354     raise;
355 end delete_Validation_event;
356 
357 end PQH_FR_VALIDATION_EVENTS_API;