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