DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_RI_CONFIG_LOCATION_API

Source


1 Package Body per_ri_config_location_api AS
2 /* $Header: pecnlapi.pkb 120.0 2005/05/31 06:50:56 appldev noship $ */
3 --
4 -- Package Variables
5 --
6 g_package            VARCHAR2(33) := 'per_ri_config_location_api.';
7 --
8 --------------------------------------------------------------------------------
9 g_dummy number(1);      -- Dummy for cursor returns which are not needed
10 g_business_group_id number(15); -- For validating translation;
11 g_legislation_code varchar2(150); -- For validating translation;
12 --------------------------------------------------------------------------------
13 -- ----------------------------------------------------------------------------------
14 -- |-----------------------------< create_location >--------------------------|
15 -- ----------------------------------------------------------------------------------
16 --
17 Procedure create_location
18   (   p_validate                       In  Boolean   Default False
19      ,p_configuration_code             In  Varchar2
20      ,p_configuration_context          In  Varchar2
21      ,p_location_code                  In  Varchar2
22      ,p_description                    In  Varchar2  Default Null
23      ,p_style                          In  Varchar2  Default Null
24      ,p_address_line_1                 In  Varchar2  Default Null
25      ,p_address_line_2                 In  Varchar2  Default Null
26      ,p_address_line_3                 In  Varchar2  Default Null
27      ,p_town_or_city                   In  Varchar2  Default Null
28      ,p_country                        In  Varchar2  Default Null
29      ,p_postal_code                    In  Varchar2  Default Null
30      ,p_region_1                       In  Varchar2  Default Null
31      ,p_region_2                       In  Varchar2  Default Null
32      ,p_region_3                       In  Varchar2  Default Null
33      ,p_telephone_number_1             In  Varchar2  Default Null
34      ,p_telephone_number_2             In  Varchar2  Default Null
35      ,p_telephone_number_3             In  Varchar2  Default Null
36      ,p_loc_information13              In  Varchar2  Default Null
37      ,p_loc_information14              In  Varchar2  Default Null
38      ,p_loc_information15              In  Varchar2  Default Null
39      ,p_loc_information16              In  Varchar2  Default Null
40      ,p_loc_information17              In  Varchar2  Default Null
41      ,p_loc_information18              In  Varchar2  Default Null
42      ,p_loc_information19              In  Varchar2  Default Null
43      ,p_loc_information20              In  Varchar2  Default Null
44      ,p_language_code                  In  Varchar2  Default hr_api.userenv_lang
45      ,p_effective_date                 In  Date
46      ,p_object_version_number          Out Nocopy Number
47      ,p_location_id                    Out Nocopy Number
48      )
49      Is
50   --
51   -- Declare cursors and local variables
52   --
53   l_proc                  Varchar2(72) := g_package||'create_config_information';
54   l_object_version_number hr_locations_all.object_version_number%TYPE;
55   l_language_code         per_ri_workbench_items_tl.language%TYPE;
56   l_effective_date        Date;
57 
58   --
59 Begin
60   --
61   hr_utility.set_location('Entering:'|| l_proc, 10);
62   --
63   -- Issue a savepoint
64   --
65   Savepoint create_config_information;
66   --
67   hr_utility.set_location(l_proc, 15);
68   --
69   --  All date input parameters must be truncated to remove time elements
70   --
71   l_effective_date := trunc (p_effective_date);
72   --
73   --
74   -- Validate the language parameter.  l_language_code should be passed to functions
75   -- instead of p_language_code from now on, to allow an IN OUT parameter to
76   -- be passed through.
77   --
78   l_language_code := p_language_code;
79   hr_api.validate_language_code(p_language_code => l_language_code);
80   --
81   hr_utility.set_location(l_proc, 20);
82 
83   -- Process Logic
84   --
85   -- Insert non-translatable rows into PER_RI_CONFIG_LOCATION first
86    per_cnl_ins.ins
87     (  p_effective_date                  => p_effective_date
88       ,p_configuration_code              => p_configuration_code
89       ,p_configuration_context           => p_configuration_context
90       ,p_location_code                   => p_location_code
91       ,p_description                     => p_description
92       ,p_style                           => p_style
93       ,p_address_line_1                  => p_address_line_1
94       ,p_address_line_2                  => p_address_line_2
95       ,p_address_line_3                  => p_address_line_3
96       ,p_town_or_city                    => p_town_or_city
97       ,p_country                         => p_country
98       ,p_postal_code                     => p_postal_code
99       ,p_region_1                        => p_region_1
100       ,p_region_2                        => p_region_2
101       ,p_region_3                        => p_region_3
102       ,p_telephone_number_1              => p_telephone_number_1
103       ,p_telephone_number_2              => p_telephone_number_2
104       ,p_telephone_number_3              => p_telephone_number_3
105       ,p_loc_information13               => p_loc_information13
106       ,p_loc_information14               => p_loc_information14
107       ,p_loc_information15               => p_loc_information15
108       ,p_loc_information16               => p_loc_information16
109       ,p_loc_information17               => p_loc_information17
110       ,p_loc_information18               => p_loc_information18
111       ,p_loc_information19               => p_loc_information19
112       ,p_loc_information20               => p_loc_information20
113       ,p_location_id                     => p_location_id
114       ,p_object_version_number           => l_object_version_number
115    );
116   --
117 
118 
119   hr_utility.set_location(l_proc, 60);
120   --
121   -- When in validation only mode raise the Validate_Enabled exception
122   --
123   If p_validate Then
124     Raise hr_api.validate_enabled;
125   End If;
126   --
127   -- Set all output arguments
128   --
129     p_object_version_number := l_object_version_number;
130   --
131   hr_utility.set_location(' Leaving:'||l_proc, 70);
132   --
133 Exception
134   --
135   When hr_api.validate_enabled Then
136     --
137     -- As the Validate_Enabled exception has been raised
138     -- we must rollback to the savepoint
139     --
140     Rollback To create_config_information;
141     --
142     -- Only set output warning arguments
143     -- (Any key or derived arguments must be set to null
144     -- when validation only mode is being used.)
145     --
146     p_object_version_number  := Null;
147     hr_utility.set_location(' Leaving:'||l_proc, 80);
148   When Others Then
149     --
150     -- A validation or unexpected error has occurred
151     Rollback To create_config_information;
152     -- Set OUT parameters.
153     p_object_version_number  := Null;
154     hr_utility.set_location(' Leaving:'||l_proc, 90);
155     Raise;
156    --
157 End create_location;
158 -- ----------------------------------------------------------------------------
159 -- |--------------------------< update_location >-----------------------------|
160 -- ----------------------------------------------------------------------------
161 --
162 Procedure update_location
163   (   p_validate                       In  Boolean   Default False
164      ,p_location_id                    In  Number
165      ,p_configuration_code             In  Varchar2
166      ,p_configuration_context          In  Varchar2
167      ,p_location_code                  In  Varchar2
168      ,p_description                    In  Varchar2  Default hr_api.g_varchar2
169      ,p_style                          In  Varchar2  Default hr_api.g_varchar2
170      ,p_address_line_1                 In  Varchar2  Default hr_api.g_varchar2
171      ,p_address_line_2                 In  Varchar2  Default hr_api.g_varchar2
172      ,p_address_line_3                 In  Varchar2  Default hr_api.g_varchar2
173      ,p_town_or_city                   In  Varchar2  Default hr_api.g_varchar2
174      ,p_country                        In  Varchar2  Default hr_api.g_varchar2
175      ,p_postal_code                    In  Varchar2  Default hr_api.g_varchar2
176      ,p_region_1                       In  Varchar2  Default hr_api.g_varchar2
177      ,p_region_2                       In  Varchar2  Default hr_api.g_varchar2
178      ,p_region_3                       In  Varchar2  Default hr_api.g_varchar2
179      ,p_telephone_number_1             In  Varchar2  Default hr_api.g_varchar2
180      ,p_telephone_number_2             In  Varchar2  Default hr_api.g_varchar2
181      ,p_telephone_number_3             In  Varchar2  Default hr_api.g_varchar2
182      ,p_loc_information13              In  Varchar2  Default hr_api.g_varchar2
183      ,p_loc_information14              In  Varchar2  Default hr_api.g_varchar2
184      ,p_loc_information15              In  Varchar2  Default hr_api.g_varchar2
185      ,p_loc_information16              In  Varchar2  Default hr_api.g_varchar2
186      ,p_loc_information17              In  Varchar2  Default hr_api.g_varchar2
187      ,p_loc_information18              In  Varchar2  Default hr_api.g_varchar2
188      ,p_loc_information19              In  Varchar2  Default hr_api.g_varchar2
189      ,p_loc_information20              In  Varchar2  Default hr_api.g_varchar2
190      ,p_language_code                  In  Varchar2  Default hr_api.userenv_lang
191      ,p_effective_date                 In  Date
192      ,p_object_version_number          In Out Nocopy Number
193   ) Is
194   --
195   -- Declare cursors and local variables
196   --
197   l_proc                  VARCHAR2(72) := g_package||'update_location';
198   l_object_version_number hr_locations.object_version_number%TYPE;
199   l_language_code         hr_locations_all_tl.language%TYPE;
200   l_workbench_item_creation_date Date;
201   l_effective_date        DATE;
202 
203   l_temp_ovn   number := p_object_version_number;
204   --
205 BEGIN
206   --
207   hr_utility.set_location('Entering:'|| l_proc, 10);
208   --
209   -- Issue a savepoint.
210   --
211   savepoint update_location;
212   --
213   --
214   --  All date input parameters must be truncated to remove time elements
215   --
216   l_effective_date := trunc (p_effective_date);
217 
218   --
219   -- Validate the language parameter.  l_language_code should be passed to functions
220   -- instead of p_language_code from now on, to allow an IN OUT parameter to be
221   -- passed through.
222   --
223   l_language_code := p_language_code;
224   hr_api.validate_language_code(p_language_code => l_language_code);
225   hr_utility.set_location(l_proc, 20);
226   --
227   --
228   -- Process Logic
229   --
230   l_object_version_number := p_object_version_number;
231   --
232   -- Insert non-translatable rows in PER_RI_CONFIG_INFORMATION Table
233   --
234      per_cnl_upd.upd
235           ( p_effective_date            =>  p_effective_date
236            ,p_location_id               =>  p_location_id
237            ,p_object_version_number     =>  p_object_version_number
238            ,p_configuration_code        =>  p_configuration_code
239            ,p_configuration_context     =>  p_configuration_context
240            ,p_location_code             =>  p_location_code
241            ,p_description               =>  p_description
242            ,p_style                     =>  p_style
243            ,p_address_line_1            =>  p_address_line_1
244            ,p_address_line_2            =>  p_address_line_2
245            ,p_address_line_3            =>  p_address_line_3
246            ,p_town_or_city              =>  p_town_or_city
247            ,p_country                   =>  p_country
248            ,p_postal_code               =>  p_postal_code
249            ,p_region_1                  =>  p_region_1
250            ,p_region_2                  =>  p_region_2
251            ,p_region_3                  =>  p_region_3
252            ,p_telephone_number_1        =>  p_telephone_number_1
253            ,p_telephone_number_2        =>  p_telephone_number_2
254            ,p_telephone_number_3        =>  p_telephone_number_3
255            ,p_loc_information13         =>  p_loc_information13
256            ,p_loc_information14         =>  p_loc_information14
257            ,p_loc_information15         =>  p_loc_information15
258            ,p_loc_information16         =>  p_loc_information16
259            ,p_loc_information17         =>  p_loc_information17
260            ,p_loc_information18         =>  p_loc_information18
261            ,p_loc_information19         =>  p_loc_information19
262            ,p_loc_information20         =>  p_loc_information20
263           );
264   --
265 
266 
267   hr_utility.set_location(l_proc, 60);
268   --
269   -- When in validation only mode raise the Validate_Enabled exception
270   --
271   If p_validate Then
272     Raise hr_api.validate_enabled;
273   End If;
274   --
275   -- Set all output arguments.  If p_validate was TRUE, this bit is
276   -- never reached, so p_object_version_number is passed back unchanged.
277   --
278   p_object_version_number := l_object_version_number;
279   --
280   hr_utility.set_location(' Leaving:'||l_proc, 70);
281   --
282 Exception
283   --
284   When hr_api.validate_enabled Then
285     --
286     -- As the Validate_Enabled exception has been raised
287     -- we must rollback to the savepoint
288     --
289     Rollback To update_location;
290     --
291     -- Only set output warning arguments
292     -- (Any key or derived arguments must be set to null
293     -- when validation only mode is being used.)
294     -- Reset IN OUT parameters.
295     p_object_version_number := l_temp_ovn;
296     hr_utility.set_location(' Leaving:'||l_proc, 80);
297   When Others Then
298     --
299     -- A validation or unexpected error has occurred
300     Rollback To update_location;
301     -- Reset IN OUT parameters.
302     p_object_version_number := l_temp_ovn;
303     hr_utility.set_location(' Leaving:'||l_proc, 90);
304     Raise;
305     --
306     --
307 End update_location;
308 -- ----------------------------------------------------------------------------
309 -- |-------------------------< delete_location >------------------------------|
310 -- ----------------------------------------------------------------------------
311 --
312 Procedure delete_location
313    (  p_validate                     In Boolean Default False
314      ,p_location_id                  In Number
315      ,p_object_version_number        IN Number )
316 
317 Is
318   --
319   --
320   -- Declare cursors and local variables
321   --
322   l_proc Varchar2(72) := g_package||'delete_config_information';
323   --
324 Begin
325   --
326   hr_utility.set_location('Entering:'|| l_proc, 10);
327   --
328   -- Issue a savepoint
329   --
330   Savepoint delete_workbench_item;
331 
332 
333   --
334 
335   hr_utility.set_location( l_proc, 40);
336 
337   per_cnl_del.del(p_location_id           => p_location_id
338                  ,p_object_version_number => p_object_version_number);
339 
340 
341 --
342   hr_utility.set_location(' Leaving:'||l_proc, 60);
343   --
344   -- When in validation only mode raise the Validate_Enabled exception
345   --
346   If p_validate Then
347      Raise hr_api.validate_enabled;
348   End If;
349   --
350   --
351 Exception
352   --
353   When hr_api.validate_enabled Then
354     --
355     -- As the Validate_Enabled exception has been raised
356     -- we must rollback to the savepoint
357     --
358     Rollback To delete_location;
359     --
360     -- Only set output warning arguments
361     -- (Any key or derived arguments must be set to null
362     -- when validation only mode is being used.)
363     --
364     hr_utility.set_location(' Leaving:'||l_proc, 80);
365   When Others Then
366     --
367     -- A validation or unexpected error has occurred
368     Rollback To delete_location;
369     hr_utility.set_location(' Leaving:'||l_proc, 90);
370     Raise;
371     --
372 End delete_location;
373 
374 --
375 
376 End per_ri_config_location_api;