[Home] [Help]
PACKAGE BODY: APPS.CAC_SYNC_CONTACT_MAPPINGS_PVT
Source
1 PACKAGE BODY CAC_SYNC_CONTACT_MAPPINGS_PVT AS
2 /* $Header: cacvscvb.pls 120.1 2005/07/02 02:20:59 appldev noship $ */
3
4 g_pkg_name CONSTANT VARCHAR2(30) := 'CAC_SYNC_CONTACT_MAPPINGS_PVT';
5
6 PROCEDURE CREATE_CONTACT_MAPPING
7 ( p_api_version IN NUMBER
8 , p_init_msg_list IN VARCHAR2
9 , p_commit IN VARCHAR2
10 , p_sync_contact_mapping_id IN NUMBER
11 , p_contact_party_id IN NUMBER
12 , p_org_party_id IN NUMBER
13 , p_person_party_id IN NUMBER
14 , p_party_site_id IN NUMBER
15 , p_work_contact_point_id IN NUMBER
16 , p_home_contact_point_id IN NUMBER
17 , p_fax_contact_point_id IN NUMBER
18 , p_cell_contact_point_id IN NUMBER
19 , p_pager_contact_point_id IN NUMBER
20 , p_email_contact_point_id IN NUMBER
21 , p_last_sync_date IN DATE
22 , x_sync_contact_mapping_id OUT NOCOPY NUMBER
23 , x_return_status OUT NOCOPY VARCHAR2
24 , x_msg_count OUT NOCOPY NUMBER
25 , x_msg_data OUT NOCOPY VARCHAR2
26 )
27 IS
28 l_rowid ROWID;
29 l_api_version CONSTANT NUMBER := 1.0;
30 l_api_name CONSTANT VARCHAR2(30) := 'CREATE_CONTACT_MAPPING';
31
32 CURSOR c_mapping IS
33 SELECT sync_contact_mapping_id
34 , org_party_id
35 , person_party_id
36 , party_site_id
37 , work_contact_point_id
38 , home_contact_point_id
39 , fax_contact_point_id
40 , cell_contact_point_id
41 , pager_contact_point_id
42 , email_contact_point_id
43 FROM cac_sync_contact_mappings
44 WHERE contact_party_id = p_contact_party_id;
45
46 rec_mapping c_mapping%ROWTYPE;
47 BEGIN
48 SAVEPOINT create_contact_mapping_sv;
49
50 x_return_status := fnd_api.g_ret_sts_success;
51
52 IF NOT fnd_api.compatible_api_call (l_api_version, p_api_version, l_api_name, g_pkg_name)
53 THEN
54 RAISE fnd_api.g_exc_unexpected_error;
55 END IF;
56
57 IF p_init_msg_list IS NULL OR
58 fnd_api.to_boolean (p_init_msg_list)
59 THEN
60 fnd_msg_pub.initialize;
61 END IF;
62
63 -- Check if the given contact_party_id exists
64 OPEN c_mapping;
65 FETCH c_mapping INTO rec_mapping;
66
67 IF c_mapping%FOUND THEN
68 CLOSE c_mapping;
69
70 UPDATE_CONTACT_MAPPING
71 ( p_api_version => p_api_version
72 , p_init_msg_list => p_init_msg_list
73 , p_commit => p_commit
74 , p_sync_contact_mapping_id => rec_mapping.sync_contact_mapping_id
75 , p_contact_party_id => p_contact_party_id
76 , p_org_party_id => p_org_party_id
77 , p_person_party_id => p_person_party_id
78 , p_party_site_id => p_party_site_id
79 , p_work_contact_point_id => p_work_contact_point_id
80 , p_home_contact_point_id => p_home_contact_point_id
81 , p_fax_contact_point_id => p_fax_contact_point_id
82 , p_cell_contact_point_id => p_cell_contact_point_id
83 , p_pager_contact_point_id => p_pager_contact_point_id
84 , p_email_contact_point_id => p_email_contact_point_id
85 , p_last_sync_date => p_last_sync_date
86 , x_return_status => x_return_status
87 , x_msg_count => x_msg_count
88 , x_msg_data => x_msg_data
89 );
90
91 IF fnd_api.to_boolean(p_commit)
92 THEN
93 COMMIT WORK;
94 END IF;
95
96 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
97
98 RETURN;
99 END IF;
100 CLOSE c_mapping;
101
102 IF p_sync_contact_mapping_id IS NULL
103 THEN
104 SELECT cac_sync_contact_mappings_s.nextval
105 INTO x_sync_contact_mapping_id
106 FROM DUAL;
107 ELSE
108 x_sync_contact_mapping_id := p_sync_contact_mapping_id;
109 END IF;
110
111 cac_sync_contact_mappings_pkg.insert_row
112 ( x_rowid => l_rowid
113 , x_sync_contact_mapping_id => p_sync_contact_mapping_id
114 , x_contact_party_id => p_contact_party_id
115 , x_org_party_id => p_org_party_id
116 , x_person_party_id => p_person_party_id
117 , x_party_site_id => p_party_site_id
118 , x_work_contact_point_id => p_work_contact_point_id
119 , x_home_contact_point_id => p_home_contact_point_id
120 , x_fax_contact_point_id => p_fax_contact_point_id
121 , x_cell_contact_point_id => p_cell_contact_point_id
122 , x_pager_contact_point_id => p_pager_contact_point_id
123 , x_email_contact_point_id => p_email_contact_point_id
124 , x_created_by => fnd_global.user_id
125 , x_creation_date => NVL(p_last_sync_date,SYSDATE)
126 , x_last_updated_by => fnd_global.user_id
127 , x_last_update_date => NVL(p_last_sync_date,SYSDATE)
128 , x_last_update_login => fnd_global.login_id
129 );
130
131 IF fnd_api.to_boolean(p_commit)
132 THEN
133 COMMIT WORK;
134 END IF;
135
136 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
137
138 EXCEPTION
139 WHEN fnd_api.g_exc_unexpected_error THEN
140 ROLLBACK TO create_contact_mapping_sv;
141 x_return_status := fnd_api.g_ret_sts_unexp_error;
142 fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
143 IF c_mapping%ISOPEN THEN
144 CLOSE c_mapping;
145 END IF;
146
147 WHEN OTHERS THEN
148 ROLLBACK TO create_contact_mapping_sv;
149 fnd_message.set_name ('JTF', 'JTF_TASK_UNKNOWN_ERROR');
150 fnd_message.set_token ('P_TEXT', SQLCODE || SQLERRM);
151 fnd_msg_pub.add;
152 x_return_status := fnd_api.g_ret_sts_unexp_error;
153 fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
154 IF c_mapping%ISOPEN THEN
155 CLOSE c_mapping;
156 END IF;
157 END CREATE_CONTACT_MAPPING;
158
159 PROCEDURE UPDATE_CONTACT_MAPPING
160 ( p_api_version IN NUMBER
161 , p_init_msg_list IN VARCHAR2
162 , p_commit IN VARCHAR2
163 , p_sync_contact_mapping_id IN NUMBER
164 , p_contact_party_id IN NUMBER
165 , p_org_party_id IN NUMBER
166 , p_person_party_id IN NUMBER
167 , p_party_site_id IN NUMBER
168 , p_work_contact_point_id IN NUMBER
169 , p_home_contact_point_id IN NUMBER
170 , p_fax_contact_point_id IN NUMBER
171 , p_cell_contact_point_id IN NUMBER
172 , p_pager_contact_point_id IN NUMBER
173 , p_email_contact_point_id IN NUMBER
174 , p_last_sync_date IN DATE
175 , x_return_status OUT NOCOPY VARCHAR2
176 , x_msg_count OUT NOCOPY NUMBER
177 , x_msg_data OUT NOCOPY VARCHAR2
178 )
179 IS
180 l_rowid ROWID;
181 l_api_version CONSTANT NUMBER := 1.0;
182 l_api_name CONSTANT VARCHAR2(30) := 'UDPATE_CONTACT_MAPPING';
183
184 CURSOR c_mapping IS
185 SELECT NULL
186 FROM cac_sync_contact_mappings
187 WHERE sync_contact_mapping_id = p_sync_contact_mapping_id;
188
189 rec_mapping c_mapping%ROWTYPE;
190 BEGIN
191 SAVEPOINT update_contact_mapping_sv;
192
193 x_return_status := fnd_api.g_ret_sts_success;
194
195 IF NOT fnd_api.compatible_api_call (l_api_version, p_api_version, l_api_name, g_pkg_name)
196 THEN
197 RAISE fnd_api.g_exc_unexpected_error;
198 END IF;
199
200 IF p_init_msg_list IS NULL OR
201 fnd_api.to_boolean (p_init_msg_list)
202 THEN
203 fnd_msg_pub.initialize;
204 END IF;
205
206 OPEN c_mapping;
207 FETCH c_mapping INTO rec_mapping;
208
209 IF c_mapping%NOTFOUND THEN
210 CLOSE c_mapping;
211
212 fnd_message.set_name ('JTF', 'CAC_SYNC_CONTACT_MAPPING_NF');
213 fnd_msg_pub.add;
214 RAISE fnd_api.g_exc_unexpected_error;
215 END IF;
216 CLOSE c_mapping;
217
218 cac_sync_contact_mappings_pkg.update_row
219 ( x_sync_contact_mapping_id => p_sync_contact_mapping_id
220 , x_contact_party_id => p_contact_party_id
221 , x_org_party_id => p_org_party_id
222 , x_person_party_id => p_person_party_id
223 , x_party_site_id => p_party_site_id
224 , x_work_contact_point_id => p_work_contact_point_id
225 , x_home_contact_point_id => p_home_contact_point_id
226 , x_fax_contact_point_id => p_fax_contact_point_id
227 , x_cell_contact_point_id => p_cell_contact_point_id
228 , x_pager_contact_point_id => p_pager_contact_point_id
229 , x_email_contact_point_id => p_email_contact_point_id
230 , x_last_updated_by => fnd_global.user_id
231 , x_last_update_date => NVL(p_last_sync_date,SYSDATE)
232 , x_last_update_login => fnd_global.login_id
233 );
234
235 IF fnd_api.to_boolean(p_commit)
236 THEN
237 COMMIT WORK;
238 END IF;
239
240 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
241
242 EXCEPTION
243 WHEN fnd_api.g_exc_unexpected_error THEN
244 ROLLBACK TO update_contact_mapping_sv;
245 x_return_status := fnd_api.g_ret_sts_unexp_error;
246 fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
247 IF c_mapping%ISOPEN THEN
248 CLOSE c_mapping;
249 END IF;
250
251 WHEN OTHERS THEN
252 ROLLBACK TO update_contact_mapping_sv;
253 fnd_message.set_name ('JTF', 'JTF_TASK_UNKNOWN_ERROR');
254 fnd_message.set_token ('P_TEXT', SQLCODE || SQLERRM);
255 fnd_msg_pub.add;
256 x_return_status := fnd_api.g_ret_sts_unexp_error;
257 fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
258 END UPDATE_CONTACT_MAPPING;
259
260
261 PROCEDURE DELETE_CONTACT_MAPPING
262 ( p_api_version IN NUMBER
263 , p_init_msg_list IN VARCHAR2
264 , p_commit IN VARCHAR2
265 , p_sync_contact_mapping_id IN NUMBER
266 , x_return_status OUT NOCOPY VARCHAR2
267 , x_msg_count OUT NOCOPY NUMBER
268 , x_msg_data OUT NOCOPY VARCHAR2
269 )
270 IS
271 l_rowid ROWID;
272 l_api_version CONSTANT NUMBER := 1.0;
273 l_api_name CONSTANT VARCHAR2(30) := 'DELETE_CONTACT_MAPPING';
274 BEGIN
275 SAVEPOINT delete_contact_mapping_sv;
276
277 x_return_status := fnd_api.g_ret_sts_success;
278
279 IF NOT fnd_api.compatible_api_call (l_api_version, p_api_version, l_api_name, g_pkg_name)
280 THEN
281 RAISE fnd_api.g_exc_unexpected_error;
282 END IF;
283
284 IF p_init_msg_list IS NULL OR
285 fnd_api.to_boolean (p_init_msg_list)
286 THEN
287 fnd_msg_pub.initialize;
288 END IF;
289
290 cac_sync_contact_mappings_pkg.delete_row
291 (x_sync_contact_mapping_id => p_sync_contact_mapping_id);
292
293 IF fnd_api.to_boolean(p_commit)
294 THEN
295 COMMIT WORK;
296 END IF;
297
298 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
299
300 EXCEPTION
301 WHEN fnd_api.g_exc_unexpected_error THEN
302 ROLLBACK TO delete_contact_mapping_sv;
303 x_return_status := fnd_api.g_ret_sts_unexp_error;
304 fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
305
306 WHEN OTHERS THEN
307 ROLLBACK TO delete_contact_mapping_sv;
308 fnd_message.set_name ('JTF', 'JTF_TASK_UNKNOWN_ERROR');
309 fnd_message.set_token ('P_TEXT', SQLCODE || SQLERRM);
310 fnd_msg_pub.add;
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 DELETE_CONTACT_MAPPING;
314
315
316 END CAC_SYNC_CONTACT_MAPPINGS_PVT;