DBA Data[Home] [Help]

PACKAGE BODY: APPS.IRC_NOTES_API

Source


1 Package Body IRC_NOTES_API as
2 /* $Header: irinoapi.pkb 120.0 2005/09/27 09:08:47 sayyampe noship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := '  IRC_NOTES_API.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |--------------------------< <CREATE_NOTE> >--------------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure CREATE_NOTE
13    (p_validate                      in     boolean  default false
14   ,p_offer_status_history_id        in     number
15   ,p_note_text                      in     varchar2
16   ,p_note_id                          out nocopy   number
17   ,p_object_version_number            out nocopy   number
18   ) is
19   --
20   -- Declare cursors and local variables
21   --
22   l_note_id             number(15);
23   l_object_version_number number(9);
24   l_proc                varchar2(72) := g_package||'CREATE_NOTE';
25 begin
26   hr_utility.set_location('Entering:'|| l_proc, 10);
27   --
28   -- Issue a savepoint
29   --
30   savepoint CREATE_NOTE;
31   --
32   -- Truncate the time portion from all IN date parameters
33   --
34   --
35   -- Call Before Process User Hook
36   --
37   begin
38     IRC_NOTES_BK1.CREATE_NOTE_b
39       (p_offer_status_history_id       => p_offer_status_history_id
40       ,p_note_text                     => p_note_text
41       );
42   exception
43     when hr_api.cannot_find_prog_unit then
44       hr_api.cannot_find_prog_unit_error
45         (p_module_name => 'CREATE_NOTE'
46         ,p_hook_type   => 'BP'
47         );
48   end;
49   --
50   -- Process Logic
51   --
52   irc_ino_ins.ins
53     (
54      p_offer_status_history_id       => p_offer_status_history_id
55      ,p_note_text                     => p_note_text
56      ,p_note_id                       => l_note_id
57      ,p_object_version_number         => l_object_version_number
58     );
59   --
60   -- Call After Process User Hook
61   --
62   begin
63     IRC_NOTES_BK1.CREATE_NOTE_a
64       (p_note_id                       => l_note_id
65       ,p_offer_status_history_id       => p_offer_status_history_id
66       ,p_note_text                     => p_note_text
67       ,p_object_version_number         => l_object_version_number
68       );
69   exception
70     when hr_api.cannot_find_prog_unit then
71       hr_api.cannot_find_prog_unit_error
72         (p_module_name => 'CREATE_NOTE'
73         ,p_hook_type   => 'AP'
74         );
75   end;
76   --
77   -- When in validation only mode raise the Validate_Enabled exception
78   --
79   if p_validate then
80     raise hr_api.validate_enabled;
81   end if;
82   --
83   -- Set all IN OUT and OUT parameters with out values
84   --
85   p_note_id                := l_note_id;
86   p_object_version_number  := l_object_version_number;
87   --
88   hr_utility.set_location(' Leaving:'||l_proc, 70);
89 exception
90   when hr_api.validate_enabled then
91     --
92     -- As the Validate_Enabled exception has been raised
93     -- we must rollback to the savepoint
94     --
95     rollback to CREATE_NOTE;
96     --
97     -- Reset IN OUT parameters and set OUT parameters
98     -- (Any key or derived arguments must be set to null
99     -- when validation only mode is being used.)
100     --
101     p_note_id                := null;
102     p_object_version_number  := null;
103     hr_utility.set_location(' Leaving:'||l_proc, 80);
104   when others then
105     --
106     -- A validation or unexpected error has occured
107     --
108     rollback to CREATE_NOTE;
109     --
110     -- Reset IN OUT parameters and set all
111     -- OUT parameters, including warnings, to null
112     --
113     p_note_id                := null;
114     p_object_version_number  := null;
115     hr_utility.set_location(' Leaving:'||l_proc, 90);
116     raise;
117 end CREATE_NOTE;
118 --
119 --
120 -- ----------------------------------------------------------------------------
121 -- |----------------------------< <UPDATE_NOTE> >-----------------------------|
122 -- ----------------------------------------------------------------------------
123 --
124 procedure UPDATE_NOTE
125    (p_validate                      in     boolean  default false
126   ,p_note_id                        in     number
127   ,p_offer_status_history_id        in     number
128   ,p_note_text                      in     varchar2 default hr_api.g_varchar2
129   ,p_object_version_number          in  out nocopy   number
130   ) is
131   --
132   -- Declare cursors and local variables
133   --
134   l_object_version_number number(9);
135   l_proc                varchar2(72) := g_package||'UPDATE_NOTE';
136 begin
137   hr_utility.set_location('Entering:'|| l_proc, 10);
138   --
139   -- Issue a savepoint
140   --
141   savepoint UPDATE_NOTE;
142   --
143   -- Truncate the time portion from all IN date parameters
144   --
145   --
146   -- Call Before Process User Hook
147   --
148   begin
149     IRC_NOTES_BK2.UPDATE_NOTE_b
150       (p_note_id                       => p_note_id
151       ,p_offer_status_history_id       => p_offer_status_history_id
152       ,p_note_text                     => p_note_text
153       ,p_object_version_number         => p_object_version_number
154       );
155   exception
156     when hr_api.cannot_find_prog_unit then
157       hr_api.cannot_find_prog_unit_error
158         (p_module_name => 'UPDATE_NOTE'
159         ,p_hook_type   => 'BP'
160         );
161   end;
162   --
163   -- Process Logic
164   --
165   l_object_version_number := p_object_version_number;
166   --
167   irc_ino_upd.upd
168     (
169      p_note_id                       => p_note_id
170      ,p_offer_status_history_id       => p_offer_status_history_id
171      ,p_object_version_number         => l_object_version_number
172      ,p_note_text                     => p_note_text
173     );
174   --
175   -- Call After Process User Hook
176   --
177   begin
178     IRC_NOTES_BK2.UPDATE_NOTE_a
179       (p_note_id                       => p_note_id
180       ,p_offer_status_history_id       => p_offer_status_history_id
181       ,p_note_text                     => p_note_text
182       ,p_object_version_number         => l_object_version_number
183       );
184   exception
185     when hr_api.cannot_find_prog_unit then
186       hr_api.cannot_find_prog_unit_error
187         (p_module_name => 'UPDATE_NOTE'
188         ,p_hook_type   => 'AP'
189         );
190   end;
191   --
192   -- When in validation only mode raise the Validate_Enabled exception
193   --
194   if p_validate then
195     raise hr_api.validate_enabled;
196   end if;
197   --
198   -- Set all IN OUT and OUT parameters with out values
199   --
200   p_object_version_number  := l_object_version_number;
201   --
202   hr_utility.set_location(' Leaving:'||l_proc, 70);
203 exception
204   when hr_api.validate_enabled then
205     --
206     -- As the Validate_Enabled exception has been raised
207     -- we must rollback to the savepoint
208     --
209     rollback to UPDATE_NOTE;
210     --
211     -- Reset IN OUT parameters and set OUT parameters
212     -- (Any key or derived arguments must be set to null
213     -- when validation only mode is being used.)
214     --
215     p_object_version_number  := null;
216     hr_utility.set_location(' Leaving:'||l_proc, 80);
217   when others then
218     --
219     -- A validation or unexpected error has occured
220     --
221     rollback to UPDATE_NOTE;
222     --
223     -- Reset IN OUT parameters and set all
224     -- OUT parameters, including warnings, to null
225     --
226     p_object_version_number  := null;
227     hr_utility.set_location(' Leaving:'||l_proc, 90);
228     raise;
229 end UPDATE_NOTE;
230 --
231 --
232 -- ----------------------------------------------------------------------------
233 -- |---------------------------< <DELETE_NOTE> >------------------------------|
234 -- ----------------------------------------------------------------------------
235 --
236 procedure DELETE_NOTE
237    (p_validate                      in     boolean  default false
238   ,p_note_id                        in     number
239   ,p_object_version_number          in     number
240   ) is
241   --
242   -- Declare cursors and local variables
243   --
244   l_proc                varchar2(72) := g_package||'DELETE_NOTE';
245 begin
246   hr_utility.set_location('Entering:'|| l_proc, 10);
247   --
248   -- Issue a savepoint
249   --
250   savepoint DELETE_NOTE;
251   --
252   -- Truncate the time portion from all IN date parameters
253   --
254   -- Call Before Process User Hook
255   --
256   begin
257     IRC_NOTES_BK3.DELETE_NOTE_b
258       (p_note_id                       => p_note_id
259       ,p_object_version_number         => p_object_version_number
260       );
261   exception
262     when hr_api.cannot_find_prog_unit then
263       hr_api.cannot_find_prog_unit_error
264         (p_module_name => 'DELETE_NOTE'
265         ,p_hook_type   => 'BP'
266         );
267   end;
268   --
269   -- Process Logic
270   --
271   irc_ino_del.del
272     (
273      p_note_id                        => p_note_id
274      ,p_object_version_number         => p_object_version_number
275     );
276   --
277   -- Call After Process User Hook
278   --
279   begin
280     IRC_NOTES_BK3.DELETE_NOTE_a
281       (p_note_id                       => p_note_id
282       ,p_object_version_number         => p_object_version_number
283       );
284   exception
285     when hr_api.cannot_find_prog_unit then
286       hr_api.cannot_find_prog_unit_error
287         (p_module_name => 'DELETE_NOTE'
288         ,p_hook_type   => 'AP'
289         );
290   end;
291   --
292   -- When in validation only mode raise the Validate_Enabled exception
293   --
294   if p_validate then
295     raise hr_api.validate_enabled;
296   end if;
297   --
298   hr_utility.set_location(' Leaving:'||l_proc, 70);
299 exception
300   when hr_api.validate_enabled then
301     --
302     -- As the Validate_Enabled exception has been raised
303     -- we must rollback to the savepoint
304     --
305     rollback to DELETE_NOTE;
306     --
307     hr_utility.set_location(' Leaving:'||l_proc, 80);
308   when others then
309     --
310     -- A validation or unexpected error has occured
311     --
312     rollback to DELETE_NOTE;
313     --
314     hr_utility.set_location(' Leaving:'||l_proc, 90);
315     raise;
316 end DELETE_NOTE;
317 --
318 end IRC_NOTES_API;