DBA Data[Home] [Help]

PACKAGE BODY: APPS.FF_FUNCTION_PARAMETERS_API

Source


1 Package Body FF_FUNCTION_PARAMETERS_API as
2 /* $Header: ffffpapi.pkb 120.0 2005/05/27 23:23:54 appldev noship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := '  FF_FUNCTION_PARAMETERS_API.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |--------------------------< CREATE_PARAMETER >----------------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure create_parameter
13   (p_validate                      in     boolean  default false
14   ,p_effective_date                in     date
15   ,p_function_id                   in     number
16   ,p_class                         in     varchar2
17   ,p_data_type                     in     varchar2
18   ,p_name                          in     varchar2
19   ,p_optional                      in     varchar2 default 'N'
20   ,p_continuing_parameter          in     varchar2 default 'N'
21   ,p_sequence_number                  out nocopy   number
22   ,p_object_version_number            out nocopy   number
23   )
24  is
25   --
26   -- Declare cursors and local variables
27   --
28   l_sequence_number            ff_function_parameters.sequence_number%type;
29   l_optional                   ff_function_parameters.optional%type;
30   l_continuing_parameter       ff_function_parameters.continuing_parameter%type;
31   l_object_version_number      ff_function_parameters.object_version_number%type;
32   l_effective_date      date;
33   l_proc                varchar2(72) := g_package||'CREATE_PARAMETER';
34 begin
35   hr_utility.set_location('Entering:'|| l_proc, 10);
36   --
37   -- Issue a savepoint
38   --
39   savepoint CREATE_PARAMETER;
40   --
41   -- Remember IN OUT parameter IN values
42   --
43   -- Truncate the time portion from all IN date parameters
44   --
45   l_effective_date := trunc(p_effective_date);
46 
47   --
48   -- Call Before Process User Hook
49   --
50 
51   begin
52     FF_FUNCTION_PARAMETERS_BK1.CREATE_PARAMETER_b
53       (p_effective_date            => l_effective_date
54       ,p_function_id               => p_function_id
55       ,p_class                     => p_class
56       ,p_data_type                 => p_data_type
57       ,p_name                      => p_name
58       ,p_optional                  => p_optional
59       ,p_continuing_parameter      => p_continuing_parameter
60   );
61   exception
62     when hr_api.cannot_find_prog_unit then
63       hr_api.cannot_find_prog_unit_error
64         (p_module_name => 'CREATE_PARAMETER'
65         ,p_hook_type   => 'BP'
66         );
67   end;
68   --
69   -- Validation in addition to Row Handlers
70   --
71   -- if parameter class is 'OUT' or 'IN/OUT' type then optional must be 'N'
72   if (p_class <> 'I' ) then
73      l_optional := 'N';
74      l_continuing_parameter := 'N';
75   else
76      l_optional := p_optional;
77      l_continuing_parameter := p_continuing_parameter;
78   end if;
79   --
80   -- Process Logic
81   --
82 
83   ff_ffp_ins.ins
84       (p_effective_date            => l_effective_date
85       ,p_function_id               => p_function_id
86       ,p_class                     => p_class
87       ,p_continuing_parameter      => l_continuing_parameter
88       ,p_data_type                 => p_data_type
89       ,p_name                      => p_name
90       ,p_optional                  => l_optional
91       ,p_sequence_number           => l_sequence_number
92       ,p_object_version_number     => l_object_version_number
93   );
94 
95   --
96   -- Call After Process User Hook
97   --
98   begin
99     FF_FUNCTION_PARAMETERS_BK1.CREATE_PARAMETER_a
100       (p_effective_date            => l_effective_date
101       ,p_function_id               => p_function_id
102       ,p_class                     => p_class
103       ,p_data_type                 => p_data_type
104       ,p_name                      => p_name
105       ,p_optional                  => l_optional
106       ,p_continuing_parameter      => l_continuing_parameter
107       ,p_sequence_number           => l_sequence_number
108       ,p_object_version_number     => l_object_version_number
109      );
110 
111   exception
112     when hr_api.cannot_find_prog_unit then
113       hr_api.cannot_find_prog_unit_error
114         (p_module_name => 'CREATE_PARAMETER'
115         ,p_hook_type   => 'AP'
116         );
117   end;
118   --
119   -- When in validation only mode raise the Validate_Enabled exception
120   --
121   if p_validate then
122     raise hr_api.validate_enabled;
123   end if;
124   --
125   -- Set all IN OUT and OUT parameters with out values
126   --
127   p_sequence_number        := l_sequence_number;
128   p_object_version_number  := l_object_version_number;
129 
130   --
131   hr_utility.set_location(' Leaving:'||l_proc, 70);
132 exception
133   when hr_api.validate_enabled then
134     --
135     -- As the Validate_Enabled exception has been raised
136     -- we must rollback to the savepoint
137     --
138     rollback to CREATE_PARAMETER;
139     --
140     -- Reset IN OUT parameters and set OUT parameters
141     -- (Any key or derived arguments must be set to null
142     -- when validation only mode is being used.)
143     --
144 
145     p_sequence_number        := null;
146     p_object_version_number  := null;
147 
148     hr_utility.set_location(' Leaving:'||l_proc, 80);
149   when others then
150     --
151     -- A validation or unexpected error has occured
152     --
153     rollback to CREATE_PARAMETER;
154     --
155     -- Reset IN OUT parameters and set all
156     -- OUT parameters, including warnings, to null
157     --
158      p_sequence_number        := null;
159     p_object_version_number  := null;
160 
161    hr_utility.set_location(' Leaving:'||l_proc, 90);
162     raise;
163 end CREATE_PARAMETER;
164 --
165 -- ----------------------------------------------------------------------------
166 -- |--------------------------< UPDATE_PARAMETER >--------------------------|
167 -- ----------------------------------------------------------------------------
168 --
169 procedure UPDATE_PARAMETER
170   (p_validate                      in     boolean  default false
171   ,p_effective_date                in     date
172   ,p_function_id                   in     number
173   ,p_sequence_number               in     number
174   ,p_object_version_number         in out nocopy   number
175   ,p_class                         in     varchar2 default hr_api.g_varchar2
176   ,p_data_type                     in     varchar2 default hr_api.g_varchar2
177   ,p_name                          in     varchar2 default hr_api.g_varchar2
178   ,p_optional                      in     varchar2 default hr_api.g_varchar2
179   ,p_continuing_parameter          in     varchar2 default hr_api.g_varchar2
180   ) is
181   --
182   -- Declare cursors and local variables
183   --
184   l_optional                   ff_function_parameters.optional%type;
185   l_continuing_parameter       ff_function_parameters.continuing_parameter%type;
186   l_object_version_number      ff_function_parameters.object_version_number%type;
187   l_effective_date      date;
188   l_proc                varchar2(72) := g_package||'UPDATE_PARAMETER';
189 begin
190   hr_utility.set_location('Entering:'|| l_proc, 10);
191   --
192   -- Issue a savepoint
193   --
194   savepoint UPDATE_PARAMETER;
195   --
196   -- Remember IN OUT parameter IN values
197   --
198   l_object_version_number := p_object_version_number;
199 
200   --
201   -- Truncate the time portion from all IN date parameters
202   --
203   l_effective_date := trunc(p_effective_date);
204 
205   --
206   -- Call Before Process User Hook
207   --
208   begin
209     FF_FUNCTION_PARAMETERS_BK2.UPDATE_PARAMETER_b
210        (p_effective_date           => l_effective_date
211        ,p_function_id              => p_function_id
212        ,p_sequence_number          => p_sequence_number
213        ,p_object_version_number    => l_object_version_number
214        ,p_class                    => p_class
215        ,p_data_type                => p_data_type
216        ,p_name                     => p_name
217        ,p_optional                 => p_optional
218        ,p_continuing_parameter     => p_continuing_parameter
219   );  exception
220     when hr_api.cannot_find_prog_unit then
221       hr_api.cannot_find_prog_unit_error
222         (p_module_name => 'UPDATE_PARAMETER'
223         ,p_hook_type   => 'BP'
224         );
225   end;
226   --
227   -- Validation in addition to Row Handlers
228   --
229   --
230   -- if parameter class is 'OUT' or 'IN/OUT' type then optional must be 'N'
231   if (p_class <> 'I' ) then
232      l_optional := 'N';
233      l_continuing_parameter := 'N';
234   else
235      l_optional := p_optional;
236      l_continuing_parameter := p_continuing_parameter;
237   end if;
238   --
239   ff_ffp_upd.upd
240        (p_effective_date           => l_effective_date
241        ,p_function_id              => p_function_id
242        ,p_sequence_number          => p_sequence_number
243        ,p_object_version_number    => l_object_version_number
244        ,p_class                    => p_class
245        ,p_continuing_parameter     => l_continuing_parameter
246        ,p_data_type                => p_data_type
247        ,p_name                     => p_name
248        ,p_optional                 => l_optional
249        );
250 
251   --
252   -- Process Logic
253   --
254 
255   --
256   -- Call After Process User Hook
257   --
258   begin
259     FF_FUNCTION_PARAMETERS_BK2.UPDATE_PARAMETER_a
260        (p_effective_date           => l_effective_date
261        ,p_function_id              => p_function_id
262        ,p_sequence_number          => p_sequence_number
263        ,p_object_version_number    => l_object_version_number
264        ,p_class                    => p_class
265        ,p_data_type                => p_data_type
266        ,p_name                     => p_name
267        ,p_optional                 => l_optional
268        ,p_continuing_parameter     => l_continuing_parameter
269       );
270   exception
271     when hr_api.cannot_find_prog_unit then
272       hr_api.cannot_find_prog_unit_error
273         (p_module_name => 'UPDATE_PARAMETER'
274         ,p_hook_type   => 'AP'
275         );
276   end;
277   --
278   -- When in validation only mode raise the Validate_Enabled exception
279   --
280   if p_validate then
281     raise hr_api.validate_enabled;
282   end if;
283   --
284   -- Set all IN OUT and OUT parameters with out values
285   --
286   p_object_version_number  := l_object_version_number;
287   --
288   hr_utility.set_location(' Leaving:'||l_proc, 70);
289 exception
290   when hr_api.validate_enabled then
291     --
292     -- As the Validate_Enabled exception has been raised
293     -- we must rollback to the savepoint
294     --
295     rollback to UPDATE_PARAMETER;
296     --
297     -- Reset IN OUT parameters and set OUT parameters
298     -- (Any key or derived arguments must be set to null
299     -- when validation only mode is being used.)
300     --
301   p_object_version_number  := l_object_version_number;
302   hr_utility.set_location(' Leaving:'||l_proc, 80);
303   when others then
304     --
305     -- A validation or unexpected error has occured
306     --
307     rollback to UPDATE_PARAMETER;
308     --
309     -- Reset IN OUT parameters and set all
310     -- OUT parameters, including warnings, to null
311     --
312     p_object_version_number  := l_object_version_number;
313     hr_utility.set_location(' Leaving:'||l_proc, 90);
314     raise;
315 end UPDATE_PARAMETER;
316 --
317 -- ----------------------------------------------------------------------------
318 -- |--------------------------< DELETE_PARAMETER >--------------------------|
319 -- ----------------------------------------------------------------------------
320 --
321 procedure DELETE_PARAMETER
322   (p_validate                      in     boolean  default false
323   ,p_function_id                   in     number
324   ,p_sequence_number               in     number
325   ,p_object_version_number         in     number
326   ) is
327   --
328   -- Declare cursors and local variables
329   --
330   l_proc                varchar2(72) := g_package||'DELETE_PARAMETER';
331 begin
332   hr_utility.set_location('Entering:'|| l_proc, 10);
333   --
334   -- Issue a savepoint
335   --
336   savepoint DELETE_PARAMETER;
337   --
338   -- Remember IN OUT parameter IN values
339   --
340   --
341   -- Truncate the time portion from all IN date parameters
342   --
343 
344   --
345   -- Call Before Process User Hook
346   --
347   begin
348     FF_FUNCTION_PARAMETERS_BK3.DELETE_PARAMETER_b
349        (p_function_id              => p_function_id
350        ,p_sequence_number          => p_sequence_number
351        ,p_object_version_number    => p_object_version_number
352        );
353   exception
354     when hr_api.cannot_find_prog_unit then
355       hr_api.cannot_find_prog_unit_error
356         (p_module_name => 'DELETE_PARAMETER'
357         ,p_hook_type   => 'BP'
358         );
359   end;
360   --
361   -- Validation in addition to Row Handlers
362   --
363 
364   --
365   -- Process Logic
366   --
367   ff_ffp_del.del
368        (p_function_id              => p_function_id
369        ,p_sequence_number          => p_sequence_number
370        ,p_object_version_number    => p_object_version_number
371        );
372 
373   --
374   -- Call After Process User Hook
375   --
376   begin
377     FF_FUNCTION_PARAMETERS_BK3.DELETE_PARAMETER_a
378        (p_function_id              => p_function_id
379        ,p_sequence_number          => p_sequence_number
380        ,p_object_version_number    => p_object_version_number
381        );
382   exception
383     when hr_api.cannot_find_prog_unit then
384       hr_api.cannot_find_prog_unit_error
385         (p_module_name => 'DELETE_PARAMETER'
386         ,p_hook_type   => 'AP'
387         );
388   end;
389   --
390   -- When in validation only mode raise the Validate_Enabled exception
391   --
392   if p_validate then
393     raise hr_api.validate_enabled;
394   end if;
395   --
396   -- Set all IN OUT and OUT parameters with out values
397   --
398   hr_utility.set_location(' Leaving:'||l_proc, 70);
399 exception
400   when hr_api.validate_enabled then
401     --
402     -- As the Validate_Enabled exception has been raised
403     -- we must rollback to the savepoint
404     --
405     rollback to DELETE_PARAMETER;
406     --
407     -- Reset IN OUT parameters and set OUT parameters
408     -- (Any key or derived arguments must be set to null
409     -- when validation only mode is being used.)
410     --
411     hr_utility.set_location(' Leaving:'||l_proc, 80);
412   when others then
413     --
414     -- A validation or unexpected error has occured
415     --
416     rollback to DELETE_PARAMETER;
417     --
418     -- Reset IN OUT parameters and set all
419     -- OUT parameters, including warnings, to null
420     --
421     hr_utility.set_location(' Leaving:'||l_proc, 90);
422     raise;
423 end DELETE_PARAMETER;
424 --
425 
426 end FF_FUNCTION_PARAMETERS_API;