DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_ADI_DOCUMENT_SWI

Source


1 Package Body hr_adi_document_swi As
2 /* $Header: hrlobswi.pkb 115.3 2002/11/21 14:21:56 menderby noship $ */
3 --
4 -- Package variables
5 --
6 g_package  varchar2(33) := 'hr_adi_document_swi.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |----------------------------< create_document >---------------------------|
10 -- ----------------------------------------------------------------------------
11 PROCEDURE create_document
12   (p_validate                     in     number    default hr_api.g_false_num
13   ,p_effective_date               in     date
14   ,p_mime_type                    in     varchar2
15   ,p_file_name                    in     varchar2
16   ,p_type                         in     varchar2
17   ,p_file_id                      in     number
18   ,p_return_status                   out nocopy varchar2
19   ) is
20   --
21   -- Variables for API Boolean parameters
22   l_validate                      boolean;
23   --
24   -- Variables for IN/OUT parameters
25   --
26   -- Other variables
27   l_file_id                      number;
28   l_proc    varchar2(72) := g_package ||'create_document';
29 Begin
30   hr_utility.set_location(' Entering:' || l_proc,10);
31   --
32   -- Issue a savepoint
33   --
34   savepoint create_document_swi;
35   --
36   -- Initialise Multiple Message Detection
37   --
38   hr_multi_message.enable_message_list;
39   --
40   -- Remember IN OUT parameter IN values
41   --
42   --
43   -- Convert constant values to their corresponding boolean value
44   --
45   l_validate :=
46     hr_api.constant_to_boolean
47       (p_constant_value => p_validate);
48   --
49   -- Register Surrogate ID or user key values
50   --
51   hr_adi_lob_ins.set_base_key_value
52     (p_file_id => p_file_id
53     );
54   --
55   -- Call API
56   --
57   hr_adi_document_api.create_document
58     (p_validate                     => l_validate
59     ,p_effective_date               => p_effective_date
60     ,p_mime_type                    => p_mime_type
61     ,p_file_name                    => p_file_name
62     ,p_type                         => p_type
63     ,p_file_id                      => l_file_id
64     );
65   --
66   -- Convert API warning boolean parameter values to specific
67   -- messages and add them to Multiple Message List
68   --
69   --
70   -- Convert API non-warning boolean parameter values
71   --
72   --
73   -- Derive the API return status value based on whether
74   -- messages of any type exist in the Multiple Message List.
75   -- Also disable Multiple Message Detection.
76   --
77   p_return_status := hr_multi_message.get_return_status_disable;
78   hr_utility.set_location(' Leaving:' || l_proc,20);
79   --
80 exception
81   when hr_multi_message.error_message_exist then
82     --
83     -- Catch the Multiple Message List exception which
84     -- indicates API processing has been aborted because
85     -- at least one message exists in the list.
86     --
87     rollback to create_document_swi;
88     --
89     -- Reset IN OUT parameters and set OUT parameters
90     --
91     p_return_status := hr_multi_message.get_return_status_disable;
92     hr_utility.set_location(' Leaving:' || l_proc, 30);
93   when others then
94     --
95     -- When Multiple Message Detection is enabled catch
96     -- any Application specific or other unexpected
97     -- exceptions.  Adding appropriate details to the
98     -- Multiple Message List.  Otherwise re-raise the
99     -- error.
100     --
101     rollback to create_document_swi;
102     if hr_multi_message.unexpected_error_add(l_proc) then
103        hr_utility.set_location(' Leaving:' || l_proc,40);
104        raise;
105     end if;
106     --
107     -- Reset IN OUT and set OUT parameters
108     --
109     p_return_status := hr_multi_message.get_return_status_disable;
110     hr_utility.set_location(' Leaving:' || l_proc,50);
111 end create_document;
112 -- ----------------------------------------------------------------------------
113 -- |----------------------------< delete_document >---------------------------|
114 -- ----------------------------------------------------------------------------
115 PROCEDURE delete_document
116   (p_validate                     in     number    default hr_api.g_false_num
117   ,p_file_id                      in     number
118   ,p_return_status                   out nocopy varchar2
119   ) is
120   --
121   -- Variables for API Boolean parameters
122   l_validate                      boolean;
123   --
124   -- Variables for IN/OUT parameters
125   --
126   -- Other variables
127   l_proc    varchar2(72) := g_package ||'delete_document';
128 Begin
129   hr_utility.set_location(' Entering:' || l_proc,10);
130   --
131   -- Issue a savepoint
132   --
133   savepoint delete_document_swi;
134   --
135   -- Initialise Multiple Message Detection
136   --
137   hr_multi_message.enable_message_list;
138   --
139   -- Remember IN OUT parameter IN values
140   --
141   --
142   -- Convert constant values to their corresponding boolean value
143   --
144   l_validate :=
145     hr_api.constant_to_boolean
146       (p_constant_value => p_validate);
147   --
148   -- Register Surrogate ID or user key values
149   --
150   --
151   -- Call API
152   --
153   hr_adi_document_api.delete_document
154     (p_validate                     => l_validate
155     ,p_file_id                      => p_file_id
156     );
157   --
158   -- Convert API warning boolean parameter values to specific
159   -- messages and add them to Multiple Message List
160   --
161   --
162   -- Convert API non-warning boolean parameter values
163   --
164   --
165   -- Derive the API return status value based on whether
166   -- messages of any type exist in the Multiple Message List.
167   -- Also disable Multiple Message Detection.
168   --
169   p_return_status := hr_multi_message.get_return_status_disable;
170   hr_utility.set_location(' Leaving:' || l_proc,20);
171   --
172 exception
173   when hr_multi_message.error_message_exist then
174     --
175     -- Catch the Multiple Message List exception which
176     -- indicates API processing has been aborted because
177     -- at least one message exists in the list.
178     --
179     rollback to delete_document_swi;
180     --
181     -- Reset IN OUT parameters and set OUT parameters
182     --
183     p_return_status := hr_multi_message.get_return_status_disable;
184     hr_utility.set_location(' Leaving:' || l_proc, 30);
185   when others then
186     --
187     -- When Multiple Message Detection is enabled catch
188     -- any Application specific or other unexpected
189     -- exceptions.  Adding appropriate details to the
190     -- Multiple Message List.  Otherwise re-raise the
191     -- error.
192     --
193     rollback to delete_document_swi;
194     if hr_multi_message.unexpected_error_add(l_proc) then
195        hr_utility.set_location(' Leaving:' || l_proc,40);
196        raise;
197     end if;
198     --
199     -- Reset IN OUT and set OUT parameters
200     --
201     p_return_status := hr_multi_message.get_return_status_disable;
202     hr_utility.set_location(' Leaving:' || l_proc,50);
203 end delete_document;
204 -- ----------------------------------------------------------------------------
205 -- |----------------------------< update_document >---------------------------|
206 -- ----------------------------------------------------------------------------
207 PROCEDURE update_document
208   (p_validate                     in     number    default hr_api.g_false_num
209   ,p_effective_date               in     date
210   ,p_file_id                      in     number
211   ,p_mime_type                    in     varchar2
212   ,p_file_name                    in     varchar2
213   ,p_return_status                   out nocopy varchar2
214   ) is
215   --
216   -- Variables for API Boolean parameters
217   l_validate                      boolean;
218   --
219   -- Variables for IN/OUT parameters
220   --
221   -- Other variables
222   l_proc    varchar2(72) := g_package ||'update_document';
223 Begin
224   hr_utility.set_location(' Entering:' || l_proc,10);
225   --
226   -- Issue a savepoint
227   --
228   savepoint update_document_swi;
229   --
230   -- Initialise Multiple Message Detection
231   --
232   hr_multi_message.enable_message_list;
233   --
234   -- Remember IN OUT parameter IN values
235   --
236   --
237   -- Convert constant values to their corresponding boolean value
238   --
239   l_validate :=
240     hr_api.constant_to_boolean
241       (p_constant_value => p_validate);
242   --
243   -- Register Surrogate ID or user key values
244   --
245   --
246   -- Call API
247   --
248   hr_adi_document_api.update_document
249     (p_validate                     => l_validate
250     ,p_effective_date               => p_effective_date
251     ,p_file_id                      => p_file_id
252     ,p_mime_type                    => p_mime_type
253     ,p_file_name                    => p_file_name
254     );
255   --
256   -- Convert API warning boolean parameter values to specific
257   -- messages and add them to Multiple Message List
258   --
259   --
260   -- Convert API non-warning boolean parameter values
261   --
262   --
263   -- Derive the API return status value based on whether
264   -- messages of any type exist in the Multiple Message List.
265   -- Also disable Multiple Message Detection.
266   --
267   p_return_status := hr_multi_message.get_return_status_disable;
268   hr_utility.set_location(' Leaving:' || l_proc,20);
269   --
270 exception
271   when hr_multi_message.error_message_exist then
272     --
273     -- Catch the Multiple Message List exception which
274     -- indicates API processing has been aborted because
275     -- at least one message exists in the list.
276     --
277     rollback to update_document_swi;
278     --
279     -- Reset IN OUT parameters and set OUT parameters
280     --
281     p_return_status := hr_multi_message.get_return_status_disable;
282     hr_utility.set_location(' Leaving:' || l_proc, 30);
283   when others then
284     --
285     -- When Multiple Message Detection is enabled catch
286     -- any Application specific or other unexpected
287     -- exceptions.  Adding appropriate details to the
288     -- Multiple Message List.  Otherwise re-raise the
289     -- error.
290     --
291     rollback to update_document_swi;
292     if hr_multi_message.unexpected_error_add(l_proc) then
293        hr_utility.set_location(' Leaving:' || l_proc,40);
294        raise;
295     end if;
296     --
297     -- Reset IN OUT and set OUT parameters
298     --
299     p_return_status := hr_multi_message.get_return_status_disable;
300     hr_utility.set_location(' Leaving:' || l_proc,50);
301 end update_document;
302 end hr_adi_document_swi;