DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_SOLUTION_API

Source


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