DBA Data[Home] [Help]

PACKAGE BODY: APPS.OTA_CHAT_USER_API

Source


1 PACKAGE BODY ota_chat_user_api as
2 /*$Header: otcusapi.pkb 120.1 2005/08/03 16:30 asud noship $*/
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := '  OTA_CHAT_USER_API.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |-------------------------< CREATE_CHAT_USER >--------------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure create_chat_user (
13    p_validate                     in  boolean          default false
14   ,p_effective_date               in  date
15   ,p_chat_id                      in  number
16   ,p_person_id                    in  number
17   ,p_contact_id                   in  number
18   ,p_login_date                     in  date
19   ,p_business_group_id            in  number
20   ,p_object_version_number        out nocopy number) is
21   --
22   -- Declare cursors and local variables
23   --
24   l_proc                    varchar2(72) := g_package||' create_chat_user';
25   l_object_version_number   number;
26   l_effective_date          date;
27   l_end_date date;
28 begin
29   hr_utility.set_location('Entering:'|| l_proc, 10);
30   --
31   -- Issue a savepoint
32   --
33   savepoint CREATE_CHAT_USER;
34   --
35   -- Truncate the time portion from all IN date parameters
36   --
37   l_effective_date := trunc(p_effective_date);
38   --
39   -- Call Before Process User Hook
40   --
41     begin
42   ota_chat_user_bk1.create_chat_user_b
43   ( p_chat_id                   => p_chat_id
44   ,p_person_id                 => p_person_id
45   ,p_contact_id                => p_contact_id
46   ,p_effective_date            => p_effective_date
47   ,p_business_group_id         => p_business_group_id
48   ,p_login_date                  => p_login_date
49   ,p_object_version_number     => p_object_version_number
50     );
51   exception
52     when hr_api.cannot_find_prog_unit then
53       hr_api.cannot_find_prog_unit_error
54         (p_module_name => 'CREATE_CHAT_USER'
55         ,p_hook_type   => 'BP'
56         );
57   end;
58 
59   --
60 
61   -- Validation in addition to Row Handlers
62   --
63   --
64   -- Process Logic
65   --
66 
67   ota_cus_ins.ins
68   (
69    p_chat_id                   => p_chat_id
70   ,p_person_id                 => p_person_id
71   ,p_contact_id                => p_contact_id
72   ,p_effective_date            => p_effective_date
73   ,p_business_group_id         => p_business_group_id
74   ,p_login_date                  => p_login_date
75   ,p_object_version_number     => p_object_version_number
76   );
77 
78   --
79   -- Call After Process User Hook
80     begin
81   ota_chat_user_bk1.create_chat_user_a
82   ( p_chat_id                   => p_chat_id
83   ,p_person_id                 => p_person_id
84   ,p_contact_id                => p_contact_id
85   ,p_effective_date            => p_effective_date
86   ,p_business_group_id         => p_business_group_id
87   ,p_login_date                  => p_login_date
88   ,p_object_version_number     => p_object_version_number
89     );
90   exception
91     when hr_api.cannot_find_prog_unit then
92       hr_api.cannot_find_prog_unit_error
93         (p_module_name => 'CREATE_CHAT_USER'
94         ,p_hook_type   => 'AP'
95         );
96   end;
97 
98 
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_object_version_number   := l_object_version_number;
109 
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_CHAT_USER;
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_object_version_number   := null;
125     hr_utility.set_location(' Leaving:'||l_proc, 80);
126   when others then
127     --
128     -- A validation or unexpected error has occured
129     --
130     rollback to CREATE_CHAT_USER;
131     p_object_version_number   := null;
132     hr_utility.set_location(' Leaving:'||l_proc, 90);
133     raise;
134 end create_chat_user;
135 
136 --
137 --
138 -- ----------------------------------------------------------------------------
139 -- |-------------------------< UPDATE_CHAT_USER >--------------------------|
140 -- ----------------------------------------------------------------------------
141 --
142 procedure update_chat_user (
143    p_validate                     in  boolean          default false
144   ,p_effective_date               in  date
145   ,p_chat_id                      in  number
146   ,p_person_id                    in  number           default hr_api.g_number
147   ,p_contact_id                   in  number           default hr_api.g_number
148   ,p_login_date                   in  date
149   ,p_business_group_id            in  number
150   ,p_object_version_number        in out nocopy number) is
151   --
152   -- Declare cursors and local variables
153   --
154   l_proc                    varchar2(72) := g_package||' update_chat_user';
155   l_object_version_number   number := p_object_version_number;
156   l_effective_date          date := trunc(p_effective_date);
157   l_end_date date;
158 begin
159   hr_utility.set_location('Entering:'|| l_proc, 10);
160   --
161   -- Issue a savepoint
162   --
163   savepoint UPDATE_CHAT_USER;
164   --
165   -- Call Before Process User Hook
166   --
167     begin
168   ota_chat_user_bk2.update_chat_user_b
169   ( p_chat_id                  => p_chat_id
170   ,p_person_id                 => p_person_id
171   ,p_contact_id                => p_contact_id
172   ,p_effective_date            => p_effective_date
173   ,p_business_group_id         => p_business_group_id
174   ,p_login_date                => p_login_date
175   ,p_object_version_number     => l_object_version_number
176     );
177   exception
178     when hr_api.cannot_find_prog_unit then
179       hr_api.cannot_find_prog_unit_error
180         (p_module_name => 'UPDATE_CHAT_USER'
181         ,p_hook_type   => 'BP'
182         );
183   end;
184 
185   --
186 
187   -- Validation in addition to Row Handlers
188   --
189   --
190   -- Process Logic
191   --
192 
193   ota_cus_upd.upd
194   (
195    p_chat_id                   => p_chat_id
196   ,p_person_id                 => p_person_id
197   ,p_contact_id                => p_contact_id
198   ,p_effective_date            => l_effective_date
199   ,p_business_group_id         => p_business_group_id
200   ,p_login_date                => p_login_date
201   ,p_object_version_number     => l_object_version_number
202   );
203 
204   --
205   -- Call After Process User Hook
206     begin
207   ota_chat_user_bk2.update_chat_user_a
208   ( p_chat_id                  => p_chat_id
209   ,p_person_id                 => p_person_id
210   ,p_contact_id                => p_contact_id
211   ,p_effective_date            => l_effective_date
212   ,p_business_group_id         => p_business_group_id
213   ,p_login_date                => p_login_date
214   ,p_object_version_number     => l_object_version_number
215     );
216   exception
217     when hr_api.cannot_find_prog_unit then
218       hr_api.cannot_find_prog_unit_error
219         (p_module_name => 'UPDATE_CHAT_USER'
220         ,p_hook_type   => 'AP'
221         );
222   end;
223 
224 
225   --
226   -- When in validation only mode raise the Validate_Enabled exception
227   --
228   if p_validate then
229     raise hr_api.validate_enabled;
230   end if;
231   --
232 
233   hr_utility.set_location(' Leaving:'||l_proc, 70);
234 exception
235   when hr_api.validate_enabled then
236     --
237     -- As the Validate_Enabled exception has been raised
238     -- we must rollback to the savepoint
239     --
240     rollback to UPDATE_CHAT_USER;
241     --
242     -- Only set output warning arguments
243     -- (Any key or derived arguments must be set to null
244     -- when validation only mode is being used.)
245     --
246     p_object_version_number   := l_object_version_number;
247     hr_utility.set_location(' Leaving:'||l_proc, 80);
248   when others then
249     --
250     -- A validation or unexpected error has occured
251     --
252     rollback to UPDATE_CHAT_USER;
253     p_object_version_number   := l_object_version_number;
254     hr_utility.set_location(' Leaving:'||l_proc, 90);
255     raise;
256 end update_chat_user;
257 
258 -- ----------------------------------------------------------------------------
259 -- |-------------------------< DELETE_CHAT_USER >--------------------------|
260 -- ----------------------------------------------------------------------------
261 --
262 procedure delete_chat_user
263   (p_validate                      in     boolean  default false
264   ,p_chat_id                      in     number
265   ,p_person_id                    in  number
266   ,p_contact_id                   in  number
267   ,p_object_version_number         in     number
268   ) is
269   --
270   -- Declare cursors and local variables
271   --
272   l_proc                    varchar2(72) := g_package||' Delete_chat';
273   l_object_version_id       number;
274   --
275   --
276 begin
277   hr_utility.set_location('Entering:'|| l_proc, 10);
278   --
279   -- Issue a savepoint
280   --
281   savepoint DELETE_CHAT_USER;
282   --
283   -- Truncate the time portion from all IN date parameters
284   --
285   --
286 
287   -- Call Before Process User Hook
288   begin
289   ota_chat_user_bk3.delete_chat_user_b
290   (p_chat_id        => p_chat_id
291   ,p_person_id      => p_person_id
292   ,p_contact_id     => p_contact_id
293   ,p_object_version_number   => p_object_version_number
294     );
295   exception
296     when hr_api.cannot_find_prog_unit then
297       hr_api.cannot_find_prog_unit_error
298         (p_module_name => 'DELETE_CHAT_USER'
299         ,p_hook_type   => 'BP'
300         );
301   end;
302 
303   --
304   -- Validation in addition to Row Handlers
305   --
306   --
307   -- Process Logic
308   --
309   ota_cus_del.del
310   (p_chat_id        => p_chat_id
311   ,p_person_id      => p_person_id
312   ,p_contact_id     => p_contact_id
313   ,p_object_version_number   => p_object_version_number
314   );
315 
316 
317   --
318   -- Call After Process User Hook
319   begin
320   ota_chat_user_bk3.delete_chat_user_a
321   (p_chat_id        => p_chat_id
322   ,p_person_id      => p_person_id
323   ,p_contact_id     => p_contact_id
324   ,p_object_version_number   => p_object_version_number
325     );
326   exception
327     when hr_api.cannot_find_prog_unit then
328       hr_api.cannot_find_prog_unit_error
329         (p_module_name => 'DELETE_CHAT_USER'
330         ,p_hook_type   => 'AP'
331         );
332   end;
333   --
334   -- When in validation only mode raise the Validate_Enabled exception
335   --
336   if p_validate then
337     raise hr_api.validate_enabled;
338   end if;
339   --
340   -- Set all output arguments
341   --
342   --
343   hr_utility.set_location(' Leaving:'||l_proc, 170);
344 exception
345   when hr_api.validate_enabled then
346     --
347     -- As the Validate_Enabled exception has been raised
348     -- we must rollback to the savepoint
349     --
350     rollback to DELETE_CHAT_USER;
351     --
352     -- Only set output warning arguments
353     -- (Any key or derived arguments must be set to null
354     -- when validation only mode is being used.)
355     --
356     hr_utility.set_location(' Leaving:'||l_proc, 180);
357   when others then
358     --
359     -- A validation or unexpected error has occured
360     --
361     rollback to DELETE_CHAT_USER;
362     hr_utility.set_location(' Leaving:'||l_proc, 190);
363     raise;
364 end delete_chat_user;
365 --
366 end ota_chat_user_api;