DBA Data[Home] [Help]

PACKAGE BODY: APPS.JTF_EC_CONTACTS_PVT

Source


1 PACKAGE BODY jtf_ec_contacts_pvt AS
2 /* $Header: jtfeccob.pls 115.14 2003/02/04 11:55:08 siyappan ship $ */
3    PROCEDURE create_escalation_contacts (
4       p_api_version                 IN       NUMBER,
5       p_init_msg_list               IN       VARCHAR2 DEFAULT fnd_api.g_false,
6       p_commit                      IN       VARCHAR2 DEFAULT fnd_api.g_false,
7       p_escalation_id               IN       NUMBER DEFAULT NULL,
8       p_escalation_number           IN       VARCHAR2 DEFAULT NULL,
9       p_contact_id                  IN       NUMBER,
10       p_contact_type_code           IN       VARCHAR2 DEFAULT NULL,
11       p_escalation_notify_flag      IN       VARCHAR2 DEFAULT NULL,
12       p_escalation_requester_flag   IN       VARCHAR2 DEFAULT NULL,
13       x_escalation_contact_id       OUT NOCOPY     NUMBER,
14       x_return_status               OUT NOCOPY     VARCHAR2,
15       x_msg_data                    OUT NOCOPY     VARCHAR2,
16       x_msg_count                   OUT NOCOPY     NUMBER,
17       p_attribute1              	IN       VARCHAR2 DEFAULT jtf_task_utl.g_miss_char,
18       p_attribute2              	IN       VARCHAR2 DEFAULT jtf_task_utl.g_miss_char,
19       p_attribute3              	IN       VARCHAR2 DEFAULT jtf_task_utl.g_miss_char,
20       p_attribute4              	IN       VARCHAR2 DEFAULT jtf_task_utl.g_miss_char,
21       p_attribute5              	IN       VARCHAR2 DEFAULT jtf_task_utl.g_miss_char,
22       p_attribute6              	IN       VARCHAR2 DEFAULT jtf_task_utl.g_miss_char,
23       p_attribute7              	IN       VARCHAR2 DEFAULT jtf_task_utl.g_miss_char,
24       p_attribute8              	IN       VARCHAR2 DEFAULT jtf_task_utl.g_miss_char,
25       p_attribute9              	IN       VARCHAR2 DEFAULT jtf_task_utl.g_miss_char,
26       p_attribute10             	IN       VARCHAR2 DEFAULT jtf_task_utl.g_miss_char,
27       p_attribute11             	IN       VARCHAR2 DEFAULT jtf_task_utl.g_miss_char,
28       p_attribute12             	IN       VARCHAR2 DEFAULT jtf_task_utl.g_miss_char,
29       p_attribute13             	IN       VARCHAR2 DEFAULT jtf_task_utl.g_miss_char,
30       p_attribute14             	IN       VARCHAR2 DEFAULT jtf_task_utl.g_miss_char,
31       p_attribute15             	IN       VARCHAR2 DEFAULT jtf_task_utl.g_miss_char,
32       p_attribute_category      	IN       VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
33    )
34    IS
35       l_api_version   CONSTANT NUMBER                                 := 1.0;
36       l_api_name      CONSTANT VARCHAR2(30)
37                := 'CREATE_TASK_CONTACTS';
38       l_rowid                  ROWID;
39       l_task_id                jtf_tasks_b.task_id%TYPE;
40       l_task_contact_id        jtf_task_contacts.task_contact_id%TYPE;
41       x                        CHAR;
42    BEGIN
43       SAVEPOINT create_escalation_contacts_pub;
44       x_return_status := fnd_api.g_ret_sts_success;
45 
46       IF NOT fnd_api.compatible_api_call (
47                 l_api_version,
48                 p_api_version,
49                 l_api_name,
50                 g_pkg_name
51              )
52       THEN
53          RAISE fnd_api.g_exc_unexpected_error;
54       END IF;
55 
56       IF fnd_api.to_boolean (p_init_msg_list)
57       THEN
58          fnd_msg_pub.initialize;
59       END IF;
60 
61 --bug 2252635
62       if jtf_ec_util.Contact_Duplicated(p_contact_id,
63                                           p_contact_type_code,
64                                           p_escalation_id) = TRUE then
65 
66           fnd_message.set_name('JTF', 'JTF_API_ALL_DUPLICATE_VALUE');
67           fnd_message.set_token('API_NAME', l_api_name);
68           fnd_message.set_token('DUPLICATE_VAL_PARAM', 'Contact ID: ' || to_char(p_contact_id));
69           fnd_msg_pub.add;
70           RAISE fnd_api.g_exc_unexpected_error;
71       end if;
72 --end
73 
74       jtf_task_contacts_pub.create_task_contacts (
75          p_api_version => 1.0,
76          p_init_msg_list => fnd_api.g_false,
77          p_commit => fnd_api.g_false,
78          p_task_id => p_escalation_id,
79          p_task_number => p_escalation_number,
80          p_contact_id => p_contact_id,
81          p_contact_type_code => p_contact_type_code,
82          p_escalation_notify_flag => p_escalation_notify_flag,
83          p_escalation_requester_flag => p_escalation_requester_flag,
84          x_task_contact_id => x_escalation_contact_id,
85          x_return_status => x_return_status,
86          x_msg_data => x_msg_data,
87          x_msg_count => x_msg_count,
88 	 p_attribute1    =>     p_attribute1,
89 	 p_attribute2    =>     p_attribute2,
90 	 p_attribute3    =>     p_attribute3,
91 	 p_attribute4    =>     p_attribute4,
92 	 p_attribute5    =>     p_attribute5,
93 	 p_attribute6    =>     p_attribute6,
94 	 p_attribute7    =>     p_attribute7,
95 	 p_attribute8    =>     p_attribute8,
96 	 p_attribute9    =>     p_attribute9,
97 	 p_attribute10    =>    p_attribute10,
98 	 p_attribute11    =>    p_attribute11,
99 	 p_attribute12    =>    p_attribute12,
100 	 p_attribute13    =>    p_attribute13,
101 	 p_attribute14    =>     p_attribute14,
102 	 p_attribute15    =>     p_attribute15,
103          p_attribute_category  => p_attribute_category
104       );
105 
106       IF NOT (x_return_status = fnd_api.g_ret_sts_success)
107       THEN
108          x_return_status := fnd_api.g_ret_sts_unexp_error;
109          RAISE fnd_api.g_exc_unexpected_error;
110       END IF;
111 
112       IF fnd_api.to_boolean (p_commit)
113       THEN
114          COMMIT WORK;
115       END IF;
116 
120       WHEN fnd_api.g_exc_unexpected_error
117       fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
118 
119    EXCEPTION
121       THEN
122          ROLLBACK TO create_escalation_contacts_pub;
123          x_return_status := fnd_api.g_ret_sts_unexp_error;
124          fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
125       WHEN OTHERS
126       THEN
127          ROLLBACK TO create_escalation_contacts_pub;
128          fnd_message.set_name ('JTF', 'JTF_TASK_UNKNOWN_ERROR');
129          fnd_message.set_token ('P_TEXT', SQLCODE || SQLERRM);
130          x_return_status := fnd_api.g_ret_sts_unexp_error;
131          fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
132    END;
133 
134    PROCEDURE update_escalation_contacts (
135       p_api_version                 IN       NUMBER,
136       p_init_msg_list               IN       VARCHAR2 DEFAULT fnd_api.g_false,
137       p_commit                      IN       VARCHAR2 DEFAULT fnd_api.g_false,
138       p_object_version_number       IN OUT NOCOPY  VARCHAR2,
139       p_escalation_contact_id       IN       NUMBER DEFAULT NULL,
140       p_contact_id                  IN       NUMBER,
141       p_contact_type_code           IN       VARCHAR2 DEFAULT NULL,
142       p_escalation_notify_flag      IN       VARCHAR2 DEFAULT NULL,
143       p_escalation_requester_flag   IN       VARCHAR2 DEFAULT NULL,
144       x_return_status               OUT NOCOPY     VARCHAR2,
145       x_msg_data                    OUT NOCOPY     VARCHAR2,
146       x_msg_count                   OUT NOCOPY     NUMBER,
147       p_attribute1              	IN       VARCHAR2 DEFAULT jtf_task_utl.g_miss_char,
148       p_attribute2              	IN       VARCHAR2 DEFAULT jtf_task_utl.g_miss_char,
149       p_attribute3              	IN       VARCHAR2 DEFAULT jtf_task_utl.g_miss_char,
150       p_attribute4              	IN       VARCHAR2 DEFAULT jtf_task_utl.g_miss_char,
151       p_attribute5              	IN       VARCHAR2 DEFAULT jtf_task_utl.g_miss_char,
152       p_attribute6              	IN       VARCHAR2 DEFAULT jtf_task_utl.g_miss_char,
153       p_attribute7              	IN       VARCHAR2 DEFAULT jtf_task_utl.g_miss_char,
154       p_attribute8              	IN       VARCHAR2 DEFAULT jtf_task_utl.g_miss_char,
155       p_attribute9              	IN       VARCHAR2 DEFAULT jtf_task_utl.g_miss_char,
156       p_attribute10             	IN       VARCHAR2 DEFAULT jtf_task_utl.g_miss_char,
157       p_attribute11             	IN       VARCHAR2 DEFAULT jtf_task_utl.g_miss_char,
158       p_attribute12             	IN       VARCHAR2 DEFAULT jtf_task_utl.g_miss_char,
159       p_attribute13             	IN       VARCHAR2 DEFAULT jtf_task_utl.g_miss_char,
160       p_attribute14             	IN       VARCHAR2 DEFAULT jtf_task_utl.g_miss_char,
161       p_attribute15             	IN       VARCHAR2 DEFAULT jtf_task_utl.g_miss_char,
162       p_attribute_category      	IN       VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
163    )
164    IS
165       l_api_version    CONSTANT NUMBER       := 1.0;
166       l_api_name       CONSTANT VARCHAR2(30) := 'UPDATE_TASK_CONTACTS';
167       l_object_version_number   NUMBER;
168    BEGIN
169       SAVEPOINT update_escalation_contacts_pub;
170       x_return_status := fnd_api.g_ret_sts_success;
171 
172       IF NOT fnd_api.compatible_api_call (
173                 l_api_version,
174                 p_api_version,
175                 l_api_name,
176                 g_pkg_name
177              )
178       THEN
179          RAISE fnd_api.g_exc_unexpected_error;
180       END IF;
181 
182       IF fnd_api.to_boolean (p_init_msg_list)
183       THEN
184          fnd_msg_pub.initialize;
185       END IF;
186 
187       x_return_status := fnd_api.g_ret_sts_success;
188       l_object_version_number := p_object_version_number;
189       jtf_task_contacts_pub.update_task_contacts (
190          p_api_version => p_api_version,
191          p_init_msg_list => p_init_msg_list,
192          p_commit => p_commit,
193          p_task_contact_id => p_escalation_contact_id,
194          p_object_version_number => l_object_version_number,
195          p_contact_id => p_contact_id,
196          p_contact_type_code => p_contact_type_code,
197          p_escalation_notify_flag => p_escalation_notify_flag,
198          p_escalation_requester_flag => p_escalation_requester_flag,
199          x_return_status => x_return_status,
200          x_msg_data => x_msg_data,
201          x_msg_count => x_msg_count,
202 	 p_attribute1    =>     p_attribute1,
203 	 p_attribute2    =>     p_attribute2,
204 	 p_attribute3    =>     p_attribute3,
205 	 p_attribute4    =>     p_attribute4,
206 	 p_attribute5    =>     p_attribute5,
207 	 p_attribute6    =>     p_attribute6,
208 	 p_attribute7    =>     p_attribute7,
209 	 p_attribute8    =>     p_attribute8,
210 	 p_attribute9    =>     p_attribute9,
211 	 p_attribute10    =>    p_attribute10,
212 	 p_attribute11    =>    p_attribute11,
213 	 p_attribute12    =>    p_attribute12,
214 	 p_attribute13    =>    p_attribute13,
215 	 p_attribute14    =>     p_attribute14,
216 	 p_attribute15    =>     p_attribute15,
217          p_attribute_category  => p_attribute_category
218       );
219 
220      p_object_version_number := l_object_version_number;
221 
222       IF fnd_api.to_boolean (p_commit)
223       THEN
224          COMMIT WORK;
225       END IF;
226 
227       fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
228    EXCEPTION
229       WHEN fnd_api.g_exc_unexpected_error
230       THEN
231          ROLLBACK TO update_escalation_contacts_pub;
232          x_return_status := fnd_api.g_ret_sts_unexp_error;
233          fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
234       WHEN OTHERS
235       THEN
236          ROLLBACK TO update_escalation_contacts_pub;
237          fnd_message.set_name ('JTF', 'JTF_TASK_UNKNOWN_ERROR');
238          fnd_message.set_token ('P_TEXT', SQLCODE || SQLERRM);
239          x_return_status := fnd_api.g_ret_sts_unexp_error;
240          fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
241    END;
242 
243    PROCEDURE delete_escalation_contacts (
244       p_api_version             IN       NUMBER,
245       p_init_msg_list           IN       VARCHAR2 DEFAULT fnd_api.g_false,
246       p_commit                  IN       VARCHAR2 DEFAULT fnd_api.g_false,
247       p_object_version_number   IN       NUMBER,
248       p_escalation_contact_id   IN       NUMBER,
249       x_return_status           OUT NOCOPY     VARCHAR2,
250       x_msg_data                OUT NOCOPY     VARCHAR2,
251       x_msg_count               OUT NOCOPY     NUMBER
252    )
253    IS
254       l_api_version   CONSTANT NUMBER       := 1.0;
255       l_api_name      CONSTANT VARCHAR2(30) := 'DELETE_TASK_CONTACTS';
256    BEGIN
257       SAVEPOINT delete_escalation_contacts_pub;
258       x_return_status := fnd_api.g_ret_sts_success;
259       x_return_status := fnd_api.g_ret_sts_success;
260 
261       IF NOT fnd_api.compatible_api_call (
262                 l_api_version,
263                 p_api_version,
264                 l_api_name,
265                 g_pkg_name
266              )
267       THEN
268          RAISE fnd_api.g_exc_unexpected_error;
269       END IF;
270 
271       IF fnd_api.to_boolean (p_init_msg_list)
272       THEN
273          fnd_msg_pub.initialize;
274       END IF;
275 
276       x_return_status := fnd_api.g_ret_sts_success;
277       jtf_task_contacts_pub.delete_task_contacts (
278          p_api_version => p_api_version,
279          p_init_msg_list => p_init_msg_list,
280          p_commit => p_commit,
281          p_object_version_number => p_object_version_number,
282          p_task_contact_id => p_escalation_contact_id,
283          x_return_status => x_return_status,
284          x_msg_data => x_msg_data,
285          x_msg_count => x_msg_count
286       );
287 
288       IF NOT (x_return_status = fnd_api.g_ret_sts_success)
289       THEN
290          x_return_status := fnd_api.g_ret_sts_unexp_error;
291          RAISE fnd_api.g_exc_unexpected_error;
292       END IF;
293 
294       IF fnd_api.to_boolean (p_commit)
295       THEN
296          COMMIT WORK;
297       END IF;
298 
299       fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
300    EXCEPTION
301       WHEN fnd_api.g_exc_unexpected_error
302       THEN
303          ROLLBACK TO delete_task_contacts_pvt;
304          x_return_status := fnd_api.g_ret_sts_unexp_error;
305          fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
306       WHEN OTHERS
307       THEN
308          ROLLBACK TO delete_task_contacts_pvt;
309          fnd_message.set_name ('JTF', 'JTF_TASK_UNKNOWN_ERROR');
310          fnd_message.set_token ('P_TEXT', SQLCODE || SQLERRM);
311          x_return_status := fnd_api.g_ret_sts_unexp_error;
312          fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
313    END;
314 END;