1 PACKAGE BODY IGS_SC_DATA_SEC_APIS_PKG AS
2 /* $Header: IGSSC02B.pls 120.12 2006/04/19 02:13:02 gmaheswa ship $ */
3
4 /******************************************************************
5
6 Copyright (c) 2002 Oracle Corporation, Redwood Shores, CA, USA
7 All rights reserved.
8
9 Created By : Don Shellito
10
11 Date Created By : April 8, 2003
12
13 Purpose : This package is to be used for the processing and
14 gathering of the security process for Oracle
15 Student System.
16
17 remarks : None
18
19 Change History
20
21 Who When What
22 -----------------------------------------------------------
23 Don Shellito 08-Apr-2003 New Package created.
24 Uma Maheswari 24-Aug-2004 Bug 3828353 : Modified enable_upgrade_mode to unlock all grants for object_group_id = -1;
25 Uma Maheswari 13-Apr-2004 Bug 4068422 : Modified c_obj cursor to select objeect_id based on obj_name instead of datbase_object_name.
26 As obj_name and data_base_object_name will be same in security module, this change is done for using the index on the table.
27 mmkumar 28-Jun-2005 Bug 4431768 : Added a paqrameter for overwrite
28 Inside Update_Grant_Cond, removed code for cursor c_get_grant_cond.
29 prbhardw 18-Jul-2005 Inside Update_Grant_Cond, modified code to update condition number
30 mmkumar 21-JUL-2005 Closed the cursors whereever appropriate
31 gmaheswa 26-Jul-2005 Fnd Logging
32 pkpatel 10-Mar-2006 Bug 5081932 (Used wf_local_synch instead of private API wf_directory)
33 gmaheswa 19-Apr-2006 Bug: 4587521: Modified Modify_Policy to add long_predicate parameter to add_policy. this parameter allows max predicate where clause lenght to 32K
34 ******************************************************************/
35
36 -- -----------------------------------------------------------------
37 -- Define the global variables to be used in this package.
38 -- -----------------------------------------------------------------
39 g_pkg_name CONSTANT VARCHAR2(30) := 'IGS_SC_DATA_SEC_APIS_PKG';
40 g_upgrade_mode VARCHAR2(1) := 'N';
41
42 l_prog_label CONSTANT VARCHAR2(500) :='igs.plsql.igs_sc_data_sec_apis_pkg';
43 l_label VARCHAR2(4000);
44 l_debug_str VARCHAR2(32000);
45
46 -- -----------------------------------------------------------------
47 -- Define other procedures that are to be used internally here.
48 -- -----------------------------------------------------------------
49 CURSOR c_table_name (v_object_id NUMBER) IS
50 SELECT database_object_name
51 FROM fnd_objects
52 WHERE object_id = v_object_id;
53
54
55
56 PROCEDURE Get_Valid_Grant_Vals (p_grant_select_flag IN VARCHAR2,
57 p_grant_insert_flag IN VARCHAR2,
58 p_grant_delete_flag IN VARCHAR2,
59 p_grant_update_flag IN VARCHAR2,
60 x_grant_select_flag OUT NOCOPY VARCHAR2,
61 x_grant_insert_flag OUT NOCOPY VARCHAR2,
62 x_grant_delete_flag OUT NOCOPY VARCHAR2,
63 x_grant_update_flag OUT NOCOPY VARCHAR2
64 );
65
66 FUNCTION Validate_Function_ID (p_function_id IN NUMBER) RETURN NUMBER;
67
68 FUNCTION Validate_Obj_Grp_ID (p_group_id IN NUMBER) RETURN NUMBER;
69
70 FUNCTION Validate_User_Grp_ID (p_user_group_id IN NUMBER) RETURN NUMBER;
71
72 FUNCTION Validate_Grant_ID (p_grant_id IN NUMBER) RETURN NUMBER;
73
74 FUNCTION Validate_Obj_Attr_ID (p_obj_attr_id IN NUMBER) RETURN NUMBER;
75
76 FUNCTION Validate_User_Attr_ID (p_user_attr_id IN NUMBER) RETURN NUMBER;
77
78 FUNCTION Validate_Object_ID (p_object_id IN NUMBER) RETURN NUMBER;
79
80 FUNCTION Validate_Static_Type (p_static_type IN VARCHAR2) RETURN VARCHAR2;
81
82 FUNCTION Validate_Obj_Attr_Type (p_obj_att_type IN VARCHAR2) RETURN VARCHAR2;
83
84 FUNCTION Validate_User_Attr_Type (p_usr_att_type IN VARCHAR2) RETURN VARCHAR2;
85
86 FUNCTION check_attrib_text (
87 p_table_name VARCHAR2,
88 p_select_text VARCHAR2,
89 p_obj_attrib_type VARCHAR2 )
90
91 RETURN BOOLEAN IS
92 BEGIN
93
94 RETURN IGS_SC_GRANTS_PVT.check_attrib_text ( p_table_name , p_select_text , p_obj_attrib_type );
95
96 END check_attrib_text;
97
98
99
100 PROCEDURE modify_policy (
101 p_database_object_name IN VARCHAR2,
102 p_action VARCHAR2 DEFAULT 'CREATE' );
103
104 /******************************************************************
105 Created By : Don Shellito
106 Date Created By : April 23, 2003
107 Purpose : This procedure is designed for the handling of
108 data insertion into the igs_sc_grants table.
109 Validation is performed on the function_id,
110 user_group_id, and obj_group_id that these IDs
111 are currently in the IGS Security structure.
112 Remarks :
113
114 Change History
115 Who When What
116 ------------------------------------------------------------------------
117 Don Shellito April 23, 2003 New Procedure Created.
118
119 ******************************************************************/
120 PROCEDURE Insert_Grant (p_api_version IN NUMBER,
121 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
122 p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE,
123 p_grant_id IN OUT NOCOPY igs_sc_grants.grant_id%TYPE,
124 p_function_id IN igs_sc_grants.function_id%TYPE,
125 p_user_group_id IN igs_sc_grants.user_group_id%TYPE,
126 p_obj_group_id IN igs_sc_grants.obj_group_id%TYPE,
127 p_grant_name IN igs_sc_grants.grant_name%TYPE,
128 p_grant_text IN igs_sc_grants.grant_text%TYPE,
129 p_grant_select_flag IN igs_sc_grants.grant_select_flag%TYPE DEFAULT 'N',
130 p_grant_insert_flag IN igs_sc_grants.grant_insert_flag%TYPE DEFAULT 'N',
131 p_grant_update_flag IN igs_sc_grants.grant_update_flag%TYPE DEFAULT 'N',
132 p_grant_delete_flag IN igs_sc_grants.grant_delete_flag%TYPE DEFAULT 'N',
133 x_return_status OUT NOCOPY VARCHAR2,
134 x_return_message OUT NOCOPY VARCHAR2
135 )
136 IS
137
138 -- -----------------------------------------------------------------
139 -- Define local variables to be used.
140 -- -----------------------------------------------------------------
141 l_api_name CONSTANT VARCHAR2(30) := 'Insert_Grant';
142 l_api_version CONSTANT NUMBER := 1.0;
143 l_return_message VARCHAR2(2000);
144 l_message_count NUMBER(15);
145 l_return_status VARCHAR2(30);
146 l_grant_select_flag igs_sc_grants.grant_select_flag%TYPE;
147 l_grant_delete_flag igs_sc_grants.grant_delete_flag%TYPE;
148 l_grant_update_flag igs_sc_grants.grant_update_flag%TYPE;
149 l_grant_insert_flag igs_sc_grants.grant_insert_flag%TYPE;
150 l_locked_flag igs_sc_grants.locked_flag%TYPE := 'N';
151 l_function_id igs_sc_obj_functns.function_id%TYPE;
152 l_obj_group_id igs_sc_objects.object_id%TYPE;
153 l_user_group_id wf_local_roles.orig_system_id%TYPE;
154
155 BEGIN
156 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
157 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Insert_Grant';
158 l_debug_str := 'Grant ID: '||p_grant_id||','||'Role ID: '||','||p_user_group_id||','||' Object Group ID: '||p_obj_group_id
159 ||','||' Grant Name: '||p_grant_name||','||' Grant Text: '||p_grant_text||','||'Select Flag: '||p_grant_select_flag
160 ||','||' Insert Flag: '||p_grant_insert_flag||','||' Update Flag: '||p_grant_update_flag||','||' Delete Flag: '||p_grant_delete_flag;
161 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
162 END IF;
163
164 SAVEPOINT Insert_Grant_SP;
165
166 -- -----------------------------------------------------------------
167 -- Check for the Compatible API call
168 -- -----------------------------------------------------------------
169 IF NOT FND_API.COMPATIBLE_API_CALL (l_api_version,
170 p_api_version,
171 l_api_name,
172 g_pkg_name) THEN
173 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
174 END IF;
175
176 -- -----------------------------------------------------------------
177 -- If the calling program has passed the parameter for initializing
178 -- the message list
179 -- -----------------------------------------------------------------
180 IF FND_API.TO_BOOLEAN (p_init_msg_list) THEN
181 FND_MSG_PUB.INITIALIZE;
182 END IF;
183
184 -- -----------------------------------------------------------------
185 -- Set the return status to success
186 -- -----------------------------------------------------------------
187 x_return_status := FND_API.G_RET_STS_SUCCESS;
188
189 -- -----------------------------------------------------------------
190 -- Ensure that the grant name is not null.
191 -- -----------------------------------------------------------------
192 IF (p_grant_name IS NULL) THEN
193 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_NO_GRANT_NAME');
194 FND_MSG_PUB.Add;
195 RAISE FND_API.G_EXC_ERROR;
196 END IF;
197
198 -- -----------------------------------------------------------------
199 -- Ensure that the grant values are correct.
200 -- -----------------------------------------------------------------
201 Get_Valid_Grant_Vals (p_grant_select_flag => p_grant_select_flag,
202 p_grant_insert_flag => p_grant_insert_flag,
203 p_grant_delete_flag => p_grant_delete_flag,
204 p_grant_update_flag => p_grant_update_flag,
205 x_grant_select_flag => l_grant_select_flag,
206 x_grant_insert_flag => l_grant_insert_flag,
207 x_grant_delete_flag => l_grant_delete_flag,
208 x_grant_update_flag => l_grant_update_flag);
209
210 -- -----------------------------------------------------------------
211 -- Ensure that if there is a function ID provided that it is valid
212 -- -----------------------------------------------------------------
213 IF (p_function_id IS NOT NULL) THEN
214 l_function_id := Validate_Function_ID (p_function_id => p_function_id);
215 IF (l_function_id <= 0) THEN
216 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_INV_FUNC_FOR_GRNT');
217 FND_MESSAGE.SET_TOKEN('GRANT_NAME', p_grant_name);
218 RAISE FND_API.G_EXC_ERROR;
219 END IF;
220 END IF;
221
222 -- -----------------------------------------------------------------
223 -- Validate object group id provided
224 -- -----------------------------------------------------------------
225 l_obj_group_id := Validate_Obj_Grp_ID (p_group_id => p_obj_group_id);
226
227 IF (l_obj_group_id <= 0) THEN
228 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_INV_OBJ_GROUP');
229 FND_MSG_PUB.Add;
230 RAISE FND_API.G_EXC_ERROR;
231 END IF;
232
233 -- -----------------------------------------------------------------
234 -- Validate User Group ID provided.
235 -- -----------------------------------------------------------------
236 l_user_group_id := Validate_User_Grp_ID (p_user_group_id => p_user_group_id);
237
238 IF (l_user_group_id <= 0) THEN
239 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_INV_USER_GROUP');
240 FND_MSG_PUB.Add;
241 RAISE FND_API.G_EXC_ERROR;
242 END IF;
243
244 -- -----------------------------------------------------------------
245 -- Insert the values requested into the Grants table.
246 -- -----------------------------------------------------------------
247 INSERT
248 INTO igs_sc_grants
249 (grant_id,
250 function_id,
251 user_group_id,
252 obj_group_id,
253 grant_name,
254 grant_text,
255 grant_select_flag,
256 grant_insert_flag,
257 grant_update_flag,
258 grant_delete_flag,
259 locked_flag,
260 creation_date,
261 created_by,
262 last_updated_by,
263 last_update_date,
264 last_update_login
265 )
266 VALUES (NVL(p_grant_id,igs_sc_grants_s.nextval),
267 l_function_id,
268 l_user_group_id,
269 l_obj_group_id,
270 p_grant_name,
271 p_grant_text,
272 p_grant_select_flag,
273 l_grant_insert_flag,
274 l_grant_update_flag,
275 l_grant_delete_flag,
276 l_locked_flag,
277 SYSDATE,
278 NVL(FND_GLOBAL.user_id,-1),
279 NVL(FND_GLOBAL.user_id,-1),
280 SYSDATE,
281 NVL(FND_GLOBAL.login_id, -1)
282 )
283 RETURNING grant_id INTO p_grant_id;
284
285 -- -----------------------------------------------------------------
286 -- Commit the transaction if requested to via parameter value.
287 -- -----------------------------------------------------------------
288 IF (FND_API.to_Boolean(p_commit)) THEN
289 COMMIT;
290 END IF;
291
292 -- -----------------------------------------------------------------
293 -- Exception Block definition
294 -- -----------------------------------------------------------------
295 EXCEPTION
296 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
297 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
298 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
299 p_count => l_message_count,
300 p_data => x_return_message);
301 ROLLBACK TO Insert_Grant_SP;
302 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
303 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Insert_Grant.Ex_UN';
304 l_debug_str := 'Unhandled Exception: Grant ID: '||p_grant_id||','||' Grant Name: '||p_grant_name||','||'Error Message: '||x_return_message;
305 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
306 END IF;
307
308 WHEN FND_API.G_EXC_ERROR THEN
309 x_return_status := FND_API.G_RET_STS_ERROR;
310
311 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
312 p_count => l_message_count,
313 p_data => x_return_message);
314 ROLLBACK TO Insert_Grant_SP;
315 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
316 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Insert_Grant.Ex_error';
317 l_debug_str := 'Handled Exception: Grant ID: '||p_grant_id||','||' Grant Name: '||p_grant_name||','||'Error Message: '||x_return_message;
318 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
319 END IF;
320
321 WHEN OTHERS THEN
322 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
323 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
324 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
325 END IF;
326 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
327 p_count => l_message_count,
328 p_data => x_return_message);
329 ROLLBACK TO Insert_Grant_SP;
330
331 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
332 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Insert_Grant.Ex_others';
333 l_debug_str := 'Other Exception: Grant ID: '||p_grant_id||','||' Grant Name: '||p_grant_name||','||'Error Message: '||x_return_message;
334 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
335 END IF;
336
337 IF g_upgrade_mode = 'Y' THEN
338 RAISE;
339 END IF;
340
341 END Insert_Grant;
342
343
344 /******************************************************************
345 Created By : Don Shellito
346 Date Created By : April 23, 2003
347 Purpose : The purpose of this procedure is for the
348 handling on inserting data into igs_sc_grant_conds
349 table. There is validation on the grant_id,
350 obj_attrib_id, and user_attrib_id values received
351 to ensure that these records have been inserted
352 into the OSS security data model.
353 Remarks :
354
355 Change History
356 Who When What
357 ------------------------------------------------------------------------
358 Don Shellito April 23, 2003 New Procedure Created.
359
360 ******************************************************************/
361 PROCEDURE Insert_Grant_Cond (p_api_version IN NUMBER,
362 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
363 p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE,
364 p_grant_id IN igs_sc_grant_conds.grant_id%TYPE,
365 p_obj_attrib_id IN igs_sc_grant_conds.obj_attrib_id%TYPE,
366 p_user_attrib_id IN igs_sc_grant_conds.user_attrib_id%TYPE,
367 p_condition IN igs_sc_grant_conds.condition%TYPE,
368 p_text_value IN igs_sc_grant_conds.text_value%TYPE,
369 p_grant_cond_num IN igs_sc_grant_conds.grant_cond_num%TYPE,
370 x_return_status OUT NOCOPY VARCHAR2,
371 x_return_message OUT NOCOPY VARCHAR2
372 )
373 IS
374
375 -- -----------------------------------------------------------------
376 -- Define local variables to be used.
377 -- -----------------------------------------------------------------
378 l_api_name CONSTANT VARCHAR2(30) := 'Insert_Grant_Cond';
379 l_api_version CONSTANT NUMBER := 1.0;
380 l_return_message VARCHAR2(2000);
381 l_message_count NUMBER(15);
382 l_return_status VARCHAR2(30);
383 l_user_attr_id igs_sc_usr_attribs.user_attrib_id%TYPE := p_user_attrib_id;
384 l_obj_attr_id igs_sc_obj_attribs.obj_attrib_id%TYPE := p_obj_attrib_id;
385 l_grant_id igs_sc_grants.grant_id%TYPE := p_grant_id;
386
387 BEGIN
388 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
389 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Insert_Grant_Cond';
390 l_debug_str := 'Grant ID: '||p_grant_id||','||' Object Attribute ID: '||p_obj_attrib_id||','||'User Attribute ID: '||p_user_attrib_id
391 ||','||'Condition: '||p_condition||','||' Text Value: '||p_text_value||','||'Grant Cond Number: '||p_grant_cond_num;
392 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
393 END IF;
394
395 SAVEPOINT Insert_Grant_Cond_SP;
396
397 -- -----------------------------------------------------------------
398 -- Check for the Compatible API call
399 -- -----------------------------------------------------------------
400 IF NOT FND_API.COMPATIBLE_API_CALL (l_api_version,
401 p_api_version,
402 l_api_name,
403 g_pkg_name) THEN
404 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
405 END IF;
406
407 -- -----------------------------------------------------------------
408 -- If the calling program has passed the parameter for initializing
409 -- the message list
410 -- -----------------------------------------------------------------
411 IF FND_API.TO_BOOLEAN (p_init_msg_list) THEN
412 FND_MSG_PUB.INITIALIZE;
413 END IF;
414
415 -- -----------------------------------------------------------------
416 -- Set the return status to success
417 -- -----------------------------------------------------------------
418 x_return_status := FND_API.G_RET_STS_SUCCESS;
419
420 -- -----------------------------------------------------------------
421 -- Validate that the grant exists.
422 -- -----------------------------------------------------------------
423 l_grant_id := Validate_Grant_ID (p_grant_id => p_grant_id);
424 IF (l_grant_id <= 0) THEN
425 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_INV_GRANT');
426 FND_MSG_PUB.Add;
427 RAISE FND_API.G_EXC_ERROR;
428 END IF;
429
430 -- -----------------------------------------------------------------
431 -- Validate that the object attribute ID exists.
432 -- -----------------------------------------------------------------
433 IF (p_obj_attrib_id IS NOT NULL) THEN
434 l_obj_attr_id := Validate_Obj_Attr_ID (p_obj_attr_id => p_obj_attrib_id);
435 IF (l_obj_attr_id <= 0) THEN
436 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_INV_OBJ_ATTR');
437 FND_MSG_PUB.Add;
438 RAISE FND_API.G_EXC_ERROR;
439 END IF;
440 END IF;
441
442 -- -----------------------------------------------------------------
443 -- Validate that the user attribute ID exists.
444 -- -----------------------------------------------------------------
445 IF (p_user_attrib_id IS NOT NULL) THEN
446 l_user_attr_id := Validate_User_Attr_ID (p_user_attr_id => p_user_attrib_id);
447 IF (l_user_attr_id <= 0) THEN
448 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_INV_USR_ATTR');
449 FND_MSG_PUB.Add;
450 RAISE FND_API.G_EXC_ERROR;
451 END IF;
452 END IF;
453
454 -- -----------------------------------------------------------------
455 -- Check to make sure that the Grant Condition Number given is legal
456 -- -----------------------------------------------------------------
457 IF (p_grant_cond_num <= 0) THEN
458 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_INV_COND_NUM');
459 FND_MSG_PUB.Add;
460 RAISE FND_API.G_EXC_ERROR;
461 END IF;
462
463 -- -----------------------------------------------------------------
464 -- Insert the values requested into the Grant Conditions table.
465 -- -----------------------------------------------------------------
466 INSERT
467 INTO igs_sc_grant_conds
468 (grant_id,
469 grant_cond_num,
470 obj_attrib_id,
471 user_attrib_id,
472 condition,
473 text_value,
474 creation_date,
475 created_by,
476 last_updated_by,
477 last_update_date,
478 last_update_login
479 )
480 VALUES (l_grant_id,
481 p_grant_cond_num,
482 l_obj_attr_id,
483 l_user_attr_id,
484 p_condition,
485 p_text_value,
486 SYSDATE,
487 NVL(FND_GLOBAL.user_id,-1),
488 NVL(FND_GLOBAL.user_id,-1),
489 SYSDATE,
490 NVL(FND_GLOBAL.login_id, -1)
491 );
492
493 -- -----------------------------------------------------------------
494 -- Commit the transaction if requested to via parameter value.
495 -- -----------------------------------------------------------------
496 IF (FND_API.to_Boolean(p_commit)) THEN
497 COMMIT;
498 END IF;
499
500 -- -----------------------------------------------------------------
501 -- Exception Block definition
502 -- -----------------------------------------------------------------
503 EXCEPTION
504 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
505 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
506 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
507 p_count => l_message_count,
508 p_data => x_return_message);
509 ROLLBACK TO Insert_Grant_Cond_SP;
510
511 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
512 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Insert_Grant_Cond.Ex_error';
513 l_debug_str := 'Unhandled Exception: Grant ID: '||p_grant_id||','||' Condtion Number: '||p_grant_cond_num||','||'Error Message: '||x_return_message;
514 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
515 END IF;
516
517 WHEN FND_API.G_EXC_ERROR THEN
518 x_return_status := FND_API.G_RET_STS_ERROR;
519
520 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
521 p_count => l_message_count,
522 p_data => x_return_message);
523 ROLLBACK TO Insert_Grant_Cond_SP;
524
525 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
526 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Insert_Grant_Cond.Ex_un';
527 l_debug_str := 'Handled Exception: Grant ID: '||p_grant_id||','||' Condtion Number: '||p_grant_cond_num||','||'Error Message: '||x_return_message;
528 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
529 END IF;
530
531 WHEN OTHERS THEN
532 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
533 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
534 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
535 END IF;
536 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
537 p_count => l_message_count,
538 p_data => x_return_message);
539 ROLLBACK TO Insert_Grant_Cond_SP;
540
541 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
542 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Insert_Grant_Cond.Ex_others';
543 l_debug_str := 'Other Exception: Grant ID: '||p_grant_id||','||' Condtion Number: '||p_grant_cond_num||','||'Error Message: '||x_return_message;
544 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
545 END IF;
546
547 IF g_upgrade_mode = 'Y' THEN
548 RAISE;
549 END IF;
550
551 END Insert_Grant_Cond;
552
553
554 /******************************************************************
555 Created By : Don Shellito
556 Date Created By : April 23, 2003
557 Purpose : This procedure is designed for the handling
558 of the data insertion into igs_sc_obj_groups
559 table. There is validation to ensure that
560 the group_name is not null and that the value
561 for the default_policy_type is either 'G'- Global
562 or 'R' - Restricted.
563 Remarks :
564
565 Change History
566 Who When What
567 ------------------------------------------------------------------------
568 Don Shellito April 23, 2003 New Procedure Created.
569
570 ******************************************************************/
571 PROCEDURE Insert_Object_Group (p_api_version IN NUMBER,
572 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
573 p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE,
574 p_obj_group_id IN OUT NOCOPY igs_sc_obj_groups.obj_group_id%TYPE,
575 p_obj_group_name IN igs_sc_obj_groups.obj_group_name%TYPE ,
576 p_default_policy_type IN igs_sc_obj_groups.default_policy_type%TYPE,
577 x_return_status OUT NOCOPY VARCHAR2,
578 x_return_message OUT NOCOPY VARCHAR2
579 ) IS
580
581 -- -----------------------------------------------------------------
582 -- Define local variables to be used.
583 -- -----------------------------------------------------------------
584 l_api_name CONSTANT VARCHAR2(30) := 'Insert_Object_Group';
585 l_api_version CONSTANT NUMBER := 1.0;
586 l_return_message VARCHAR2(2000);
587 l_message_count NUMBER(15);
588 l_return_status VARCHAR2(30);
589 l_default_policy_type igs_sc_obj_groups.default_policy_type%TYPE;
590
591 BEGIN
592
593 SAVEPOINT Insert_Object_Group_SP;
594
595 -- -----------------------------------------------------------------
596 -- Check for the Compatible API call
597 -- -----------------------------------------------------------------
598 IF NOT FND_API.COMPATIBLE_API_CALL (l_api_version,
599 p_api_version,
600 l_api_name,
601 g_pkg_name) THEN
602 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
603 END IF;
604
605 -- -----------------------------------------------------------------
606 -- If the calling program has passed the parameter for initializing
607 -- the message list
608 -- -----------------------------------------------------------------
609 IF FND_API.TO_BOOLEAN (p_init_msg_list) THEN
610 FND_MSG_PUB.INITIALIZE;
611 END IF;
612
613 -- -----------------------------------------------------------------
614 -- Set the return status to success
615 -- -----------------------------------------------------------------
616 x_return_status := FND_API.G_RET_STS_SUCCESS;
617
618 -- -----------------------------------------------------------------
619 -- Check if admin mode is enabled
620 -- -----------------------------------------------------------------
621 IF IGS_SC_GRANTS_PVT.admin_mode <> 'Y' AND g_upgrade_mode <> 'Y' THEN
622
623 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_ADMIN_MODE_OFF');
624 FND_MSG_PUB.Add;
625 RAISE FND_API.G_EXC_ERROR;
626
627 END IF;
628
629 -- -----------------------------------------------------------------
630 -- Ensure that the object group name is NOT NULL
631 -- -----------------------------------------------------------------
632 IF (p_obj_group_name IS NULL) THEN
633 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_NULL_OBJ_GRP_NAME');
634 FND_MSG_PUB.Add;
635 RAISE FND_API.G_EXC_ERROR;
636 END IF;
637
638 -- -----------------------------------------------------------------
639 -- Ensure that the default policy has correct value of Y or N
640 -- -----------------------------------------------------------------
641 IF (p_default_policy_type IN ('G', 'R')) THEN
642 l_default_policy_type := p_default_policy_type;
643 ELSE
644 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_INV_DEF_POLICY_TYPE');
645 FND_MESSAGE.SET_TOKEN('DEFAULT_POLICY', p_default_policy_type);
646 FND_MSG_PUB.Add;
647 RAISE FND_API.G_EXC_ERROR;
648 END IF;
649
650 -- -----------------------------------------------------------------
651 -- Insert the values requested into the Grants table.
652 -- -----------------------------------------------------------------
653 INSERT
654 INTO igs_sc_obj_groups
655 (obj_group_id,
656 obj_group_name,
657 default_policy_type,
658 creation_date,
659 created_by,
660 last_updated_by,
661 last_update_date,
662 last_update_login
663 )
664 VALUES (NVL(p_obj_group_id,igs_sc_obj_groups_s.nextval),
665 p_obj_group_name,
666 l_default_policy_type,
667 SYSDATE,
668 NVL(FND_GLOBAL.user_id,-1),
669 NVL(FND_GLOBAL.user_id,-1),
670 SYSDATE,
671 NVL(FND_GLOBAL.login_id, -1)
672 )
673 RETURNING obj_group_id INTO p_obj_group_id;
674
675 -- -----------------------------------------------------------------
676 -- Commit the transaction if requested to via parameter value.
677 -- -----------------------------------------------------------------
678 IF (FND_API.to_Boolean(p_commit)) THEN
679 COMMIT;
680 END IF;
681
682 -- -----------------------------------------------------------------
683 -- Exception Block definition
684 -- -----------------------------------------------------------------
685 EXCEPTION
686 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
687 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
688 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
689 p_count => l_message_count,
690 p_data => x_return_message);
691 ROLLBACK TO Insert_Object_Group_SP;
692
693 WHEN FND_API.G_EXC_ERROR THEN
694 x_return_status := FND_API.G_RET_STS_ERROR;
695
696 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
697 p_count => l_message_count,
698 p_data => x_return_message);
699 ROLLBACK TO Insert_Object_Group_SP;
700
701 WHEN OTHERS THEN
702 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
703 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
704 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
705 END IF;
706 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
707 p_count => l_message_count,
708 p_data => x_return_message);
709 ROLLBACK TO Insert_Object_Group_SP;
710 IF g_upgrade_mode = 'Y' THEN
711 RAISE;
712 END IF;
713
714 END Insert_Object_Group;
715
716
717 /******************************************************************
718 Created By : Don Shellito
719 Date Created By : April 23, 2003
720 Purpose : The purpose of this procedure is for the handling
721 on insertion of data into igs_sc_obj_attribs table.
722 There is validation performed on the obj_group_id
723 and obj_attrib_id provided to ensure that the
724 records are present in the OSS data structure.
725 Remarks :
726
727 Change History
728 Who When What
729 ------------------------------------------------------------------------
730 Don Shellito April 23, 2003 New Procedure Created.
731
732 ******************************************************************/
733 PROCEDURE Insert_Object_Attr (p_api_version IN NUMBER,
734 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
735 p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE,
736 p_obj_attrib_id IN OUT NOCOPY igs_sc_obj_attribs.obj_attrib_id%TYPE,
737 p_obj_group_id IN igs_sc_obj_attribs.obj_group_id%TYPE,
738 p_obj_attrib_name IN igs_sc_obj_attribs.obj_attrib_name%TYPE,
739 p_active_flag IN VARCHAR2 DEFAULT 'Y',
740 x_return_status OUT NOCOPY VARCHAR2,
741 x_return_message OUT NOCOPY VARCHAR2
742 ) IS
743
744 -- -----------------------------------------------------------------
745 -- Define local variables to be used.
746 -- -----------------------------------------------------------------
747 l_api_name CONSTANT VARCHAR2(30) := 'Insert_Object_Attr';
748 l_api_version CONSTANT NUMBER := 1.0;
749 l_return_message VARCHAR2(2000);
750 l_message_count NUMBER(15);
751 l_return_status VARCHAR2(30);
752 l_obj_group_id igs_sc_obj_groups.obj_group_id%TYPE;
753
754 BEGIN
755
756 SAVEPOINT Insert_Object_Attr_SP;
757
758 -- -----------------------------------------------------------------
759 -- Check for the Compatible API call
760 -- -----------------------------------------------------------------
761 IF NOT FND_API.COMPATIBLE_API_CALL (l_api_version,
762 p_api_version,
763 l_api_name,
764 g_pkg_name) THEN
765 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
766 END IF;
767
768 -- -----------------------------------------------------------------
769 -- If the calling program has passed the parameter for initializing
770 -- the message list
771 -- -----------------------------------------------------------------
772 IF FND_API.TO_BOOLEAN (p_init_msg_list) THEN
773 FND_MSG_PUB.INITIALIZE;
774 END IF;
775
776 -- -----------------------------------------------------------------
777 -- Set the return status to success
778 -- -----------------------------------------------------------------
779 x_return_status := FND_API.G_RET_STS_SUCCESS;
780
781 -- -----------------------------------------------------------------
782 -- Check if admin mode is enabled
783 -- -----------------------------------------------------------------
784 IF IGS_SC_GRANTS_PVT.admin_mode <> 'Y' AND g_upgrade_mode <> 'Y' THEN
785
786 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_ADMIN_MODE_OFF');
787 FND_MSG_PUB.Add;
788 RAISE FND_API.G_EXC_ERROR;
789
790 END IF;
791
792 -- -----------------------------------------------------------------
793 -- Validate the object group ID is present.
794 -- -----------------------------------------------------------------
795 l_obj_group_id := Validate_Obj_Grp_ID (p_group_id => p_obj_group_id);
796
797 IF (l_obj_group_id <= 0) THEN
798 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_INV_OBJ_GROUP');
799 FND_MSG_PUB.Add;
800 RAISE FND_API.G_EXC_ERROR;
801 END IF;
802
803 -- -----------------------------------------------------------------
804 -- Ensure that the object attribute name is valid
805 -- -----------------------------------------------------------------
806 IF (p_obj_attrib_name IS NULL) THEN
807 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_INV_OBJ_ATTR_NAME');
808 FND_MSG_PUB.Add;
809 RAISE FND_API.G_EXC_ERROR;
810 END IF;
811
812 -- -----------------------------------------------------------------
813 -- Insert the values requested into the Grants table.
814 -- -----------------------------------------------------------------
815 INSERT
816 INTO igs_sc_obj_attribs
817 (obj_group_id,
818 obj_attrib_id,
819 obj_attrib_name,
820 creation_date,
821 created_by,
822 last_updated_by,
823 last_update_date,
824 last_update_login,
825 active_flag
826 )
827 VALUES (l_obj_group_id,
828 NVL(p_obj_attrib_id,igs_sc_obj_attribs_s.nextval),
829 p_obj_attrib_name,
830 SYSDATE,
831 NVL(FND_GLOBAL.user_id,-1),
832 NVL(FND_GLOBAL.user_id,-1),
833 SYSDATE,
834 NVL(FND_GLOBAL.login_id, -1),
835 p_active_flag
836 )
837 RETURNING obj_attrib_id INTO p_obj_attrib_id;
838
839 -- -----------------------------------------------------------------
840 -- Commit the transaction if requested to via parameter value.
841 -- -----------------------------------------------------------------
842 IF (FND_API.to_Boolean(p_commit)) THEN
843 COMMIT;
844 END IF;
845
846 -- -----------------------------------------------------------------
847 -- Exception Block definition
848 -- -----------------------------------------------------------------
849 EXCEPTION
850 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
851 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
852 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
853 p_count => l_message_count,
854 p_data => x_return_message);
855 ROLLBACK TO Insert_Object_Attr_SP;
856
857 WHEN FND_API.G_EXC_ERROR THEN
858 x_return_status := FND_API.G_RET_STS_ERROR;
859
860 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
861 p_count => l_message_count,
862 p_data => x_return_message);
863 ROLLBACK TO Insert_Object_Attr_SP;
864
865 WHEN OTHERS THEN
866 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
867 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
868 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
869 END IF;
870 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
871 p_count => l_message_count,
872 p_data => x_return_message);
873 ROLLBACK TO Insert_Object_Attr_SP;
874
875 IF g_upgrade_mode = 'Y' THEN
876 RAISE;
877 END IF;
878
879 END Insert_Object_Attr;
880
881
882 /******************************************************************
883 Created By : Don Shellito
884 Date Created By : April 23, 2003
885 Purpose : The purpose of this procedure is for the handling
886 of data insertion into the igs_sc_obj_att_mths
887 table. There is validation performed on the
888 object_id, obj_attrib_id, obj_attrib_type, and
889 static_type to ensure that the values given are
890 in the OSS data model or have valid values expected
891 for the types.
892 Remarks :
893
894 Change History
895 Who When What
896 ------------------------------------------------------------------------
897 Don Shellito April 23, 2003 New Procedure Created.
898
899 ******************************************************************/
900 PROCEDURE Insert_Object_Attr_Method (p_api_version IN NUMBER,
901 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
902 p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE,
903 p_object_id IN igs_sc_obj_att_mths.object_id%TYPE,
904 p_obj_attrib_id IN igs_sc_obj_att_mths.obj_attrib_id%TYPE,
905 p_obj_attrib_type IN igs_sc_obj_att_mths.obj_attrib_type%TYPE,
906 p_static_type IN igs_sc_obj_att_mths.static_type%TYPE,
907 p_select_text IN igs_sc_obj_att_mths.select_text%TYPE,
908 p_null_allow_flag IN VARCHAR2 DEFAULT 'N',
909 p_call_from_lct IN VARCHAR2 DEFAULT 'N',
910 x_return_status OUT NOCOPY VARCHAR2,
911 x_return_message OUT NOCOPY VARCHAR2
912 ) IS
913
914 -- -----------------------------------------------------------------
915 -- Define local variables to be used.
916 -- -----------------------------------------------------------------
917 l_api_name CONSTANT VARCHAR2(30) := 'Insert_Object_Attr_Method';
918 l_api_version CONSTANT NUMBER := 1.0;
919 l_return_message VARCHAR2(2000);
920 l_message_count NUMBER(15);
921 l_return_status VARCHAR2(30);
922 l_object_id igs_sc_obj_att_mths.object_id%TYPE;
923 l_obj_attrib_id igs_sc_obj_att_mths.obj_attrib_id%TYPE;
924 l_obj_attrib_type igs_sc_obj_att_mths.obj_attrib_type%TYPE;
925 l_static_type igs_sc_obj_att_mths.static_type%TYPE;
926 l_object_name fnd_objects.database_object_name%TYPE;
927
928 BEGIN
929
930 SAVEPOINT Insert_Object_Attr_Method_SP;
931
932 -- -----------------------------------------------------------------
933 -- Check for the Compatible API call
934 -- -----------------------------------------------------------------
935 IF NOT FND_API.COMPATIBLE_API_CALL (l_api_version,
936 p_api_version,
937 l_api_name,
938 g_pkg_name) THEN
939 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
940 END IF;
941
942 -- -----------------------------------------------------------------
943 -- If the calling program has passed the parameter for initializing
944 -- the message list
945 -- -----------------------------------------------------------------
946 IF FND_API.TO_BOOLEAN (p_init_msg_list) THEN
947 FND_MSG_PUB.INITIALIZE;
948 END IF;
949
950 -- -----------------------------------------------------------------
951 -- Set the return status to success
952 -- -----------------------------------------------------------------
953 x_return_status := FND_API.G_RET_STS_SUCCESS;
954
955 -- -----------------------------------------------------------------
956 -- Check if admin mode is enabled
957 -- -----------------------------------------------------------------
958 IF IGS_SC_GRANTS_PVT.admin_mode <> 'Y' AND g_upgrade_mode <> 'Y' THEN
959
960 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_ADMIN_MODE_OFF');
961 FND_MSG_PUB.Add;
962 RAISE FND_API.G_EXC_ERROR;
963
964 END IF;
965
966 -- -----------------------------------------------------------------
967 -- Validate the object ID is present.
968 -- -----------------------------------------------------------------
969 l_object_id := Validate_Object_ID (p_object_id => p_object_id);
970
971 IF (l_object_id <= 0) THEN
972 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_INV_OBJECT');
973 FND_MSG_PUB.Add;
974 RAISE FND_API.G_EXC_ERROR;
975 END IF;
976
977 -- -----------------------------------------------------------------
978 -- Validate that the object attribute ID exists.
979 -- -----------------------------------------------------------------
980
981 l_obj_attrib_id := Validate_Obj_Attr_ID (p_obj_attr_id => p_obj_attrib_id);
982
983 IF (l_obj_attrib_id <= 0) THEN
984 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_INV_OBJ_ATTR');
985 FND_MSG_PUB.Add;
986 RAISE FND_API.G_EXC_ERROR;
987 END IF;
988
989 -- -----------------------------------------------------------------
990 -- Validate the information that is to be updated.
991 -- -----------------------------------------------------------------
992
993 l_obj_attrib_type := Validate_Obj_Attr_type (p_obj_att_type => p_obj_attrib_type);
994
995 IF (l_obj_attrib_type IS NULL) THEN
996 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_INV_OBJ_ATTR_TYPE');
997 FND_MSG_PUB.Add;
998 RAISE FND_API.G_EXC_ERROR;
999 END IF;
1000
1001 l_static_type := Validate_Static_Type (p_static_type => p_static_type);
1002
1003 IF (l_static_type IS NULL) THEN
1004 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_INV_STATIC_TYPE');
1005 FND_MSG_PUB.Add;
1006 RAISE FND_API.G_EXC_ERROR;
1007 END IF;
1008
1009 IF P_CALL_FROM_LCT <> 'Y' THEN
1010 OPEN c_table_name(p_object_id);
1011 FETCH c_table_name INTO l_object_name;
1012 CLOSE c_table_name;
1013 IF NOT check_attrib_text ( l_object_name, p_select_text,l_obj_attrib_type) THEN
1014 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_GRNT_TXT_ERR');
1015 FND_MESSAGE.SET_TOKEN('OBJ_NAME',l_object_name);
1016 FND_MESSAGE.SET_TOKEN('GRNT_TEXT', p_select_text);
1017 FND_MSG_PUB.Add;
1018 RAISE FND_API.G_EXC_ERROR;
1019
1020 END IF;
1021 END IF;
1022
1023 -- -----------------------------------------------------------------
1024 -- Insert the values requested into the Grants table.
1025 -- -----------------------------------------------------------------
1026 INSERT
1027 INTO igs_sc_obj_att_mths
1028 (object_id,
1029 obj_attrib_id,
1030 obj_attrib_type,
1031 static_type,
1032 select_text,
1033 creation_date,
1034 created_by,
1035 last_updated_by,
1036 last_update_date,
1037 last_update_login,
1038 null_allow_flag
1039 )
1040 VALUES (l_object_id,
1041 l_obj_attrib_id,
1042 l_obj_attrib_type,
1043 l_static_type,
1044 p_select_text,
1045 SYSDATE,
1046 NVL(FND_GLOBAL.user_id,-1),
1047 NVL(FND_GLOBAL.user_id,-1),
1048 SYSDATE,
1049 NVL(FND_GLOBAL.login_id, -1),
1050 p_null_allow_flag
1051 );
1052 -- -----------------------------------------------------------------
1053 -- Commit the transaction if requested to via parameter value.
1054 -- -----------------------------------------------------------------
1055 IF (FND_API.to_Boolean(p_commit)) THEN
1056 COMMIT;
1057 END IF;
1058
1059 -- -----------------------------------------------------------------
1060 -- Exception Block definition
1061 -- -----------------------------------------------------------------
1062 EXCEPTION
1063 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1064 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1065 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
1066 p_count => l_message_count,
1067 p_data => x_return_message);
1068 ROLLBACK TO Insert_Object_Attr_Method_SP;
1069
1070 WHEN FND_API.G_EXC_ERROR THEN
1071 x_return_status := FND_API.G_RET_STS_ERROR;
1072
1073 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
1074 p_count => l_message_count,
1075 p_data => x_return_message);
1076 ROLLBACK TO Insert_Object_Attr_Method_SP;
1077
1078 WHEN OTHERS THEN
1079 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1080 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
1081 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
1082 END IF;
1083 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
1084 p_count => l_message_count,
1085 p_data => x_return_message);
1086 ROLLBACK TO Insert_Object_Attr_Method_SP;
1087
1088 IF g_upgrade_mode = 'Y' THEN
1089 RAISE;
1090 END IF;
1091
1092 END Insert_Object_Attr_Method;
1093
1094
1095 /******************************************************************
1096 Created By : Don Shellito
1097 Date Created By : April 23, 2003
1098 Purpose : The purpose of this procedure is for the
1099 handling of the inserting of data into the
1100 table igs_sc_obj_functns. There is validation
1101 performed on the obj_group_id to ensure that
1102 the value given is present in the OSS data
1103 model.
1104 Remarks :
1105
1106 Change History
1107 Who When What
1108 ------------------------------------------------------------------------
1109 Don Shellito April 23, 2003 New Procedure Created.
1110
1111 ******************************************************************/
1112 PROCEDURE Insert_Object_Func (p_api_version IN NUMBER,
1113 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
1114 p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE,
1115 p_function_id IN OUT NOCOPY igs_sc_obj_functns.function_id%TYPE,
1116 p_obj_group_id IN igs_sc_obj_functns.obj_group_id%TYPE,
1117 p_function_name IN igs_sc_obj_functns.function_name%TYPE,
1118 x_return_status OUT NOCOPY VARCHAR2,
1119 x_return_message OUT NOCOPY VARCHAR2
1120 ) IS
1121
1122 -- -----------------------------------------------------------------
1123 -- Define local variables to be used.
1124 -- -----------------------------------------------------------------
1125 l_api_name CONSTANT VARCHAR2(30) := 'Insert_Object_Func';
1126 l_api_version CONSTANT NUMBER := 1.0;
1127 l_return_message VARCHAR2(2000);
1128 l_message_count NUMBER(15);
1129 l_return_status VARCHAR2(30);
1130 l_obj_group_id igs_sc_obj_functns.obj_group_id%TYPE;
1131
1132 BEGIN
1133
1134 SAVEPOINT Insert_Object_Func_SP;
1135
1136 -- -----------------------------------------------------------------
1137 -- Check for the Compatible API call
1138 -- -----------------------------------------------------------------
1139 IF NOT FND_API.COMPATIBLE_API_CALL (l_api_version,
1140 p_api_version,
1141 l_api_name,
1142 g_pkg_name) THEN
1143 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1144 END IF;
1145
1146 -- -----------------------------------------------------------------
1147 -- If the calling program has passed the parameter for initializing
1148 -- the message list
1149 -- -----------------------------------------------------------------
1150 IF FND_API.TO_BOOLEAN (p_init_msg_list) THEN
1151 FND_MSG_PUB.INITIALIZE;
1152 END IF;
1153
1154 -- -----------------------------------------------------------------
1155 -- Set the return status to success
1156 -- -----------------------------------------------------------------
1157 x_return_status := FND_API.G_RET_STS_SUCCESS;
1158
1159 -- -----------------------------------------------------------------
1160 -- Check if admin mode is enabled
1161 -- -----------------------------------------------------------------
1162 IF IGS_SC_GRANTS_PVT.admin_mode <> 'Y' AND g_upgrade_mode <> 'Y' THEN
1163
1164 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_ADMIN_MODE_OFF');
1165 FND_MSG_PUB.Add;
1166 RAISE FND_API.G_EXC_ERROR;
1167
1168 END IF;
1169
1170 -- -----------------------------------------------------------------
1171 -- Validate object group id provided
1172 -- -----------------------------------------------------------------
1173 l_obj_group_id := Validate_Obj_Grp_ID (p_group_id => p_obj_group_id);
1174
1175 IF (l_obj_group_id <= 0) THEN
1176 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_INV_OBJ_GROUP');
1177 FND_MSG_PUB.Add;
1178 RAISE FND_API.G_EXC_ERROR;
1179 END IF;
1180
1181 -- -----------------------------------------------------------------
1182 -- Ensure that the function name is not null.
1183 -- -----------------------------------------------------------------
1184 IF (p_function_name IS NULL) THEN
1185 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_INV_FUNC_NAME');
1186 FND_MSG_PUB.Add;
1187 RAISE FND_API.G_EXC_ERROR;
1188 END IF;
1189
1190 -- -----------------------------------------------------------------
1191 -- Insert the values requested into the Grants table.
1192 -- -----------------------------------------------------------------
1193 INSERT
1194 INTO igs_sc_obj_functns
1195 (function_id,
1196 obj_group_id,
1197 function_name,
1198 creation_date,
1199 created_by,
1200 last_updated_by,
1201 last_update_date,
1202 last_update_login
1203 )
1204 VALUES (NVL(igs_sc_obj_functns_s.nextval,p_function_id),
1205 l_obj_group_id,
1206 p_function_name,
1207 SYSDATE,
1208 NVL(FND_GLOBAL.user_id,-1),
1209 NVL(FND_GLOBAL.user_id,-1),
1210 SYSDATE,
1211 NVL(FND_GLOBAL.login_id, -1)
1212 )
1213 RETURNING function_id INTO p_function_id;
1214
1215 -- -----------------------------------------------------------------
1216 -- Commit the transaction if requested to via parameter value.
1217 -- -----------------------------------------------------------------
1218 IF (FND_API.to_Boolean(p_commit)) THEN
1219 COMMIT;
1220 END IF;
1221
1222 -- -----------------------------------------------------------------
1223 -- Exception Block definition
1224 -- -----------------------------------------------------------------
1225 EXCEPTION
1226 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1227 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1228 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
1229 p_count => l_message_count,
1230 p_data => x_return_message);
1231 ROLLBACK TO Insert_Object_Func_SP;
1232
1233 WHEN FND_API.G_EXC_ERROR THEN
1234 x_return_status := FND_API.G_RET_STS_ERROR;
1235
1236 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
1237 p_count => l_message_count,
1238 p_data => x_return_message);
1239 ROLLBACK TO Insert_Object_Func_SP;
1240
1241 WHEN OTHERS THEN
1242 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1243 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
1244 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
1245 END IF;
1246 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
1247 p_count => l_message_count,
1248 p_data => x_return_message);
1249 ROLLBACK TO Insert_Object_Func_SP;
1250
1251 IF g_upgrade_mode = 'Y' THEN
1252 RAISE;
1253 END IF;
1254
1255 END Insert_Object_Func;
1256
1257
1258 /******************************************************************
1259 Created By : Don Shellito
1260 Date Created By : April 23, 2003
1261 Purpose : The purpose of this procedure is to handle
1262 the insertion of the data into igs_sc_objects
1263 table. This ensures a link between the object
1264 groups and the fnd objects resident in the system.
1265 There is validation to ensure that the object_id,
1266 and the obj_group_id are valid and present in the
1267 data model.
1268 Remarks :
1269
1270 Change History
1271 Who When What
1272 ------------------------------------------------------------------------
1273 Don Shellito April 23, 2003 New Procedure Created.
1274
1275 ******************************************************************/
1276 PROCEDURE Insert_Object (p_api_version IN NUMBER,
1277 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
1278 p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE,
1279 p_object_id IN OUT NOCOPY igs_sc_objects.object_id%TYPE,
1280 p_obj_group_id IN igs_sc_objects.obj_group_id%TYPE,
1281 p_obj_name IN fnd_objects.obj_name%TYPE ,
1282 p_database_object_name IN fnd_objects.database_object_name%TYPE ,
1283 p_pk1_column_name IN fnd_objects.pk1_column_name%TYPE ,
1284 p_pk2_column_name IN fnd_objects.pk2_column_name%TYPE ,
1285 p_pk3_column_name IN fnd_objects.pk3_column_name%TYPE ,
1286 p_pk4_column_name IN fnd_objects.pk4_column_name%TYPE ,
1287 p_pk5_column_name IN fnd_objects.pk5_column_name%TYPE ,
1288 p_pk1_column_type IN fnd_objects.pk1_column_type%TYPE ,
1289 p_pk2_column_type IN fnd_objects.pk2_column_type%TYPE ,
1290 p_pk3_column_type IN fnd_objects.pk3_column_type%TYPE ,
1291 p_pk4_column_type IN fnd_objects.pk4_column_type%TYPE ,
1292 p_pk5_column_type IN fnd_objects.pk5_column_type%TYPE ,
1293 p_select_flag IN VARCHAR2 DEFAULT 'Y',
1294 p_insert_flag IN VARCHAR2 DEFAULT 'Y',
1295 p_update_flag IN VARCHAR2 DEFAULT 'Y',
1296 p_delete_flag IN VARCHAR2 DEFAULT 'Y',
1297 p_enforce_par_sec_flag IN VARCHAR2 DEFAULT 'N',
1298 p_active_flag IN VARCHAR2 DEFAULT 'Y',
1299 x_return_status OUT NOCOPY VARCHAR2,
1300 x_return_message OUT NOCOPY VARCHAR2
1301 )
1302 IS
1303
1304 -- -----------------------------------------------------------------
1305 -- Define local variables to be used.
1306 -- -----------------------------------------------------------------
1307 l_api_name CONSTANT VARCHAR2(30) := 'Insert_Object';
1308 l_api_version CONSTANT NUMBER := 1.0;
1309 l_return_message VARCHAR2(2000);
1310 l_message_count NUMBER(15);
1311 l_return_status VARCHAR2(30);
1312 l_object_id igs_sc_objects.object_id%TYPE;
1313 l_obj_group_id igs_sc_objects.obj_group_id%TYPE;
1314 l_rowid VARCHAR2(255);
1315 l_application_id NUMBER;
1316
1317 CURSOR c_obj IS
1318 SELECT object_id
1319 FROM fnd_objects
1320 WHERE obj_name = p_obj_name;
1321
1322 -- -----------------------------------------------------------------
1323 -- Define the cursors to be used in procedure.
1324 -- -----------------------------------------------------------------
1325
1326 BEGIN
1327
1328 SAVEPOINT Insert_Object_SP;
1329
1330 -- -----------------------------------------------------------------
1331 -- Check for the Compatible API call
1332 -- -----------------------------------------------------------------
1333 IF NOT FND_API.COMPATIBLE_API_CALL (l_api_version,
1334 p_api_version,
1335 l_api_name,
1336 g_pkg_name) THEN
1337 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1338 END IF;
1339
1340 -- -----------------------------------------------------------------
1341 -- If the calling program has passed the parameter for initializing
1342 -- the message list
1343 -- -----------------------------------------------------------------
1344 IF FND_API.TO_BOOLEAN (p_init_msg_list) THEN
1345 FND_MSG_PUB.INITIALIZE;
1346 END IF;
1347
1348 -- -----------------------------------------------------------------
1349 -- Set the return status to success
1350 -- -----------------------------------------------------------------
1351 x_return_status := FND_API.G_RET_STS_SUCCESS;
1352
1353 -- -----------------------------------------------------------------
1354 -- Check if admin mode is enabled
1355 -- -----------------------------------------------------------------
1356 IF IGS_SC_GRANTS_PVT.admin_mode <> 'Y' AND g_upgrade_mode <> 'Y' THEN
1357
1358 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_ADMIN_MODE_OFF');
1359 FND_MSG_PUB.Add;
1360 RAISE FND_API.G_EXC_ERROR;
1361
1362 END IF;
1363
1364 -- -----------------------------------------------------------------
1365 -- Validate object group id provided
1366 -- -----------------------------------------------------------------
1367 l_obj_group_id := Validate_Obj_Grp_ID (p_group_id => p_obj_group_id);
1368
1369 IF (l_obj_group_id <= 0) THEN
1370 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_INV_OBJ_GROUP');
1371 FND_MSG_PUB.Add;
1372 RAISE FND_API.G_EXC_ERROR;
1373 END IF;
1374
1375 -- -----------------------------------------------------------------
1376 -- Check if object exists
1377 -- -----------------------------------------------------------------
1378
1379 OPEN c_obj;
1380 FETCH c_obj INTO l_object_id;
1381 CLOSE c_obj;
1382
1383 IF(SUBSTR(p_obj_name,1,3) = 'IGS') THEN
1384 l_application_id := 8405;
1385 ELSIF(SUBSTR(p_obj_name,1,3) = 'IGF') THEN
1386 l_application_id := 8406;
1387 END IF;
1388
1389 IF l_object_id IS NULL THEN
1390 -- populate ID Insert table into FND
1391
1392 IF p_object_id IS NULL THEN
1393 SELECT fnd_objects_s.nextval INTO l_object_id FROM DUAL;
1394 ELSE
1395 l_object_id := p_object_id;
1396 END IF;
1397
1398 FND_OBJECTS_PKG.INSERT_ROW (
1399 x_rowid => l_rowid,
1400 x_object_id =>l_object_id,
1401 x_obj_name => p_obj_name,
1402 x_pk1_column_name => p_pk1_column_name,
1403 x_pk2_column_name => p_pk2_column_name,
1404 x_pk3_column_name => p_pk3_column_name,
1405 x_pk4_column_name => p_pk4_column_name,
1406 x_pk5_column_name => p_pk5_column_name,
1407 x_pk1_column_type => p_pk1_column_type,
1408 x_pk2_column_type => p_pk2_column_type,
1409 x_pk3_column_type => p_pk3_column_type,
1410 x_pk4_column_type => p_pk4_column_type,
1411 x_pk5_column_type => p_pk5_column_type,
1412 x_application_id => l_application_id,
1413 x_database_object_name => p_database_object_name,
1414 x_display_name => p_obj_name,
1415 x_description => p_obj_name,
1416 x_creation_date => SYSDATE,
1417 x_created_by => NVL(fnd_global.user_id,-1),
1418 x_last_update_date => SYSDATE,
1419 x_last_updated_by => NVL(fnd_global.user_id,-1),
1420 x_last_update_login => NVL(fnd_global.login_id, -1));
1421
1422 END IF;
1423
1424 p_object_id := l_object_id;
1425
1426 -- -----------------------------------------------------------------
1427 -- Insert the values requested into the Grants table.
1428 -- -----------------------------------------------------------------
1429
1430 INSERT
1431 INTO igs_sc_objects
1432 (object_id,
1433 obj_group_id,
1434 creation_date,
1435 created_by,
1436 last_updated_by,
1437 last_update_date,
1438 last_update_login,
1439 select_flag,
1440 insert_flag,
1441 update_flag,
1442 delete_flag,
1443 enforce_par_sec_flag,
1444 active_flag
1445 )
1446 VALUES (l_object_id,
1447 l_obj_group_id,
1448 SYSDATE,
1449 NVL(FND_GLOBAL.user_id,-1),
1450 NVL(FND_GLOBAL.user_id,-1),
1451 SYSDATE,
1452 NVL(FND_GLOBAL.login_id, -1),
1453 p_select_flag,
1454 p_insert_flag,
1455 p_update_flag,
1456 p_delete_flag,
1457 p_enforce_par_sec_flag,
1458 p_active_flag
1459 );
1460
1461 -- Create database policy for table
1462 modify_policy(p_database_object_name ) ;
1463
1464 -- -----------------------------------------------------------------
1465 -- Commit the transaction if requested to via parameter value.
1466 -- -----------------------------------------------------------------
1467 IF (FND_API.to_Boolean(p_commit)) THEN
1468 COMMIT;
1469 END IF;
1470
1471 -- -----------------------------------------------------------------
1472 -- Exception Block definition
1473 -- -----------------------------------------------------------------
1474 EXCEPTION
1475 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1476 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1477 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
1478 p_count => l_message_count,
1479 p_data => x_return_message);
1480 ROLLBACK TO Insert_Object_SP;
1481
1482 WHEN FND_API.G_EXC_ERROR THEN
1483 x_return_status := FND_API.G_RET_STS_ERROR;
1484
1485 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
1486 p_count => l_message_count,
1487 p_data => x_return_message);
1488 ROLLBACK TO Insert_Object_SP;
1489
1490 WHEN OTHERS THEN
1491 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1492 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
1493 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
1494 END IF;
1495 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
1496 p_count => l_message_count,
1497 p_data => x_return_message);
1498 ROLLBACK TO Insert_Object_SP;
1499
1500 IF g_upgrade_mode = 'Y' THEN
1501 RAISE;
1502 END IF;
1503
1504 END Insert_Object;
1505
1506
1507 /******************************************************************
1508 Created By : Don Shellito
1509 Date Created By : April 23, 2003
1510 Purpose : The purpose of this procedure is to handle
1511 the insertion of data into the table
1512 igs_sc_usr_attribs. There is validation
1513 to ensure that the static_type and
1514 user_attrib_type are valid values.
1515 Remarks :
1516
1517 Change History
1518 Who When What
1519 ------------------------------------------------------------------------
1520 Don Shellito April 23, 2003 New Procedure Created.
1521
1522 *****************************************************************/
1523 PROCEDURE Insert_User_Attr (p_api_version IN NUMBER,
1524 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
1525 p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE,
1526 p_user_attrib_id IN OUT NOCOPY igs_sc_usr_attribs.user_attrib_id%TYPE,
1527 p_user_attrib_name IN igs_sc_usr_attribs.user_attrib_name%TYPE,
1528 p_user_attrib_type IN igs_sc_usr_attribs.user_attrib_type%TYPE,
1529 p_static_type IN igs_sc_usr_attribs.static_type%TYPE,
1530 p_select_text IN igs_sc_usr_attribs.select_text%TYPE,
1531 p_active_flag IN VARCHAR2 DEFAULT 'Y',
1532 x_return_status OUT NOCOPY VARCHAR2,
1533 x_return_message OUT NOCOPY VARCHAR2
1534 ) IS
1535
1536 -- -----------------------------------------------------------------
1537 -- Define local variables to be used.
1538 -- -----------------------------------------------------------------
1539 l_api_name CONSTANT VARCHAR2(30) := 'Insert_User_Attr';
1540 l_api_version CONSTANT NUMBER := 1.0;
1541 l_return_message VARCHAR2(2000);
1542 l_message_count NUMBER(15);
1543 l_return_status VARCHAR2(30);
1544 l_user_attrib_type igs_sc_usr_attribs.user_attrib_type%TYPE;
1545 l_static_type igs_sc_usr_attribs.static_type%TYPE;
1546
1547 BEGIN
1548
1549 SAVEPOINT Insert_User_Attr_SP;
1550
1551 -- -----------------------------------------------------------------
1552 -- Check for the Compatible API call
1553 -- -----------------------------------------------------------------
1554 IF NOT FND_API.COMPATIBLE_API_CALL (l_api_version,
1555 p_api_version,
1556 l_api_name,
1557 g_pkg_name) THEN
1558 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1559 END IF;
1560
1561 -- -----------------------------------------------------------------
1562 -- If the calling program has passed the parameter for initializing
1563 -- the message list
1564 -- -----------------------------------------------------------------
1565 IF FND_API.TO_BOOLEAN (p_init_msg_list) THEN
1566 FND_MSG_PUB.INITIALIZE;
1567 END IF;
1568
1569 -- -----------------------------------------------------------------
1570 -- Set the return status to success
1571 -- -----------------------------------------------------------------
1572 x_return_status := FND_API.G_RET_STS_SUCCESS;
1573
1574
1575 -- -----------------------------------------------------------------
1576 -- Check if admin mode is enabled
1577 -- -----------------------------------------------------------------
1578 IF IGS_SC_GRANTS_PVT.admin_mode <> 'Y' AND g_upgrade_mode <> 'Y' THEN
1579
1580 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_ADMIN_MODE_OFF');
1581 FND_MSG_PUB.Add;
1582 RAISE FND_API.G_EXC_ERROR;
1583
1584 END IF;
1585
1586 -- -----------------------------------------------------------------
1587 -- Validate that the attribute name is valid.
1588 -- -----------------------------------------------------------------
1589 IF (p_user_attrib_name IS NULL) THEN
1590 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_INV_USR_ATTR_NAME');
1591 FND_MSG_PUB.Add;
1592 RAISE FND_API.G_EXC_ERROR;
1593 END IF;
1594
1595 -- -----------------------------------------------------------------
1596 -- Ensure that there is SELECT text provided.
1597 -- -----------------------------------------------------------------
1598 IF (p_select_text IS NULL) THEN
1599 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_INV_SELECT_TEXT');
1600 FND_MSG_PUB.Add;
1601 RAISE FND_API.G_EXC_ERROR;
1602 END IF;
1603
1604 -- -----------------------------------------------------------------
1605 -- Validate that the attribute type is valid.
1606 -- -----------------------------------------------------------------
1607 l_user_attrib_type := Validate_User_Attr_Type (p_usr_att_type => p_user_attrib_type);
1608
1609 IF (l_user_attrib_type IS NULL) THEN
1610 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_INV_USR_ATT_TYPE');
1611 FND_MSG_PUB.Add;
1612 RAISE FND_API.G_EXC_ERROR;
1613 END IF;
1614
1615 -- -----------------------------------------------------------------
1616 -- Validatate that the static type is valid.
1617 -- -----------------------------------------------------------------
1618 l_static_type := Validate_Static_Type (p_static_type => p_static_type);
1619
1620 IF (l_static_type IS NULL) THEN
1621 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_INV_STATIC_TYPE');
1622 FND_MSG_PUB.Add;
1623 RAISE FND_API.G_EXC_ERROR;
1624 END IF;
1625
1626 IF NOT check_attrib_text ( 'DUAL', p_select_text,l_user_attrib_type) THEN
1627
1628 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_GRNT_TXT_ERR');
1629 FND_MESSAGE.SET_TOKEN('OBJ_NAME','USER_ATTRIB');
1630 FND_MESSAGE.SET_TOKEN('GRNT_TEXT', p_select_text);
1631 FND_MSG_PUB.Add;
1632 RAISE FND_API.G_EXC_ERROR;
1633
1634 END IF;
1635
1636
1637 -- -----------------------------------------------------------------
1638 -- Insert the values requested into the Grants table.
1639 -- -----------------------------------------------------------------
1640 INSERT
1641 INTO igs_sc_usr_attribs
1642 (user_attrib_id,
1643 user_attrib_name,
1644 user_attrib_type,
1645 static_type,
1646 select_text,
1647 creation_date,
1648 created_by,
1649 last_updated_by,
1650 last_update_date,
1651 last_update_login,
1652 active_flag
1653 )
1654 VALUES ( NVL(p_user_attrib_id,igs_sc_usr_attribs_s.nextval),
1655 p_user_attrib_name,
1656 l_user_attrib_type,
1657 l_static_type,
1658 p_select_text,
1659 SYSDATE,
1660 NVL(FND_GLOBAL.user_id,-1),
1661 NVL(FND_GLOBAL.user_id,-1),
1662 SYSDATE,
1663 NVL(FND_GLOBAL.login_id, -1),
1664 p_active_flag
1665 )
1666 RETURNING user_attrib_id INTO p_user_attrib_id;
1667
1668 -- Generate values
1669
1670 IF l_static_type IN ('C','S') AND l_user_attrib_type <> 'U' THEN
1671
1672 IGS_SC_GRANTS_PVT.POPULATE_USER_ATTRIB (
1673 P_API_VERSION => 1.0,
1674 P_ATTRIB_ID => p_user_attrib_id,
1675 P_USER_ID => NULL,
1676 P_ALL_ATTRIBS => 'Y',
1677 X_RETURN_STATUS => l_return_status,
1678 X_MSG_COUNT => l_message_count,
1679 X_MSG_DATA => l_return_message
1680 );
1681
1682
1683 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
1684 RAISE FND_API.G_EXC_ERROR;
1685 END IF;
1686
1687 END IF;
1688
1689 -- -----------------------------------------------------------------
1690 -- Commit the transaction if requested to via parameter value.
1691 -- -----------------------------------------------------------------
1692 IF (FND_API.to_Boolean(p_commit)) THEN
1693 COMMIT;
1694 END IF;
1695
1696 -- -----------------------------------------------------------------
1697 -- Exception Block definition
1698 -- -----------------------------------------------------------------
1699 EXCEPTION
1700 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1701 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1702 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
1703 p_count => l_message_count,
1704 p_data => x_return_message);
1705 ROLLBACK TO Insert_User_Attr_SP;
1706
1707 WHEN FND_API.G_EXC_ERROR THEN
1708 x_return_status := FND_API.G_RET_STS_ERROR;
1709
1710 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
1711 p_count => l_message_count,
1712 p_data => x_return_message);
1713 ROLLBACK TO Insert_User_Attr_SP;
1714
1715 WHEN OTHERS THEN
1716 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1717 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
1718 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
1719 END IF;
1720 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
1721 p_count => l_message_count,
1722 p_data => x_return_message);
1723
1724 ROLLBACK TO Insert_User_Attr_SP;
1725
1726 IF g_upgrade_mode = 'Y' THEN
1727 RAISE;
1728 END IF;
1729
1730
1731 END Insert_User_Attr;
1732
1733
1734 /******************************************************************
1735 Created By : Don Shellito
1736 Date Created By : April 23, 2003
1737 Purpose :
1738 Remarks :
1739
1740 Change History
1741 Who When What
1742 ------------------------------------------------------------------------
1743 Don Shellito April 23, 2003 New Procedure Created.
1744 pkpatel 10-Mar-2006 Bug 5081932 (Used wf_local_synch instead of private API wf_directory)
1745 ******************************************************************/
1746 PROCEDURE Insert_Local_Role (
1747 p_api_version IN NUMBER,
1748 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
1749 p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE,
1750 p_role_name IN VARCHAR2,
1751 p_role_display_name IN VARCHAR2,
1752 p_orig_system IN VARCHAR2,
1753 p_orig_system_id IN NUMBER,
1754 p_language IN VARCHAR2 DEFAULT NULL,
1755 p_territory IN VARCHAR2 DEFAULT NULL,
1756 p_role_description IN VARCHAR2 DEFAULT NULL,
1757 p_notification_preference IN VARCHAR2 DEFAULT 'MAILHTML',
1758 p_email_address IN VARCHAR2 DEFAULT NULL,
1759 p_fax IN VARCHAR2 DEFAULT NULL,
1760 p_status IN VARCHAR2 DEFAULT 'ACTIVE',
1761 p_expiration_date IN DATE DEFAULT NULL,
1762 p_start_date IN DATE DEFAULT SYSDATE,
1763 x_return_status OUT NOCOPY VARCHAR2,
1764 x_return_message OUT NOCOPY VARCHAR2
1765 ) IS
1766
1767 -- -----------------------------------------------------------------
1768 -- Define local variables to be used.
1769 -- -----------------------------------------------------------------
1770 l_api_name CONSTANT VARCHAR2(30) := 'Insert_Local_Role';
1771 l_api_version CONSTANT NUMBER := 1.0;
1772 l_return_message VARCHAR2(2000);
1773 l_message_count NUMBER(15);
1774 l_return_status VARCHAR2(30);
1775 l_parameters wf_parameter_list_t;
1776 -- -----------------------------------------------------------------
1777 -- Define the cursors to be used in procedure.
1778 -- -----------------------------------------------------------------
1779
1780 BEGIN
1781 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
1782 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Insert_Local_Role';
1783 l_debug_str := 'Role Name: '||p_role_name||','||' Role Display Name: '||p_role_display_name||','||'Role Orig System: '||p_orig_system
1784 ||','||' Role Orig System ID: '||p_orig_system_id;
1785 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
1786 END IF;
1787
1788 SAVEPOINT Insert_Local_Role_SP;
1789
1790 -- -----------------------------------------------------------------
1791 -- Check for the Compatible API call
1792 -- -----------------------------------------------------------------
1793 IF NOT FND_API.COMPATIBLE_API_CALL (l_api_version,
1794 p_api_version,
1795 l_api_name,
1796 g_pkg_name) THEN
1797 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1798 END IF;
1799
1800 -- -----------------------------------------------------------------
1801 -- If the calling program has passed the parameter for initializing
1802 -- the message list
1803 -- -----------------------------------------------------------------
1804 IF FND_API.TO_BOOLEAN (p_init_msg_list) THEN
1805 FND_MSG_PUB.INITIALIZE;
1806 END IF;
1807
1808 -- -----------------------------------------------------------------
1809 -- Set the return status to success
1810 -- -----------------------------------------------------------------
1811 x_return_status := FND_API.G_RET_STS_SUCCESS;
1812
1813 wf_event.addparametertolist('USER_NAME',p_role_name,l_parameters);
1814 wf_event.addparametertolist('DISPLAYNAME',p_role_display_name,l_parameters);
1815 wf_event.addparametertolist('DESCRIPTION',p_role_description,l_parameters);
1816 wf_event.addparametertolist('PREFERREDLANGUAGE',p_language,l_parameters);
1817 wf_event.addparametertolist('ORCLNLSTERRITORY',p_territory,l_parameters);
1818 wf_event.addparametertolist('ORCLWORKFLOWNOTIFICATIONPREF',p_notification_preference,l_parameters);
1819 wf_event.addparametertolist('MAIL',p_email_address,l_parameters);
1820 wf_event.addparametertolist('FACSIMILETELEPHONENUMBER',p_fax,l_parameters);
1821 wf_event.addparametertolist('ORCLISENABLED',p_status,l_parameters);
1822
1823 wf_local_synch.propagate_role(p_orig_system => p_orig_system,
1824 p_orig_system_id => p_orig_system_id,
1825 p_attributes => l_parameters,
1826 p_start_date => p_start_date,
1827 p_expiration_date => p_expiration_date
1828 );
1829
1830
1831 -- -----------------------------------------------------------------
1832 -- Commit the transaction if requested to via parameter value.
1833 -- -----------------------------------------------------------------
1834 IF (FND_API.to_Boolean(p_commit)) THEN
1835 COMMIT;
1836 END IF;
1837
1838 -- -----------------------------------------------------------------
1839 -- Exception Block definition
1840 -- -----------------------------------------------------------------
1841 EXCEPTION
1842 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1843 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1844 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
1845 p_count => l_message_count,
1846 p_data => x_return_message);
1847 ROLLBACK TO Insert_Local_Role_SP;
1848 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
1849 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Insert_Local_Role.Ex_UN';
1850 l_debug_str := 'Unhandled Exception: Role Name: '||p_role_name||','||' Error Message: '||x_return_message;
1851 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
1852 END IF;
1853 WHEN FND_API.G_EXC_ERROR THEN
1854 x_return_status := FND_API.G_RET_STS_ERROR;
1855
1856 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
1857 p_count => l_message_count,
1858 p_data => x_return_message);
1859 ROLLBACK TO Insert_Local_Role_SP;
1860
1861 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
1862 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Insert_Local_Role.Ex_Error';
1863 l_debug_str := 'Handled Exception: Role Name: '||p_role_name||','||' Error Message: '||x_return_message;
1864 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
1865 END IF;
1866
1867 WHEN OTHERS THEN
1868 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1869 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
1870 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
1871 END IF;
1872 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
1873 p_count => l_message_count,
1874 p_data => x_return_message);
1875 ROLLBACK TO Insert_Local_Role_SP;
1876
1877 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
1878 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Insert_Local_Role.Ex_others';
1879 l_debug_str := 'Other Exception: Role Name: '||p_role_name||','||' Error Message: '||x_return_message;
1880 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
1881 END IF;
1882
1883 IF g_upgrade_mode = 'Y' THEN
1884 RAISE;
1885 END IF;
1886
1887
1888 END Insert_Local_Role;
1889
1890
1891 /******************************************************************
1892 Created By : Don Shellito
1893 Date Created By : April 23, 2003
1894 Purpose :
1895 Remarks :
1896
1897 Change History
1898 Who When What
1899 ------------------------------------------------------------------------
1900 Don Shellito April 23, 2003 New Procedure Created.
1901 gmaheswa Jul 28, 2005 Modified c_fnd_user_name cursor to validate user from fnd_user instead of wf_user.
1902 pkpatel 10-Mar-2006 Bug 5081932 (Used wf_local_synch instead of private API wf_directory)
1903 ******************************************************************/
1904 PROCEDURE Insert_Local_User_Role (p_api_version IN NUMBER,
1905 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
1906 p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE,
1907 p_user_name IN wf_local_user_roles.user_name%TYPE,
1908 p_role_name IN wf_local_user_roles.role_name%TYPE,
1909 p_user_orig_system IN wf_local_user_roles.user_orig_system%TYPE,
1910 p_user_orig_system_id IN wf_local_user_roles.user_orig_system_id%TYPE,
1911 p_role_orig_system IN wf_local_user_roles.role_orig_system%TYPE,
1912 p_role_orig_system_id IN wf_local_user_roles.role_orig_system_id%TYPE,
1913 p_start_date IN wf_local_user_roles.start_date%TYPE,
1914 p_expiration_date IN wf_local_user_roles.expiration_date%TYPE,
1915 p_security_group_id IN wf_local_user_roles.security_group_id%TYPE,
1916 x_return_status OUT NOCOPY VARCHAR2,
1917 x_return_message OUT NOCOPY VARCHAR2
1918 )
1919 IS
1920
1921 -- -----------------------------------------------------------------
1922 -- Define local variables to be used.
1923 -- -----------------------------------------------------------------
1924 l_api_name CONSTANT VARCHAR2(30) := 'Insert_Local_User_Role';
1925 l_api_version CONSTANT NUMBER := 1.0;
1926 l_return_message VARCHAR2(2000);
1927 l_message_count NUMBER(15);
1928 l_return_status VARCHAR2(30);
1929 l_user_found VARCHAR2(1);
1930 -- -----------------------------------------------------------------
1931 -- Define the cursors to be used in procedure.
1932 -- -----------------------------------------------------------------
1933 -- This cursor check what user_id and system are used in wf_users view
1934
1935 CURSOR c_fnd_user_name IS
1936 SELECT 'X'
1937 FROM fnd_user
1938 WHERE user_name = p_user_name
1939 AND user_id = p_user_orig_system_id;
1940
1941 BEGIN
1942
1943 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
1944 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Insert_Local_User_Role';
1945 l_debug_str := 'Role Name: '||p_role_name||','||' User Name: '||p_user_name||','||'Role Orig System: '||p_role_orig_system
1946 ||','||' Role Orig System ID: '||p_role_orig_system_id||'User Orig System: '||p_user_orig_system
1947 ||','||' User Orig System ID: '||p_user_orig_system_id;
1948 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
1949 END IF;
1950
1951 SAVEPOINT Insert_Local_User_Role_SP;
1952
1953 -- -----------------------------------------------------------------
1954 -- Check for the Compatible API call
1955 -- -----------------------------------------------------------------
1956 IF NOT FND_API.COMPATIBLE_API_CALL (l_api_version,
1957 p_api_version,
1958 l_api_name,
1959 g_pkg_name) THEN
1960 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1961 END IF;
1962
1963 -- -----------------------------------------------------------------
1964 -- If the calling program has passed the parameter for initializing
1965 -- the message list
1966 -- -----------------------------------------------------------------
1967 IF FND_API.TO_BOOLEAN (p_init_msg_list) THEN
1968 FND_MSG_PUB.INITIALIZE;
1969 END IF;
1970
1971 -- -----------------------------------------------------------------
1972 -- Set the return status to success
1973 -- -----------------------------------------------------------------
1974 x_return_status := FND_API.G_RET_STS_SUCCESS;
1975
1976 -- Check if fnd userid is used.
1977
1978 OPEN c_fnd_user_name;
1979 FETCH c_fnd_user_name INTO l_user_found;
1980
1981 IF c_fnd_user_name%NOTFOUND THEN
1982
1983 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_USR_NOT_FOUND');
1984 FND_MSG_PUB.Add;
1985 RAISE FND_API.G_EXC_ERROR;
1986
1987 END IF;
1988
1989 CLOSE c_fnd_user_name;
1990
1991 wf_local_synch.propagateUserRole(p_user_name => p_user_name,
1992 p_role_name => p_role_name,
1993 p_user_orig_system => p_user_orig_system,
1994 p_user_orig_system_id => p_user_orig_system_id,
1995 p_role_orig_system => p_role_orig_system,
1996 p_role_orig_system_id => p_role_orig_system_id,
1997 p_start_date => p_start_date,
1998 p_expiration_date => p_expiration_date
1999 );
2000
2001 -- Populate the user attributes values
2002 IGS_SC_GRANTS_PVT.POPULATE_USER_ATTRIB (
2003 P_API_VERSION => 1.0,
2004 P_ATTRIB_ID => NULL,
2005 P_USER_ID => p_user_orig_system_id,
2006 P_ALL_ATTRIBS => 'Y',
2007 X_RETURN_STATUS => l_return_status,
2008 X_MSG_COUNT => l_message_count,
2009 X_MSG_DATA => l_return_message
2010 );
2011
2012 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
2013 RAISE FND_API.G_EXC_ERROR;
2014 END IF;
2015
2016 -- -----------------------------------------------------------------
2017 -- Commit the transaction if requested to via parameter value.
2018 -- -----------------------------------------------------------------
2019 IF (FND_API.to_Boolean(p_commit)) THEN
2020 COMMIT;
2021 END IF;
2022
2023 -- -----------------------------------------------------------------
2024 -- Exception Block definition
2025 -- -----------------------------------------------------------------
2026 EXCEPTION
2027 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2028 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2029 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
2030 p_count => l_message_count,
2031 p_data => x_return_message);
2032 ROLLBACK TO Insert_Local_User_Role_SP;
2033
2034 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
2035 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Insert_Local_User_Role.Ex_UN';
2036 l_debug_str := 'Other Exception: Role Name: '||p_role_name||','||' User Name: '||p_user_name||','||' Error Message: '||x_return_message;
2037 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
2038 END IF;
2039
2040 WHEN FND_API.G_EXC_ERROR THEN
2041 x_return_status := FND_API.G_RET_STS_ERROR;
2042
2043 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
2044 p_count => l_message_count,
2045 p_data => x_return_message);
2046 ROLLBACK TO Insert_Local_User_Role_SP;
2047
2048 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
2049 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Insert_Local_User_Role.Ex_error';
2050 l_debug_str := 'Other Exception: Role Name: '||p_role_name||','||' User Name: '||p_user_name||','||' Error Message: '||x_return_message;
2051 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
2052 END IF;
2053
2054 WHEN OTHERS THEN
2055 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2056 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
2057 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
2058 END IF;
2059 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
2060 p_count => l_message_count,
2061 p_data => x_return_message);
2062 ROLLBACK TO Insert_Local_User_Role_SP;
2063
2064 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
2065 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Insert_Local_User_Role.Ex_others';
2066 l_debug_str := 'Other Exception: Role Name: '||p_role_name||','||' User Name: '||p_user_name||','||' Error Message: '||x_return_message;
2067 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
2068 END IF;
2069
2070 IF g_upgrade_mode = 'Y' THEN
2071 RAISE;
2072 END IF;
2073
2074 END Insert_Local_User_Role;
2075
2076
2077
2078 /******************************************************************
2079 Created By : Don Shellito
2080 Date Created By : April 23, 2003
2081 Purpose : The purpose of this procedure is to handle
2082 the insertion of the data into igs_sc_objects
2083 table. This ensures a link between the object
2084 groups and the fnd objects resident in the system.
2085 There is validation to ensure that the object_id,
2086 and the obj_group_id are valid and present in the
2087 data model.
2088 Remarks :
2089
2090 Change History
2091 Who When What
2092 ------------------------------------------------------------------------
2093 Don Shellito April 23, 2003 New Procedure Created.
2094
2095 ******************************************************************/
2096 PROCEDURE Update_Object (p_api_version IN NUMBER,
2097 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
2098 p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE,
2099 p_object_id IN igs_sc_objects.object_id%TYPE,
2100 p_obj_group_id IN igs_sc_objects.obj_group_id%TYPE,
2101 p_obj_name IN fnd_objects.obj_name%TYPE ,
2102 p_database_object_name IN fnd_objects.database_object_name%TYPE ,
2103 p_pk1_column_name IN fnd_objects.pk1_column_name%TYPE ,
2104 p_pk2_column_name IN fnd_objects.pk2_column_name%TYPE ,
2105 p_pk3_column_name IN fnd_objects.pk3_column_name%TYPE ,
2106 p_pk4_column_name IN fnd_objects.pk4_column_name%TYPE ,
2107 p_pk5_column_name IN fnd_objects.pk5_column_name%TYPE ,
2108 p_pk1_column_type IN fnd_objects.pk1_column_type%TYPE ,
2109 p_pk2_column_type IN fnd_objects.pk2_column_type%TYPE ,
2110 p_pk3_column_type IN fnd_objects.pk3_column_type%TYPE ,
2111 p_pk4_column_type IN fnd_objects.pk4_column_type%TYPE ,
2112 p_pk5_column_type IN fnd_objects.pk5_column_type%TYPE ,
2113 p_select_flag IN VARCHAR2 DEFAULT 'Y',
2114 p_insert_flag IN VARCHAR2 DEFAULT 'Y',
2115 p_update_flag IN VARCHAR2 DEFAULT 'Y',
2116 p_delete_flag IN VARCHAR2 DEFAULT 'Y',
2117 p_enforce_par_sec_flag IN VARCHAR2 DEFAULT 'N',
2118 p_active_flag IN VARCHAR2 DEFAULT 'Y',
2119 x_return_status OUT NOCOPY VARCHAR2,
2120 x_return_message OUT NOCOPY VARCHAR2
2121 )
2122 IS
2123
2124 -- -----------------------------------------------------------------
2125 -- Define local variables to be used.
2126 -- -----------------------------------------------------------------
2127 l_api_name CONSTANT VARCHAR2(30) := 'Update_Object';
2128 l_api_version CONSTANT NUMBER := 1.0;
2129 l_return_message VARCHAR2(2000);
2130 l_message_count NUMBER(15);
2131 l_return_status VARCHAR2(30);
2132 l_object_id igs_sc_objects.object_id%TYPE;
2133 l_obj_group_id igs_sc_objects.obj_group_id%TYPE;
2134 l_rowid VARCHAR2(255);
2135 l_object_name fnd_objects.database_object_name%TYPE ;
2136
2137 -- -----------------------------------------------------------------
2138 -- Define the cursors to be used in procedure.
2139 -- -----------------------------------------------------------------
2140
2141 BEGIN
2142
2143 SAVEPOINT Update_Object_SP;
2144
2145 -- -----------------------------------------------------------------
2146 -- Check for the Compatible API call
2147 -- -----------------------------------------------------------------
2148 IF NOT FND_API.COMPATIBLE_API_CALL (l_api_version,
2149 p_api_version,
2150 l_api_name,
2151 g_pkg_name) THEN
2152 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2153 END IF;
2154
2155 -- -----------------------------------------------------------------
2156 -- If the calling program has passed the parameter for initializing
2157 -- the message list
2158 -- -----------------------------------------------------------------
2159 IF FND_API.TO_BOOLEAN (p_init_msg_list) THEN
2160 FND_MSG_PUB.INITIALIZE;
2161 END IF;
2162
2163 -- -----------------------------------------------------------------
2164 -- Set the return status to success
2165 -- -----------------------------------------------------------------
2166 x_return_status := FND_API.G_RET_STS_SUCCESS;
2167
2168 -- -----------------------------------------------------------------
2169 -- Check if admin mode is enabled
2170 -- -----------------------------------------------------------------
2171 IF IGS_SC_GRANTS_PVT.admin_mode <> 'Y' AND g_upgrade_mode <> 'Y' THEN
2172
2173 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_ADMIN_MODE_OFF');
2174 FND_MSG_PUB.Add;
2175 RAISE FND_API.G_EXC_ERROR;
2176
2177 END IF;
2178
2179 -- -----------------------------------------------------------------
2180 -- Validate object group id provided
2181 -- -----------------------------------------------------------------
2182 l_obj_group_id := Validate_Obj_Grp_ID (p_group_id => p_obj_group_id);
2183
2184 IF (l_obj_group_id <= 0) THEN
2185 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_INV_OBJ_GROUP');
2186 FND_MSG_PUB.Add;
2187 RAISE FND_API.G_EXC_ERROR;
2188 END IF;
2189
2190 -- -----------------------------------------------------------------
2191 -- Check if object exists
2192 -- -----------------------------------------------------------------
2193
2194 OPEN c_table_name(p_object_id);
2195 FETCH c_table_name INTO l_object_name;
2196 CLOSE c_table_name;
2197
2198 IF l_object_name IS NULL THEN
2199
2200 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_INV_OBJECT');
2201 FND_MSG_PUB.Add;
2202 RAISE FND_API.G_EXC_ERROR;
2203
2204 END IF;
2205
2206 FND_OBJECTS_PKG.UPDATE_ROW (
2207 x_object_id =>p_object_id,
2208 x_obj_name => p_obj_name,
2209 x_pk1_column_name => p_pk1_column_name,
2210 x_pk2_column_name => p_pk2_column_name,
2211 x_pk3_column_name => p_pk3_column_name,
2212 x_pk4_column_name => p_pk4_column_name,
2213 x_pk5_column_name => p_pk5_column_name,
2214 x_pk1_column_type => p_pk1_column_type,
2215 x_pk2_column_type => p_pk2_column_type,
2216 x_pk3_column_type => p_pk3_column_type,
2217 x_pk4_column_type => p_pk4_column_type,
2218 x_pk5_column_type => p_pk5_column_type,
2219 x_application_id => 8405,
2220 x_database_object_name => p_database_object_name,
2221 x_display_name => p_obj_name,
2222 x_description => p_obj_name,
2223 x_last_update_date => sysdate,
2224 x_last_updated_by => nvl(fnd_global.user_id,-1),
2225 x_last_update_login => nvl(fnd_global.login_id, -1));
2226
2227
2228 UPDATE IGS_SC_OBJECTS SET
2229 LAST_UPDATED_BY = NVL(FND_GLOBAL.user_id,-1),
2230 LAST_UPDATE_DATE = SYSDATE,
2231 LAST_UPDATE_LOGIN = NVL(FND_GLOBAL.login_id, -1),
2232 SELECT_FLAG = P_SELECT_FLAG,
2233 INSERT_FLAG = P_INSERT_FLAG,
2234 UPDATE_FLAG = P_UPDATE_FLAG,
2235 DELETE_FLAG = P_DELETE_FLAG,
2236 ENFORCE_PAR_SEC_FLAG = P_ENFORCE_PAR_SEC_FLAG,
2237 ACTIVE_FLAG = P_ACTIVE_FLAG
2238 WHERE OBJECT_ID = P_OBJECT_ID
2239 AND OBJ_GROUP_ID = P_OBJ_GROUP_ID;
2240
2241
2242 modify_policy(p_database_object_name );
2243
2244
2245 -- -----------------------------------------------------------------
2246 -- Commit the transaction if requested to via parameter value.
2247 -- -----------------------------------------------------------------
2248 IF (FND_API.to_Boolean(p_commit)) THEN
2249 COMMIT;
2250 END IF;
2251
2252 -- -----------------------------------------------------------------
2253 -- Exception Block definition
2254 -- -----------------------------------------------------------------
2255 EXCEPTION
2256 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2257 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2258 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
2259 p_count => l_message_count,
2260 p_data => x_return_message);
2261 ROLLBACK TO Update_Object_SP;
2262
2263 WHEN FND_API.G_EXC_ERROR THEN
2264 x_return_status := FND_API.G_RET_STS_ERROR;
2265
2266 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
2267 p_count => l_message_count,
2268 p_data => x_return_message);
2269 ROLLBACK TO Update_Object_SP;
2270
2271 WHEN OTHERS THEN
2272 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2273 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
2274 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
2275 END IF;
2276 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
2277 p_count => l_message_count,
2278 p_data => x_return_message);
2279 ROLLBACK TO Update_Object_SP;
2280 IF g_upgrade_mode = 'Y' THEN
2281 RAISE;
2282 END IF;
2283
2284 END Update_Object;
2285
2286
2287 /******************************************************************
2288 Created By : Don Shellito
2289 Date Created By : April 23, 2003
2290 Purpose :
2291 Remarks :
2292
2293 Change History
2294 Who When What
2295 ------------------------------------------------------------------------
2296 Don Shellito April 23, 2003 New Procedure Created.
2297 pkpatel 10-Mar-2006 Bug 5081932 (Used wf_local_synch instead of directly updating table wf_local_role)
2298 ******************************************************************/
2299 PROCEDURE Update_Local_Role (p_api_version IN NUMBER,
2300 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
2301 p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE,
2302 p_role_name IN VARCHAR2,
2303 p_role_display_name IN VARCHAR2,
2304 p_orig_system IN VARCHAR2,
2305 p_orig_system_id IN NUMBER,
2306 p_language IN VARCHAR2 DEFAULT NULL,
2307 p_territory IN VARCHAR2 DEFAULT NULL,
2308 p_role_description IN VARCHAR2 DEFAULT NULL,
2309 p_notification_preference IN VARCHAR2 DEFAULT 'MAILHTML',
2310 p_email_address IN VARCHAR2 DEFAULT NULL,
2311 p_fax IN VARCHAR2 DEFAULT NULL,
2312 p_status IN VARCHAR2 DEFAULT 'ACTIVE',
2313 p_expiration_date IN DATE DEFAULT NULL,
2314 p_start_date IN DATE DEFAULT SYSDATE,
2315 x_return_status OUT NOCOPY VARCHAR2,
2316 x_return_message OUT NOCOPY VARCHAR2
2317 ) IS
2318
2319 -- -----------------------------------------------------------------
2320 -- Define local variables to be used.
2321 -- -----------------------------------------------------------------
2322 l_api_name CONSTANT VARCHAR2(30) := 'Update_Local_Role';
2323 l_api_version CONSTANT NUMBER := 1.0;
2324 l_return_message VARCHAR2(2000);
2325 l_message_count NUMBER(15);
2326 l_return_status VARCHAR2(30);
2327 l_parameters wf_parameter_list_t;
2328 -- -----------------------------------------------------------------
2329 -- Define the cursors to be used in procedure.
2330 -- -----------------------------------------------------------------
2331
2332 BEGIN
2333 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
2334 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Update_Local_Role';
2335 l_debug_str := 'Role Name: '||p_role_name||','||' Role Display Name: '||p_role_display_name||','||'Role Orig System: '||p_orig_system
2336 ||','||' Role Orig System ID: '||p_orig_system_id;
2337 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
2338 END IF;
2339
2340 SAVEPOINT Update_Local_Roles_SP;
2341
2342 -- -----------------------------------------------------------------
2343 -- Check for the Compatible API call
2344 -- -----------------------------------------------------------------
2345 IF NOT FND_API.COMPATIBLE_API_CALL (l_api_version,
2346 p_api_version,
2347 l_api_name,
2348 g_pkg_name) THEN
2349 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2350 END IF;
2351
2352 -- -----------------------------------------------------------------
2353 -- If the calling program has passed the parameter for initializing
2354 -- the message list
2355 -- -----------------------------------------------------------------
2356 IF FND_API.TO_BOOLEAN (p_init_msg_list) THEN
2357 FND_MSG_PUB.INITIALIZE;
2358 END IF;
2359
2360 -- -----------------------------------------------------------------
2361 -- Set the return status to success
2362 -- -----------------------------------------------------------------
2363 x_return_status := FND_API.G_RET_STS_SUCCESS;
2364
2365 wf_event.addparametertolist('USER_NAME',p_role_name,l_parameters);
2366 wf_event.addparametertolist('DISPLAYNAME',p_role_display_name,l_parameters);
2367 wf_event.addparametertolist('DESCRIPTION',p_role_description,l_parameters);
2368 wf_event.addparametertolist('PREFERREDLANGUAGE',p_language,l_parameters);
2369 wf_event.addparametertolist('ORCLNLSTERRITORY',p_territory,l_parameters);
2370 wf_event.addparametertolist('ORCLWORKFLOWNOTIFICATIONPREF',p_notification_preference,l_parameters);
2371 wf_event.addparametertolist('MAIL',p_email_address,l_parameters);
2372 wf_event.addparametertolist('FACSIMILETELEPHONENUMBER',p_fax,l_parameters);
2373 wf_event.addparametertolist('ORCLISENABLED',p_status,l_parameters);
2374 wf_event.addparametertolist('UPDATEONLY','TRUE',l_parameters);
2375
2376 wf_local_synch.propagate_role(p_orig_system => p_orig_system,
2377 p_orig_system_id => p_orig_system_id,
2378 p_attributes => l_parameters,
2379 p_start_date => p_start_date,
2380 p_expiration_date => p_expiration_date
2381 );
2382
2383 -- -----------------------------------------------------------------
2384 -- Commit the transaction if requested to via parameter value.
2385 -- -----------------------------------------------------------------
2386 IF (FND_API.to_Boolean(p_commit)) THEN
2387 COMMIT;
2388 END IF;
2389
2390 -- -----------------------------------------------------------------
2391 -- Exception Block definition
2392 -- -----------------------------------------------------------------
2393 EXCEPTION
2394 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2395 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2396 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
2397 p_count => l_message_count,
2398 p_data => x_return_message);
2399 ROLLBACK TO Update_Local_Roles_SP;
2400
2401 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
2402 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Update_Local_Role.Ex_error';
2403 l_debug_str := 'Unhandled Exception: Role Name: '||p_role_name||','||' Error Message: '||x_return_message;
2404 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
2405 END IF;
2406
2407 WHEN FND_API.G_EXC_ERROR THEN
2408 x_return_status := FND_API.G_RET_STS_ERROR;
2409
2410 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
2411 p_count => l_message_count,
2412 p_data => x_return_message);
2413 ROLLBACK TO Update_Local_Roles_SP;
2414
2415 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
2416 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Update_Local_Role.Ex_un';
2417 l_debug_str := 'handled Exception: Role Name: '||p_role_name||','||' Error Message: '||x_return_message;
2418 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
2419 END IF;
2420
2421 WHEN OTHERS THEN
2422 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2423 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
2424 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
2425 END IF;
2426 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
2427 p_count => l_message_count,
2428 p_data => x_return_message);
2429 ROLLBACK TO Update_Local_Roles_SP;
2430
2431 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
2432 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Update_Local_Role.Ex_others';
2433 l_debug_str := 'Other Exception: Role Name: '||p_role_name||','||' Error Message: '||x_return_message;
2434 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
2435 END IF;
2436
2437 IF g_upgrade_mode = 'Y' THEN
2438 RAISE;
2439 END IF;
2440
2441 END Update_Local_Role;
2442
2443
2444 /******************************************************************
2445 Created By : Don Shellito
2446 Date Created By : April 23, 2003
2447 Purpose :
2448 Remarks :
2449
2450 Change History
2451 Who When What
2452
2453 ------------------------------------------------------------------------
2454 Don Shellito April 23, 2003 New Procedure Created.
2455 pkpatel 10-Mar-2006 Bug 5081932 (Used wf_local_synch instead of private API wf_directory)
2456 ******************************************************************/
2457 PROCEDURE Update_Local_User_Role (p_api_version IN NUMBER,
2458 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
2459 p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE,
2460 p_user_name IN wf_local_user_roles.user_name%TYPE,
2461 p_role_name IN wf_local_user_roles.role_name%TYPE,
2462 p_user_orig_system IN wf_local_user_roles.user_orig_system%TYPE,
2463 p_user_orig_system_id IN wf_local_user_roles.user_orig_system_id%TYPE,
2464 p_role_orig_system IN wf_local_user_roles.role_orig_system%TYPE,
2465 p_role_orig_system_id IN wf_local_user_roles.role_orig_system_id%TYPE,
2466 p_start_date IN wf_local_user_roles.start_date%TYPE,
2467 p_expiration_date IN wf_local_user_roles.expiration_date%TYPE,
2468 p_security_group_id IN wf_local_user_roles.security_group_id%TYPE,
2469 x_return_status OUT NOCOPY VARCHAR2,
2470 x_return_message OUT NOCOPY VARCHAR2
2471 ) IS
2472
2473 -- -----------------------------------------------------------------
2474 -- Define local variables to be used.
2475 -- -----------------------------------------------------------------
2476 l_api_name CONSTANT VARCHAR2(30) := 'Update_Local_User_Role';
2477 l_api_version CONSTANT NUMBER := 1.0;
2478 l_return_message VARCHAR2(2000);
2479 l_message_count NUMBER(15);
2480 l_return_status VARCHAR2(30);
2481
2482 -- -----------------------------------------------------------------
2483 -- Define the cursors to be used in procedure.
2484 -- -----------------------------------------------------------------
2485
2486 BEGIN
2487 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
2488 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Update_Local_User_Role';
2489 l_debug_str := 'Role Name: '||p_role_name||','||' User Name: '||p_user_name||','||'Role Orig System: '||p_role_orig_system
2490 ||','||' Role Orig System ID: '||p_role_orig_system_id||'User Orig System: '||p_user_orig_system
2491 ||','||' User Orig System ID: '||p_user_orig_system_id;
2492 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
2493 END IF;
2494
2495 SAVEPOINT Update_Local_User_Roles_SP;
2496
2497 -- -----------------------------------------------------------------
2498 -- Check for the Compatible API call
2499 -- -----------------------------------------------------------------
2500 IF NOT FND_API.COMPATIBLE_API_CALL (l_api_version,
2501 p_api_version,
2502 l_api_name,
2503 g_pkg_name) THEN
2504 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2505 END IF;
2506
2507 -- -----------------------------------------------------------------
2508 -- If the calling program has passed the parameter for initializing
2509 -- the message list
2510 -- -----------------------------------------------------------------
2511 IF FND_API.TO_BOOLEAN (p_init_msg_list) THEN
2512 FND_MSG_PUB.INITIALIZE;
2513 END IF;
2514
2515 -- -----------------------------------------------------------------
2516 -- Set the return status to success
2517 -- -----------------------------------------------------------------
2518 x_return_status := FND_API.G_RET_STS_SUCCESS;
2519
2520 wf_local_synch.propagateUserRole(p_user_name => p_user_name,
2521 p_role_name => p_role_name,
2522 p_user_orig_system => p_user_orig_system,
2523 p_user_orig_system_id => p_user_orig_system_id,
2524 p_role_orig_system => p_role_orig_system,
2525 p_role_orig_system_id => p_role_orig_system_id,
2526 p_start_date => p_start_date,
2527 p_expiration_date => p_expiration_date
2528 );
2529
2530 -- -----------------------------------------------------------------
2531 -- Commit the transaction if requested to via parameter value.
2532 -- -----------------------------------------------------------------
2533 IF (FND_API.to_Boolean(p_commit)) THEN
2534 COMMIT;
2535 END IF;
2536
2537 -- -----------------------------------------------------------------
2538 -- Exception Block definition
2539 -- -----------------------------------------------------------------
2540 EXCEPTION
2541 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2542 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2543 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
2544 p_count => l_message_count,
2545 p_data => x_return_message);
2546 ROLLBACK TO Update_Local_User_Roles_SP;
2547
2548 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
2549 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Update_Local_User_Role.Ex_un';
2550 l_debug_str := 'Unhandled Exception: Role Name: '||p_role_name||','||' User Name: '||p_user_name||','||' Error Message: '||x_return_message;
2551 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
2552 END IF;
2553
2554 WHEN FND_API.G_EXC_ERROR THEN
2555 x_return_status := FND_API.G_RET_STS_ERROR;
2556
2557 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
2558 p_count => l_message_count,
2559 p_data => x_return_message);
2560 ROLLBACK TO Update_Local_User_Roles_SP;
2561
2562 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
2563 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Update_Local_User_Role.Ex_error';
2564 l_debug_str := 'Handled Exception: Role Name: '||p_role_name||','||' User Name: '||p_user_name||','||' Error Message: '||x_return_message;
2565 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
2566 END IF;
2567
2568 WHEN OTHERS THEN
2569 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2570 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
2571 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
2572 END IF;
2573 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
2574 p_count => l_message_count,
2575 p_data => x_return_message);
2576 ROLLBACK TO Update_Local_User_Roles_SP;
2577
2578 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
2579 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Update_Local_User_Role.Ex_others';
2580 l_debug_str := 'Other Exception: Role Name: '||p_role_name||','||' User Name: '||p_user_name||','||' Error Message: '||x_return_message;
2581 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
2582 END IF;
2583
2584 IF g_upgrade_mode = 'Y' THEN
2585 RAISE;
2586 END IF;
2587
2588 END Update_Local_User_Role;
2589
2590
2591 /******************************************************************
2592 Created By : Don Shellito
2593 Date Created By : April 23, 2003
2594 Purpose : The purpose of this procedure is to handle the
2595 updating of the grant information requested. There
2596 will be validations to ensure that the IDs provided
2597 have already been defined in the OSS data model.
2598 Remarks :
2599
2600 Change History
2601 Who When What
2602 ------------------------------------------------------------------------
2603 Don Shellito April 23, 2003 New Procedure Created.
2604
2605 ******************************************************************/
2606 PROCEDURE Update_Grant (p_api_version IN NUMBER,
2607 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
2608 p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE,
2609 p_grant_id IN igs_sc_grants.grant_id%TYPE,
2610 p_function_id IN igs_sc_grants.function_id%TYPE,
2611 p_user_group_id IN igs_sc_grants.user_group_id%TYPE,
2612 p_grant_name IN igs_sc_grants.grant_name%TYPE,
2613 p_grant_text IN igs_sc_grants.grant_text%TYPE,
2614 p_grant_select_flag IN igs_sc_grants.grant_select_flag%TYPE DEFAULT 'N',
2615 p_grant_insert_flag IN igs_sc_grants.grant_insert_flag%TYPE DEFAULT 'N',
2616 p_grant_update_flag IN igs_sc_grants.grant_update_flag%TYPE DEFAULT 'N',
2617 p_grant_delete_flag IN igs_sc_grants.grant_delete_flag%TYPE DEFAULT 'N',
2618 x_return_status OUT NOCOPY VARCHAR2,
2619 x_return_message OUT NOCOPY VARCHAR2
2620 ) IS
2621
2622 -- -----------------------------------------------------------------
2623 -- Define local variables to be used.
2624 -- -----------------------------------------------------------------
2625 l_api_name CONSTANT VARCHAR2(30) := 'Update_Grant';
2626 l_update_oper CONSTANT VARCHAR2(30) := 'UPDATE';
2627 l_api_version CONSTANT NUMBER := 1.0;
2628 l_return_message VARCHAR2(2000);
2629 l_message_count NUMBER(15);
2630 l_return_status VARCHAR2(30);
2631 l_grant_name igs_sc_grants.grant_name%TYPE;
2632 l_function_id igs_sc_grants.function_id%TYPE;
2633 l_grant_text igs_sc_grants.grant_text%TYPE;
2634 l_grant_select_flag igs_sc_grants.grant_select_flag%TYPE;
2635 l_grant_delete_flag igs_sc_grants.grant_delete_flag%TYPE;
2636 l_grant_update_flag igs_sc_grants.grant_update_flag%TYPE;
2637 l_grant_insert_flag igs_sc_grants.grant_insert_flag%TYPE;
2638 l_locked_flag igs_sc_grants.locked_flag%TYPE;
2639
2640 -- -----------------------------------------------------------------
2641 -- Define the cursors to be used in procedure.
2642 -- -----------------------------------------------------------------
2643 CURSOR c_get_grants_values IS
2644 SELECT grant_name,
2645 grant_text,
2646 function_id,
2647 grant_select_flag,
2648 grant_delete_flag,
2649 grant_update_flag,
2650 grant_insert_flag,
2651 locked_flag
2652 FROM igs_sc_grants
2653 WHERE grant_id = p_grant_id;
2654
2655 BEGIN
2656
2657 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
2658 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Update_Grant';
2659 l_debug_str := 'Grant ID: '||p_grant_id||','||'Role ID: '||','||p_user_group_id
2660 ||','||' Grant Name: '||p_grant_name||','||' Grant Text: '||p_grant_text||','||'Select Flag: '||p_grant_select_flag
2661 ||','||' Insert Flag: '||p_grant_insert_flag||','||' Update Flag: '||p_grant_update_flag||','||' Delete Flag: '||p_grant_delete_flag;
2662 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
2663 END IF;
2664
2665 SAVEPOINT Update_Grant_SP;
2666
2667 -- -----------------------------------------------------------------
2668 -- Check for the Compatible API call
2669 -- -----------------------------------------------------------------
2670 IF NOT FND_API.COMPATIBLE_API_CALL (l_api_version,
2671 p_api_version,
2672 l_api_name,
2673 g_pkg_name) THEN
2674 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2675 END IF;
2676
2677 -- -----------------------------------------------------------------
2678 -- If the calling program has passed the parameter for initializing
2679 -- the message list
2680 -- -----------------------------------------------------------------
2681 IF FND_API.TO_BOOLEAN (p_init_msg_list) THEN
2682 FND_MSG_PUB.INITIALIZE;
2683 END IF;
2684
2685 -- -----------------------------------------------------------------
2686 -- Set the return status to success
2687 -- -----------------------------------------------------------------
2688 x_return_status := FND_API.G_RET_STS_SUCCESS;
2689
2690 -- -----------------------------------------------------------------
2691 -- Obtain the previous values of the grants record.
2692 -- -----------------------------------------------------------------
2693 OPEN c_get_grants_values;
2694 FETCH c_get_grants_values
2695 INTO l_grant_name,
2696 l_grant_text,
2697 l_function_id,
2698 l_grant_select_flag,
2699 l_grant_delete_flag,
2700 l_grant_update_flag,
2701 l_grant_insert_flag,
2702 l_locked_flag;
2703
2704
2705
2706 IF (c_get_grants_values%NOTFOUND) THEN
2707 CLOSE c_get_grants_values; --mmkumar
2708 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_GRANT_NOT_FOUND');
2709 FND_MSG_PUB.Add;
2710 RAISE FND_API.G_EXC_ERROR;
2711 END IF;
2712
2713 IF (c_get_grants_values%ISOPEN) THEN
2714 CLOSE c_get_grants_values;
2715 END IF;
2716
2717 -- -----------------------------------------------------------------
2718 -- Determine if the function ID provided is a valid function ID.
2719 -- -----------------------------------------------------------------
2720 IF ((p_function_id IS NOT NULL) ) THEN
2721 l_function_id := Validate_Function_ID (p_function_id => p_function_id);
2722 IF (l_function_id <= 0) THEN
2723 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_INV_FUNC_FOR_GRNT');
2724 FND_MESSAGE.SET_TOKEN('GRANT_NAME', l_grant_name);
2725 FND_MSG_PUB.Add;
2726 RAISE FND_API.G_EXC_ERROR;
2727 END IF;
2728 END IF;
2729
2730 -- -----------------------------------------------------------------
2731 -- Ensure that the values provided are valid for the grants.
2732 -- -----------------------------------------------------------------
2733 Get_Valid_Grant_Vals (p_grant_select_flag => p_grant_select_flag,
2734 p_grant_insert_flag => p_grant_insert_flag,
2735 p_grant_delete_flag => p_grant_delete_flag,
2736 p_grant_update_flag => p_grant_update_flag,
2737 x_grant_select_flag => l_grant_select_flag,
2738 x_grant_insert_flag => l_grant_insert_flag,
2739 x_grant_delete_flag => l_grant_delete_flag,
2740 x_grant_update_flag => l_grant_update_flag
2741 );
2742
2743 -- -----------------------------------------------------------------
2744 -- Make sure that the locked flag has a correct value.
2745 -- -----------------------------------------------------------------
2746 IF (l_locked_flag = 'Y') THEN
2747 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_GRANT_LOCKED_NO_OPS');
2748 FND_MESSAGE.SET_TOKEN('OPS_TYPE', l_update_oper);
2749 FND_MESSAGE.SET_TOKEN('GRANT_NAME', l_grant_name);
2750 FND_MSG_PUB.Add;
2751 RAISE FND_API.G_EXC_ERROR;
2752 END IF;
2753
2754
2755
2756 -- -----------------------------------------------------------------
2757 -- Update the existing record
2758 -- -----------------------------------------------------------------
2759 UPDATE igs_sc_grants grts
2760 SET grts.grant_name = p_grant_name,
2761 grts.grant_text = p_grant_text,
2762 grts.function_id = l_function_id,
2763 grts.user_group_id = p_user_group_id,
2764 grts.grant_select_flag = l_grant_select_flag,
2765 grts.grant_delete_flag = l_grant_delete_flag,
2766 grts.grant_update_flag = l_grant_update_flag,
2767 grts.grant_insert_flag = l_grant_insert_flag,
2768 grts.last_updated_by = NVL(FND_GLOBAL.user_id,-1),
2769 grts.last_update_date = SYSDATE,
2770 grts.last_update_login = NVL(FND_GLOBAL.login_id, -1)
2771 WHERE grts.grant_id = p_grant_id;
2772
2773 -- -----------------------------------------------------------------
2774 -- Commit the transaction if requested to via parameter value.
2775 -- -----------------------------------------------------------------
2776 IF (FND_API.to_Boolean(p_commit)) THEN
2777 COMMIT;
2778 END IF;
2779
2780 -- -----------------------------------------------------------------
2781 -- Exception Block definition
2782 -- -----------------------------------------------------------------
2783 EXCEPTION
2784 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2785 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2786 IF (c_get_grants_values%ISOPEN) THEN
2787 CLOSE c_get_grants_values;
2788 END IF;
2789 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
2790 p_count => l_message_count,
2791 p_data => x_return_message);
2792 ROLLBACK TO Update_Grant_SP;
2793
2794 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
2795 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Update_Grant.Ex_error';
2796 l_debug_str := 'Handled Exception: Grant ID: '||p_grant_id||','||' Grant Name: '||p_grant_name||','||'Error Message: '||x_return_message;
2797 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
2798 END IF;
2799
2800 WHEN FND_API.G_EXC_ERROR THEN
2801 x_return_status := FND_API.G_RET_STS_ERROR;
2802
2803 IF (c_get_grants_values%ISOPEN) THEN
2804 CLOSE c_get_grants_values;
2805 END IF;
2806 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
2807 p_count => l_message_count,
2808 p_data => x_return_message);
2809 ROLLBACK TO Update_Grant_SP;
2810
2811 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
2812 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Update_Grant.Ex_un';
2813 l_debug_str := 'Unhandled Exception: Grant ID: '||p_grant_id||','||' Grant Name: '||p_grant_name||','||'Error Message: '||x_return_message;
2814 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
2815 END IF;
2816
2817 WHEN OTHERS THEN
2818 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2819 IF (c_get_grants_values%ISOPEN) THEN
2820 CLOSE c_get_grants_values;
2821 END IF;
2822 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
2823 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
2824 END IF;
2825 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
2826 p_count => l_message_count,
2827 p_data => x_return_message);
2828 ROLLBACK TO Update_Grant_SP;
2829
2830 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
2831 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Update_Grant.Ex_others';
2832 l_debug_str := 'Other Exception: Grant ID: '||p_grant_id||','||' Grant Name: '||p_grant_name||','||'Error Message: '||x_return_message;
2833 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
2834 END IF;
2835
2836 IF g_upgrade_mode = 'Y' THEN
2837 RAISE;
2838 END IF;
2839
2840 END Update_Grant;
2841
2842
2843 /******************************************************************
2844 Created By : Don Shellito
2845 Date Created By : April 23, 2003
2846 Purpose : The purpose of this procedure is to handle
2847 the updates on the igs_sc_grant_conds table.
2848 There are validations to ensure that the IDs
2849 provided are valid.
2850 Remarks :
2851
2852 Change History
2853 Who When What
2854 ------------------------------------------------------------------------
2855 Don Shellito April 23, 2003 New Procedure Created.
2856 mmkumar Jun 28, 2005 Removed code for opening cursor c_get_grant_cond
2857 prbhardw Jul 18, 2005 Modified code to update condition number
2858 ******************************************************************/
2859 PROCEDURE Update_Grant_Cond (p_api_version IN NUMBER,
2860 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
2861 p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE,
2862 p_grant_id IN igs_sc_grant_conds.grant_id%TYPE,
2863 p_obj_attrib_id IN igs_sc_grant_conds.obj_attrib_id%TYPE,
2864 p_user_attrib_id IN igs_sc_grant_conds.user_attrib_id%TYPE,
2865 p_condition IN igs_sc_grant_conds.condition%TYPE,
2866 p_text_value IN igs_sc_grant_conds.text_value%TYPE,
2867 p_grant_cond_num IN igs_sc_grant_conds.grant_cond_num%TYPE,
2868 p_old_grant_cond_num IN igs_sc_grant_conds.grant_cond_num%TYPE DEFAULT 0,
2869 x_return_status OUT NOCOPY VARCHAR2,
2870 x_return_message OUT NOCOPY VARCHAR2
2871 ) IS
2872
2873 -- -----------------------------------------------------------------
2874 -- Define local variables to be used.
2875 -- -----------------------------------------------------------------
2876 l_api_name CONSTANT VARCHAR2(30) := 'Update_Grant_Cond';
2877 l_update_oper CONSTANT VARCHAR2(30) := 'UPDATE';
2878 l_api_version CONSTANT NUMBER := 1.0;
2879 l_return_message VARCHAR2(2000);
2880 l_message_count NUMBER(15);
2881 l_return_status VARCHAR2(30);
2882 l_obj_attrib_id igs_sc_grant_conds.obj_attrib_id%TYPE;
2883 l_user_attrib_id igs_sc_grant_conds.user_attrib_id%TYPE;
2884 l_grant_name igs_sc_grants.grant_name%TYPE;
2885 l_old_grant_cond_num NUMBER;
2886
2887 -- -----------------------------------------------------------------
2888 -- Define the cursors to be used in procedure.
2889 -- -----------------------------------------------------------------
2890 CURSOR c_get_grant_cond IS
2891 SELECT cnds.obj_attrib_id,
2892 cnds.user_attrib_id
2893 FROM igs_sc_grant_conds cnds
2894 WHERE cnds.grant_id = p_grant_id
2895 AND cnds.grant_cond_num = p_grant_cond_num;
2896
2897 CURSOR c_get_grant_name IS
2898 SELECT grt.grant_name
2899 FROM igs_sc_grants grt
2900 WHERE grt.grant_id = p_grant_id;
2901
2902 BEGIN
2903
2904 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
2905 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Update_Grant_Cond';
2906 l_debug_str := 'Grant ID: '||p_grant_id||','||' Object Attribute ID: '||p_obj_attrib_id||','||'User Attribute ID: '||p_user_attrib_id
2907 ||','||'Condition: '||p_condition||','||' Text Value: '||p_text_value||','||'Grant Cond Number: '||p_grant_cond_num;
2908 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
2909 END IF;
2910
2911 SAVEPOINT Update_Grant_Cond_SP;
2912 IF p_old_grant_cond_num <> 0 THEN
2913 l_old_grant_cond_num := p_old_grant_cond_num;
2914 ELSE
2915 l_old_grant_cond_num := p_grant_cond_num;
2916 END IF;
2917
2918 -- -----------------------------------------------------------------
2919 -- Check for the Compatible API call
2920 -- -----------------------------------------------------------------
2921 IF NOT FND_API.COMPATIBLE_API_CALL (l_api_version,
2922 p_api_version,
2923 l_api_name,
2924 g_pkg_name) THEN
2925 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2926 END IF;
2927
2928 -- -----------------------------------------------------------------
2929 -- If the calling program has passed the parameter for initializing
2930 -- the message list
2931 -- -----------------------------------------------------------------
2932 IF FND_API.TO_BOOLEAN (p_init_msg_list) THEN
2933 FND_MSG_PUB.INITIALIZE;
2934 END IF;
2935
2936 -- -----------------------------------------------------------------
2937 -- Set the return status to success
2938 -- -----------------------------------------------------------------
2939 x_return_status := FND_API.G_RET_STS_SUCCESS;
2940
2941 -- -----------------------------------------------------------------
2942 -- Check to determine if the grant is locked or not. If not locked
2943 -- then the update to the condition can happen.
2944 -- -----------------------------------------------------------------
2945 IF (Is_Grant_Locked(p_grant_id) = 'Y') THEN
2946 OPEN c_get_grant_name;
2947 FETCH c_get_grant_name
2948 INTO l_grant_name;
2949
2950 CLOSE c_get_grant_name; --mmkumar
2951 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_GRANT_LOCKED_NO_OPS');
2952 FND_MESSAGE.SET_TOKEN('OPS_TYPE', l_update_oper);
2953 FND_MESSAGE.SET_TOKEN('GRANT_NAME', l_grant_name);
2954 FND_MSG_PUB.Add;
2955 RAISE FND_API.G_EXC_ERROR;
2956 END IF;
2957
2958
2959
2960
2961 -- -----------------------------------------------------------------
2962 -- Get the existing values for the record being updated.
2963 -- -----------------------------------------------------------------
2964 -- mmkumar, removed code where we were opening cursors c_get_grant_cond Bug : 4431768
2965
2966 -- -----------------------------------------------------------------
2967 -- Determine if the parameters given are valid to use for update.
2968 -- -----------------------------------------------------------------
2969 IF ((p_obj_attrib_id IS NOT NULL)) THEN
2970 l_obj_attrib_id := Validate_Obj_Attr_ID (p_obj_attr_id => p_obj_attrib_id);
2971 IF (l_obj_attrib_id <= 0) THEN
2972 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_INV_OBJ_ATTR');
2973 FND_MSG_PUB.Add;
2974 RAISE FND_API.G_EXC_ERROR;
2975 END IF;
2976 END IF;
2977
2978 IF ((p_user_attrib_id IS NOT NULL) ) THEN
2979 l_user_attrib_id := Validate_User_Attr_ID (p_user_attr_id => p_user_attrib_id);
2980 IF (l_user_attrib_id <= 0) THEN
2981 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_INV_USR_ATTR');
2982 FND_MSG_PUB.Add;
2983 RAISE FND_API.G_EXC_ERROR;
2984 END IF;
2985 END IF;
2986
2987
2988 -- -----------------------------------------------------------------
2989 -- Update the Grant Conditions record.
2990 -- -----------------------------------------------------------------
2991 UPDATE igs_sc_grant_conds cnds
2992 SET cnds.obj_attrib_id = l_obj_attrib_id,
2993 cnds.user_attrib_id = l_user_attrib_id,
2994 cnds.condition = p_condition,
2995 cnds.text_value = p_text_value,
2996 cnds.last_updated_by = NVL(FND_GLOBAL.user_id,-1),
2997 cnds.last_update_date = SYSDATE,
2998 cnds.last_update_login = NVL(FND_GLOBAL.login_id, -1),
2999 cnds.grant_cond_num = p_grant_cond_num
3000 WHERE cnds.grant_id = p_grant_id
3001 AND cnds.grant_cond_num = l_old_grant_cond_num;
3002
3003 -- -----------------------------------------------------------------
3004 -- Commit the transaction if requested to via parameter value.
3005 -- -----------------------------------------------------------------
3006 IF (FND_API.to_Boolean(p_commit)) THEN
3007 COMMIT;
3008 END IF;
3009
3010 -- -----------------------------------------------------------------
3011 -- Exception Block definition
3012 -- -----------------------------------------------------------------
3013 EXCEPTION
3014 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3015 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3016
3017 IF (c_get_grant_name%ISOPEN) THEN
3018 CLOSE c_get_grant_name;
3019 END IF;
3020 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
3021 p_count => l_message_count,
3022 p_data => x_return_message);
3023 ROLLBACK TO Update_Grant_Cond_SP;
3024
3025 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
3026 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Update_Grant_Cond.Ex_un';
3027 l_debug_str := 'Unhandled Exception: Grant ID: '||p_grant_id||','||' Condtion Number: '||p_grant_cond_num||','||'Error Message: '||x_return_message;
3028 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
3029 END IF;
3030
3031 WHEN FND_API.G_EXC_ERROR THEN
3032 x_return_status := FND_API.G_RET_STS_ERROR;
3033
3034 IF (c_get_grant_name%ISOPEN) THEN
3035 CLOSE c_get_grant_name;
3036 END IF;
3037 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
3038 p_count => l_message_count,
3039 p_data => x_return_message);
3040 ROLLBACK TO Update_Grant_Cond_SP;
3041
3042 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
3043 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Update_Grant_Cond.Ex_error';
3044 l_debug_str := 'Handled Exception: Grant ID: '||p_grant_id||','||' Condtion Number: '||p_grant_cond_num||','||'Error Message: '||x_return_message;
3045 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
3046 END IF;
3047
3048 WHEN OTHERS THEN
3049 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3050 IF (c_get_grant_name%ISOPEN) THEN
3051 CLOSE c_get_grant_name;
3052 END IF;
3053 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
3054 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
3055 END IF;
3056 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
3057 p_count => l_message_count,
3058 p_data => x_return_message);
3059 ROLLBACK TO Update_Grant_Cond_SP;
3060
3061 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
3062 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Update_Grant_Cond.Ex_others';
3063 l_debug_str := 'Other Exception: Grant ID: '||p_grant_id||','||' Condtion Number: '||p_grant_cond_num||','||'Error Message: '||x_return_message;
3064 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
3065 END IF;
3066
3067 IF g_upgrade_mode = 'Y' THEN
3068 RAISE;
3069 END IF;
3070
3071 END Update_Grant_Cond;
3072
3073
3074 /******************************************************************
3075 Created By : Don Shellito
3076 Date Created By : April 23, 2003
3077 Purpose : The purpose of this procedure is to handle
3078 the updating of the igs_sc_obj_groups records.
3079 There is validation on the IDs given and ensure
3080 that the appropriate values are updated.
3081 Remarks :
3082
3083 Change History
3084 Who When What
3085 ------------------------------------------------------------------------
3086 Don Shellito April 23, 2003 New Procedure Created.
3087
3088 ******************************************************************/
3089 PROCEDURE Update_Object_Group (p_api_version IN NUMBER,
3090 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
3091 p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE,
3092 p_obj_group_id IN igs_sc_obj_groups.obj_group_id%TYPE,
3093 p_obj_group_name IN igs_sc_obj_groups.obj_group_name%TYPE ,
3094 p_default_policy_type IN igs_sc_obj_groups.default_policy_type%TYPE,
3095 x_return_status OUT NOCOPY VARCHAR2,
3096 x_return_message OUT NOCOPY VARCHAR2
3097 ) IS
3098
3099 -- -----------------------------------------------------------------
3100 -- Define local variables to be used.
3101 -- -----------------------------------------------------------------
3102 l_api_name CONSTANT VARCHAR2(30) := 'Update_Object_Group';
3103 l_update_oper CONSTANT VARCHAR2(30) := 'UPDATE';
3104 l_api_version CONSTANT NUMBER := 1.0;
3105 l_return_message VARCHAR2(2000);
3106 l_message_count NUMBER(15);
3107 l_return_status VARCHAR2(30);
3108 l_obj_group_name igs_sc_obj_groups.obj_group_name%TYPE;
3109 l_default_policy_type igs_sc_obj_groups.default_policy_type%TYPE;
3110 l_grant_name igs_sc_grants.grant_name%TYPE;
3111 l_grant_id igs_sc_grants.grant_id%TYPE;
3112
3113 -- -----------------------------------------------------------------
3114 -- Define the cursors to be used in procedure.
3115 -- -----------------------------------------------------------------
3116 CURSOR c_get_obj_group IS
3117 SELECT grps.obj_group_name,
3118 grps.default_policy_type
3119 FROM igs_sc_obj_groups grps
3120 WHERE grps.obj_group_id = p_obj_group_id;
3121
3122 CURSOR c_get_grant_name IS
3123 SELECT grt.grant_name
3124 FROM igs_sc_grants grt
3125 WHERE grt.grant_id = l_grant_id;
3126
3127 CURSOR c_get_grants IS
3128 SELECT grt.grant_id,
3129 grt.grant_name
3130 FROM igs_sc_grants grt
3131 WHERE grt.obj_group_id = p_obj_group_id;
3132
3133 BEGIN
3134
3135 SAVEPOINT Update_Object_Group_SP;
3136
3137 -- -----------------------------------------------------------------
3138 -- Check for the Compatible API call
3139 -- -----------------------------------------------------------------
3140 IF NOT FND_API.COMPATIBLE_API_CALL (l_api_version,
3141 p_api_version,
3142 l_api_name,
3143 g_pkg_name) THEN
3144 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3145 END IF;
3146
3147 -- -----------------------------------------------------------------
3148 -- If the calling program has passed the parameter for initializing
3149 -- the message list
3150 -- -----------------------------------------------------------------
3151 IF FND_API.TO_BOOLEAN (p_init_msg_list) THEN
3152 FND_MSG_PUB.INITIALIZE;
3153 END IF;
3154
3155 -- -----------------------------------------------------------------
3156 -- Set the return status to success
3157 -- -----------------------------------------------------------------
3158 x_return_status := FND_API.G_RET_STS_SUCCESS;
3159
3160 -- -----------------------------------------------------------------
3161 -- Check if admin mode is enabled
3162 -- -----------------------------------------------------------------
3163 -- -----------------------------------------------------------------
3164 -- Obtain the latest values for the object group being updated.
3165 -- -----------------------------------------------------------------
3166 OPEN c_get_obj_group;
3167 FETCH c_get_obj_group
3168 INTO l_obj_group_name,
3169 l_default_policy_type;
3170
3171 IF (c_get_obj_group%NOTFOUND) THEN
3172 CLOSE c_get_obj_group; --mmkumar
3173 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_OBJ_GRP_NOT_FOUND');
3174 FND_MSG_PUB.Add;
3175 RAISE FND_API.G_EXC_ERROR;
3176 END IF;
3177
3178 -- -----------------------------------------------------------------
3179 -- Check values being updated.
3180 -- -----------------------------------------------------------------
3181 IF ((p_default_policy_type IS NOT NULL) ) THEN
3182 l_default_policy_type := p_default_policy_type;
3183 END IF;
3184
3185 IF ((p_obj_group_name IS NOT NULL) ) THEN
3186 l_obj_group_name := p_obj_group_name;
3187 END IF;
3188
3189 IF (c_get_obj_group%ISOPEN) THEN
3190 CLOSE c_get_obj_group;
3191 END IF;
3192
3193
3194
3195 -- -----------------------------------------------------------------
3196 -- Ensure that the default policy value is valid.
3197 -- -----------------------------------------------------------------
3198 IF (l_default_policy_type NOT IN ('G', 'R')) THEN
3199 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_INV_DEF_POLICY_TYPE');
3200 FND_MESSAGE.SET_TOKEN('DEFAULT_POLICY', l_default_policy_type);
3201 FND_MSG_PUB.Add;
3202 RAISE FND_API.G_EXC_ERROR;
3203 END IF;
3204
3205 -- -----------------------------------------------------------------
3206 -- Update the object groups information for the group ID given.
3207 -- -----------------------------------------------------------------
3208 IF IGS_SC_GRANTS_PVT.admin_mode <> 'Y' AND g_upgrade_mode <> 'Y' THEN
3209
3210 UPDATE igs_sc_obj_groups objs
3211 SET objs.default_policy_type = l_default_policy_type,
3212 objs.last_updated_by = NVL(FND_GLOBAL.user_id,-1),
3213 objs.last_update_date = SYSDATE,
3214 objs.last_update_login = NVL(FND_GLOBAL.login_id, -1)
3215 WHERE objs.obj_group_id = p_obj_group_id;
3216
3217 ELSE
3218
3219 UPDATE igs_sc_obj_groups objs
3220 SET objs.obj_group_name = l_obj_group_name,
3221 objs.default_policy_type = l_default_policy_type,
3222 objs.last_updated_by = NVL(FND_GLOBAL.user_id,-1),
3223 objs.last_update_date = SYSDATE,
3224 objs.last_update_login = NVL(FND_GLOBAL.login_id, -1)
3225 WHERE objs.obj_group_id = p_obj_group_id;
3226
3227 END IF;
3228
3229 -- -----------------------------------------------------------------
3230 -- Commit the transaction if requested to via parameter value.
3231 -- -----------------------------------------------------------------
3232 IF (FND_API.to_Boolean(p_commit)) THEN
3233 COMMIT;
3234 END IF;
3235
3236 -- -----------------------------------------------------------------
3237 -- Exception Block definition
3238 -- -----------------------------------------------------------------
3239 EXCEPTION
3240 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3241 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3242 IF (c_get_obj_group%ISOPEN) THEN
3243 CLOSE c_get_obj_group;
3244 END IF;
3245 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
3246 p_count => l_message_count,
3247 p_data => x_return_message);
3248 ROLLBACK TO Update_Object_Group_SP;
3249
3250 WHEN FND_API.G_EXC_ERROR THEN
3251 x_return_status := FND_API.G_RET_STS_ERROR;
3252
3253 IF (c_get_obj_group%ISOPEN) THEN
3254 CLOSE c_get_obj_group;
3255 END IF;
3256 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
3257 p_count => l_message_count,
3258 p_data => x_return_message);
3259 ROLLBACK TO Update_Object_Group_SP;
3260
3261 WHEN OTHERS THEN
3262 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3263 IF (c_get_obj_group%ISOPEN) THEN
3264 CLOSE c_get_obj_group;
3265 END IF;
3266 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
3267 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
3268 END IF;
3269 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
3270 p_count => l_message_count,
3271 p_data => x_return_message);
3272 ROLLBACK TO Update_Object_Group_SP;
3273 IF g_upgrade_mode = 'Y' THEN
3274 RAISE;
3275 END IF;
3276
3277 END Update_Object_Group;
3278
3279
3280 /******************************************************************
3281 Created By : Don Shellito
3282 Date Created By : April 23, 2003
3283 Purpose : The purpose of this procedure is to ensure that
3284 the updates made to igs_sc_obj_att_mths is perform
3285 with the proper validation. The IDs are validated
3286 to ensure they exist in the OSS data model.
3287 Remarks :
3288
3289 Change History
3290 Who When What
3291 ------------------------------------------------------------------------
3292 Don Shellito April 23, 2003 New Procedure Created.
3293
3294 ******************************************************************/
3295 PROCEDURE Update_Object_Attr_Method (p_api_version IN NUMBER,
3296 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
3297 p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE,
3298 p_object_id IN igs_sc_obj_att_mths.object_id%TYPE,
3299 p_obj_attrib_id IN igs_sc_obj_att_mths.obj_attrib_id%TYPE,
3300 p_obj_attrib_type IN igs_sc_obj_att_mths.obj_attrib_type%TYPE,
3301 p_static_type IN igs_sc_obj_att_mths.static_type%TYPE,
3302 p_select_text IN igs_sc_obj_att_mths.select_text%TYPE,
3303 p_null_allow_flag IN VARCHAR2 DEFAULT 'N',
3304 p_call_from_lct IN VARCHAR2 DEFAULT 'N',
3305 x_return_status OUT NOCOPY VARCHAR2,
3306 x_return_message OUT NOCOPY VARCHAR2
3307 ) IS
3308
3309 -- -----------------------------------------------------------------
3310 -- Define local variables to be used.
3311 -- -----------------------------------------------------------------
3312 l_api_name CONSTANT VARCHAR2(30) := 'Update_Object_Attr_Method';
3313 l_update_oper CONSTANT VARCHAR2(30) := 'UPDATE';
3314 l_api_version CONSTANT NUMBER := 1.0;
3315 l_return_message VARCHAR2(2000);
3316 l_message_count NUMBER(15);
3317 l_return_status VARCHAR2(30);
3318 l_obj_attrib_type igs_sc_obj_att_mths.obj_attrib_type%TYPE;
3319 l_static_type igs_sc_obj_att_mths.static_type%TYPE;
3320 l_select_text igs_sc_obj_att_mths.select_text%TYPE;
3321 l_grant_id igs_sc_grants.grant_id%TYPE;
3322 l_grant_name igs_sc_grants.grant_name%TYPE;
3323 l_object_name fnd_objects.database_object_name%TYPE;
3324
3325
3326 -- -----------------------------------------------------------------
3327 -- Define the cursors to be used in procedure.
3328 -- -----------------------------------------------------------------
3329 CURSOR c_get_obj_mthd IS
3330 SELECT mthd.obj_attrib_type,
3331 mthd.static_type,
3332 mthd.select_text
3333 FROM igs_sc_obj_att_mths mthd
3334 WHERE mthd.object_id = p_object_id
3335 AND mthd.obj_attrib_id = p_obj_attrib_id;
3336
3337 CURSOR c_get_grant_info IS
3338 SELECT cond.grant_id,
3339 grt.grant_name
3340 FROM igs_sc_grant_conds cond,
3341 igs_sc_grants grt
3342 WHERE cond.obj_attrib_id = p_obj_attrib_id
3343 AND grt.grant_id = cond.grant_id;
3344
3345 BEGIN
3346
3347 SAVEPOINT Update_Object_Attr_Method_SP;
3348
3349 -- -----------------------------------------------------------------
3350 -- Check for the Compatible API call
3351 -- -----------------------------------------------------------------
3352 IF NOT FND_API.COMPATIBLE_API_CALL (l_api_version,
3353 p_api_version,
3354 l_api_name,
3355 g_pkg_name) THEN
3356 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3357 END IF;
3358
3359 -- -----------------------------------------------------------------
3360 -- If the calling program has passed the parameter for initializing
3361 -- the message list
3362 -- -----------------------------------------------------------------
3363 IF FND_API.TO_BOOLEAN (p_init_msg_list) THEN
3364 FND_MSG_PUB.INITIALIZE;
3365 END IF;
3366
3367 -- -----------------------------------------------------------------
3368 -- Set the return status to success
3369 -- -----------------------------------------------------------------
3370 x_return_status := FND_API.G_RET_STS_SUCCESS;
3371
3372
3373 -- -----------------------------------------------------------------
3374 -- Check if admin mode is enabled
3375 -- -----------------------------------------------------------------
3376 IF IGS_SC_GRANTS_PVT.admin_mode <> 'Y' AND g_upgrade_mode <> 'Y' THEN
3377
3378 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_ADMIN_MODE_OFF');
3379 FND_MSG_PUB.Add;
3380 RAISE FND_API.G_EXC_ERROR;
3381
3382 END IF;
3383 -- -----------------------------------------------------------------
3384 -- Determine if there is a grant associated to the user attribute so
3385 -- that the check on lock can be performed.
3386 -- -----------------------------------------------------------------
3387 OPEN c_get_grant_info;
3388 FETCH c_get_grant_info
3389 INTO l_grant_id,
3390 l_grant_name;
3391
3392 WHILE (c_get_grant_info%FOUND) LOOP
3393
3394 -- -----------------------------------------------------------------
3395 -- Check to determine if the grant is locked or not. If not locked
3396 -- then the update to the condition can happen.
3397 -- -----------------------------------------------------------------
3398 IF (Is_Grant_Locked(l_grant_id) = 'Y') THEN
3399 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_GRANT_LOCKED_NO_OPS');
3400 FND_MESSAGE.SET_TOKEN('OPS_TYPE', l_update_oper);
3401 FND_MESSAGE.SET_TOKEN('GRANT_NAME', l_grant_name);
3402 FND_MSG_PUB.Add;
3403 RAISE FND_API.G_EXC_ERROR;
3404 END IF;
3405
3406 FETCH c_get_grant_info
3407 INTO l_grant_id,
3408 l_grant_name;
3409
3410 END LOOP;
3411
3412 CLOSE c_get_grant_info;
3413
3414 -- -----------------------------------------------------------------
3415 -- Obtain the previous values of the object method before update
3416 -- -----------------------------------------------------------------
3417 OPEN c_get_obj_mthd;
3418 FETCH c_get_obj_mthd
3419 INTO l_obj_attrib_type,
3420 l_static_type,
3421 l_select_text;
3422
3423 IF (c_get_obj_mthd%NOTFOUND) THEN
3424
3425 -- Call Insert instead
3426 Insert_Object_Attr_Method (p_api_version => p_api_version,
3427 p_init_msg_list => p_init_msg_list,
3428 p_commit => p_commit,
3429 p_object_id => p_object_id,
3430 p_obj_attrib_id => p_obj_attrib_id,
3431 p_obj_attrib_type => p_obj_attrib_type,
3432 p_static_type => p_static_type,
3433 p_select_text => p_select_text,
3434 p_null_allow_flag=> p_null_allow_flag,
3435 x_return_status => x_return_status,
3436 x_return_message => x_return_message );
3437 return;
3438
3439
3440 /* FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_OBJ_MTHD_NOT_FOUND');
3441 FND_MSG_PUB.Add;
3442 RAISE FND_API.G_EXC_ERROR;
3443 */
3444 END IF;
3445
3446 -- -----------------------------------------------------------------
3447 -- Validate the information that is to be updated.
3448 -- -----------------------------------------------------------------
3449 IF ((p_obj_attrib_type IS NOT NULL) ) THEN
3450 l_obj_attrib_type := Validate_Obj_Attr_type (p_obj_att_type => p_obj_attrib_type);
3451 IF (l_obj_attrib_type IS NULL) THEN
3452 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_INV_OBJ_ATTR_TYPE');
3453 FND_MSG_PUB.Add;
3454 RAISE FND_API.G_EXC_ERROR;
3455 END IF;
3456 END IF;
3457
3458 IF ((p_static_type IS NOT NULL) ) THEN
3459 l_static_type := Validate_Static_Type (p_static_type => p_static_type);
3460 IF (l_static_type IS NULL) THEN
3461 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_INV_STATIC_TYPE');
3462 FND_MSG_PUB.Add;
3463 RAISE FND_API.G_EXC_ERROR;
3464 END IF;
3465 END IF;
3466
3467 IF ((p_select_text is NOT NULL) ) THEN
3468 l_select_text := p_select_text;
3469 END IF;
3470
3471 CLOSE c_get_obj_mthd;
3472
3473 -- -----------------------------------------------------------------
3474 -- Update the Object Attribute Methods.
3475 -- -----------------------------------------------------------------
3476 IF P_CALL_FROM_LCT <> 'Y' THEN
3477 OPEN c_table_name(p_object_id);
3478 FETCH c_table_name INTO l_object_name;
3479 CLOSE c_table_name;
3480 IF NOT check_attrib_text ( l_object_name, l_select_text,l_obj_attrib_type) THEN
3481 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_GRNT_TXT_ERR');
3482 FND_MESSAGE.SET_TOKEN('OBJ_NAME',l_object_name);
3483 FND_MESSAGE.SET_TOKEN('GRNT_TEXT', p_select_text);
3484 FND_MSG_PUB.Add;
3485 RAISE FND_API.G_EXC_ERROR;
3486 END IF;
3487 END IF;
3488
3489
3490 UPDATE igs_sc_obj_att_mths mthd
3491 SET mthd.obj_attrib_type = l_obj_attrib_type,
3492 mthd.static_type = l_static_type,
3493 mthd.select_text = l_select_text,
3494 mthd.last_updated_by = NVL(FND_GLOBAL.user_id,-1),
3495 mthd.last_update_date = SYSDATE,
3496 mthd.last_update_login = NVL(FND_GLOBAL.login_id, -1),
3497 mthd.null_allow_flag = p_null_allow_flag
3498 WHERE mthd.object_id = p_object_id
3499 AND mthd.obj_attrib_id = p_obj_attrib_id;
3500
3501 -- -----------------------------------------------------------------
3502 -- Commit the transaction if requested to via parameter value.
3503 -- -----------------------------------------------------------------
3504 IF (FND_API.to_Boolean(p_commit)) THEN
3505 COMMIT;
3506 END IF;
3507
3508 -- -----------------------------------------------------------------
3509 -- Exception Block definition
3510 -- -----------------------------------------------------------------
3511 EXCEPTION
3512 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3513 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3514 IF (c_get_obj_mthd%ISOPEN) THEN
3515 CLOSE c_get_obj_mthd;
3516 END IF;
3517 IF (c_get_grant_info%ISOPEN) THEN
3518 CLOSE c_get_grant_info;
3519 END IF;
3520 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
3521 p_count => l_message_count,
3522 p_data => x_return_message);
3523 ROLLBACK TO Update_Object_Attr_Method_SP;
3524
3525 WHEN FND_API.G_EXC_ERROR THEN
3526 x_return_status := FND_API.G_RET_STS_ERROR;
3527
3528 IF (c_get_obj_mthd%ISOPEN) THEN
3529 CLOSE c_get_obj_mthd;
3530 END IF;
3531 IF (c_get_grant_info%ISOPEN) THEN
3532 CLOSE c_get_grant_info;
3533 END IF;
3534 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
3535 p_count => l_message_count,
3536 p_data => x_return_message);
3537 ROLLBACK TO Update_Object_Attr_Method_SP;
3538
3539 WHEN OTHERS THEN
3540 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3541 IF (c_get_obj_mthd%ISOPEN) THEN
3542 CLOSE c_get_obj_mthd;
3543 END IF;
3544 IF (c_get_grant_info%ISOPEN) THEN
3545 CLOSE c_get_grant_info;
3546 END IF;
3547 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
3548 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
3549 END IF;
3550 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
3551 p_count => l_message_count,
3552 p_data => x_return_message);
3553 ROLLBACK TO Update_Object_Attr_Method_SP;
3554 IF g_upgrade_mode = 'Y' THEN
3555 RAISE;
3556 END IF;
3557
3558 END Update_Object_Attr_Method;
3559
3560
3561 /******************************************************************
3562 Created By : Don Shellito
3563 Date Created By : April 23, 2003
3564 Purpose : This procedure is designed for the updates
3565 to be made to the table igs_sc_obj_functns.
3566 There are validations performed on the IDs that
3567 are provided to ensure they exist in the OSS
3568 data model.
3569 Remarks :
3570
3571 Change History
3572 Who When What
3573 ------------------------------------------------------------------------
3574 Don Shellito April 23, 2003 New Procedure Created.
3575
3576 ******************************************************************/
3577 PROCEDURE Update_Object_Func (p_api_version IN NUMBER,
3578 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
3579 p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE,
3580 p_function_id IN igs_sc_obj_functns.function_id%TYPE,
3581 p_obj_group_id IN igs_sc_obj_functns.obj_group_id%TYPE,
3582 p_function_name IN igs_sc_obj_functns.function_name%TYPE,
3583 x_return_status OUT NOCOPY VARCHAR2,
3584 x_return_message OUT NOCOPY VARCHAR2
3585 ) IS
3586
3587 -- -----------------------------------------------------------------
3588 -- Define local variables to be used.
3589 -- -----------------------------------------------------------------
3590 l_api_name CONSTANT VARCHAR2(30) := 'Update_Object_Func';
3591 l_api_version CONSTANT NUMBER := 1.0;
3592 l_update_oper CONSTANT VARCHAR2(30) := 'UPDATE';
3593 l_return_message VARCHAR2(2000);
3594 l_message_count NUMBER(15);
3595 l_return_status VARCHAR2(30);
3596 l_obj_group_id igs_sc_obj_functns.obj_group_id%TYPE;
3597 l_function_name igs_sc_obj_functns.function_name%TYPE;
3598 l_grant_id igs_sc_grants.grant_id%TYPE;
3599 l_grant_name igs_sc_grants.grant_name%TYPE;
3600
3601 -- -----------------------------------------------------------------
3602 -- Define the cursors to be used in procedure.
3603 -- -----------------------------------------------------------------
3604 CURSOR c_get_func_values IS
3605 SELECT fnc.obj_group_id,
3606 fnc.function_name
3607 FROM igs_sc_obj_functns fnc
3608 WHERE fnc.function_id = p_function_id;
3609
3610 CURSOR c_get_grants IS
3611 SELECT grt.grant_id,
3612 grt.grant_name
3613 FROM igs_sc_grants grt
3614 WHERE grt.function_id = p_function_id;
3615
3616 BEGIN
3617
3618 SAVEPOINT Update_Object_Func_SP;
3619
3620 -- -----------------------------------------------------------------
3621 -- Check for the Compatible API call
3622 -- -----------------------------------------------------------------
3623 IF NOT FND_API.COMPATIBLE_API_CALL (l_api_version,
3624 p_api_version,
3625 l_api_name,
3626 g_pkg_name) THEN
3627 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3628 END IF;
3629
3630 -- -----------------------------------------------------------------
3631 -- If the calling program has passed the parameter for initializing
3632 -- the message list
3633 -- -----------------------------------------------------------------
3634 IF FND_API.TO_BOOLEAN (p_init_msg_list) THEN
3635 FND_MSG_PUB.INITIALIZE;
3636 END IF;
3637
3638 -- -----------------------------------------------------------------
3639 -- Set the return status to success
3640 -- -----------------------------------------------------------------
3641 x_return_status := FND_API.G_RET_STS_SUCCESS;
3642
3643 -- -----------------------------------------------------------------
3644 -- Check if admin mode is enabled
3645 -- -----------------------------------------------------------------
3646 IF IGS_SC_GRANTS_PVT.admin_mode <> 'Y' AND g_upgrade_mode <> 'Y' THEN
3647
3648 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_ADMIN_MODE_OFF');
3649 FND_MSG_PUB.Add;
3650 RAISE FND_API.G_EXC_ERROR;
3651
3652 END IF;
3653 -- -----------------------------------------------------------------
3654 -- Ensure that there are no locked grants against the function that
3655 -- is being updated.
3656 -- -----------------------------------------------------------------
3657 OPEN c_get_grants;
3658 FETCH c_get_grants
3659 INTO l_grant_id,
3660 l_grant_name;
3661
3662 WHILE (c_get_grants%FOUND) LOOP
3663
3664 IF (Is_Grant_Locked(l_grant_id) = 'Y') THEN
3665 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_GRANT_LOCKED_NO_OPS');
3666 FND_MESSAGE.SET_TOKEN('OPS_TYPE', l_update_oper);
3667 FND_MESSAGE.SET_TOKEN('GRANT_NAME', l_grant_name);
3668 FND_MSG_PUB.Add;
3669 RAISE FND_API.G_EXC_ERROR;
3670 END IF;
3671
3672 FETCH c_get_grants
3673 INTO l_grant_id,
3674 l_grant_name;
3675
3676 END LOOP;
3677
3678 -- -----------------------------------------------------------------
3679 -- Obtain the previous function ID values.
3680 -- -----------------------------------------------------------------
3681 OPEN c_get_func_values;
3682 FETCH c_get_func_values
3683 INTO l_obj_group_id,
3684 l_function_name;
3685
3686 IF (c_get_func_values%NOTFOUND) THEN
3687 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_OBJ_FUNC_NOT_FOUND');
3688 FND_MSG_PUB.Add;
3689 RAISE FND_API.G_EXC_ERROR;
3690 END IF;
3691
3692 CLOSE c_get_func_values;
3693
3694 -- -----------------------------------------------------------------
3695 -- Update the object function values received.
3696 -- -----------------------------------------------------------------
3697 UPDATE igs_sc_obj_functns fnct
3698 SET fnct.function_name = p_function_name,
3699 fnct.last_updated_by = NVL(FND_GLOBAL.user_id,-1),
3700 fnct.last_update_date = SYSDATE,
3701 fnct.last_update_login = NVL(FND_GLOBAL.login_id, -1)
3702 WHERE fnct.function_id = p_function_id;
3703
3704 -- -----------------------------------------------------------------
3705 -- Commit the transaction if requested to via parameter value.
3706 -- -----------------------------------------------------------------
3707 IF (FND_API.to_Boolean(p_commit)) THEN
3708 COMMIT;
3709 END IF;
3710
3711 -- -----------------------------------------------------------------
3712 -- Exception Block definition
3713 -- -----------------------------------------------------------------
3714 EXCEPTION
3715 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3716 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3717 IF (c_get_func_values%ISOPEN) THEN
3718 CLOSE c_get_func_values;
3719 END IF;
3720 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
3721 p_count => l_message_count,
3722 p_data => x_return_message);
3723 ROLLBACK TO Update_Object_Func_SP;
3724
3725 WHEN FND_API.G_EXC_ERROR THEN
3726 x_return_status := FND_API.G_RET_STS_ERROR;
3727
3728 IF (c_get_func_values%ISOPEN) THEN
3729 CLOSE c_get_func_values;
3730 END IF;
3731 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
3732 p_count => l_message_count,
3733 p_data => x_return_message);
3734 ROLLBACK TO Update_Object_Func_SP;
3735
3736 WHEN OTHERS THEN
3737 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3738 IF (c_get_func_values%ISOPEN) THEN
3739 CLOSE c_get_func_values;
3740 END IF;
3741 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
3742 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
3743 END IF;
3744 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
3745 p_count => l_message_count,
3746 p_data => x_return_message);
3747 ROLLBACK TO Update_Object_Func_SP;
3748 IF g_upgrade_mode = 'Y' THEN
3749 RAISE;
3750 END IF;
3751
3752 END Update_Object_Func;
3753
3754
3755 /******************************************************************
3756 Created By : Don Shellito
3757 Date Created By : April 23, 2003
3758 Purpose : The purpose of this procedure is for the updates
3759 to be made to data present in igs_sc_obj_attribs.
3760 The IDs that are provided are validated to ensure
3761 data present in the OSS data model.
3762 Remarks :
3763
3764 Change History
3765 Who When What
3766 ------------------------------------------------------------------------
3767 Don Shellito April 23, 2003 New Procedure Created.
3768
3769 ******************************************************************/
3770 PROCEDURE Update_Object_Attr (p_api_version IN NUMBER,
3771 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
3772 p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE,
3773 p_obj_attrib_id IN igs_sc_obj_attribs.obj_attrib_id%TYPE,
3774 p_obj_group_id IN igs_sc_obj_attribs.obj_group_id%TYPE,
3775 p_obj_attrib_name IN igs_sc_obj_attribs.obj_attrib_name%TYPE,
3776 p_active_flag IN VARCHAR2 DEFAULT 'Y',
3777 x_return_status OUT NOCOPY VARCHAR2,
3778 x_return_message OUT NOCOPY VARCHAR2
3779 ) IS
3780
3781 -- -----------------------------------------------------------------
3782 -- Define local variables to be used.
3783 -- -----------------------------------------------------------------
3784 l_api_name CONSTANT VARCHAR2(30) := 'Update_Object_Attr';
3785 l_update_oper CONSTANT VARCHAR2(30) := 'UPDATE';
3786 l_api_version CONSTANT NUMBER := 1.0;
3787 l_return_message VARCHAR2(2000);
3788 l_message_count NUMBER(15);
3789 l_return_status VARCHAR2(30);
3790 l_obj_group_id igs_sc_obj_attribs.obj_group_id%TYPE;
3791 l_obj_attrib_name igs_sc_obj_attribs.obj_attrib_name%TYPE;
3792 l_grant_id igs_sc_grant_conds.grant_id%TYPE;
3793 l_grant_name igs_sc_grants.grant_name%TYPE;
3794
3795 -- -----------------------------------------------------------------
3796 -- Define the cursors to be used in procedure.
3797 -- -----------------------------------------------------------------
3798 CURSOR c_get_obj_attrib IS
3799 SELECT attr.obj_group_id,
3800 attr.obj_attrib_name
3801 FROM igs_sc_obj_attribs attr
3802 WHERE attr.obj_attrib_id = p_obj_attrib_id;
3803
3804 CURSOR c_get_grant_info IS
3805 SELECT cond.grant_id,
3806 grt.grant_name
3807 FROM igs_sc_grant_conds cond,
3808 igs_sc_grants grt
3809 WHERE cond.obj_attrib_id = p_obj_attrib_id
3810 AND grt.grant_id = cond.grant_id;
3811
3812 BEGIN
3813
3814 SAVEPOINT Update_Object_Attr_SP;
3815
3816 -- -----------------------------------------------------------------
3817 -- Check for the Compatible API call
3818 -- -----------------------------------------------------------------
3819 IF NOT FND_API.COMPATIBLE_API_CALL (l_api_version,
3820 p_api_version,
3821 l_api_name,
3822 g_pkg_name) THEN
3823 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3824 END IF;
3825
3826 -- -----------------------------------------------------------------
3827 -- If the calling program has passed the parameter for initializing
3828 -- the message list
3829 -- -----------------------------------------------------------------
3830 IF FND_API.TO_BOOLEAN (p_init_msg_list) THEN
3831 FND_MSG_PUB.INITIALIZE;
3832 END IF;
3833
3834 -- -----------------------------------------------------------------
3835 -- Set the return status to success
3836 -- -----------------------------------------------------------------
3837 x_return_status := FND_API.G_RET_STS_SUCCESS;
3838
3839 -- -----------------------------------------------------------------
3840 -- Check if admin mode is enabled
3841 -- -----------------------------------------------------------------
3842 IF IGS_SC_GRANTS_PVT.admin_mode <> 'Y' AND g_upgrade_mode <> 'Y' THEN
3843
3844 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_ADMIN_MODE_OFF');
3845 FND_MSG_PUB.Add;
3846 RAISE FND_API.G_EXC_ERROR;
3847
3848 END IF;
3849
3850 -- -----------------------------------------------------------------
3851 -- Determine if there is a grant associated to the user attribute so
3852 -- that the check on lock can be performed.
3853 -- -----------------------------------------------------------------
3854 OPEN c_get_grant_info;
3855 FETCH c_get_grant_info
3856 INTO l_grant_id,
3857 l_grant_name;
3858
3859 WHILE (c_get_grant_info%FOUND) LOOP
3860
3861 -- -----------------------------------------------------------------
3862 -- Check to determine if the grant is locked or not. If not locked
3863 -- then the update to the condition can happen.
3864 -- -----------------------------------------------------------------
3865 IF (Is_Grant_Locked(l_grant_id) = 'Y') THEN
3866 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_GRANT_LOCKED_NO_OPS');
3867 FND_MESSAGE.SET_TOKEN('OPS_TYPE', l_update_oper);
3868 FND_MESSAGE.SET_TOKEN('GRANT_NAME', l_grant_name);
3869 FND_MSG_PUB.Add;
3870 RAISE FND_API.G_EXC_ERROR;
3871 END IF;
3872
3873 FETCH c_get_grant_info
3874 INTO l_grant_id,
3875 l_grant_name;
3876
3877 END LOOP;
3878
3879 CLOSE c_get_grant_info;
3880
3881 -- -----------------------------------------------------------------
3882 -- Obtain the previous function ID values.
3883 -- -----------------------------------------------------------------
3884 OPEN c_get_obj_attrib;
3885 FETCH c_get_obj_attrib
3886 INTO l_obj_group_id,
3887 l_obj_attrib_name;
3888
3889 IF (c_get_obj_attrib%NOTFOUND) THEN
3890 CLOSE c_get_obj_attrib; --mmkumar
3891 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_OBJ_ATTR_NOT_FOUND');
3892 FND_MSG_PUB.Add;
3893 RAISE FND_API.G_EXC_ERROR;
3894 END IF;
3895
3896 IF (c_get_obj_attrib%ISOPEN) THEN
3897 CLOSE c_get_obj_attrib;
3898 END IF;
3899
3900
3901
3902 -- ----------------------------------------------------------------
3903 -- Update the object attributes with the values received.
3904 -- ----------------------------------------------------------------
3905 UPDATE igs_sc_obj_attribs attr
3906 SET attr.obj_attrib_name = p_obj_attrib_name,
3907 attr.last_updated_by = NVL(FND_GLOBAL.user_id,-1),
3908 attr.last_update_date = SYSDATE,
3909 attr.last_update_login = NVL(FND_GLOBAL.login_id, -1),
3910 attr.active_flag = p_active_flag
3911 WHERE attr.obj_attrib_id = p_obj_attrib_id;
3912
3913 -- -----------------------------------------------------------------
3914 -- Commit the transaction if requested to via parameter value.
3915 -- -----------------------------------------------------------------
3916 IF (FND_API.to_Boolean(p_commit)) THEN
3917 COMMIT;
3918 END IF;
3919
3920 -- -----------------------------------------------------------------
3921 -- Exception Block definition
3922 -- -----------------------------------------------------------------
3923 EXCEPTION
3924 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3925 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3926 IF (c_get_obj_attrib%ISOPEN) THEN
3927 CLOSE c_get_obj_attrib;
3928 END IF;
3929 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
3930 p_count => l_message_count,
3931 p_data => x_return_message);
3932 ROLLBACK TO Update_Object_Attr_SP;
3933
3934 WHEN FND_API.G_EXC_ERROR THEN
3935 x_return_status := FND_API.G_RET_STS_ERROR;
3936
3937 IF (c_get_obj_attrib%ISOPEN) THEN
3938 CLOSE c_get_obj_attrib;
3939 END IF;
3940 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
3941 p_count => l_message_count,
3942 p_data => x_return_message);
3943 ROLLBACK TO Update_Object_Attr_SP;
3944
3945 WHEN OTHERS THEN
3946 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3947 IF (c_get_obj_attrib%ISOPEN) THEN
3948 CLOSE c_get_obj_attrib;
3949 END IF;
3950 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
3951 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
3952 END IF;
3953 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
3954 p_count => l_message_count,
3955 p_data => x_return_message);
3956 ROLLBACK TO Update_Object_Attr_SP;
3957 IF g_upgrade_mode = 'Y' THEN
3958 RAISE;
3959 END IF;
3960
3961 END Update_Object_Attr;
3962
3963
3964 /******************************************************************
3965 Created By : Don Shellito
3966 Date Created By : April 23, 2003
3967 Purpose : The purpose of this procedure is for the updates
3968 that are required to the table igs_sc_usr_attribs.
3969 There is validation on the types and the IDs to
3970 ensure data is in OSS data model and for integrity.
3971 Remarks :
3972
3973 Change History
3974 Who When What
3975 ------------------------------------------------------------------------
3976 Don Shellito April 23, 2003 New Procedure Created.
3977
3978 ******************************************************************/
3979 PROCEDURE Update_User_Attr (p_api_version IN NUMBER,
3980 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
3981 p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE,
3982 p_user_attrib_id IN igs_sc_usr_attribs.user_attrib_id%TYPE,
3983 p_user_attrib_name IN igs_sc_usr_attribs.user_attrib_name%TYPE,
3984 p_user_attrib_type IN igs_sc_usr_attribs.user_attrib_type%TYPE,
3985 p_static_type IN igs_sc_usr_attribs.static_type%TYPE,
3986 p_select_text IN igs_sc_usr_attribs.select_text%TYPE,
3987 p_active_flag IN igs_sc_usr_attribs.active_flag%TYPE,
3988 x_return_status OUT NOCOPY VARCHAR2,
3989 x_return_message OUT NOCOPY VARCHAR2
3990 ) IS
3991
3992 -- -----------------------------------------------------------------
3993 -- Define local variables to be used.
3994 -- -----------------------------------------------------------------
3995 l_api_name CONSTANT VARCHAR2(30) := 'Update_User_Attr';
3996 l_update_oper CONSTANT VARCHAR2(30) := 'UPDATE';
3997 l_api_version CONSTANT NUMBER := 1.0;
3998 l_return_message VARCHAR2(2000);
3999 l_message_count NUMBER(15);
4000 l_return_status VARCHAR2(30);
4001 l_user_attrib_name igs_sc_usr_attribs.user_attrib_name%TYPE;
4002 l_user_attrib_type igs_sc_usr_attribs.user_attrib_type%TYPE;
4003 l_static_type igs_sc_usr_attribs.static_type%TYPE;
4004 l_select_text igs_sc_usr_attribs.select_text%TYPE;
4005 l_grant_name igs_sc_grants.grant_name%TYPE;
4006 l_grant_id igs_sc_grants.grant_id%TYPE;
4007
4008 -- -----------------------------------------------------------------
4009 -- Define the cursors to be used in procedure.
4010 -- -----------------------------------------------------------------
4011 CURSOR c_get_usr_attrib IS
4012 SELECT attr.user_attrib_name,
4013 attr.user_attrib_type,
4014 attr.static_type,
4015 attr.select_text
4016 FROM igs_sc_usr_attribs attr
4017 WHERE attr.user_attrib_id = p_user_attrib_id;
4018
4019 CURSOR c_get_grant_info IS
4020 SELECT cond.grant_id,
4021 grt.grant_name
4022 FROM igs_sc_grant_conds cond,
4023 igs_sc_grants grt
4024 WHERE cond.user_attrib_id = p_user_attrib_id
4025 AND grt.grant_id = cond.grant_id;
4026
4027 BEGIN
4028
4029 SAVEPOINT Update_User_Attr_SP;
4030
4031 -- -----------------------------------------------------------------
4032 -- Check for the Compatible API call
4033 -- -----------------------------------------------------------------
4034 IF NOT FND_API.COMPATIBLE_API_CALL (l_api_version,
4035 p_api_version,
4036 l_api_name,
4037 g_pkg_name) THEN
4038 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
4039 END IF;
4040
4041 -- -----------------------------------------------------------------
4042 -- If the calling program has passed the parameter for initializing
4043 -- the message list
4044 -- -----------------------------------------------------------------
4045 IF FND_API.TO_BOOLEAN (p_init_msg_list) THEN
4046 FND_MSG_PUB.INITIALIZE;
4047 END IF;
4048
4049 -- -----------------------------------------------------------------
4050 -- Set the return status to success
4051 -- -----------------------------------------------------------------
4052 x_return_status := FND_API.G_RET_STS_SUCCESS;
4053
4054
4055 -- -----------------------------------------------------------------
4056 -- Check if admin mode is enabled
4057 -- -----------------------------------------------------------------
4058 IF IGS_SC_GRANTS_PVT.admin_mode <> 'Y' AND g_upgrade_mode <> 'Y' THEN
4059
4060 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_ADMIN_MODE_OFF');
4061 FND_MSG_PUB.Add;
4062 RAISE FND_API.G_EXC_ERROR;
4063
4064 END IF;
4065
4066
4067
4068 -- -----------------------------------------------------------------
4069 -- Determine if there is a grant associated to the user attribute so
4070 -- that the check on lock can be performed.
4071 -- -----------------------------------------------------------------
4072 OPEN c_get_grant_info;
4073 FETCH c_get_grant_info
4074 INTO l_grant_id,
4075 l_grant_name;
4076
4077 WHILE (c_get_grant_info%FOUND) LOOP
4078
4079 -- -----------------------------------------------------------------
4080 -- Check to determine if the grant is locked or not. If not locked
4081 -- then the update to the condition can happen.
4082 -- -----------------------------------------------------------------
4083 IF (Is_Grant_Locked(l_grant_id) = 'Y') THEN
4084 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_GRANT_LOCKED_NO_OPS');
4085 FND_MESSAGE.SET_TOKEN('OPS_TYPE', l_update_oper);
4086 FND_MESSAGE.SET_TOKEN('GRANT_NAME', l_grant_name);
4087 FND_MSG_PUB.Add;
4088 RAISE FND_API.G_EXC_ERROR;
4089 END IF;
4090
4091 FETCH c_get_grant_info
4092 INTO l_grant_id,
4093 l_grant_name;
4094
4095 END LOOP;
4096
4097 CLOSE c_get_grant_info;
4098
4099 -- -----------------------------------------------------------------
4100 -- Obtain the previous User Attribute values.
4101 -- -----------------------------------------------------------------
4102 OPEN c_get_usr_attrib;
4103 FETCH c_get_usr_attrib
4104 INTO l_user_attrib_name,
4105 l_user_attrib_type,
4106 l_static_type,
4107 l_select_text;
4108
4109 IF (c_get_usr_attrib%NOTFOUND) THEN
4110 CLOSE c_get_usr_attrib; --mmkumar
4111 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_USR_ATTR_NOT_FOUND');
4112 FND_MSG_PUB.Add;
4113 RAISE FND_API.G_EXC_ERROR;
4114 END IF;
4115
4116 IF (c_get_usr_attrib%ISOPEN) THEN
4117 CLOSE c_get_usr_attrib;
4118 END IF;
4119
4120
4121 -- -----------------------------------------------------------------
4122 -- Validate the values to be updated.
4123 -- -----------------------------------------------------------------
4124 IF ((p_user_attrib_type IS NOT NULL) ) THEN
4125 l_user_attrib_type := Validate_User_Attr_Type (p_usr_att_type => p_user_attrib_type);
4126 IF (l_user_attrib_type IS NULL) THEN
4127 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_INV_USR_ATT_TYPE');
4128 FND_MSG_PUB.Add;
4129 RAISE FND_API.G_EXC_ERROR;
4130 END IF;
4131 END IF;
4132
4133 l_static_type := Validate_Static_Type (p_static_type => p_static_type);
4134 IF (l_static_type IS NULL) THEN
4135 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_INV_STATIC_TYPE');
4136 FND_MSG_PUB.Add;
4137 RAISE FND_API.G_EXC_ERROR;
4138 END IF;
4139
4140 IF ((p_select_text IS NOT NULL) ) THEN
4141 l_select_text := p_select_text;
4142 END IF;
4143
4144 IF ((p_user_attrib_name IS NOT NULL) ) THEN
4145 l_user_attrib_name := p_user_attrib_name;
4146 END IF;
4147
4148
4149
4150 IF NOT check_attrib_text ( 'DUAL', l_select_text,l_user_attrib_type) THEN
4151
4152 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_GRNT_TXT_ERR');
4153 FND_MESSAGE.SET_TOKEN('OBJ_NAME','USER_ATTRIB');
4154 FND_MESSAGE.SET_TOKEN('GRNT_TEXT', l_select_text);
4155 FND_MSG_PUB.Add;
4156 RAISE FND_API.G_EXC_ERROR;
4157
4158 END IF;
4159
4160 -- -----------------------------------------------------------------
4161 -- Update the user attribute values.
4162 -- -----------------------------------------------------------------
4163 UPDATE igs_sc_usr_attribs attr
4164 SET attr.user_attrib_name = l_user_attrib_name,
4165 attr.user_attrib_type = l_user_attrib_type,
4166 attr.static_type = l_static_type,
4167 attr.select_text = l_select_text,
4168 attr.last_updated_by = NVL(FND_GLOBAL.user_id,-1),
4169 attr.last_update_date = SYSDATE,
4170 attr.last_update_login = NVL(FND_GLOBAL.login_id, -1),
4171 attr.active_flag = p_active_flag
4172 WHERE attr.user_attrib_id = p_user_attrib_id;
4173
4174 IF l_static_type IN ('C','S') AND (p_active_flag = 'Y') THEN
4175
4176 IGS_SC_GRANTS_PVT.POPULATE_USER_ATTRIB (
4177 P_API_VERSION => 1.0,
4178 P_ATTRIB_ID => p_user_attrib_id,
4179 P_USER_ID => NULL,
4180 P_ALL_ATTRIBS => 'Y',
4181 X_RETURN_STATUS => l_return_status,
4182 X_MSG_COUNT => l_message_count,
4183 X_MSG_DATA => l_return_message
4184 );
4185
4186
4187 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
4188 RAISE FND_API.G_EXC_ERROR;
4189 END IF;
4190 ELSE
4191 -- delete all curent values
4192 Delete_User_Attr_Val (p_api_version => l_api_version,
4193 p_user_attrib_id => p_user_attrib_id,
4194 p_user_id => NULL,
4195 x_return_status => l_return_status,
4196 x_return_message => l_return_message
4197 );
4198
4199 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
4200 RAISE FND_API.G_EXC_ERROR;
4201 END IF;
4202
4203 END IF;
4204
4205
4206 -- -----------------------------------------------------------------
4207 -- Commit the transaction if requested to via parameter value.
4208 -- -----------------------------------------------------------------
4209 IF (FND_API.to_Boolean(p_commit)) THEN
4210 COMMIT;
4211 END IF;
4212
4213 -- -----------------------------------------------------------------
4214 -- Exception Block definition
4215 -- -----------------------------------------------------------------
4216 EXCEPTION
4217 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4218 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4219
4220 IF (c_get_grant_info%ISOPEN) THEN
4221 CLOSE c_get_grant_info;
4222 END IF;
4223 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
4224 p_count => l_message_count,
4225 p_data => x_return_message);
4226 ROLLBACK TO Update_User_Attr_SP;
4227
4228 WHEN FND_API.G_EXC_ERROR THEN
4229 x_return_status := FND_API.G_RET_STS_ERROR;
4230
4231 IF (c_get_usr_attrib%ISOPEN) THEN
4232 CLOSE c_get_usr_attrib;
4233 END IF;
4234 IF (c_get_grant_info%ISOPEN) THEN
4235 CLOSE c_get_grant_info;
4236 END IF;
4237 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
4238 p_count => l_message_count,
4239 p_data => x_return_message);
4240 ROLLBACK TO Update_User_Attr_SP;
4241
4242 WHEN OTHERS THEN
4243 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4244 IF (c_get_usr_attrib%ISOPEN) THEN
4245 CLOSE c_get_usr_attrib;
4246 END IF;
4247 IF (c_get_grant_info%ISOPEN) THEN
4248 CLOSE c_get_grant_info;
4249 END IF;
4250 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
4251 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
4252 END IF;
4253 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
4254 p_count => l_message_count,
4255 p_data => x_return_message);
4256 ROLLBACK TO Update_User_Attr_SP;
4257 IF g_upgrade_mode = 'Y' THEN
4258 RAISE;
4259 END IF;
4260
4261 END Update_User_Attr;
4262
4263
4264 /******************************************************************
4265 Created By : Don Shellito
4266 Date Created By : April 23, 2003
4267 Purpose : The purpose of this procedure is to remove
4268 the object group from the OSS data model. The
4269 Child tables that reference the object group ID
4270 will also be removed.
4271 Remarks :
4272
4273 Change History
4274 Who When What
4275 ------------------------------------------------------------------------
4276 Don Shellito April 23, 2003 New Procedure Created.
4277
4278 ******************************************************************/
4279 PROCEDURE Delete_Object_Group (p_api_version IN NUMBER,
4280 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
4281 p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE,
4282 p_obj_group_id IN igs_sc_obj_groups.obj_group_id%TYPE,
4283 x_return_status OUT NOCOPY VARCHAR2,
4284 x_return_message OUT NOCOPY VARCHAR2
4285 ) IS
4286
4287 -- -----------------------------------------------------------------
4288 -- Define local variables to be used.
4289 -- -----------------------------------------------------------------
4290 l_api_name CONSTANT VARCHAR2(30) := 'Delete_Object_Group';
4291 l_api_version CONSTANT NUMBER := 1.0;
4292 l_object_id igs_sc_objects.object_id%TYPE;
4293 l_function_id igs_sc_obj_functns.function_id%TYPE;
4294 l_grant_id igs_sc_grants.grant_id%TYPE;
4295 l_obj_attrib_id igs_sc_obj_attribs.obj_attrib_id%TYPE;
4296 l_return_message VARCHAR2(2000);
4297 l_message_count NUMBER(15);
4298 l_return_status VARCHAR2(30);
4299
4300 -- -----------------------------------------------------------------
4301 -- Define the cursors to be used in procedure.
4302 -- -----------------------------------------------------------------
4303 CURSOR c_get_object_id IS
4304 SELECT objs.object_id
4305 FROM igs_sc_objects objs
4306 WHERE objs.obj_group_id = p_obj_group_id;
4307
4308 CURSOR c_get_function_id IS
4309 SELECT funcs.function_id
4310 FROM igs_sc_obj_functns funcs
4311 WHERE funcs.obj_group_id = p_obj_group_id;
4312
4313 CURSOR c_get_grant_id IS
4314 SELECT grts.grant_id
4315 FROM igs_sc_grants grts
4316 WHERE grts.obj_group_id = p_obj_group_id;
4317
4318 CURSOR c_get_obj_attr_id IS
4319 SELECT attrs.obj_attrib_id
4320 FROM igs_sc_obj_attribs attrs
4321 WHERE attrs.obj_group_id = p_obj_group_id;
4322
4323 BEGIN
4324
4325 SAVEPOINT Delete_Object_Group_SP;
4326
4327 -- -----------------------------------------------------------------
4328 -- Check for the Compatible API call
4329 -- -----------------------------------------------------------------
4330 IF NOT FND_API.COMPATIBLE_API_CALL (l_api_version,
4331 p_api_version,
4332 l_api_name,
4333 g_pkg_name) THEN
4334 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
4335 END IF;
4336
4337 -- -----------------------------------------------------------------
4338 -- If the calling program has passed the parameter for initializing
4339 -- the message list
4340 -- -----------------------------------------------------------------
4341 IF FND_API.TO_BOOLEAN (p_init_msg_list) THEN
4342 FND_MSG_PUB.INITIALIZE;
4343 END IF;
4344
4345 -- -----------------------------------------------------------------
4346 -- Set the return status to success
4347 -- -----------------------------------------------------------------
4348 x_return_status := FND_API.G_RET_STS_SUCCESS;
4349
4350 -- -----------------------------------------------------------------
4351 -- Check if admin mode is enabled
4352 -- -----------------------------------------------------------------
4353 IF IGS_SC_GRANTS_PVT.admin_mode <> 'Y' AND g_upgrade_mode <> 'Y' THEN
4354
4355 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_ADMIN_MODE_OFF');
4356 FND_MSG_PUB.Add;
4357 RAISE FND_API.G_EXC_ERROR;
4358
4359 END IF;
4360 -- -----------------------------------------------------------------
4361 -- Delete all the grants associated to the group provided
4362 -- -----------------------------------------------------------------
4363 OPEN c_get_grant_id;
4364 FETCH c_get_grant_id
4365 INTO l_grant_id;
4366
4367 WHILE (c_get_grant_id%FOUND) LOOP
4368
4369 Delete_Grant (p_api_version => l_api_version,
4370 p_grant_id => l_grant_id,
4371 x_return_status => l_return_status,
4372 x_return_message => l_return_message
4373 );
4374
4375 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
4376 RAISE FND_API.G_EXC_ERROR;
4377 END IF;
4378
4379 FETCH c_get_grant_id
4380 INTO l_grant_id;
4381
4382 END LOOP;
4383
4384 IF (c_get_grant_id%ISOPEN) THEN
4385 CLOSE c_get_grant_id;
4386 END IF;
4387
4388 -- -----------------------------------------------------------------
4389 -- Delete all the object attributes associated to the group provided
4390 -- -----------------------------------------------------------------
4391 OPEN c_get_obj_attr_id;
4392 FETCH c_get_obj_attr_id
4393 INTO l_obj_attrib_id;
4394
4395 WHILE (c_get_obj_attr_id%FOUND) LOOP
4396
4397 Delete_Object_Attr (p_api_version => l_api_version,
4398 p_obj_attrib_id => l_obj_attrib_id,
4399 x_return_status => l_return_status,
4400 x_return_message => l_return_message
4401 );
4402
4403 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
4404 RAISE FND_API.G_EXC_ERROR;
4405 END IF;
4406
4407 FETCH c_get_obj_attr_id
4408 INTO l_obj_attrib_id;
4409
4410 END LOOP;
4411
4412 IF (c_get_obj_attr_id%ISOPEN) THEN
4413 CLOSE c_get_obj_attr_id;
4414 END IF;
4415
4416 -- -----------------------------------------------------------------
4417 -- Delete all the object functions associated to the group provided
4418 -- -----------------------------------------------------------------
4419 OPEN c_get_function_id;
4420 FETCH c_get_function_id
4421 INTO l_function_id;
4422
4423 WHILE (c_get_function_id%FOUND) LOOP
4424
4425 Delete_Object_Func (p_api_version => l_api_version,
4426 p_function_id => l_function_id,
4427 x_return_status => l_return_status,
4428 x_return_message => l_return_message
4429 );
4430
4431 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
4432 RAISE FND_API.G_EXC_ERROR;
4433 END IF;
4434
4435 FETCH c_get_function_id
4436 INTO l_function_id;
4437
4438 END LOOP;
4439
4440 IF (c_get_function_id%ISOPEN) THEN
4441 CLOSE c_get_function_id;
4442 END IF;
4443
4444 -- -----------------------------------------------------------------
4445 -- Delete all the objects associated to the group provided
4446 -- -----------------------------------------------------------------
4447 OPEN c_get_object_id;
4448 FETCH c_get_object_id
4449 INTO l_object_id;
4450
4451 WHILE (c_get_object_id%FOUND) LOOP
4452
4453 Delete_Object (p_api_version => l_api_version,
4454 p_obj_group_id => p_obj_group_id,
4455 p_object_id => l_object_id,
4456 x_return_status => l_return_status,
4457 x_return_message => l_return_message
4458 );
4459
4460 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
4461 RAISE FND_API.G_EXC_ERROR;
4462 END IF;
4463
4464 FETCH c_get_object_id
4465 INTO l_object_id;
4466
4467 END LOOP;
4468
4469 IF (c_get_object_id%ISOPEN) THEN
4470 CLOSE c_get_object_id;
4471 END IF;
4472
4473 -- -----------------------------------------------------------------
4474 -- Delete the object group group that has been requested for delete.
4475 -- -----------------------------------------------------------------
4476 DELETE
4477 FROM igs_sc_obj_groups grps
4478 WHERE grps.obj_group_id = p_obj_group_id;
4479
4480 -- -----------------------------------------------------------------
4481 -- Commit the transaction if requested to via parameter value.
4482 -- -----------------------------------------------------------------
4483 IF (FND_API.to_Boolean(p_commit)) THEN
4484 COMMIT;
4485 END IF;
4486
4487 -- -----------------------------------------------------------------
4488 -- Exception Block definition
4489 -- -----------------------------------------------------------------
4490 EXCEPTION
4491
4492 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4493 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4494 IF (c_get_grant_id%ISOPEN) THEN
4495 CLOSE c_get_grant_id;
4496 END IF;
4497 IF (c_get_object_id%ISOPEN) THEN
4498 CLOSE c_get_object_id;
4499 END IF;
4500 IF (c_get_obj_attr_id%ISOPEN) THEN
4501 CLOSE c_get_obj_attr_id;
4502 END IF;
4503 IF (c_get_function_id%ISOPEN) THEN
4504 CLOSE c_get_function_id;
4505 END IF;
4506 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
4507 p_count => l_message_count,
4508 p_data => x_return_message);
4509 ROLLBACK TO Delete_Object_Group_SP;
4510
4511 WHEN FND_API.G_EXC_ERROR THEN
4512 x_return_status := FND_API.G_RET_STS_ERROR;
4513
4514 IF (c_get_grant_id%ISOPEN) THEN
4515 CLOSE c_get_grant_id;
4516 END IF;
4517 IF (c_get_object_id%ISOPEN) THEN
4518 CLOSE c_get_object_id;
4519 END IF;
4520 IF (c_get_obj_attr_id%ISOPEN) THEN
4521 CLOSE c_get_obj_attr_id;
4522 END IF;
4523 IF (c_get_function_id%ISOPEN) THEN
4524 CLOSE c_get_function_id;
4525 END IF;
4526 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
4527 p_count => l_message_count,
4528 p_data => x_return_message);
4529 ROLLBACK TO Delete_Object_Group_SP;
4530
4531 WHEN OTHERS THEN
4532 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4533 IF (c_get_grant_id%ISOPEN) THEN
4534 CLOSE c_get_grant_id;
4535 END IF;
4536 IF (c_get_object_id%ISOPEN) THEN
4537 CLOSE c_get_object_id;
4538 END IF;
4539 IF (c_get_obj_attr_id%ISOPEN) THEN
4540 CLOSE c_get_obj_attr_id;
4541 END IF;
4542 IF (c_get_function_id%ISOPEN) THEN
4543 CLOSE c_get_function_id;
4544 END IF;
4545 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
4546 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
4547 END IF;
4548 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
4549 p_count => l_message_count,
4550 p_data => x_return_message);
4551 ROLLBACK TO Delete_Object_Group_SP;
4552 IF g_upgrade_mode = 'Y' THEN
4553 RAISE;
4554 END IF;
4555
4556 END Delete_Object_Group;
4557
4558
4559 /******************************************************************
4560 Created By : Don Shellito
4561 Date Created By : April 23, 2003
4562 Purpose : The purpose of this procedure is to remove the
4563 object attribute requested from the OSS data model.
4564 This will ensure that all child tables that have
4565 reference to the object attribute are also removed.
4566 Remarks :
4567
4568 Change History
4569 Who When What
4570 ------------------------------------------------------------------------
4571 Don Shellito April 23, 2003 New Procedure Created.
4572
4573 ******************************************************************/
4574 PROCEDURE Delete_Object_Attr (p_api_version IN NUMBER,
4575 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
4576 p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE,
4577 p_obj_attrib_id IN igs_sc_obj_attribs.obj_attrib_id%TYPE,
4578 x_return_status OUT NOCOPY VARCHAR2,
4579 x_return_message OUT NOCOPY VARCHAR2
4580 ) IS
4581
4582 -- -----------------------------------------------------------------
4583 -- Define local variables to be used.
4584 -- -----------------------------------------------------------------
4585 l_api_name CONSTANT VARCHAR2(30) := 'Delete_Object_Attr';
4586 l_api_version CONSTANT NUMBER := 1.0;
4587 l_grant_id igs_sc_grant_conds.grant_id%TYPE;
4588 l_grant_cond_num igs_sc_grant_conds.grant_cond_num%TYPE;
4589 l_object_id_mthd igs_sc_obj_att_mths.object_id%TYPE;
4590 l_object_id_val igs_sc_obj_att_vals.object_id%TYPE;
4591 l_return_message VARCHAR2(2000);
4592 l_message_count NUMBER(15);
4593 l_return_status VARCHAR2(30);
4594
4595 -- -----------------------------------------------------------------
4596 -- Define the cursors to be used in procedure.
4597 -- -----------------------------------------------------------------
4598 CURSOR c_get_object_id_mthd IS
4599 SELECT objs.object_id
4600 FROM igs_sc_obj_att_mths objs
4601 WHERE objs.obj_attrib_id = p_obj_attrib_id;
4602
4603 CURSOR c_get_object_id_val IS
4604 SELECT attrs.object_id
4605 FROM igs_sc_obj_att_vals attrs
4606 WHERE attrs.obj_attrib_id = p_obj_attrib_id;
4607
4608 BEGIN
4609
4610 SAVEPOINT Delete_Object_Attr_SP;
4611
4612 -- -----------------------------------------------------------------
4613 -- Check for the Compatible API call
4614 -- -----------------------------------------------------------------
4615 IF (NOT FND_API.COMPATIBLE_API_CALL (l_api_version,
4616 p_api_version,
4617 l_api_name,
4618 g_pkg_name)) THEN
4619 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
4620 END IF;
4621
4622 -- -----------------------------------------------------------------
4623 -- If the calling program has passed the parameter for initializing
4624 -- the message list
4625 -- -----------------------------------------------------------------
4626 IF FND_API.TO_BOOLEAN (p_init_msg_list) THEN
4627 FND_MSG_PUB.INITIALIZE;
4628 END IF;
4629
4630 -- -----------------------------------------------------------------
4631 -- Set the return status to success
4632 -- -----------------------------------------------------------------
4633 x_return_status := FND_API.G_RET_STS_SUCCESS;
4634
4635 -- -----------------------------------------------------------------
4636 -- Check if admin mode is enabled
4637 -- -----------------------------------------------------------------
4638 IF IGS_SC_GRANTS_PVT.admin_mode <> 'Y' AND g_upgrade_mode <> 'Y' THEN
4639
4640 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_ADMIN_MODE_OFF');
4641 FND_MSG_PUB.Add;
4642 RAISE FND_API.G_EXC_ERROR;
4643
4644 END IF;
4645
4646 OPEN c_get_object_id_val;
4647 FETCH c_get_object_id_val
4648 INTO l_object_id_val;
4649
4650 WHILE (c_get_object_id_val%FOUND) LOOP
4651
4652 -- -----------------------------------------------------------------
4653 -- Delete all the object attribute values that are associated to the
4654 -- object attribute that is being requested for deletion.
4655 -- -----------------------------------------------------------------
4656 Delete_Object_Attr_Val (p_api_version => l_api_version,
4657 p_obj_attrib_id => p_obj_attrib_id,
4658 p_object_id => l_object_id_val,
4659 x_return_status => l_return_status,
4660 x_return_message => l_return_message
4661 );
4662
4663 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
4664 RAISE FND_API.G_EXC_ERROR;
4665 END IF;
4666
4667 FETCH c_get_object_id_val
4668 INTO l_object_id_val;
4669
4670 END LOOP;
4671
4672 IF (c_get_object_id_val%ISOPEN) THEN
4673 CLOSE c_get_object_id_val;
4674 END IF;
4675
4676 -- -----------------------------------------------------------------
4677 -- Delete the object attribute methods that are associated to
4678 -- the attribute being deleted.
4679 -- -----------------------------------------------------------------
4680 OPEN c_get_object_id_mthd;
4681 FETCH c_get_object_id_mthd
4682 INTO l_object_id_mthd;
4683
4684 WHILE (c_get_object_id_mthd%FOUND) LOOP
4685
4686 Delete_Object_Attr_Method (p_api_version => l_api_version,
4687 p_object_id => l_object_id_mthd,
4688 p_obj_attrib_id => p_obj_attrib_id,
4689 x_return_status => l_return_status,
4690 x_return_message => l_return_message
4691 );
4692
4693 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
4694 RAISE FND_API.G_EXC_ERROR;
4695 END IF;
4696
4697 FETCH c_get_object_id_mthd
4698 INTO l_object_id_mthd;
4699
4700 END LOOP;
4701
4702 IF (c_get_object_id_mthd%ISOPEN) THEN
4703 CLOSE c_get_object_id_mthd;
4704 END IF;
4705
4706 -- -----------------------------------------------------------------
4707 -- Delete the attribute that has been requested for deletion.
4708 -- -----------------------------------------------------------------
4709 DELETE
4710 FROM igs_sc_obj_attribs attrs
4711 WHERE attrs.obj_attrib_id = p_obj_attrib_id;
4712
4713 -- -----------------------------------------------------------------
4714 -- Commit the transaction if requested to via parameter value.
4715 -- -----------------------------------------------------------------
4716 IF (FND_API.to_Boolean(p_commit)) THEN
4717 COMMIT;
4718 END IF;
4719
4720 -- -----------------------------------------------------------------
4721 -- Exception Block definition
4722 -- -----------------------------------------------------------------
4723 EXCEPTION
4724
4725 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4726 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4727 IF (c_get_object_id_mthd%ISOPEN) THEN
4728 CLOSE c_get_object_id_mthd;
4729 END IF;
4730 IF (c_get_object_id_val%ISOPEN) THEN
4731 CLOSE c_get_object_id_val;
4732 END IF;
4733 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
4734 p_count => l_message_count,
4735 p_data => x_return_message);
4736 ROLLBACK TO Delete_Object_Attr_SP;
4737
4738 WHEN FND_API.G_EXC_ERROR THEN
4739 x_return_status := FND_API.G_RET_STS_ERROR;
4740
4741 IF (c_get_object_id_mthd%ISOPEN) THEN
4742 CLOSE c_get_object_id_mthd;
4743 END IF;
4744 IF (c_get_object_id_val%ISOPEN) THEN
4745 CLOSE c_get_object_id_val;
4746 END IF;
4747 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
4748 p_count => l_message_count,
4749 p_data => x_return_message);
4750 ROLLBACK TO Delete_Object_Attr_SP;
4751
4752 WHEN OTHERS THEN
4753 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4754 IF (c_get_object_id_mthd%ISOPEN) THEN
4755 CLOSE c_get_object_id_mthd;
4756 END IF;
4757 IF (c_get_object_id_val%ISOPEN) THEN
4758 CLOSE c_get_object_id_val;
4759 END IF;
4760 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
4761 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
4762 END IF;
4763 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
4764 p_count => l_message_count,
4765 p_data => x_return_message);
4766 ROLLBACK TO Delete_Object_Attr_SP;
4767 IF g_upgrade_mode = 'Y' THEN
4768 RAISE;
4769 END IF;
4770
4771 END Delete_Object_Attr;
4772
4773
4774 /******************************************************************
4775 Created By : Don Shellito
4776 Date Created By : April 23, 2003
4777 Purpose : The purpose of this procedure is to remove the
4778 object attribute method from the OSS data model.
4779 There are no child tables that have reference to
4780 the methods so there is no need to remove any
4781 references.
4782 Remarks :
4783
4784 Change History
4785 Who When What
4786 ------------------------------------------------------------------------
4787 Don Shellito April 23, 2003 New Procedure Created.
4788
4789 ******************************************************************/
4790 PROCEDURE Delete_Object_Attr_Method (p_api_version IN NUMBER,
4791 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
4792 p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE,
4793 p_object_id IN igs_sc_obj_att_mths.object_id%TYPE,
4794 p_obj_attrib_id IN igs_sc_obj_att_mths.obj_attrib_id%TYPE,
4795 x_return_status OUT NOCOPY VARCHAR2,
4796 x_return_message OUT NOCOPY VARCHAR2
4797 ) IS
4798
4799 -- -----------------------------------------------------------------
4800 -- Define local variables to be used.
4801 -- -----------------------------------------------------------------
4802 l_api_name CONSTANT VARCHAR2(30) := 'Delete_Object_Attr_Method';
4803 l_api_version CONSTANT NUMBER := 1.0;
4804 l_message_count NUMBER(15);
4805
4806 BEGIN
4807
4808 SAVEPOINT Delete_Object_Attr_Method_SP;
4809
4810 -- -----------------------------------------------------------------
4811 -- Check for the Compatible API call
4812 -- -----------------------------------------------------------------
4813 IF NOT FND_API.COMPATIBLE_API_CALL (l_api_version,
4814 p_api_version,
4815 l_api_name,
4816 g_pkg_name) THEN
4817 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
4818 END IF;
4819
4820 -- -----------------------------------------------------------------
4821 -- If the calling program has passed the parameter for initializing
4822 -- the message list
4823 -- -----------------------------------------------------------------
4824 IF FND_API.TO_BOOLEAN (p_init_msg_list) THEN
4825 FND_MSG_PUB.INITIALIZE;
4826 END IF;
4827
4828 -- -----------------------------------------------------------------
4829 -- Set the return status to success
4830 -- -----------------------------------------------------------------
4831 x_return_status := FND_API.G_RET_STS_SUCCESS;
4832 -- -----------------------------------------------------------------
4833 -- Check if admin mode is enabled
4834 -- -----------------------------------------------------------------
4835 IF IGS_SC_GRANTS_PVT.admin_mode <> 'Y' AND g_upgrade_mode <> 'Y' THEN
4836
4837 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_ADMIN_MODE_OFF');
4838 FND_MSG_PUB.Add;
4839 RAISE FND_API.G_EXC_ERROR;
4840
4841 END IF;
4842
4843
4844 -- -----------------------------------------------------------------
4845 -- Delete all the methods associated to the object_id and the
4846 -- obj_attrib_id provided.
4847 -- -----------------------------------------------------------------
4848 DELETE
4849 FROM igs_sc_obj_att_mths mtds
4850 WHERE mtds.object_id = p_object_id
4851 AND mtds.obj_attrib_id = p_obj_attrib_id;
4852
4853 -- -----------------------------------------------------------------
4854 -- Commit the transaction if requested to via parameter value.
4855 -- -----------------------------------------------------------------
4856 IF (FND_API.to_Boolean(p_commit)) THEN
4857 COMMIT;
4858 END IF;
4859
4860 -- -----------------------------------------------------------------
4861 -- Exception Block definition
4862 -- -----------------------------------------------------------------
4863 EXCEPTION
4864 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4865 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4866 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
4867 p_count => l_message_count,
4868 p_data => x_return_message);
4869 ROLLBACK TO Delete_Object_Attr_Method_SP;
4870
4871 WHEN FND_API.G_EXC_ERROR THEN
4872 x_return_status := FND_API.G_RET_STS_ERROR;
4873
4874 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
4875 p_count => l_message_count,
4876 p_data => x_return_message);
4877 ROLLBACK TO Delete_Object_Attr_Method_SP;
4878
4879 WHEN OTHERS THEN
4880 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4881 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
4882 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
4883 END IF;
4884 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
4885 p_count => l_message_count,
4886 p_data => x_return_message);
4887 ROLLBACK TO Delete_Object_Attr_Method_SP;
4888 IF g_upgrade_mode = 'Y' THEN
4889 RAISE;
4890 END IF;
4891
4892 END Delete_Object_Attr_Method;
4893
4894
4895 /******************************************************************
4896 Created By : Don Shellito
4897 Date Created By : April 23, 2003
4898 Purpose : The purpose of this procedure is to remove the
4899 object function from the OSS data model. The
4900 child table on grants that have any reference to
4901 this function being removed shall also be removed.
4902 Remarks :
4903
4904 Change History
4905 Who When What
4906 ------------------------------------------------------------------------
4907 Don Shellito April 23, 2003 New Procedure Created.
4908
4909 ******************************************************************/
4910 PROCEDURE Delete_Object_Func (p_api_version IN NUMBER,
4911 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
4912 p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE,
4913 p_function_id IN igs_sc_obj_functns.function_id%TYPE,
4914 x_return_status OUT NOCOPY VARCHAR2,
4915 x_return_message OUT NOCOPY VARCHAR2
4916 ) IS
4917
4918 -- -----------------------------------------------------------------
4919 -- Define local variables to be used.
4920 -- -----------------------------------------------------------------
4921 l_api_name CONSTANT VARCHAR2(30) := 'Delete_Object_Func';
4922 l_api_version CONSTANT NUMBER := 1.0;
4923 l_grant_id igs_sc_grants.grant_id%TYPE;
4924 l_return_message VARCHAR2(2000);
4925 l_message_count NUMBER(15);
4926 l_return_status VARCHAR2(30);
4927
4928 -- -----------------------------------------------------------------
4929 -- Define the cursors to be used in procedure.
4930 -- -----------------------------------------------------------------
4931 CURSOR c_get_grant_id IS
4932 SELECT grt.grant_id
4933 FROM igs_sc_grants grt,
4934 igs_sc_obj_functns fnc
4935 WHERE fnc.function_id = p_function_id
4936 AND grt.function_id = fnc.function_id
4937 AND grt.obj_group_id = fnc.obj_group_id;
4938
4939 BEGIN
4940
4941 SAVEPOINT Delete_Object_Func_SP;
4942
4943 -- -----------------------------------------------------------------
4944 -- Check for the Compatible API call
4945 -- -----------------------------------------------------------------
4946 IF NOT FND_API.COMPATIBLE_API_CALL (l_api_version,
4947 p_api_version,
4948 l_api_name,
4949 g_pkg_name) THEN
4950 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
4951 END IF;
4952
4953 -- -----------------------------------------------------------------
4954 -- If the calling program has passed the parameter for initializing
4955 -- the message list
4956 -- -----------------------------------------------------------------
4957 IF FND_API.TO_BOOLEAN (p_init_msg_list) THEN
4958 FND_MSG_PUB.INITIALIZE;
4959 END IF;
4960
4961 -- -----------------------------------------------------------------
4962 -- Set the return status to success
4963 -- -----------------------------------------------------------------
4964 x_return_status := FND_API.G_RET_STS_SUCCESS;
4965
4966 -- -----------------------------------------------------------------
4967 -- Check if admin mode is enabled
4968 -- -----------------------------------------------------------------
4969 IF IGS_SC_GRANTS_PVT.admin_mode <> 'Y' AND g_upgrade_mode <> 'Y' THEN
4970
4971 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_ADMIN_MODE_OFF');
4972 FND_MSG_PUB.Add;
4973 RAISE FND_API.G_EXC_ERROR;
4974
4975 END IF;
4976
4977 -- -----------------------------------------------------------------
4978 -- Delete all the grants that are associated to the function_id
4979 -- provided.
4980 -- -----------------------------------------------------------------
4981 OPEN c_get_grant_id;
4982 FETCH c_get_grant_id
4983 INTO l_grant_id;
4984
4985 WHILE (c_get_grant_id%FOUND) LOOP
4986
4987 Delete_Grant (p_api_version => l_api_version,
4988 p_grant_id => l_grant_id,
4989 x_return_status => l_return_status,
4990 x_return_message => l_return_message
4991 );
4992
4993 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
4994 RAISE FND_API.G_EXC_ERROR;
4995 END IF;
4996
4997 FETCH c_get_grant_id
4998 INTO l_grant_id;
4999
5000 END LOOP;
5001
5002 IF (c_get_grant_id%ISOPEN) THEN
5003 CLOSE c_get_grant_id;
5004 END IF;
5005
5006 -- -----------------------------------------------------------------
5007 -- Delete the function that is provided.
5008 -- -----------------------------------------------------------------
5009 DELETE
5010 FROM igs_sc_obj_functns fctn
5011 WHERE fctn.function_id = p_function_id;
5012
5013 -- -----------------------------------------------------------------
5014 -- Commit the transaction if requested to via parameter value.
5015 -- -----------------------------------------------------------------
5016 IF (FND_API.to_Boolean(p_commit)) THEN
5017 COMMIT;
5018 END IF;
5019
5020 -- -----------------------------------------------------------------
5021 -- Exception Block definition
5022 -- -----------------------------------------------------------------
5023 EXCEPTION
5024 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
5025 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
5026 IF (c_get_grant_id%ISOPEN) THEN
5027 CLOSE c_get_grant_id;
5028 END IF;
5029 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
5030 p_count => l_message_count,
5031 p_data => x_return_message);
5032 ROLLBACK TO Delete_Object_Func_SP;
5033
5034 WHEN FND_API.G_EXC_ERROR THEN
5035 x_return_status := FND_API.G_RET_STS_ERROR;
5036
5037 IF (c_get_grant_id%ISOPEN) THEN
5038 CLOSE c_get_grant_id;
5039 END IF;
5040 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
5041 p_count => l_message_count,
5042 p_data => x_return_message);
5043 ROLLBACK TO Delete_Object_Func_SP;
5044
5045 WHEN OTHERS THEN
5046 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
5047 IF (c_get_grant_id%ISOPEN) THEN
5048 CLOSE c_get_grant_id;
5049 END IF;
5050 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
5051 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
5052 END IF;
5053 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
5054 p_count => l_message_count,
5055 p_data => x_return_message);
5056 ROLLBACK TO Delete_Object_Func_SP;
5057 IF g_upgrade_mode = 'Y' THEN
5058 RAISE;
5059 END IF;
5060
5061 END Delete_Object_Func;
5062
5063
5064 /******************************************************************
5065 Created By : Don Shellito
5066 Date Created By : April 23, 2003
5067 Purpose : The purpose of this procedure is to remove the
5068 object attribute value from the OSS data model.
5069 There are no child tables that need to be cleaned
5070 of the object attribute value.
5071 Remarks :
5072
5073 Change History
5074 Who When What
5075 ------------------------------------------------------------------------
5076 Don Shellito April 23, 2003 New Procedure Created.
5077
5078 ******************************************************************/
5079 PROCEDURE Delete_Object_Attr_Val (p_api_version IN NUMBER,
5080 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
5081 p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE,
5082 p_object_id IN igs_sc_obj_att_mths.object_id%TYPE,
5083 p_obj_attrib_id IN igs_sc_obj_att_mths.obj_attrib_id%TYPE,
5084 x_return_status OUT NOCOPY VARCHAR2,
5085 x_return_message OUT NOCOPY VARCHAR2
5086 ) IS
5087
5088 -- -----------------------------------------------------------------
5089 -- Define local variables to be used.
5090 -- -----------------------------------------------------------------
5091 l_api_name CONSTANT VARCHAR2(30) := 'Delete_Object_Attr_Val';
5092 l_api_version CONSTANT NUMBER := 1.0;
5093 l_message_count NUMBER(15);
5094
5095 BEGIN
5096
5097 SAVEPOINT Delete_Object_Attr_Val_SP;
5098
5099 -- -----------------------------------------------------------------
5100 -- Check for the Compatible API call
5101 -- -----------------------------------------------------------------
5102 IF NOT FND_API.COMPATIBLE_API_CALL (l_api_version,
5103 p_api_version,
5104 l_api_name,
5105 g_pkg_name) THEN
5106 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
5107 END IF;
5108
5109 -- -----------------------------------------------------------------
5110 -- If the calling program has passed the parameter for initializing
5111 -- the message list
5112 -- -----------------------------------------------------------------
5113 IF FND_API.TO_BOOLEAN (p_init_msg_list) THEN
5114 FND_MSG_PUB.INITIALIZE;
5115 END IF;
5116
5117 -- -----------------------------------------------------------------
5118 -- Set the return status to success
5119 -- -----------------------------------------------------------------
5120 x_return_status := FND_API.G_RET_STS_SUCCESS;
5121
5122 -- -----------------------------------------------------------------
5123 -- Check if admin mode is enabled
5124 -- -----------------------------------------------------------------
5125 IF IGS_SC_GRANTS_PVT.admin_mode <> 'Y' AND g_upgrade_mode <> 'Y' THEN
5126
5127 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_ADMIN_MODE_OFF');
5128 FND_MSG_PUB.Add;
5129 RAISE FND_API.G_EXC_ERROR;
5130
5131 END IF;
5132
5133 -- -----------------------------------------------------------------
5134 -- Delete the attribute values that are associated to the attribute
5135 -- id and object id provided.
5136 -- -----------------------------------------------------------------
5137 DELETE
5138 FROM igs_sc_obj_att_vals oval
5139 WHERE oval.obj_attrib_id = p_obj_attrib_id
5140 AND oval.object_id = p_object_id;
5141
5142 -- -----------------------------------------------------------------
5143 -- Commit the transaction if requested to via parameter value.
5144 -- -----------------------------------------------------------------
5145 IF (FND_API.to_Boolean(p_commit)) THEN
5146 COMMIT;
5147 END IF;
5148
5149 -- -----------------------------------------------------------------
5150 -- Exception Block definition
5151 -- -----------------------------------------------------------------
5152 EXCEPTION
5153 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
5154 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
5155 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
5156 p_count => l_message_count,
5157 p_data => x_return_message);
5158 ROLLBACK TO Delete_Object_Attr_Val_SP;
5159
5160 WHEN FND_API.G_EXC_ERROR THEN
5161 x_return_status := FND_API.G_RET_STS_ERROR;
5162
5163 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
5164 p_count => l_message_count,
5165 p_data => x_return_message);
5166 ROLLBACK TO Delete_Object_Attr_Val_SP;
5167
5168 WHEN OTHERS THEN
5169 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
5170 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
5171 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
5172 END IF;
5173 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
5174 p_count => l_message_count,
5175 p_data => x_return_message);
5176 ROLLBACK TO Delete_Object_Attr_Val_SP;
5177 IF g_upgrade_mode = 'Y' THEN
5178 RAISE;
5179 END IF;
5180
5181 END Delete_Object_Attr_Val;
5182
5183
5184 /******************************************************************
5185 Created By : Don Shellito
5186 Date Created By : April 23, 2003
5187 Purpose : The purpose of this procedure is to remove
5188 the object from the OSS data model. There are
5189 no child tables that are to be cleaned of the
5190 object being removed.
5191 Remarks :
5192
5193 Change History
5194 Who When What
5195 ------------------------------------------------------------------------
5196 Don Shellito April 23, 2003 New Procedure Created.
5197
5198 ******************************************************************/
5199 PROCEDURE Delete_Object (p_api_version IN NUMBER,
5200 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
5201 p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE,
5202 p_obj_group_id IN igs_sc_objects.obj_group_id%TYPE,
5203 p_object_id IN igs_sc_objects.object_id%TYPE,
5204 x_return_status OUT NOCOPY VARCHAR2,
5205 x_return_message OUT NOCOPY VARCHAR2
5206 ) IS
5207
5208 -- -----------------------------------------------------------------
5209 -- Define local variables to be used.
5210 -- -----------------------------------------------------------------
5211 l_api_name CONSTANT VARCHAR2(30) := 'Delete_Object';
5212 l_api_version CONSTANT NUMBER := 1.0;
5213 l_message_count NUMBER(15);
5214 l_database_object_name VARCHAR2(255);
5215
5216 CURSOR c_obj IS
5217 SELECT database_object_name
5218 FROM fnd_objects
5219 WHERE object_id = p_object_id;
5220 BEGIN
5221
5222 SAVEPOINT Delete_Object_SP;
5223
5224 -- -----------------------------------------------------------------
5225 -- Check for the Compatible API call
5226 -- -----------------------------------------------------------------
5227 IF NOT FND_API.COMPATIBLE_API_CALL (l_api_version,
5228 p_api_version,
5229 l_api_name,
5230 g_pkg_name) THEN
5231 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
5232 END IF;
5233
5234 -- -----------------------------------------------------------------
5235 -- If the calling program has passed the parameter for initializing
5236 -- the message list
5237 -- -----------------------------------------------------------------
5238 IF FND_API.TO_BOOLEAN (p_init_msg_list) THEN
5239 FND_MSG_PUB.INITIALIZE;
5240 END IF;
5241
5242 -- -----------------------------------------------------------------
5243 -- Set the return status to success
5244 -- -----------------------------------------------------------------
5245 x_return_status := FND_API.G_RET_STS_SUCCESS;
5246
5247 -- -----------------------------------------------------------------
5248 -- Check if admin mode is enabled
5249 -- -----------------------------------------------------------------
5250 IF IGS_SC_GRANTS_PVT.admin_mode <> 'Y' AND g_upgrade_mode <> 'Y' THEN
5251
5252 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_ADMIN_MODE_OFF');
5253 FND_MSG_PUB.Add;
5254 RAISE FND_API.G_EXC_ERROR;
5255
5256 END IF;
5257 -- -----------------------------------------------------------------
5258 -- Delete the objects that are associated to the object group id and
5259 -- the object id provided.
5260 -- -----------------------------------------------------------------
5261 DELETE
5262 FROM igs_sc_objects objs
5263 WHERE objs.obj_group_id = p_obj_group_id
5264 AND objs.object_id = p_object_id;
5265
5266 OPEN c_obj;
5267 FETCH c_obj INTO l_database_object_name;
5268 CLOSE c_obj;
5269
5270
5271 -- FND_OBJECTS_PKG.DELETE_ROW (x_object_id =>p_object_id);
5272
5273
5274 modify_policy(l_database_object_name,'DROP');
5275
5276 -- -----------------------------------------------------------------
5277 -- Commit the transaction if requested to via parameter value.
5278 -- -----------------------------------------------------------------
5279 IF (FND_API.to_Boolean(p_commit)) THEN
5280 COMMIT;
5281 END IF;
5282
5283 -- -----------------------------------------------------------------
5284 -- Exception Block definition
5285 -- -----------------------------------------------------------------
5286 EXCEPTION
5287 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
5288 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
5289 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
5290 p_count => l_message_count,
5291 p_data => x_return_message);
5292 ROLLBACK TO Delete_Object_SP;
5293
5294 WHEN FND_API.G_EXC_ERROR THEN
5295 x_return_status := FND_API.G_RET_STS_ERROR;
5296
5297 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
5298 p_count => l_message_count,
5299 p_data => x_return_message);
5300 ROLLBACK TO Delete_Object_SP;
5301
5302 WHEN OTHERS THEN
5303 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
5304 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
5305 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
5306 END IF;
5307 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
5308 p_count => l_message_count,
5309 p_data => x_return_message);
5310 ROLLBACK TO Delete_Object_SP;
5311 IF g_upgrade_mode = 'Y' THEN
5312 RAISE;
5313 END IF;
5314
5315 END Delete_Object;
5316
5317
5318 /******************************************************************
5319 Created By : Don Shellito
5320 Date Created By : April 23, 2003
5321 Purpose : The purpose of this procedure is to remove the
5322 user attribute from the OSS data model. The child
5323 tables that have reference to the user attribute
5324 being removed will also be removed.
5325 Remarks :
5326
5327 Change History
5328 Who When What
5329 ------------------------------------------------------------------------
5330 Don Shellito April 23, 2003 New Procedure Created.
5331
5332 ******************************************************************/
5333 PROCEDURE Delete_User_Attr (p_api_version IN NUMBER,
5334 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
5335 p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE,
5336 p_user_attrib_id IN igs_sc_usr_attribs.user_attrib_id%TYPE,
5337 x_return_status OUT NOCOPY VARCHAR2,
5338 x_return_message OUT NOCOPY VARCHAR2
5339 ) IS
5340
5341 -- -----------------------------------------------------------------
5342 -- Define local variables to be used.
5343 -- -----------------------------------------------------------------
5344 l_api_name CONSTANT VARCHAR2(30) := 'Delete_User_Attr';
5345 l_api_version CONSTANT NUMBER := 1.0;
5346 l_grant_id igs_sc_grant_conds.grant_id%TYPE;
5347 l_grant_cond_num igs_sc_grant_conds.grant_cond_num%TYPE;
5348 l_user_id igs_sc_usr_att_vals.user_id%TYPE;
5349 l_grant_name igs_sc_grants.grant_name%TYPE;
5350 l_return_message VARCHAR2(2000);
5351 l_message_count NUMBER(15);
5352 l_return_status VARCHAR2(30);
5353
5354 -- -----------------------------------------------------------------
5355 -- Define the cursors to be used in procedure.
5356 -- -----------------------------------------------------------------
5357 CURSOR c_get_grant_conds IS
5358 SELECT grts.grant_id,
5359 grts.grant_cond_num,
5360 gnt.grant_name
5361 FROM igs_sc_grant_conds grts,
5362 igs_sc_grants gnt
5363 WHERE grts.user_attrib_id = p_user_attrib_id
5364 AND gnt.grant_id = grts.grant_id;
5365
5366 CURSOR c_get_user_id IS
5367 SELECT uval.user_id
5368 FROM igs_sc_usr_att_vals uval
5369 WHERE uval.user_attrib_id = p_user_attrib_id;
5370
5371 BEGIN
5372
5373 SAVEPOINT Delete_User_Attr_SP;
5374
5375 -- -----------------------------------------------------------------
5376 -- Check for the Compatible API call
5377 -- -----------------------------------------------------------------
5378 IF NOT FND_API.COMPATIBLE_API_CALL (l_api_version,
5379 p_api_version,
5380 l_api_name,
5381 g_pkg_name) THEN
5382 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
5383 END IF;
5384
5385 -- -----------------------------------------------------------------
5386 -- If the calling program has passed the parameter for initializing
5387 -- the message list
5388 -- -----------------------------------------------------------------
5389 IF FND_API.TO_BOOLEAN (p_init_msg_list) THEN
5390 FND_MSG_PUB.INITIALIZE;
5391 END IF;
5392
5393 -- -----------------------------------------------------------------
5394 -- Set the return status to success
5395 -- -----------------------------------------------------------------
5396 x_return_status := FND_API.G_RET_STS_SUCCESS;
5397
5398 -- -----------------------------------------------------------------
5399 -- Check if admin mode is enabled
5400 -- -----------------------------------------------------------------
5401 IF IGS_SC_GRANTS_PVT.admin_mode <> 'Y' AND g_upgrade_mode <> 'Y' THEN
5402
5403 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_ADMIN_MODE_OFF');
5404 FND_MSG_PUB.Add;
5405 RAISE FND_API.G_EXC_ERROR;
5406
5407 END IF;
5408
5409 -- -----------------------------------------------------------------
5410 -- Delete all the grant conditions that may have the object
5411 -- attribute associated to it.
5412 -- -----------------------------------------------------------------
5413 OPEN c_get_grant_conds;
5414 FETCH c_get_grant_conds
5415 INTO l_grant_id,
5416 l_grant_cond_num,
5417 l_grant_name;
5418
5419 IF (c_get_grant_conds%FOUND) THEN
5420 CLOSE c_get_grant_conds; --mmkumar
5421 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_GRANT_PRSNT');
5422 FND_MESSAGE.SET_TOKEN('GRANT_NAME', l_grant_name);
5423 FND_MSG_PUB.Add;
5424 RAISE FND_API.G_EXC_ERROR;
5425 END IF;
5426
5427 IF (c_get_grant_conds%ISOPEN) THEN
5428 CLOSE c_get_grant_conds;
5429 END IF;
5430
5431 -- -----------------------------------------------------------------
5432 -- Delete all the grant conditions that may have the user
5433 -- attribute associated to it.
5434 -- -----------------------------------------------------------------
5435 Delete_User_Attr_Val (p_api_version => l_api_version,
5436 p_user_attrib_id => p_user_attrib_id,
5437 p_user_id => NULL,
5438 x_return_status => l_return_status,
5439 x_return_message => l_return_message
5440 );
5441
5442 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
5443 RAISE FND_API.G_EXC_ERROR;
5444 END IF;
5445
5446 IF (c_get_user_id%ISOPEN) THEN
5447 CLOSE c_get_user_id;
5448 END IF;
5449
5450 -- -----------------------------------------------------------------
5451 -- Delete the user attributes associated to the attribute id given
5452 -- -----------------------------------------------------------------
5453 DELETE
5454 FROM igs_sc_usr_attribs attr
5455 WHERE attr.user_attrib_id = p_user_attrib_id;
5456
5457 -- -----------------------------------------------------------------
5458 -- Commit the transaction if requested to via parameter value.
5459 -- -----------------------------------------------------------------
5460 IF (FND_API.to_Boolean(p_commit)) THEN
5461 COMMIT;
5462 END IF;
5463
5464 -- -----------------------------------------------------------------
5465 -- Exception Block definition
5466 -- -----------------------------------------------------------------
5467 EXCEPTION
5468 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
5469 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
5470 IF (c_get_grant_conds%ISOPEN) THEN
5471 CLOSE c_get_grant_conds;
5472 END IF;
5473 IF (c_get_user_id%ISOPEN) THEN
5474 CLOSE c_get_user_id;
5475 END IF;
5476 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
5477 p_count => l_message_count,
5478 p_data => x_return_message);
5479 ROLLBACK TO Delete_User_Attr_SP;
5480
5481 WHEN FND_API.G_EXC_ERROR THEN
5482 x_return_status := FND_API.G_RET_STS_ERROR;
5483
5484 IF (c_get_grant_conds%ISOPEN) THEN
5485 CLOSE c_get_grant_conds;
5486 END IF;
5487 IF (c_get_user_id%ISOPEN) THEN
5488 CLOSE c_get_user_id;
5489 END IF;
5490 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
5491 p_count => l_message_count,
5492 p_data => x_return_message);
5493 ROLLBACK TO Delete_User_Attr_SP;
5494
5495 WHEN OTHERS THEN
5496 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
5497 IF (c_get_grant_conds%ISOPEN) THEN
5498 CLOSE c_get_grant_conds;
5499 END IF;
5500 IF (c_get_user_id%ISOPEN) THEN
5501 CLOSE c_get_user_id;
5502 END IF;
5503 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
5504 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
5505 END IF;
5506 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
5507 p_count => l_message_count,
5508 p_data => x_return_message);
5509 ROLLBACK TO Delete_User_Attr_SP;
5510 IF g_upgrade_mode = 'Y' THEN
5511 RAISE;
5512 END IF;
5513
5514 END Delete_User_Attr;
5515
5516
5517 /******************************************************************
5518 Created By : Don Shellito
5519 Date Created By : April 23, 2003
5520 Purpose : The purpose of this procedure is to remove
5521 the user attribute values from the OSS data
5522 model. There are no child tables to be updated
5523 due to the removal of the value.
5524 Remarks :
5525
5526 Change History
5527 Who When What
5528 ------------------------------------------------------------------------
5529 Don Shellito April 23, 2003 New Procedure Created.
5530
5531 ******************************************************************/
5532 PROCEDURE Delete_User_Attr_Val (p_api_version IN NUMBER,
5533 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
5534 p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE,
5535 p_user_attrib_id IN igs_sc_usr_attribs.user_attrib_id%TYPE,
5536 p_user_id IN NUMBER,
5537 x_return_status OUT NOCOPY VARCHAR2,
5538 x_return_message OUT NOCOPY VARCHAR2
5539 ) IS
5540
5541 -- -----------------------------------------------------------------
5542 -- Define local variables to be used.
5543 -- -----------------------------------------------------------------
5544 l_api_name CONSTANT VARCHAR2(30) := 'Delete_User_Attr_Val';
5545 l_api_version CONSTANT NUMBER := 1.0;
5546 l_return_message VARCHAR2(2000);
5547 l_message_count NUMBER(15);
5548 l_return_status VARCHAR2(30);
5549
5550 BEGIN
5551
5552 SAVEPOINT Delete_User_Attr_Val_SP;
5553
5554 -- -----------------------------------------------------------------
5555 -- Check for the Compatible API call
5556 -- -----------------------------------------------------------------
5557 IF NOT FND_API.COMPATIBLE_API_CALL (l_api_version,
5558 p_api_version,
5559 l_api_name,
5560 g_pkg_name) THEN
5561 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
5562 END IF;
5563
5564 -- -----------------------------------------------------------------
5565 -- If the calling program has passed the parameter for initializing
5566 -- the message list
5567 -- -----------------------------------------------------------------
5568 IF FND_API.TO_BOOLEAN (p_init_msg_list) THEN
5569 FND_MSG_PUB.INITIALIZE;
5570 END IF;
5571
5572 -- -----------------------------------------------------------------
5573 -- Set the return status to success
5574 -- -----------------------------------------------------------------
5575 x_return_status := FND_API.G_RET_STS_SUCCESS;
5576
5577 -- -----------------------------------------------------------------
5578 -- Delete the user attribute values based on the attribute ID and
5579 -- User ID provided.
5580 -- -----------------------------------------------------------------
5581 DELETE
5582 FROM igs_sc_usr_att_vals atvl
5583 WHERE ( atvl.user_id = p_user_id OR p_user_id IS NULL )
5584 AND atvl.user_attrib_id = p_user_attrib_id;
5585
5586 -- -----------------------------------------------------------------
5587 -- Commit the transaction if requested to via parameter value.
5588 -- -----------------------------------------------------------------
5589 IF (FND_API.to_Boolean(p_commit)) THEN
5590 COMMIT;
5591 END IF;
5592
5593 -- -----------------------------------------------------------------
5594 -- Exception Block definition
5595 -- -----------------------------------------------------------------
5596 EXCEPTION
5597 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
5598 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
5599 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
5600 p_count => l_message_count,
5601 p_data => x_return_message);
5602 ROLLBACK TO Delete_User_Attr_Val_SP;
5603
5604 WHEN FND_API.G_EXC_ERROR THEN
5605 x_return_status := FND_API.G_RET_STS_ERROR;
5606
5607 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
5608 p_count => l_message_count,
5609 p_data => x_return_message);
5610 ROLLBACK TO Delete_User_Attr_Val_SP;
5611
5612 WHEN OTHERS THEN
5613 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
5614 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
5615 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
5616 END IF;
5617 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
5618 p_count => l_message_count,
5619 p_data => x_return_message);
5620 ROLLBACK TO Delete_User_Attr_Val_SP;
5621 IF g_upgrade_mode = 'Y' THEN
5622 RAISE;
5623 END IF;
5624
5625 END Delete_User_Attr_Val;
5626
5627
5628 /******************************************************************
5629 Created By : Don Shellito
5630 Date Created By : April 23, 2003
5631 Purpose : The purpose of this procedure is to remove the
5632 grant from the OSS data model. All child tables
5633 that have reference to the grant being removed
5634 will also be removed. It must be noted that the
5635 only way to remove a grant is to unlock it first.
5636 Remarks :
5637
5638 Change History
5639 Who When What
5640 ------------------------------------------------------------------------
5641 Don Shellito April 23, 2003 New Procedure Created.
5642
5643 ******************************************************************/
5644 PROCEDURE Delete_Grant (p_api_version IN NUMBER,
5645 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
5646 p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE,
5647 p_grant_id IN igs_sc_grants.grant_id%TYPE,
5648 x_return_status OUT NOCOPY VARCHAR2,
5649 x_return_message OUT NOCOPY VARCHAR2
5650 ) IS
5651
5652 -- -----------------------------------------------------------------
5653 -- Define local variables to be used.
5654 -- -----------------------------------------------------------------
5655 l_api_name CONSTANT VARCHAR2(30) := 'Delete_Grant';
5656 l_delete_oper CONSTANT VARCHAR2(30) := 'DELETE';
5657 l_api_version CONSTANT NUMBER := 1.0;
5658 l_grant_cond_num igs_sc_grant_conds.grant_cond_num%TYPE;
5659 l_grant_name igs_sc_grants.grant_name%TYPE;
5660 l_return_message VARCHAR2(2000);
5661 l_message_count NUMBER(15);
5662 l_return_status VARCHAR2(30);
5663
5664 -- -----------------------------------------------------------------
5665 -- Define the cursors to be used in procedure.
5666 -- -----------------------------------------------------------------
5667 CURSOR c_get_grant_cond IS
5668 SELECT grts.grant_cond_num
5669 FROM igs_sc_grant_conds grts
5670 WHERE grts.grant_id = p_grant_id;
5671
5672 CURSOR c_get_grant_name IS
5673 SELECT grts.grant_name
5674 FROM igs_sc_grants grts
5675 WHERE grts.grant_id = p_grant_id;
5676
5677 BEGIN
5678
5679 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
5680 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Delete_Grant';
5681 l_debug_str := 'Grant ID: '||p_grant_id;
5682 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
5683 END IF;
5684
5685 SAVEPOINT Delete_Grant_SP;
5686
5687 -- -----------------------------------------------------------------
5688 -- Check for the Compatible API call
5689 -- -----------------------------------------------------------------
5690 IF NOT FND_API.COMPATIBLE_API_CALL (l_api_version,
5691 p_api_version,
5692 l_api_name,
5693 g_pkg_name) THEN
5694 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
5695 END IF;
5696
5697 -- -----------------------------------------------------------------
5698 -- If the calling program has passed the parameter for initializing
5699 -- the message list
5700 -- -----------------------------------------------------------------
5701 IF FND_API.TO_BOOLEAN (p_init_msg_list) THEN
5702 FND_MSG_PUB.INITIALIZE;
5703 END IF;
5704
5705 -- -----------------------------------------------------------------
5706 -- Set the return status to success
5707 -- -----------------------------------------------------------------
5708 x_return_status := FND_API.G_RET_STS_SUCCESS;
5709
5710 -- -----------------------------------------------------------------
5711 -- Determine if the grant is locked or not.
5712 -- -----------------------------------------------------------------
5713 IF (Is_Grant_Locked(p_grant_id) = 'N') THEN
5714
5715 -- -----------------------------------------------------------------
5716 -- Delete all the grant conditions for the Grant.
5717 -- -----------------------------------------------------------------
5718 OPEN c_get_grant_cond;
5719 FETCH c_get_grant_cond
5720 INTO l_grant_cond_num;
5721
5722 WHILE (c_get_grant_cond%FOUND) LOOP
5723
5724 Delete_Grant_Cond (p_api_version => l_api_version,
5725 p_grant_id => p_grant_id,
5726 p_grant_cond_num => l_grant_cond_num,
5727 x_return_status => l_return_status,
5728 x_return_message => l_return_message
5729 );
5730
5731 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
5732 RAISE FND_API.G_EXC_ERROR;
5733 END IF;
5734
5735 FETCH c_get_grant_cond
5736 INTO l_grant_cond_num;
5737
5738 END LOOP;
5739
5740 IF (c_get_grant_cond%ISOPEN) THEN
5741 CLOSE c_get_grant_cond;
5742 END IF;
5743
5744 -- -----------------------------------------------------------------
5745 -- Delete the grant that has been requested for deletion.
5746 -- -----------------------------------------------------------------
5747 DELETE
5748 FROM igs_sc_grants grts
5749 WHERE grts.grant_id = p_grant_id;
5750
5751 ELSE
5752
5753 OPEN c_get_grant_name;
5754 FETCH c_get_grant_name
5755 INTO l_grant_name;
5756
5757 CLOSE c_get_grant_name; --mmkumar
5758
5759 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_GRANT_LOCKED_NO_OPS');
5760 FND_MESSAGE.SET_TOKEN('OPS_TYPE', l_delete_oper);
5761 FND_MESSAGE.SET_TOKEN('GRANT_NAME', l_grant_name);
5762 FND_MSG_PUB.Add;
5763 RAISE FND_API.G_EXC_ERROR;
5764
5765 END IF;
5766
5767 -- -----------------------------------------------------------------
5768 -- Commit the transaction if requested to via parameter value.
5769 -- -----------------------------------------------------------------
5770 IF (FND_API.to_Boolean(p_commit)) THEN
5771 COMMIT;
5772 END IF;
5773
5774 -- -----------------------------------------------------------------
5775 -- Exception Block definition
5776 -- -----------------------------------------------------------------
5777 EXCEPTION
5778
5779 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
5780 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
5781 IF (c_get_grant_name%ISOPEN) THEN
5782 CLOSE c_get_grant_name;
5783 END IF;
5784 IF (c_get_grant_cond%ISOPEN) THEN
5785 CLOSE c_get_grant_cond;
5786 END IF;
5787 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
5788 p_count => l_message_count,
5789 p_data => x_return_message);
5790 ROLLBACK TO Delete_Grant_SP;
5791
5792 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
5793 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Delete_Grant.Ex_error';
5794 l_debug_str := 'Unhandled Exception: Grant ID: '||p_grant_id||','||' Error Message: '||x_return_message;
5795 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
5796 END IF;
5797
5798 WHEN FND_API.G_EXC_ERROR THEN
5799 x_return_status := FND_API.G_RET_STS_ERROR;
5800
5801 IF (c_get_grant_name%ISOPEN) THEN
5802 CLOSE c_get_grant_name;
5803 END IF;
5804 IF (c_get_grant_cond%ISOPEN) THEN
5805 CLOSE c_get_grant_cond;
5806 END IF;
5807 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
5808 p_count => l_message_count,
5809 p_data => x_return_message);
5810 ROLLBACK TO Delete_Grant_SP;
5811
5812 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
5813 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Delete_Grant.Ex_un';
5814 l_debug_str := 'Unhandled Exception: Grant ID: '||p_grant_id||','||' Error Message: '||x_return_message;
5815 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
5816 END IF;
5817
5818 WHEN OTHERS THEN
5819 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
5820 IF (c_get_grant_name%ISOPEN) THEN
5821 CLOSE c_get_grant_name;
5822 END IF;
5823 IF (c_get_grant_cond%ISOPEN) THEN
5824 CLOSE c_get_grant_cond;
5825 END IF;
5826 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
5827 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
5828 END IF;
5829 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
5830 p_count => l_message_count,
5831 p_data => x_return_message);
5832 ROLLBACK TO Delete_Grant_SP;
5833
5834 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
5835 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Delete_Grant.Ex_others';
5836 l_debug_str := 'Other Exception: Grant ID: '||p_grant_id||','||' Error Message: '||x_return_message;
5837 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
5838 END IF;
5839
5840 IF g_upgrade_mode = 'Y' THEN
5841 RAISE;
5842 END IF;
5843
5844 END Delete_Grant;
5845
5846
5847 /******************************************************************
5848 Created By : Don Shellito
5849 Date Created By : April 23, 2003
5850 Purpose : The purpose of this procedure is to remove the
5851 grant condition from the OSS data model. There
5852 are no child tables that need to be cleaned up
5853 on this removal. It must be noted that the only
5854 way to remove the grant condition is if the grant
5855 is unlocked.
5856 Remarks :
5857
5858 Change History
5859 Who When What
5860 ------------------------------------------------------------------------
5861 Don Shellito April 23, 2003 New Procedure Created.
5862
5863 ******************************************************************/
5864 PROCEDURE Delete_Grant_Cond (p_api_version IN NUMBER,
5865 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
5866 p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE,
5867 p_grant_id IN igs_sc_grant_conds.grant_id%TYPE,
5868 p_grant_cond_num IN igs_sc_grant_conds.grant_cond_num%TYPE,
5869 x_return_status OUT NOCOPY VARCHAR2,
5870 x_return_message OUT NOCOPY VARCHAR2
5871 ) IS
5872
5873 -- -----------------------------------------------------------------
5874 -- Define local variables to be used.
5875 -- -----------------------------------------------------------------
5876 l_api_name CONSTANT VARCHAR2(30) := 'Delete_Grant_Cond';
5877 l_delete_oper CONSTANT VARCHAR2(30) := 'DELETE';
5878 l_api_version CONSTANT NUMBER := 1.0;
5879 l_grant_name igs_sc_grants.grant_name%TYPE;
5880 l_return_message VARCHAR2(2000);
5881 l_message_count NUMBER(15);
5882 l_return_status VARCHAR2(30);
5883
5884 -- -----------------------------------------------------------------
5885 -- Define the cursors to be used in procedure.
5886 -- -----------------------------------------------------------------
5887 CURSOR c_get_grant_name IS
5888 SELECT grts.grant_name
5889 FROM igs_sc_grants grts
5890 WHERE grts.grant_id = p_grant_id;
5891
5892 BEGIN
5893
5894 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
5895 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Delete_Grant_Cond';
5896 l_debug_str := 'Grant ID: '||p_grant_id||','||'Grant Cond Number: '||p_grant_cond_num;
5897 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
5898 END IF;
5899
5900 SAVEPOINT Delete_Grant_Cond_SP;
5901
5902 -- -----------------------------------------------------------------
5903 -- Check for the Compatible API call
5904 -- -----------------------------------------------------------------
5905 IF NOT FND_API.COMPATIBLE_API_CALL (l_api_version,
5906 p_api_version,
5907 l_api_name,
5908 g_pkg_name) THEN
5909 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
5910 END IF;
5911
5912 -- -----------------------------------------------------------------
5913 -- If the calling program has passed the parameter for initializing
5914 -- the message list
5915 -- -----------------------------------------------------------------
5916 IF FND_API.TO_BOOLEAN (p_init_msg_list) THEN
5917 FND_MSG_PUB.INITIALIZE;
5918 END IF;
5919
5920 -- -----------------------------------------------------------------
5921 -- Set the return status to success
5922 -- -----------------------------------------------------------------
5923 x_return_status := FND_API.G_RET_STS_SUCCESS;
5924
5925 -- -----------------------------------------------------------------
5926 -- Check to make sure that the grant is unlocked.
5927 -- -----------------------------------------------------------------
5928 IF (Is_Grant_Locked(p_grant_id) = 'N') THEN
5929
5930 -- -----------------------------------------------------------------
5931 -- Delete the grant condition that is being requested.
5932 -- -----------------------------------------------------------------
5933 DELETE
5934 FROM igs_sc_grant_conds conds
5935 WHERE conds.grant_id = p_grant_id
5936 AND conds.grant_cond_num = p_grant_cond_num;
5937
5938 ELSE
5939
5940 OPEN c_get_grant_name;
5941 FETCH c_get_grant_name
5942 INTO l_grant_name;
5943
5944 CLOSE c_get_grant_name; --mmkumar
5945
5946 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_GRANT_LOCKED_NO_OPS');
5947 FND_MESSAGE.SET_TOKEN('OPS_TYPE', l_delete_oper);
5948 FND_MESSAGE.SET_TOKEN('GRANT_NAME', l_grant_name);
5949 FND_MSG_PUB.Add;
5950 RAISE FND_API.G_EXC_ERROR;
5951
5952 END IF;
5953
5954 -- -----------------------------------------------------------------
5955 -- Commit the transaction if requested to via parameter value.
5956 -- -----------------------------------------------------------------
5957 IF (FND_API.to_Boolean(p_commit)) THEN
5958 COMMIT;
5959 END IF;
5960
5961 -- -----------------------------------------------------------------
5962 -- Exception Block definition
5963 -- -----------------------------------------------------------------
5964 EXCEPTION
5965
5966 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
5967 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
5968 IF (c_get_grant_name%ISOPEN) THEN
5969 CLOSE c_get_grant_name;
5970 END IF;
5971 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
5972 p_count => l_message_count,
5973 p_data => x_return_message);
5974 ROLLBACK TO Delete_Grant_Cond_SP;
5975
5976 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
5977 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Delete_Grant_Cond.Ex_un';
5978 l_debug_str := 'Unhandled Exception: Grant ID: '||p_grant_id||','||'Grant Cond Number: '||p_grant_cond_num||'Error Message: '||x_return_message;
5979 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
5980 END IF;
5981
5982
5983 WHEN FND_API.G_EXC_ERROR THEN
5984 x_return_status := FND_API.G_RET_STS_ERROR;
5985
5986 IF (c_get_grant_name%ISOPEN) THEN
5987 CLOSE c_get_grant_name;
5988 END IF;
5989 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
5990 p_count => l_message_count,
5991 p_data => x_return_message);
5992 ROLLBACK TO Delete_Grant_Cond_SP;
5993
5994 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
5995 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Delete_Grant_Cond.Ex_error';
5996 l_debug_str := 'Handled Exception: Grant ID: '||p_grant_id||','||'Grant Cond Number: '||p_grant_cond_num||'Error Message: '||x_return_message;
5997 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
5998 END IF;
5999
6000 WHEN OTHERS THEN
6001 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
6002 IF (c_get_grant_name%ISOPEN) THEN
6003 CLOSE c_get_grant_name;
6004 END IF;
6005 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
6006 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
6007 END IF;
6008 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
6009 p_count => l_message_count,
6010 p_data => x_return_message);
6011 ROLLBACK TO Delete_Grant_Cond_SP;
6012
6013 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
6014 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Delete_Grant_Cond.Ex_others';
6015 l_debug_str := 'Other Exception: Grant ID: '||p_grant_id||','||'Grant Cond Number: '||p_grant_cond_num||'Error Message: '||x_return_message;
6016 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
6017 END IF;
6018
6019 IF g_upgrade_mode = 'Y' THEN
6020 RAISE;
6021 END IF;
6022
6023 END Delete_Grant_Cond;
6024
6025
6026 /******************************************************************
6027 Created By : Don Shellito
6028 Date Created By : April 23, 2003
6029 Purpose :
6030 remarks :
6031
6032 Change History
6033 Who When What
6034 ------------------------------------------------------------------------
6035 Don Shellito April 23, 2003 New Procedure Created.
6036
6037 ******************************************************************/
6038 PROCEDURE Delete_Local_Role (p_api_version IN NUMBER,
6039 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
6040 p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE,
6041 x_return_status OUT NOCOPY VARCHAR2,
6042 x_return_message OUT NOCOPY VARCHAR2
6043 ) IS
6044
6045 -- -----------------------------------------------------------------
6046 -- Define local variables to be used.
6047 -- -----------------------------------------------------------------
6048 l_api_name CONSTANT VARCHAR2(30) := 'Delete_Local_Role';
6049 l_api_version CONSTANT NUMBER := 1.0;
6050 l_return_message VARCHAR2(2000);
6051 l_message_count NUMBER(15);
6052 l_return_status VARCHAR2(30);
6053
6054 BEGIN
6055
6056 SAVEPOINT Delete_Local_Role_SP;
6057
6058 -- -----------------------------------------------------------------
6059 -- Check for the Compatible API call
6060 -- -----------------------------------------------------------------
6061 IF NOT FND_API.COMPATIBLE_API_CALL (l_api_version,
6062 p_api_version,
6063 l_api_name,
6064 g_pkg_name) THEN
6065 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
6066 END IF;
6067
6068 -- -----------------------------------------------------------------
6069 -- If the calling program has passed the parameter for initializing
6070 -- the message list
6071 -- -----------------------------------------------------------------
6072 IF FND_API.TO_BOOLEAN (p_init_msg_list) THEN
6073 FND_MSG_PUB.INITIALIZE;
6074 END IF;
6075
6076 -- -----------------------------------------------------------------
6077 -- Set the return status to success
6078 -- -----------------------------------------------------------------
6079 x_return_status := FND_API.G_RET_STS_SUCCESS;
6080
6081
6082 -- -----------------------------------------------------------------
6083 -- Commit the transaction if requested to via parameter value.
6084 -- -----------------------------------------------------------------
6085 IF (FND_API.to_Boolean(p_commit)) THEN
6086 COMMIT;
6087 END IF;
6088
6089 -- -----------------------------------------------------------------
6090 -- Exception Block definition
6091 -- -----------------------------------------------------------------
6092 EXCEPTION
6093 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
6094 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
6095 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
6096 p_count => l_message_count,
6097 p_data => x_return_message);
6098 ROLLBACK TO Delete_Local_Role_SP;
6099
6100 WHEN FND_API.G_EXC_ERROR THEN
6101 x_return_status := FND_API.G_RET_STS_ERROR;
6102
6103 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
6104 p_count => l_message_count,
6105 p_data => x_return_message);
6106 ROLLBACK TO Delete_Local_Role_SP;
6107
6108 WHEN OTHERS THEN
6109 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
6110 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
6111 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
6112 END IF;
6113 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
6114 p_count => l_message_count,
6115 p_data => x_return_message);
6116 ROLLBACK TO Delete_Local_Role_SP;
6117 IF g_upgrade_mode = 'Y' THEN
6118 RAISE;
6119 END IF;
6120
6121 END Delete_Local_Role;
6122
6123
6124 /******************************************************************
6125 Created By : Don Shellito
6126 Date Created By : April 23, 2003
6127 Purpose :
6128 remarks :
6129
6130 Change History
6131 Who When What
6132 ------------------------------------------------------------------------
6133 Don Shellito April 23, 2003 New Procedure Created.
6134
6135 ******************************************************************/
6136 PROCEDURE Delete_Local_User_Role (p_api_version IN NUMBER,
6137 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
6138 p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE,
6139 x_return_status OUT NOCOPY VARCHAR2,
6140 x_return_message OUT NOCOPY VARCHAR2
6141 ) IS
6142
6143 -- -----------------------------------------------------------------
6144 -- Define local variables to be used.
6145 -- -----------------------------------------------------------------
6146 l_api_name CONSTANT VARCHAR2(30) := 'Delete_Local_User_Role';
6147 l_api_version CONSTANT NUMBER := 1.0;
6148 l_return_message VARCHAR2(2000);
6149 l_message_count NUMBER(15);
6150 l_return_status VARCHAR2(30);
6151
6152 BEGIN
6153
6154 SAVEPOINT Delete_Local_User_Role_SP;
6155
6156 -- -----------------------------------------------------------------
6157 -- Check for the Compatible API call
6158 -- -----------------------------------------------------------------
6159 IF NOT FND_API.COMPATIBLE_API_CALL (l_api_version,
6160 p_api_version,
6161 l_api_name,
6162 g_pkg_name) THEN
6163 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
6164 END IF;
6165
6166 -- -----------------------------------------------------------------
6167 -- If the calling program has passed the parameter for initializing
6168 -- the message list
6169 -- -----------------------------------------------------------------
6170 IF FND_API.TO_BOOLEAN (p_init_msg_list) THEN
6171 FND_MSG_PUB.INITIALIZE;
6172 END IF;
6173
6174 -- -----------------------------------------------------------------
6175 -- Set the return status to success
6176 -- -----------------------------------------------------------------
6177 x_return_status := FND_API.G_RET_STS_SUCCESS;
6178
6179
6180 -- -----------------------------------------------------------------
6181 -- Commit the transaction if requested to via parameter value.
6182 -- -----------------------------------------------------------------
6183 IF (FND_API.to_Boolean(p_commit)) THEN
6184 COMMIT;
6185 END IF;
6186
6187 -- -----------------------------------------------------------------
6188 -- Exception Block definition
6189 -- -----------------------------------------------------------------
6190 EXCEPTION
6191 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
6192 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
6193 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
6194 p_count => l_message_count,
6195 p_data => x_return_message);
6196 ROLLBACK TO Delete_Local_User_Role_SP;
6197
6198 WHEN FND_API.G_EXC_ERROR THEN
6199 x_return_status := FND_API.G_RET_STS_ERROR;
6200
6201 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
6202 p_count => l_message_count,
6203 p_data => x_return_message);
6204 ROLLBACK TO Delete_Local_User_Role_SP;
6205
6206 WHEN OTHERS THEN
6207 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
6208 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
6209 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
6210 END IF;
6211 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
6212 p_count => l_message_count,
6213 p_data => x_return_message);
6214 ROLLBACK TO Delete_Local_User_Role_SP;
6215 IF g_upgrade_mode = 'Y' THEN
6216 RAISE;
6217 END IF;
6218
6219 END Delete_Local_User_Role;
6220
6221
6222 /******************************************************************
6223 Created By : Don Shellito
6224 Date Created By : April 23, 2003
6225 Purpose : The purpose of this function is to determine
6226 if the grant is locked or not.
6227 Remarks :
6228
6229 Change History
6230 Who When What
6231 ------------------------------------------------------------------------
6232 Don Shellito April 23, 2003 New Procedure Created.
6233
6234 ******************************************************************/
6235 FUNCTION Is_Grant_Locked (
6236 p_grant_id IN igs_sc_grants.grant_id%TYPE
6237 ) RETURN VARCHAR2 AS
6238
6239 -- -----------------------------------------------------------------
6240 -- Define local variables to be used.
6241 -- -----------------------------------------------------------------
6242 l_api_name CONSTANT VARCHAR2(30) := 'Is_Grant_Locked';
6243 l_api_version CONSTANT NUMBER := 1.0;
6244 l_lock_flag igs_sc_grants.locked_flag%TYPE;
6245 l_return_message VARCHAR2(2000);
6246 l_message_count NUMBER(15);
6247 l_return_status VARCHAR2(30);
6248
6249 -- -----------------------------------------------------------------
6250 -- Define the cursors to be used in procedure.
6251 -- -----------------------------------------------------------------
6252 CURSOR c_get_lock_flag IS
6253 SELECT grnt.locked_flag
6254 FROM igs_sc_grants grnt
6255 WHERE grnt.grant_id = p_grant_id;
6256
6257 BEGIN
6258
6259 -- -----------------------------------------------------------------
6260 -- Check to determine if the grant is locked or not.
6261 -- -----------------------------------------------------------------
6262 OPEN c_get_lock_flag;
6263 FETCH c_get_lock_flag
6264 INTO l_lock_flag;
6265
6266 IF (l_lock_flag = 'Y') THEN
6267 CLOSE c_get_lock_flag;
6268 RETURN ('Y');
6269 ELSE
6270 CLOSE c_get_lock_flag;
6271 RETURN ('N');
6272 END IF;
6273
6274 -- -----------------------------------------------------------------
6275 -- Exception Block definition
6276 -- -----------------------------------------------------------------
6277 EXCEPTION
6278
6279 WHEN OTHERS THEN
6280 IF (c_get_lock_flag%ISOPEN) THEN
6281 CLOSE c_get_lock_flag;
6282 END IF;
6283 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
6284 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
6285 END IF;
6286 RAISE FND_API.G_EXC_ERROR;
6287 IF g_upgrade_mode = 'Y' THEN
6288 RAISE;
6289 END IF;
6290
6291 END Is_Grant_Locked;
6292
6293
6294 /******************************************************************
6295 Created By : Don Shellito
6296 Date Created By : April 23, 2003
6297 Purpose : The purpose of this procedure is to lock the
6298 grant so that it can not be deleted and start
6299 the use of the grant into the system.
6300 Remarks :
6301
6302 Change History
6303 Who When What
6304 ------------------------------------------------------------------------
6305 Don Shellito April 23, 2003 New Procedure Created.
6306
6307 ******************************************************************/
6308 PROCEDURE Lock_Grant (p_api_version IN NUMBER,
6309 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
6310 p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE,
6311 p_grant_id IN igs_sc_grants.grant_id%TYPE,
6312 x_return_status OUT NOCOPY VARCHAR2,
6313 x_return_message OUT NOCOPY VARCHAR2
6314 ) IS
6315
6316 -- -----------------------------------------------------------------
6317 -- Define local variables to be used.
6318 -- -----------------------------------------------------------------
6319 l_api_name CONSTANT VARCHAR2(30) := 'Lock_Grant';
6320 l_api_version CONSTANT NUMBER := 1.0;
6321 l_grant_id igs_sc_grants.grant_id%TYPE;
6322 l_return_message VARCHAR2(2000);
6323 l_message_count NUMBER(15);
6324 l_return_status VARCHAR2(30);
6325
6326 -- -----------------------------------------------------------------
6327 -- Define the cursors to be used in procedure.
6328 -- -----------------------------------------------------------------
6329 CURSOR c_check_grant IS
6330 SELECT grts.grant_id
6331 FROM igs_sc_grants grts
6332 WHERE grts.grant_id = p_grant_id;
6333
6334 BEGIN
6335
6336 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
6337 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Lock_Grant';
6338 l_debug_str := 'Grant ID: '||p_grant_id;
6339 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
6340 END IF;
6341
6342 SAVEPOINT Lock_Grant_SP;
6343
6344 -- -----------------------------------------------------------------
6345 -- Check for the Compatible API call
6346 -- -----------------------------------------------------------------
6347 IF NOT FND_API.COMPATIBLE_API_CALL (l_api_version,
6348 p_api_version,
6349 l_api_name,
6350 g_pkg_name) THEN
6351 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
6352 END IF;
6353
6354 -- -----------------------------------------------------------------
6355 -- If the calling program has passed the parameter for initializing
6356 -- the message list
6357 -- -----------------------------------------------------------------
6358 IF FND_API.TO_BOOLEAN (p_init_msg_list) THEN
6359 FND_MSG_PUB.INITIALIZE;
6360 END IF;
6361
6362 -- -----------------------------------------------------------------
6363 -- Set the return status to success
6364 -- -----------------------------------------------------------------
6365 x_return_status := FND_API.G_RET_STS_SUCCESS;
6366
6367 -- -----------------------------------------------------------------
6368 -- Check to ensure that the grant is in existence.
6369 -- -----------------------------------------------------------------
6370 OPEN c_check_grant;
6371 FETCH c_check_grant
6372 INTO l_grant_id;
6373
6374 IF (c_check_grant%NOTFOUND) THEN
6375
6376 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_NO_GRANT_AVAIL');
6377 FND_MESSAGE.SET_TOKEN('GRANT_NAME', p_grant_id);
6378 FND_MSG_PUB.Add;
6379 RAISE FND_API.G_EXC_ERROR;
6380
6381 ELSE
6382
6383 -- Generate grant for objects
6384 IGS_SC_GRANTS_PVT.construct_grant(
6385 p_api_version => 1.0,
6386 p_init_msg_list => FND_API.G_FALSE,
6387 p_commit => FND_API.G_FALSE,
6388 p_validation_level => FND_API.G_VALID_LEVEL_NONE,
6389 p_grant_id => p_grant_id,
6390 x_return_status => l_return_status ,
6391 x_msg_count => l_message_count,
6392 x_msg_data => l_return_message );
6393
6394 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
6395 raise FND_API.G_EXC_ERROR;
6396 END IF;
6397
6398 UPDATE igs_sc_grants grts
6399 SET grts.locked_flag = 'Y'
6400 WHERE grts.grant_id = p_grant_id;
6401
6402 END IF;
6403
6404 IF (c_check_grant%ISOPEN) THEN
6405 CLOSE c_check_grant;
6406 END IF;
6407
6408 -- -----------------------------------------------------------------
6409 -- Commit the transaction if requested to via parameter value.
6410 -- -----------------------------------------------------------------
6411 IF (FND_API.to_Boolean(p_commit)) THEN
6412 COMMIT;
6413 END IF;
6414
6415 -- -----------------------------------------------------------------
6416 -- Exception Block definition
6417 -- -----------------------------------------------------------------
6418 EXCEPTION
6419 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
6420 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
6421 IF (c_check_grant%ISOPEN) THEN
6422 CLOSE c_check_grant;
6423 END IF;
6424 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
6425 p_count => l_message_count,
6426 p_data => x_return_message);
6427 ROLLBACK TO Lock_Grant_SP;
6428
6429 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
6430 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Lock_Grant';
6431 l_debug_str := 'Unhandled Exception: Grant ID: '||p_grant_id||'Error Message: '||x_return_message;
6432 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
6433 END IF;
6434
6435 WHEN FND_API.G_EXC_ERROR THEN
6436 x_return_status := FND_API.G_RET_STS_ERROR;
6437
6438 IF (c_check_grant%ISOPEN) THEN
6439 CLOSE c_check_grant;
6440 END IF;
6441 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
6442 p_count => l_message_count,
6443 p_data => x_return_message);
6444 ROLLBACK TO Lock_Grant_SP;
6445
6446 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
6447 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Lock_Grant';
6448 l_debug_str := 'Handled Exception: Grant ID: '||p_grant_id||'Error Message: '||x_return_message;
6449 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
6450 END IF;
6451
6452 WHEN OTHERS THEN
6453 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
6454 IF (c_check_grant%ISOPEN) THEN
6455 CLOSE c_check_grant;
6456 END IF;
6457 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
6458 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
6459 END IF;
6460 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
6461 p_count => l_message_count,
6462 p_data => x_return_message);
6463 ROLLBACK TO Lock_Grant_SP;
6464
6465 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
6466 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Lock_Grant';
6467 l_debug_str := 'Other Exception: Grant ID: '||p_grant_id||'Error Message: '||x_return_message;
6468 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
6469 END IF;
6470
6471 END Lock_Grant;
6472
6473
6474 /******************************************************************
6475 Created By : Don Shellito
6476 Date Created By : April 23, 2003
6477 Purpose : The purpose of this procedure is to unlock the
6478 grant so that it can be deleted.
6479 Remarks :
6480
6481 Change History
6482 Who When What
6483 ------------------------------------------------------------------------
6484 Don Shellito April 23, 2003 New Procedure Created.
6485
6486 ******************************************************************/
6487 PROCEDURE Unlock_Grant (p_api_version IN NUMBER,
6488 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
6489 p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE,
6490 p_grant_id IN igs_sc_grants.grant_id%TYPE,
6491 x_return_status OUT NOCOPY VARCHAR2,
6492 x_return_message OUT NOCOPY VARCHAR2
6493 ) IS
6494
6495 -- -----------------------------------------------------------------
6496 -- Define local variables to be used.
6497 -- -----------------------------------------------------------------
6498 l_api_name CONSTANT VARCHAR2(30) := 'Unlock_Grant';
6499 l_api_version CONSTANT NUMBER := 1.0;
6500 l_grant_id igs_sc_grants.grant_id%TYPE;
6501 l_return_message VARCHAR2(2000);
6502 l_message_count NUMBER(15);
6503 l_return_status VARCHAR2(30);
6504 l_locked_flag_value VARCHAR2(1) := 'N';
6505
6506 -- -----------------------------------------------------------------
6507 -- Define the cursors to be used in procedure.
6508 -- -----------------------------------------------------------------
6509 CURSOR c_check_grant IS
6510 SELECT grts.grant_id
6511 FROM igs_sc_grants grts
6512 WHERE grts.grant_id = p_grant_id;
6513
6514 BEGIN
6515
6516 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
6517 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Unlock_Grant';
6518 l_debug_str := 'Grant ID: '||p_grant_id;
6519 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
6520 END IF;
6521
6522 SAVEPOINT Unlock_Grant_SP;
6523
6524 -- -----------------------------------------------------------------
6525 -- Check for the Compatible API call
6526 -- -----------------------------------------------------------------
6527 IF NOT FND_API.COMPATIBLE_API_CALL (l_api_version,
6528 p_api_version,
6529 l_api_name,
6530 g_pkg_name) THEN
6531 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
6532 END IF;
6533
6534 -- -----------------------------------------------------------------
6535 -- If the calling program has passed the parameter for initializing
6536 -- the message list
6537 -- -----------------------------------------------------------------
6538 IF FND_API.TO_BOOLEAN (p_init_msg_list) THEN
6539 FND_MSG_PUB.INITIALIZE;
6540 END IF;
6541
6542 -- -----------------------------------------------------------------
6543 -- Set the return status to success
6544 -- -----------------------------------------------------------------
6545 x_return_status := FND_API.G_RET_STS_SUCCESS;
6546
6547 -- -----------------------------------------------------------------
6548 -- Check to ensure that the grant is in existence.
6549 -- -----------------------------------------------------------------
6550 OPEN c_check_grant;
6551 FETCH c_check_grant
6552 INTO l_grant_id;
6553
6554 IF (c_check_grant%NOTFOUND) THEN
6555
6556 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_NO_GRANT_AVAIL');
6557 FND_MESSAGE.SET_TOKEN('GRANT_NAME', p_grant_id);
6558 FND_MSG_PUB.Add;
6559 RAISE FND_API.G_EXC_ERROR;
6560
6561 ELSE
6562
6563 DELETE
6564 FROM igs_sc_obj_grants objs
6565 WHERE objs.grant_id = p_grant_id;
6566
6567 UPDATE igs_sc_grants grts
6568 SET grts.locked_flag = l_locked_flag_value
6569 WHERE grts.grant_id = p_grant_id;
6570
6571 END IF;
6572
6573 IF (c_check_grant%ISOPEN) THEN
6574 CLOSE c_check_grant;
6575 END IF;
6576
6577 -- -----------------------------------------------------------------
6578 -- Commit the transaction if requested to via parameter value.
6579 -- -----------------------------------------------------------------
6580 IF (FND_API.to_Boolean(p_commit)) THEN
6581 COMMIT;
6582 END IF;
6583
6584 -- -----------------------------------------------------------------
6585 -- Exception Block definition
6586 -- -----------------------------------------------------------------
6587 EXCEPTION
6588 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
6589 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
6590 IF (c_check_grant%ISOPEN) THEN
6591 CLOSE c_check_grant;
6592 END IF;
6593 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
6594 p_count => l_message_count,
6595 p_data => x_return_message);
6596 ROLLBACK TO Unlock_Grant_SP;
6597
6598 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
6599 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Unlock_Grant';
6600 l_debug_str := 'Unhandled Exception: Grant ID: '||p_grant_id||'Error Message: '||x_return_message;
6601 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
6602 END IF;
6603
6604 WHEN FND_API.G_EXC_ERROR THEN
6605 x_return_status := FND_API.G_RET_STS_ERROR;
6606
6607 IF (c_check_grant%ISOPEN) THEN
6608 CLOSE c_check_grant;
6609 END IF;
6610 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
6611 p_count => l_message_count,
6612 p_data => x_return_message);
6613 ROLLBACK TO Unlock_Grant_SP;
6614
6615 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
6616 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Unlock_Grant';
6617 l_debug_str := 'Handled Exception: Grant ID: '||p_grant_id||'Error Message: '||x_return_message;
6618 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
6619 END IF;
6620
6621 WHEN OTHERS THEN
6622 IF (c_check_grant%ISOPEN) THEN
6623 CLOSE c_check_grant;
6624 END IF;
6625 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
6626 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
6627 END IF;
6628 FND_MSG_PUB.Count_And_Get (p_encoded => FND_API.G_FALSE,
6629 p_count => l_message_count,
6630 p_data => x_return_message);
6631 ROLLBACK TO Unlock_Grant_SP;
6632
6633 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
6634 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Unlock_Grant';
6635 l_debug_str := 'Other Exception: Grant ID: '||p_grant_id||'Error Message: '||x_return_message;
6636 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
6637 END IF;
6638
6639 END Unlock_Grant;
6640
6641
6642 /******************************************************************
6643 Created By : Don Shellito
6644 Date Created By : April 23, 2003
6645 Purpose : The purpose of this procedure is to ensure that
6646 the values that are being inserted or updated
6647 are either Y or N.
6648 Remarks :
6649
6650 Change History
6651 Who When What
6652 ------------------------------------------------------------------------
6653 Don Shellito April 23, 2003 New Procedure Created.
6654
6655 ******************************************************************/
6656 PROCEDURE Get_Valid_Grant_Vals (p_grant_select_flag IN VARCHAR2,
6657 p_grant_insert_flag IN VARCHAR2,
6658 p_grant_delete_flag IN VARCHAR2,
6659 p_grant_update_flag IN VARCHAR2,
6660 x_grant_select_flag OUT NOCOPY VARCHAR2,
6661 x_grant_insert_flag OUT NOCOPY VARCHAR2,
6662 x_grant_delete_flag OUT NOCOPY VARCHAR2,
6663 x_grant_update_flag OUT NOCOPY VARCHAR2
6664 ) IS
6665
6666 -- -----------------------------------------------------------------
6667 -- Define local variables to be used.
6668 -- -----------------------------------------------------------------
6669 l_api_name CONSTANT VARCHAR2(30) := 'Get_Valid_Grant_Vals';
6670
6671 BEGIN
6672
6673 -- -----------------------------------------------------------------
6674 -- Ensure that the values provided are valid for the grants.
6675 -- -----------------------------------------------------------------
6676 IF ((UPPER(p_grant_select_flag) = 'Y') OR (UPPER(p_grant_select_flag) = 'N')) THEN
6677 x_grant_select_flag := UPPER(p_grant_select_flag);
6678 ELSE
6679 x_grant_select_flag := 'N';
6680 END IF;
6681 IF ((UPPER(p_grant_update_flag) = 'Y') OR (UPPER(p_grant_select_flag) = 'N')) THEN
6682 x_grant_update_flag := UPPER(p_grant_update_flag);
6683 ELSE
6684 x_grant_update_flag := 'N';
6685 END IF;
6686 IF ((UPPER(p_grant_delete_flag) = 'Y') OR (UPPER(p_grant_delete_flag) = 'N')) THEN
6687 x_grant_delete_flag := UPPER(p_grant_delete_flag);
6688 ELSE
6689 x_grant_delete_flag := 'N';
6690 END IF;
6691 IF ((UPPER(p_grant_insert_flag) = 'Y') OR (UPPER(p_grant_insert_flag) = 'N')) THEN
6692 x_grant_insert_flag := UPPER(p_grant_insert_flag);
6693 ELSE
6694 x_grant_insert_flag := 'N';
6695 END IF;
6696
6697 -- -----------------------------------------------------------------
6698 -- Exception Block definition
6699 -- -----------------------------------------------------------------
6700 EXCEPTION
6701 WHEN OTHERS THEN
6702 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
6703 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
6704 END IF;
6705 RAISE FND_API.G_EXC_ERROR;
6706
6707 END Get_Valid_Grant_Vals;
6708
6709
6710 /******************************************************************
6711 Created By : Don Shellito
6712 Date Created By : April 23, 2003
6713 Purpose : The purpose of this function is to check to
6714 make sure that the function being requested
6715 for insert or update is available in the system.
6716 Remarks :
6717
6718 Change History
6719 Who When What
6720 ------------------------------------------------------------------------
6721 Don Shellito April 23, 2003 New Procedure Created.
6722
6723 ******************************************************************/
6724 FUNCTION Validate_Function_ID (
6725 p_function_id IN NUMBER
6726 ) RETURN NUMBER AS
6727
6728 -- -----------------------------------------------------------------
6729 -- Define local variables to be used.
6730 -- -----------------------------------------------------------------
6731 l_api_name CONSTANT VARCHAR2(30) := 'Validate_Function_ID';
6732 l_function_id igs_sc_obj_functns.function_id%TYPE;
6733
6734 -- -----------------------------------------------------------------
6735 -- Define the cursors to be used in procedure.
6736 -- -----------------------------------------------------------------
6737 CURSOR c_check_func_id IS
6738 SELECT fnc.function_id
6739 FROM igs_sc_obj_functns fnc
6740 WHERE fnc.function_id = p_function_id;
6741
6742 BEGIN
6743
6744 -- -----------------------------------------------------------------
6745 -- Open the cursor to determine if the ID is valid and found.
6746 -- -----------------------------------------------------------------
6747 OPEN c_check_func_id;
6748 FETCH c_check_func_id
6749 INTO l_function_id;
6750
6751 IF (c_check_func_id%FOUND) THEN
6752 CLOSE c_check_func_id;
6753 RETURN (l_function_id);
6754 ELSE
6755 CLOSE c_check_func_id;
6756 RETURN (0);
6757 END IF;
6758
6759 -- -----------------------------------------------------------------
6760 -- Exception Block definition
6761 -- -----------------------------------------------------------------
6762 EXCEPTION
6763 WHEN OTHERS THEN
6764 IF (c_check_func_id%ISOPEN) THEN
6765 CLOSE c_check_func_id;
6766 END IF;
6767 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
6768 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
6769 END IF;
6770 RAISE FND_API.G_EXC_ERROR;
6771
6772 END Validate_Function_ID;
6773
6774
6775 /******************************************************************
6776 Created By : Don Shellito
6777 Date Created By : April 23, 2003
6778 Purpose : The purpose of this function is to ensure that
6779 the object group ID is present in the system
6780 before insert or update of records.
6781 Remarks :
6782
6783 Change History
6784 Who When What
6785 ------------------------------------------------------------------------
6786 Don Shellito April 23, 2003 New Procedure Created.
6787
6788 ******************************************************************/
6789 FUNCTION Validate_Obj_Grp_ID (
6790 p_group_id IN NUMBER
6791 ) RETURN NUMBER AS
6792
6793 -- -----------------------------------------------------------------
6794 -- Define local variables to be used.
6795 -- -----------------------------------------------------------------
6796 l_api_name CONSTANT VARCHAR2(30) := 'Validate_Obj_Grp_ID';
6797 l_group_id igs_sc_obj_groups.obj_group_id%TYPE;
6798
6799 -- -----------------------------------------------------------------
6800 -- Define the cursors to be used in procedure.
6801 -- -----------------------------------------------------------------
6802 CURSOR c_check_obj_group IS
6803 SELECT grps.obj_group_id
6804 FROM igs_sc_obj_groups grps
6805 WHERE grps.obj_group_id = p_group_id;
6806
6807 BEGIN
6808
6809 -- -----------------------------------------------------------------
6810 -- Open the cursor to determine if the ID is valid and found.
6811 -- -----------------------------------------------------------------
6812 OPEN c_check_obj_group;
6813 FETCH c_check_obj_group
6814 INTO l_group_id;
6815
6816 IF (c_check_obj_group%FOUND) THEN
6817 CLOSE c_check_obj_group;
6818 RETURN (l_group_id);
6819 ELSE
6820 CLOSE c_check_obj_group;
6821 RETURN (0);
6822 END IF;
6823
6824 -- -----------------------------------------------------------------
6825 -- Exception Block definition
6826 -- -----------------------------------------------------------------
6827 EXCEPTION
6828 WHEN OTHERS THEN
6829 IF (c_check_obj_group%ISOPEN) THEN
6830 CLOSE c_check_obj_group;
6831 END IF;
6832 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
6833 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
6834 END IF;
6835 RAISE FND_API.G_EXC_ERROR;
6836
6837 END Validate_Obj_Grp_ID;
6838
6839
6840 /******************************************************************
6841 Created By : Don Shellito
6842 Date Created By : April 23, 2003
6843 Purpose : The purpose of this function is to ensure that
6844 the object attribute being inserted or updated
6845 is already present in the system.
6846 Remarks :
6847
6848 Change History
6849 Who When What
6850 ------------------------------------------------------------------------
6851 Don Shellito April 23, 2003 New Procedure Created.
6852
6853 ******************************************************************/
6854 FUNCTION Validate_Obj_Attr_ID (
6855 p_obj_attr_id IN NUMBER
6856 ) RETURN NUMBER AS
6857
6858 -- -----------------------------------------------------------------
6859 -- Define local variables to be used.
6860 -- -----------------------------------------------------------------
6861 l_api_name CONSTANT VARCHAR2(30) := 'Validate_Obj_Attr_ID';
6862 l_obj_attr_id igs_sc_obj_attribs.obj_attrib_id%TYPE;
6863
6864 -- -----------------------------------------------------------------
6865 -- Define the cursors to be used in procedure.
6866 -- -----------------------------------------------------------------
6867 CURSOR c_check_obj_attrib IS
6868 SELECT attr.obj_attrib_id
6869 FROM igs_sc_obj_attribs attr
6870 WHERE attr.obj_attrib_id = p_obj_attr_id;
6871
6872 BEGIN
6873
6874 -- -----------------------------------------------------------------
6875 -- Open the cursor to determine if the ID is valid and found.
6876 -- -----------------------------------------------------------------
6877 OPEN c_check_obj_attrib;
6878 FETCH c_check_obj_attrib
6879 INTO l_obj_attr_id;
6880
6881 IF (c_check_obj_attrib%FOUND) THEN
6882 CLOSE c_check_obj_attrib;
6883 RETURN (l_obj_attr_id);
6884 ELSE
6885 CLOSE c_check_obj_attrib;
6886 RETURN (0);
6887 END IF;
6888
6889 -- -----------------------------------------------------------------
6890 -- Exception Block definition
6891 -- -----------------------------------------------------------------
6892 EXCEPTION
6893 WHEN OTHERS THEN
6894 IF (c_check_obj_attrib%ISOPEN) THEN
6895 CLOSE c_check_obj_attrib;
6896 END IF;
6897 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
6898 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
6899 END IF;
6900 RAISE FND_API.G_EXC_ERROR;
6901
6902 END Validate_Obj_Attr_ID;
6903
6904
6905 /******************************************************************
6906 Created By : Don Shellito
6907 Date Created By : April 23, 2003
6908 Purpose : The purpose of this function is to ensure that
6909 the user group ID is defined in the system prior
6910 to insert or updated. The user group ID is
6911 associated to the wf_local_roles record being present.
6912 Remarks :
6913
6914 Change History
6915 Who When What
6916 ------------------------------------------------------------------------
6917 Don Shellito April 23, 2003 New Procedure Created.
6918
6919 ******************************************************************/
6920 FUNCTION Validate_User_Grp_ID (
6921 p_user_group_id IN NUMBER
6922 ) RETURN NUMBER AS
6923
6924 -- -----------------------------------------------------------------
6925 -- Define local variables to be used.
6926 -- -----------------------------------------------------------------
6927 l_api_name CONSTANT VARCHAR2(30) := 'Validate_User_Grp_ID';
6928 l_user_group_id wf_local_roles.orig_system_id%TYPE;
6929
6930 -- -----------------------------------------------------------------
6931 -- Define the cursors to be used in procedure.
6932 -- -----------------------------------------------------------------
6933 CURSOR c_check_user_group_id IS
6934 SELECT wflr.orig_system_id
6935 FROM wf_local_roles wflr
6936 WHERE wflr.ORIG_SYSTEM = 'IGS'
6937 AND wflr.orig_system_id = p_user_group_id;
6938
6939 BEGIN
6940
6941 -- -----------------------------------------------------------------
6942 -- Open the cursor to determine if the ID is valid and found.
6943 -- -----------------------------------------------------------------
6944 OPEN c_check_user_group_id;
6945 FETCH c_check_user_group_id
6946 INTO l_user_group_id;
6947
6948 IF (c_check_user_group_id%FOUND) THEN
6949 CLOSE c_check_user_group_id;
6950 RETURN (l_user_group_id);
6951 ELSE
6952 CLOSE c_check_user_group_id;
6953 RETURN (0);
6954 END IF;
6955
6956 -- -----------------------------------------------------------------
6957 -- Exception Block definition
6958 -- -----------------------------------------------------------------
6959 EXCEPTION
6960 WHEN OTHERS THEN
6961 IF (c_check_user_group_id%ISOPEN) THEN
6962 CLOSE c_check_user_group_id;
6963 END IF;
6964 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
6965 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
6966 END IF;
6967 RAISE FND_API.G_EXC_ERROR;
6968
6969 END Validate_User_Grp_ID;
6970
6971
6972 /******************************************************************
6973 Created By : Don Shellito
6974 Date Created By : April 23, 2003
6975 Purpose : The purpose of this function is to ensure that
6976 the grant ID that is to be inserted or updated
6977 is present in the system.
6978 Remarks :
6979
6980 Change History
6981 Who When What
6982 ------------------------------------------------------------------------
6983 Don Shellito April 23, 2003 New Procedure Created.
6984
6985 ******************************************************************/
6986 FUNCTION Validate_Grant_ID (
6987 p_grant_id IN NUMBER
6988 ) RETURN NUMBER AS
6989
6990 -- -----------------------------------------------------------------
6991 -- Define local variables to be used.
6992 -- -----------------------------------------------------------------
6993 l_api_name CONSTANT VARCHAR2(30) := 'Validate_Grant_ID';
6994 l_grant_id igs_sc_grants.grant_id%TYPE;
6995
6996 -- -----------------------------------------------------------------
6997 -- Define the cursors to be used in procedure.
6998 -- -----------------------------------------------------------------
6999 CURSOR c_check_grant_id IS
7000 SELECT grt.grant_id
7001 FROM igs_sc_grants grt
7002 WHERE grt.grant_id = p_grant_id;
7003
7004 BEGIN
7005
7006 -- -----------------------------------------------------------------
7007 -- Open the cursor to determine if the ID is valid and found.
7008 -- -----------------------------------------------------------------
7009 OPEN c_check_grant_id;
7010 FETCH c_check_grant_id
7011 INTO l_grant_id;
7012
7013 IF (c_check_grant_id%FOUND) THEN
7014 CLOSE c_check_grant_id;
7015 RETURN (l_grant_id);
7016 ELSE
7017 CLOSE c_check_grant_id;
7018 RETURN (0);
7019 END IF;
7020
7021 -- -----------------------------------------------------------------
7022 -- Exception Block definition
7023 -- -----------------------------------------------------------------
7024 EXCEPTION
7025 WHEN OTHERS THEN
7026 IF (c_check_grant_id%ISOPEN) THEN
7027 CLOSE c_check_grant_id;
7028 END IF;
7029 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
7030 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
7031 END IF;
7032 RAISE FND_API.G_EXC_ERROR;
7033
7034 END Validate_Grant_ID;
7035
7036
7037 /******************************************************************
7038 Created By : Don Shellito
7039 Date Created By : April 23, 2003
7040 Purpose : The purpose of this function is to ensure that
7041 the object that is being inserted or updated
7042 is present in the system.
7043 Remarks :
7044
7045 Change History
7046 Who When What
7047 ------------------------------------------------------------------------
7048 Don Shellito April 23, 2003 New Procedure Created.
7049
7050 ******************************************************************/
7051 FUNCTION Validate_Object_ID (
7052 p_object_id IN NUMBER
7053 ) RETURN NUMBER AS
7054
7055 -- -----------------------------------------------------------------
7056 -- Define local variables to be used.
7057 -- -----------------------------------------------------------------
7058 l_api_name CONSTANT VARCHAR2(30) := 'Validate_Object_ID';
7059 l_object_id fnd_objects.object_id%TYPE;
7060
7061 -- -----------------------------------------------------------------
7062 -- Define the cursors to be used in procedure.
7063 -- -----------------------------------------------------------------
7064 CURSOR c_check_object_id IS
7065 SELECT objs.object_id
7066 FROM fnd_objects objs
7067 WHERE objs.object_id = p_object_id;
7068
7069 BEGIN
7070
7071 -- -----------------------------------------------------------------
7072 -- Open the cursor to determine if the ID is valid and found.
7073 -- -----------------------------------------------------------------
7074 OPEN c_check_object_id;
7075 FETCH c_check_object_id
7076 INTO l_object_id;
7077
7078 IF (c_check_object_id%FOUND) THEN
7079 CLOSE c_check_object_id;
7080 RETURN (l_object_id);
7081 ELSE
7082 CLOSE c_check_object_id;
7083 RETURN (0);
7084 END IF;
7085
7086 -- -----------------------------------------------------------------
7087 -- Exception Block definition
7088 -- -----------------------------------------------------------------
7089 EXCEPTION
7090 WHEN OTHERS THEN
7091 IF (c_check_object_id%ISOPEN) THEN
7092 CLOSE c_check_object_id;
7093 END IF;
7094 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
7095 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
7096 END IF;
7097 RAISE FND_API.G_EXC_ERROR;
7098
7099 END Validate_Object_ID;
7100
7101
7102 /******************************************************************
7103 Created By : Don Shellito
7104 Date Created By : April 23, 2003
7105 Purpose : The purpose of this function is to ensure that
7106 the user attribute being inserted or updated is
7107 present in the system.
7108 Remarks :
7109
7110 Change History
7111 Who When What
7112 ------------------------------------------------------------------------
7113 Don Shellito April 23, 2003 New Procedure Created.
7114
7115 ******************************************************************/
7116 FUNCTION Validate_User_Attr_ID (
7117 p_user_attr_id IN NUMBER
7118 ) RETURN NUMBER AS
7119
7120 -- -----------------------------------------------------------------
7121 -- Define local variables to be used.
7122 -- -----------------------------------------------------------------
7123 l_api_name CONSTANT VARCHAR2(30) := 'Validate_User_Attr_ID';
7124 l_user_attr_id igs_sc_usr_attribs.user_attrib_id%TYPE;
7125
7126 -- -----------------------------------------------------------------
7127 -- Define the cursors to be used in procedure.
7128 -- -----------------------------------------------------------------
7129 CURSOR c_check_user_attr_id IS
7130 SELECT attr.user_attrib_id
7131 FROM igs_sc_usr_attribs attr
7132 WHERE attr.user_attrib_id = p_user_attr_id;
7133
7134 BEGIN
7135
7136 -- -----------------------------------------------------------------
7137 -- Open the cursor to determine if the ID is valid and found.
7138 -- -----------------------------------------------------------------
7139 OPEN c_check_user_attr_id;
7140 FETCH c_check_user_attr_id
7141 INTO l_user_attr_id;
7142
7143 IF (c_check_user_attr_id%FOUND) THEN
7144 CLOSE c_check_user_attr_id;
7145 RETURN (l_user_attr_id);
7146 ELSE
7147 CLOSE c_check_user_attr_id;
7148 RETURN (0);
7149 END IF;
7150
7151 -- -----------------------------------------------------------------
7152 -- Exception Block definition
7153 -- -----------------------------------------------------------------
7154 EXCEPTION
7155 WHEN OTHERS THEN
7156 IF (c_check_user_attr_id%ISOPEN) THEN
7157 CLOSE c_check_user_attr_id;
7158 END IF;
7159 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
7160 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
7161 END IF;
7162 RAISE FND_API.G_EXC_ERROR;
7163
7164 END Validate_User_Attr_ID;
7165
7166
7167 /******************************************************************
7168 Created By : Don Shellito
7169 Date Created By : April 23, 2003
7170 Purpose : The purpose of this function is to ensure that
7171 the value being inserted or updated for the static
7172 type falls into the values that are expected.
7173 Remarks :
7174
7175 Change History
7176 Who When What
7177 ------------------------------------------------------------------------
7178 Don Shellito April 23, 2003 New Procedure Created.
7179
7180 ******************************************************************/
7181
7182
7183 FUNCTION Validate_Static_Type (
7184 p_static_type IN VARCHAR2
7185 ) RETURN VARCHAR2 AS
7186
7187 -- -----------------------------------------------------------------
7188 -- Define local variables to be used.
7189 -- -----------------------------------------------------------------
7190 l_api_name CONSTANT VARCHAR2(30) := 'Validate_Static_Type';
7191
7192 BEGIN
7193
7194 -- -----------------------------------------------------------------
7195 -- Check for the valid values on the Static types.
7196 -- -----------------------------------------------------------------
7197 IF (p_static_type IN ('C','S','D')) THEN
7198 RETURN (p_static_type);
7199 ELSE
7200 RETURN (NULL);
7201 END IF;
7202
7203 -- -----------------------------------------------------------------
7204 -- Exception Block definition
7205 -- -----------------------------------------------------------------
7206 EXCEPTION
7207 WHEN OTHERS THEN
7208 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
7209 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
7210 END IF;
7211 RAISE FND_API.G_EXC_ERROR;
7212
7213 END Validate_Static_Type;
7214
7215
7216 /******************************************************************
7217 Created By : Don Shellito
7218 Date Created By : April 23, 2003
7219 Purpose : The purpose of this function is to ensure that
7220 the object attribute type is valid for the value
7221 expected to be there.
7222 Remarks :
7223
7224 Change History
7225 Who When What
7226 ------------------------------------------------------------------------
7227 Don Shellito April 23, 2003 New Procedure Created.
7228
7229 ******************************************************************/
7230 FUNCTION Validate_Obj_Attr_Type (
7231 p_obj_att_type IN VARCHAR2
7232 ) RETURN VARCHAR2 AS
7233
7234 -- -----------------------------------------------------------------
7235 -- Define local variables to be used.
7236 -- -----------------------------------------------------------------
7237 l_api_name CONSTANT VARCHAR2(30) := 'Validate_Obj_Attr_Type';
7238
7239 BEGIN
7240
7241 -- -----------------------------------------------------------------
7242 -- Check for the valid values on the Object attribute types.
7243 -- -----------------------------------------------------------------
7244 IF (p_obj_att_type IN ('S','T','F','M')) THEN
7245 RETURN (p_obj_att_type);
7246 ELSE
7247 RETURN (NULL);
7248 END IF;
7249
7250 -- -----------------------------------------------------------------
7251 -- Exception Block definition
7252 -- -----------------------------------------------------------------
7253 EXCEPTION
7254 WHEN OTHERS THEN
7255 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
7256 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
7257 END IF;
7258 RAISE FND_API.G_EXC_ERROR;
7259
7260 END Validate_Obj_Attr_Type;
7261
7262
7263 /******************************************************************
7264 Created By : Don Shellito
7265 Date Created By : April 23, 2003
7266 Purpose : The purpose of this function is to ensure that
7267 the value for the user attribute type is valid
7268 and can be used in the system.
7269 Remarks :
7270
7271 Change History
7272 Who When What
7273 ------------------------------------------------------------------------
7274 Don Shellito April 23, 2003 New Procedure Created.
7275
7276 ******************************************************************/
7277 FUNCTION Validate_User_Attr_Type (
7278 p_usr_att_type IN VARCHAR2
7279 ) RETURN VARCHAR2 AS
7280
7281 -- -----------------------------------------------------------------
7282 -- Define local variables to be used.
7283 -- -----------------------------------------------------------------
7284 l_api_name CONSTANT VARCHAR2(30) := 'Validate_User_Attr_Type';
7285
7286 BEGIN
7287
7288 -- -----------------------------------------------------------------
7289 -- Check for the valid values on the user attribute types.
7290 -- -----------------------------------------------------------------
7291 IF (p_usr_att_type IN ('S', 'F', 'M','U')) THEN
7292 RETURN (p_usr_att_type);
7293 ELSE
7294 RETURN (NULL);
7295 END IF;
7296
7297 -- -----------------------------------------------------------------
7298 -- Exception Block definition
7299 -- -----------------------------------------------------------------
7300 EXCEPTION
7301 WHEN OTHERS THEN
7302 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
7303 FND_MSg_PUB.Add_Exc_Msg (g_pkg_name, l_api_name);
7304 END IF;
7305 RAISE FND_API.G_EXC_ERROR;
7306
7307 END Validate_User_Attr_Type;
7308
7309 PROCEDURE Generate_Message
7310 IS
7311
7312 l_msg_count NUMBER;
7313 l_msg_data VARCHAR2(2000);
7314
7315 BEGIN
7316
7317 FND_MSg_PUB.Count_And_Get ( p_count => l_msg_count,
7318 p_data => l_msg_data );
7319
7320 IF (l_msg_count > 0) THEN
7321
7322 l_msg_data := '';
7323
7324 FOR l_cur IN 1..l_msg_count LOOP
7325
7326 l_msg_data := FND_MSg_PUB.GET(l_cur, FND_API.g_FALSE);
7327 fnd_file.put_line (FND_FILE.LOG,l_msg_data);
7328 END LOOP;
7329
7330 ELSE
7331
7332 l_msg_data := 'Error Returned but Error stack has no data';
7333 fnd_file.put_line (FND_FILE.LOG,l_msg_data);
7334
7335 END IF;
7336
7337 END Generate_Message;
7338
7339 /******************************************************************/
7340 PROCEDURE Unlock_All_Grants(
7341 errbuf OUT NOCOPY VARCHAR2, -- Request standard error string
7342 retcode OUT NOCOPY NUMBER , -- Request standard return status
7343 p_obj_group_id IN igs_sc_obj_groups.obj_group_id%TYPE
7344 ) IS
7345
7346 l_api_name CONSTANT VARCHAR2(30) := 'Unlock_All_Grants';
7347 l_msg_data VARCHAR2(2000);
7348 l_msg_count NUMBER(15);
7349 l_return_status VARCHAR2(30);
7350
7351 BEGIN
7352 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
7353 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Unlock_All_Grants';
7354 l_debug_str := 'Object Group ID: '||p_obj_group_id;
7355 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
7356 END IF;
7357 -- Just call the procedure
7358 SAVEPOINT Unlock_All_Grants;
7359
7360 IGS_SC_GRANTS_PVT.unlock_all_grants(
7361 p_api_version => 1.0 ,
7362 x_return_status => l_return_status,
7363 x_msg_count => l_msg_count,
7364 x_msg_data => l_msg_data,
7365 p_obj_group_id => p_obj_group_id
7366 );
7367
7368 -- Checking the status
7369
7370 IF (l_Return_Status = FND_API.G_RET_STS_SUCCESS) THEN
7371 --Successfull completion
7372 retcode := 0;
7373 ELSE
7374 -- Error: generating message and returning the error code
7375 Generate_Message;
7376 retcode := 2;
7377 END IF;
7378
7379
7380
7381 EXCEPTION
7382
7383 WHEN OTHERS THEN
7384
7385 ROLLBACK TO Unlock_All_Grants;
7386
7387 retcode := 2;
7388
7389 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
7390 FND_MSg_PUB.Add_Exc_Msg (g_PKg_NAME, l_api_name);
7391 END IF;
7392
7393 Generate_Message;
7394
7395 END Unlock_All_Grants;
7396
7397 PROCEDURE Lock_All_Grants(
7398 errbuf OUT NOCOPY VARCHAR2, -- Request standard error string
7399 retcode OUT NOCOPY NUMBER , -- Request standard return status
7400 p_obj_group_id IN igs_sc_obj_groups.obj_group_id%TYPE
7401 ) IS
7402
7403 l_api_name CONSTANT VARCHAR2(30) := 'Lock_All_Grants';
7404 l_msg_data VARCHAR2(2000);
7405 l_msg_count NUMBER(15);
7406 l_return_status VARCHAR2(30);
7407
7408 BEGIN
7409
7410 IF fnd_log.test(fnd_log.level_procedure,l_prog_label) THEN
7411 l_label := 'igs.plsql.igs_sc_data_sec_apis_pkg.Lock_All_Grants';
7412 l_debug_str := 'Object Group ID: '||p_obj_group_id;
7413 fnd_log.string_with_context( fnd_log.level_procedure,l_label,l_debug_str, NULL,NULL,NULL,NULL,NULL,NULL);
7414 END IF;
7415
7416 -- Just call the procedure
7417 SAVEPOINT Lock_All_Grants;
7418
7419 IGS_SC_GRANTS_PVT.lock_all_grants(
7420 p_api_version => 1.0 ,
7421 x_return_status => l_return_status,
7422 x_msg_count => l_msg_count,
7423 x_msg_data => l_msg_data,
7424 p_obj_group_id => p_obj_group_id
7425 );
7426
7427 -- Checking the status
7428
7429 IF (l_Return_Status = FND_API.G_RET_STS_SUCCESS) THEN
7430 --Successfull completion
7431 retcode := 0;
7432 ELSE
7433 -- Error: generating message and returning the error code
7434 Generate_Message;
7435 retcode := 2;
7436 END IF;
7437
7438
7439
7440 EXCEPTION
7441
7442 WHEN OTHERS THEN
7443
7444 ROLLBACK TO Lock_All_Grants;
7445
7446 retcode := 2;
7447
7448 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
7449 FND_MSg_PUB.Add_Exc_Msg (g_PKg_NAME, l_api_name);
7450 END IF;
7451
7452 Generate_Message;
7453
7454 END Lock_All_Grants;
7455
7456 PROCEDURE Populate_User_Attribs(
7457 errbuf OUT NOCOPY VARCHAR2, -- Request standard error string
7458 retcode OUT NOCOPY NUMBER , -- Request standard return status
7459 p_all_attribs IN VARCHAR2
7460 ) IS
7461
7462 l_api_name CONSTANT VARCHAR2(30) := 'Lock_All_Grants';
7463 l_msg_data VARCHAR2(2000);
7464 l_msg_count NUMBER(15);
7465 l_return_status VARCHAR2(30);
7466
7467 BEGIN
7468
7469 -- Just call the procedure
7470 SAVEPOINT Unlock_All_Grants;
7471
7472 IGS_SC_GRANTS_PVT.populate_user_attrib(
7473 p_api_version => 1.0 ,
7474 x_return_status => l_return_status,
7475 x_msg_count => l_msg_count,
7476 x_msg_data => l_msg_data,
7477 p_all_attribs => p_all_attribs
7478
7479 );
7480
7481 -- Checking the status
7482
7483 IF (l_Return_Status = FND_API.G_RET_STS_SUCCESS) THEN
7484 --Successfull completion
7485 retcode := 0;
7486 ELSE
7487 -- Error: generating message and returning the error code
7488 Generate_Message;
7489 retcode := 2;
7490 END IF;
7491
7492
7493
7494 EXCEPTION
7495
7496 WHEN OTHERS THEN
7497
7498 ROLLBACK TO Lock_All_Grants;
7499
7500 retcode := 2;
7501
7502 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
7503 FND_MSg_PUB.Add_Exc_Msg (g_PKg_NAME, l_api_name);
7504 END IF;
7505
7506 Generate_Message;
7507
7508 END Populate_User_Attribs;
7509
7510
7511 PROCEDURE enable_policy (
7512 p_database_object_name IN VARCHAR2 )
7513 IS
7514 BEGIN
7515 modify_policy (p_database_object_name);
7516 END enable_policy;
7517
7518
7519 PROCEDURE modify_policy (
7520 p_database_object_name IN VARCHAR2,
7521 p_action VARCHAR2 DEFAULT 'CREATE')
7522 IS
7523
7524 --PRAGMA AUTONOMOUS_TRANSACTION;
7525
7526 p_var VARCHAR2(32000);
7527 l_policy NUMBER(1);
7528 l_status VARCHAR2(255);
7529 l_industry VARCHAR2(255);
7530 l_owner VARCHAR2(255);
7531 l_aol_schema VARCHAR2(255);
7532 l_apps_schema VARCHAR2(255);
7533 l_apps_mls_schema VARCHAR2(255);
7534 L_SELECT_FLAG VARCHAR2(1) := NULL;
7535 L_UPDATE_FLAG VARCHAR2(1) := NULL;
7536 L_DELETE_FLAG VARCHAR2(1):= NULL;
7537 L_INSERT_FLAG VARCHAR2(1):= NULL;
7538 L_PAR_SECURITY VARCHAR2(1):= NULL;
7539
7540 CURSOR c_policy IS
7541 SELECT POLICY_NAME,
7542 OBJECT_OWNER
7543 FROM DBA_POLICIES
7544 WHERE object_name = p_database_object_name
7545 AND object_owner = l_owner;
7546
7547 CURSOR C_DEFAULT_SECURITY IS
7548 SELECT DECODE(SELECT_FLAG, 'Y','S',NULL) SELECT_FLAG,
7549 DECODE(UPDATE_FLAG, 'Y','U',NULL) UPDATE_FLAG,
7550 DECODE(DELETE_FLAG, 'Y','D',NULL) DELETE_FLAG,
7551 DECODE(INSERT_FLAG, 'Y','I',NULL) INSERT_FLAG,
7552 DECODE(ENFORCE_PAR_SEC_FLAG,'Y','Y',NULL) ENFORCE_PAR_SEC_FLAG
7553 FROM IGS_SC_OBJECTS SC,
7554 FND_OBJECTS FND
7555 WHERE FND.OBJ_NAME = p_database_object_name
7556 AND SC.OBJECT_ID = FND.OBJECT_ID
7557 AND SC.ACTIVE_FLAG = 'Y';
7558
7559
7560 CURSOR get_db_version IS
7561 SELECT SUBSTR(version,1,INSTR(version,'.')-1)
7562 FROM v$instance;
7563
7564 l_stmt VARCHAR2(10000);
7565 l_db_version NUMBER;
7566 l_app_info boolean ;
7567
7568 BEGIN
7569 /* ORA-28115 - policy with check option violation */
7570
7571 l_app_info := fnd_installation.get_app_info(
7572 'FND', l_status, l_industry, l_aol_schema);
7573 IF NOT l_app_info THEN
7574 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
7575 END IF;
7576
7577 system.ad_apps_private.get_apps_schema_name(
7578 1, l_aol_schema, l_apps_schema, l_apps_mls_schema);
7579
7580 -- Get application
7581 IF (SUBSTR(p_database_object_name,1,3) = 'IGS') THEN
7582 IF (SUBSTR(p_database_object_name,LENGTH(p_database_object_name)-2,3) IN ('_SV', '_V')) THEN
7583 l_owner := l_apps_schema;
7584 ELSE
7585 l_app_info := FND_INSTALLATION.GET_APP_INFO(
7586 application_short_name => 'IGS',
7587 status => l_status,
7588 industry => l_industry,
7589 oracle_schema => l_owner);
7590 END IF;
7591 ELSIF (SUBSTR(p_database_object_name,1,3) = 'IGF') THEN
7592 l_app_info := FND_INSTALLATION.GET_APP_INFO(
7593 application_short_name => 'IGF',
7594 status => l_status,
7595 industry => l_industry,
7596 oracle_schema => l_owner);
7597 END IF;
7598
7599
7600
7601 FOR c_policy_rec IN c_policy LOOP
7602 -- Drop existing policies
7603
7604 dbms_rls.drop_policy (object_schema => c_policy_rec.object_owner,
7605 object_name => p_database_object_name,
7606 policy_name => c_policy_rec.policy_name );
7607
7608
7609 END LOOP;
7610
7611 IF p_action = 'DROP' THEN
7612 --Don't create new policies
7613 RETURN;
7614 END IF;
7615
7616 OPEN C_DEFAULT_SECURITY;
7617 FETCH C_DEFAULT_SECURITY INTO L_SELECT_FLAG,L_UPDATE_FLAG,L_DELETE_FLAG,L_INSERT_FLAG,L_PAR_SECURITY;
7618 CLOSE C_DEFAULT_SECURITY;
7619
7620 OPEN get_db_version;
7621 FETCH get_db_version INTO l_db_version;
7622 CLOSE get_db_version;
7623
7624 IF L_INSERT_FLAG IS NOT NULL THEN
7625
7626 IF L_PAR_SECURITY IS NOT NULL THEN
7627 IF (l_db_version >= 10) THEN
7628 l_stmt:= 'BEGIN dbms_rls.add_policy (
7629 object_schema => :1,
7630 object_name => :2,
7631 policy_name => :3,
7632 function_schema => :4,
7633 policy_function => :5,
7634 statement_types => :6,
7635 update_check => TRUE,
7636 long_predicate => TRUE); END;';
7637 EXECUTE IMMEDIATE(l_stmt) using l_owner, p_database_object_name, p_database_object_name||'_PI',
7638 l_apps_schema,'IGS_SC_GRANTS_TBL_PVT.UPDATE_ROW','insert';
7639 ELSE
7640 dbms_rls.add_policy (
7641 object_schema => l_owner,
7642 object_name => p_database_object_name,
7643 policy_name => p_database_object_name||'_PI',
7644 function_schema => l_apps_schema,
7645 policy_function => 'IGS_SC_GRANTS_TBL_PVT.UPDATE_ROW',
7646 statement_types => 'insert',
7647 update_check => TRUE );
7648 END IF;
7649 ELSE
7650 IF (l_db_version >= 10) THEN
7651 l_stmt:= 'BEGIN dbms_rls.add_policy (
7652 object_schema => :1,
7653 object_name => :2,
7654 policy_name => :3,
7655 function_schema => :4,
7656 policy_function => :5,
7657 statement_types => :6,
7658 update_check => TRUE,
7659 long_predicate => TRUE); END;';
7660 EXECUTE IMMEDIATE(l_stmt) using l_owner, p_database_object_name, p_database_object_name||'_PI',
7661 l_apps_schema,'IGS_SC_GRANTS_TBL_PVT.INSERT_ROW','insert';
7662 ELSE
7663 dbms_rls.add_policy (object_schema => l_owner,
7664 object_name => p_database_object_name,
7665 policy_name => p_database_object_name||'_PI',
7666 function_schema => l_apps_schema,
7667 policy_function => 'IGS_SC_GRANTS_TBL_PVT.INSERT_ROW',
7668 statement_types => 'insert',
7669 update_check => TRUE );
7670 END IF;
7671 END IF;
7672 END IF;
7673 IF L_UPDATE_FLAG IS NOT NULL THEN
7674 IF (l_db_version >= 10) THEN
7675 l_stmt:= 'BEGIN dbms_rls.add_policy (
7676 object_schema => :1,
7677 object_name => :2,
7678 policy_name => :3,
7679 function_schema => :4,
7680 policy_function => :5,
7681 statement_types => :6,
7682 update_check => TRUE,
7683 long_predicate => TRUE); END;';
7684 EXECUTE IMMEDIATE(l_stmt) using l_owner, p_database_object_name, p_database_object_name||'_PU',
7685 l_apps_schema,'IGS_SC_GRANTS_TBL_PVT.UPDATE_ROW','update';
7686 ELSE
7687 dbms_rls.add_policy (object_schema => l_owner,
7688 object_name => p_database_object_name,
7689 policy_name => p_database_object_name||'_PU',
7690 function_schema => l_apps_schema,
7691 policy_function => 'IGS_SC_GRANTS_TBL_PVT.UPDATE_ROW',
7692 statement_types => 'update',
7693 update_check => TRUE );
7694 END IF;
7695 END IF;
7696 IF L_SELECT_FLAG IS NOT NULL THEN
7697 IF (l_db_version >= 10) THEN
7698 l_stmt:= 'BEGIN dbms_rls.add_policy (
7699 object_schema => :1,
7700 object_name => :2,
7701 policy_name => :3,
7702 function_schema => :4,
7703 policy_function => :5,
7704 statement_types => :6,
7705 update_check => TRUE,
7706 long_predicate => TRUE); END;';
7707 EXECUTE IMMEDIATE(l_stmt) using l_owner, p_database_object_name, p_database_object_name||'_PS',
7708 l_apps_schema,'IGS_SC_GRANTS_TBL_PVT.SELECT_ROW','select';
7709 ELSE
7710 dbms_rls.add_policy (object_schema => l_owner,
7711 object_name => p_database_object_name,
7712 policy_name => p_database_object_name||'_PS',
7713 function_schema => l_apps_schema,
7714 policy_function => 'IGS_SC_GRANTS_TBL_PVT.SELECT_ROW',
7715 statement_types => 'select',
7716 update_check => TRUE );
7717 END IF;
7718 END IF;
7719 IF L_DELETE_FLAG IS NOT NULL THEN
7720 IF L_PAR_SECURITY IS NOT NULL THEN
7721 IF (l_db_version >= 10) THEN
7722 l_stmt:= 'BEGIN dbms_rls.add_policy (
7723 object_schema => :1,
7724 object_name => :2,
7725 policy_name => :3,
7726 function_schema => :4,
7727 policy_function => :5,
7728 statement_types => :6,
7729 update_check => TRUE,
7730 long_predicate => TRUE); END;';
7731 EXECUTE IMMEDIATE(l_stmt) using l_owner, p_database_object_name, p_database_object_name||'_PD',
7732 l_apps_schema,'IGS_SC_GRANTS_TBL_PVT.UPDATE_ROW','delete';
7733 ELSE
7734 dbms_rls.add_policy (object_schema => l_owner,
7735 object_name => p_database_object_name,
7736 policy_name => p_database_object_name||'_PD',
7737 function_schema => l_apps_schema,
7738 policy_function => 'IGS_SC_GRANTS_TBL_PVT.UPDATE_ROW',
7739 statement_types => 'delete',
7740 update_check => TRUE );
7741 END IF;
7742 ELSE
7743 IF (l_db_version >= 10) THEN
7744 l_stmt:= 'BEGIN dbms_rls.add_policy (
7745 object_schema => :1,
7746 object_name => :2,
7747 policy_name => :3,
7748 function_schema => :4,
7749 policy_function => :5,
7750 statement_types => :6,
7751 update_check => TRUE,
7752 long_predicate => TRUE); END;';
7753 EXECUTE IMMEDIATE(l_stmt) using l_owner, p_database_object_name, p_database_object_name||'_PD',
7754 l_apps_schema,'IGS_SC_GRANTS_TBL_PVT.DELETE_ROW','delete';
7755 ELSE
7756 dbms_rls.add_policy (object_schema => l_owner,
7757 object_name => p_database_object_name,
7758 policy_name => p_database_object_name||'_PD',
7759 function_schema => l_apps_schema,
7760 policy_function => 'IGS_SC_GRANTS_TBL_PVT.DELETE_ROW',
7761 statement_types => 'delete',
7762 update_check => TRUE );
7763 END IF;
7764 END IF;
7765 END IF;
7766 -- COMMIT WORK;
7767 EXCEPTION
7768 WHEN OTHERS THEN
7769 IF C_DEFAULT_SECURITY%ISOPEN THEN
7770 CLOSE C_DEFAULT_SECURITY;
7771 END IF;
7772 ROLLBACK;
7773
7774 IF (FND_MSg_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
7775 FND_MSg_PUB.Add_Exc_Msg (g_PKg_NAME, 'MODIFY_POLICY');
7776 END IF;
7777 RAISE;
7778 -- RAISE FND_API.G_EXC_ERROR;
7779
7780 END modify_policy;
7781
7782 /* This procedure shifts sequences in all tables to remove empty spaces in numbering
7783 Table list :
7784
7785 IGS_SC_USR_ATTRIBS user_attrib_id
7786
7787 IGS_SC_USR_ATT_VALS user_id ,user_attrib_id
7788
7789 IGS_SC_OBJ_GROUPS obj_group_id
7790
7791 IGS_SC_OBJECTS object_id,obj_group_id
7792
7793 IGS_SC_OBJ_FUNCTNS function_id,obj_group_id
7794
7795 IGS_SC_OBJ_ATT_MTHS object_id,obj_attrib_id
7796
7797 IGS_SC_OBJ_ATTRIBS obj_group_id ,obj_attrib_id
7798
7799 IGS_SC_OBJ_ATT_VALS object_id,obj_attrib_id
7800
7801 IGS_SC_OBJ_GRANTS grant_id,object_id
7802
7803 IGS_SC_GRANTS grant_id,user_group_id,obj_group_id ,function_id
7804
7805 IGS_SC_GRANT_CONDS grant_id,obj_attrib_id,user_attrib_id
7806
7807 */
7808 PROCEDURE change_seq IS
7809
7810 CURSOR igs_sc_grants_c IS
7811 SELECT grant_id
7812 FROM igs_sc_grants
7813 ORDER BY grant_id
7814 FOR UPDATE OF grant_id;
7815
7816 CURSOR igs_sc_usr_attribs_c IS
7817 SELECT user_attrib_id
7818 FROM igs_sc_usr_attribs
7819 ORDER BY user_attrib_id
7820 FOR UPDATE OF user_attrib_id;
7821
7822 CURSOR igs_sc_obj_groups_c IS
7823 SELECT obj_group_id
7824 FROM igs_sc_obj_groups
7825 ORDER BY obj_group_id
7826 FOR UPDATE OF obj_group_id;
7827
7828 CURSOR igs_sc_obj_functns_c IS
7829 SELECT function_id
7830 FROM igs_sc_obj_functns
7831 ORDER BY function_id
7832 FOR UPDATE OF function_id;
7833
7834 CURSOR igs_sc_obj_attribs_c IS
7835 SELECT obj_attrib_id
7836 FROM igs_sc_obj_attribs
7837 ORDER BY obj_attrib_id
7838 FOR UPDATE OF obj_attrib_id;
7839
7840 l_current_seq NUMBER;
7841
7842 BEGIN
7843
7844 -- -----------------------------------------------------------------
7845 -- Check if admin mode is enabled
7846 -- -----------------------------------------------------------------
7847 IF IGS_SC_GRANTS_PVT.admin_mode <> 'Y' AND g_upgrade_mode <> 'Y' THEN
7848
7849 FND_MESSAGE.SET_NAME('IGS', 'IGS_SC_ADMIN_MODE_OFF');
7850 FND_MSG_PUB.Add;
7851 RAISE FND_API.G_EXC_ERROR;
7852
7853 END IF;
7854
7855 -- UPDATE GRANTS
7856
7857 l_current_seq := 1;
7858
7859 FOR igs_sc_grants_rec IN igs_sc_grants_c LOOP
7860
7861 IF igs_sc_grants_rec.grant_id <> l_current_seq THEN
7862
7863 -- Update all tables
7864 UPDATE IGS_SC_OBJ_GRANTS SET grant_id = l_current_seq WHERE grant_id = igs_sc_grants_rec.grant_id;
7865
7866 UPDATE IGS_SC_GRANT_CONDS SET grant_id = l_current_seq WHERE grant_id = igs_sc_grants_rec.grant_id;
7867
7868 -- Update table itself
7869 UPDATE igs_sc_grants SET grant_id = l_current_seq WHERE CURRENT OF igs_sc_grants_c;
7870
7871 END IF;
7872
7873 l_current_seq := l_current_seq +1;
7874
7875 END LOOP;
7876
7877 -- UPDATE USER ATTRIBS
7878
7879 l_current_seq := 1;
7880
7881 FOR igs_sc_usr_attribs_rec IN igs_sc_usr_attribs_c LOOP
7882
7883 IF igs_sc_usr_attribs_rec.user_attrib_id <> l_current_seq THEN
7884
7885 -- Update all tables
7886
7887 UPDATE IGS_SC_GRANT_CONDS SET user_attrib_id = l_current_seq WHERE user_attrib_id = igs_sc_usr_attribs_rec.user_attrib_id;
7888 UPDATE IGS_SC_USR_ATT_VALS SET user_attrib_id = l_current_seq WHERE user_attrib_id = igs_sc_usr_attribs_rec.user_attrib_id;
7889
7890 -- Update table itself
7891 UPDATE igs_sc_usr_attribs SET user_attrib_id = l_current_seq WHERE CURRENT OF igs_sc_usr_attribs_c;
7892
7893 END IF;
7894
7895 l_current_seq := l_current_seq +1;
7896
7897 END LOOP;
7898
7899
7900
7901 -- UPDATE GROUPS
7902
7903 l_current_seq := 1;
7904
7905 FOR igs_sc_obj_groups_rec IN igs_sc_obj_groups_c LOOP
7906
7907 IF igs_sc_obj_groups_rec.obj_group_id <> l_current_seq THEN
7908
7909 -- Update all tables
7910
7911 UPDATE IGS_SC_OBJECTS SET obj_group_id = l_current_seq WHERE obj_group_id = igs_sc_obj_groups_rec.obj_group_id;
7912
7913 UPDATE IGS_SC_OBJ_FUNCTNS SET obj_group_id = l_current_seq WHERE obj_group_id = igs_sc_obj_groups_rec.obj_group_id;
7914
7915 UPDATE IGS_SC_OBJ_ATTRIBS SET obj_group_id = l_current_seq WHERE obj_group_id = igs_sc_obj_groups_rec.obj_group_id;
7916
7917 UPDATE IGS_SC_GRANTS SET obj_group_id = l_current_seq WHERE obj_group_id = igs_sc_obj_groups_rec.obj_group_id;
7918
7919 -- Update table itself
7920 UPDATE igs_sc_obj_groups SET obj_group_id = l_current_seq WHERE CURRENT OF igs_sc_obj_groups_c;
7921
7922 END IF;
7923
7924 l_current_seq := l_current_seq +1;
7925
7926 END LOOP;
7927
7928 -- UPDATE FUNCTIONS
7929
7930 l_current_seq := 1;
7931
7932 FOR igs_sc_obj_functns_rec IN igs_sc_obj_functns_c LOOP
7933
7934 IF igs_sc_obj_functns_rec.function_id <> l_current_seq THEN
7935
7936 -- Update all tables
7937
7938 UPDATE IGS_SC_GRANTS SET function_id = l_current_seq WHERE function_id = igs_sc_obj_functns_rec.function_id;
7939
7940 -- Update table itself
7941 UPDATE igs_sc_obj_functns SET function_id = l_current_seq WHERE CURRENT OF igs_sc_obj_functns_c;
7942
7943 END IF;
7944
7945 l_current_seq := l_current_seq +1;
7946
7947 END LOOP;
7948
7949
7950 -- UPDATE OBJ ATTRIBS
7951
7952 l_current_seq := 1;
7953
7954 FOR igs_sc_obj_attribs_rec IN igs_sc_obj_attribs_c LOOP
7955
7956 IF igs_sc_obj_attribs_rec.obj_attrib_id <> l_current_seq THEN
7957
7958 -- Update all tables
7959
7960 UPDATE IGS_SC_OBJ_ATT_MTHS SET obj_attrib_id = l_current_seq WHERE obj_attrib_id = igs_sc_obj_attribs_rec.obj_attrib_id;
7961
7962 UPDATE IGS_SC_OBJ_ATT_VALS SET obj_attrib_id = l_current_seq WHERE obj_attrib_id = igs_sc_obj_attribs_rec.obj_attrib_id;
7963
7964 UPDATE IGS_SC_GRANT_CONDS SET obj_attrib_id = l_current_seq WHERE obj_attrib_id = igs_sc_obj_attribs_rec.obj_attrib_id;
7965
7966 -- Update table itself
7967 UPDATE igs_sc_obj_attribs SET obj_attrib_id = l_current_seq WHERE CURRENT OF igs_sc_obj_attribs_c;
7968
7969 END IF;
7970
7971 l_current_seq := l_current_seq +1;
7972
7973 END LOOP;
7974
7975
7976 END change_seq;
7977
7978
7979 PROCEDURE enable_upgrade_mode (
7980 p_api_version IN NUMBER,
7981 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
7982 p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE,
7983 p_obj_group_id IN igs_sc_obj_groups.obj_group_id%TYPE,
7984 x_return_status OUT NOCOPY VARCHAR2,
7985 x_msg_data OUT NOCOPY VARCHAR2
7986 ) IS
7987
7988 l_api_name CONSTANT VARCHAR2(30) := 'ENABLE_UPGRADE_MODE';
7989 l_api_version CONSTANT NUMBER := 1.0;
7990 l_return_status VARCHAR2(1);
7991 l_msg_count NUMBER;
7992 l_msg_data VARCHAR2(2000);
7993
7994 BEGIN
7995 -- Standard Start of API savepoint
7996 SAVEPOINT enable_upgrade_mode;
7997
7998 -- Standard call to check for call compatibility.
7999 IF NOT FND_API.Compatible_API_Call (l_api_version,
8000 p_api_version,
8001 l_api_name,
8002 G_PKG_NAME)
8003 THEN
8004 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
8005 END IF;
8006
8007 -- Initialize message list if p_init_msg_list is set to TRUE.
8008
8009 x_return_status := FND_API.G_RET_STS_SUCCESS;
8010
8011 IF FND_API.to_Boolean (p_init_msg_list) THEN
8012 FND_MSG_PUB.initialize;
8013 END IF;
8014
8015 -- API body
8016 -- Unlock all grants.
8017 IF p_obj_group_id <> -1 THEN
8018 -- Unlock Grants for the object group ID
8019 IGS_SC_GRANTS_PVT.unlock_all_grants(
8020 p_api_version => 1.0 ,
8021 x_return_status => l_return_status,
8022 x_msg_count => l_msg_count,
8023 x_msg_data => l_msg_data,
8024 p_obj_group_id => p_obj_group_id);
8025
8026
8027 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
8028 raise FND_API.G_EXC_ERROR;
8029 END IF;
8030 ELSE
8031 -- Unlock all grants i.e disable security
8032 IGS_SC_GRANTS_PVT.unlock_all_grants(
8033 p_api_version => 1.0 ,
8034 x_return_status => l_return_status,
8035 x_msg_count => l_msg_count,
8036 x_msg_data => l_msg_data,
8037 p_obj_group_id => null);
8038
8039 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
8040 raise FND_API.G_EXC_ERROR;
8041 END IF;
8042 END IF;
8043
8044
8045
8046
8047 -- Set internal variable for upgrade mode
8048
8049 g_upgrade_mode := 'Y';
8050
8051
8052 -- End of API body.
8053 -- Standard check of p_commit.
8054
8055 IF FND_API.To_Boolean( p_commit ) THEN
8056 COMMIT WORK;
8057 END IF;
8058
8059 -- Standard call to get message count and if count is 1, get message info.
8060 FND_MSG_PUB.Count_And_Get
8061 ( p_count => l_msg_count ,
8062 p_data => x_msg_data
8063 );
8064
8065 EXCEPTION
8066 WHEN FND_API.G_EXC_ERROR THEN
8067
8068 ROLLBACK TO enable_upgrade_mode;
8069 x_return_status := FND_API.G_RET_STS_ERROR;
8070 FND_MSG_PUB.Count_And_Get (p_count => l_msg_count,
8071 p_data => x_msg_data );
8072
8073 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
8074
8075 ROLLBACK TO enable_upgrade_mode;
8076 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
8077 FND_MSG_PUB.Count_And_Get ( p_count => l_msg_count,
8078 p_data => x_msg_data );
8079
8080 WHEN OTHERS THEN
8081
8082 ROLLBACK TO enable_upgrade_mode;
8083 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
8084
8085 IF (FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
8086 FND_MSG_PUB.Add_Exc_Msg (G_PKG_NAME, l_api_name);
8087 END IF;
8088 FND_MSG_PUB.Count_And_Get ( p_count => l_msg_count,
8089 p_data => x_msg_data );
8090
8091 END enable_upgrade_mode;
8092
8093 FUNCTION replace_string(
8094 p_string IN VARCHAR2,
8095 p_from_pattern IN VARCHAR2,
8096 p_to_pattern IN VARCHAR2
8097 ) RETURN VARCHAR2
8098 IS
8099
8100 l_out_string VARCHAR2(4000);
8101 l_upper_string VARCHAR2(4000);
8102 l_occurence NUMBER(10) := 0;
8103 l_len NUMBER(5);
8104
8105 BEGIN
8106
8107 IF upper(p_from_pattern) = upper(p_to_pattern) THEN
8108
8109 --check for being the same value, infinite loop
8110 RETURN p_string;
8111
8112 END IF;
8113
8114 -- delete all values for the current user
8115
8116 l_out_string := p_string;
8117 l_upper_string := UPPER(l_out_string);
8118
8119 l_len := length(p_from_pattern);
8120
8121 l_occurence := INSTR(l_upper_string,p_from_pattern,1,1);
8122
8123 LOOP
8124
8125 IF l_occurence = 0 THEN
8126 -- no more found exit
8127 EXIT;
8128
8129 END IF;
8130
8131 l_out_string := SUBSTR(l_out_string,1,l_occurence-1)||p_to_pattern||SUBSTR(l_out_string,l_occurence+l_len,32000);
8132
8133 l_upper_string := UPPER(l_out_string);
8134
8135 -- find next
8136 l_occurence := INSTR(l_upper_string,p_from_pattern,1,1);
8137
8138 END LOOP;
8139
8140 RETURN l_out_string;
8141
8142 END replace_string;
8143
8144 FUNCTION get_obj_name (
8145 p_obj_id IN fnd_objects.object_id%TYPE )
8146 RETURN VARCHAR2 IS
8147
8148 l_obj_name fnd_objects.database_object_name%TYPE ;
8149
8150 CURSOR c_objects IS
8151 SELECT DATABASE_OBJECT_NAME
8152 FROM FND_OBJECTS
8153 WHERE OBJECT_ID = p_obj_id;
8154 BEGIN
8155
8156 OPEN c_objects;
8157 FETCH c_objects INTO l_obj_name;
8158 CLOSE c_objects;
8159
8160 RETURN l_obj_name;
8161
8162
8163 END get_obj_name;
8164
8165
8166 PROCEDURE Cut_String (
8167 p_file_ptr UTL_FILE.FILE_TYPE,
8168 p_string IN VARCHAR2
8169 ) IS
8170 l_new_string VARCHAR2(255);
8171 l_result_string VARCHAR2(4000);
8172 l_pos NUMBER;
8173 l_total_len NUMBER(3) := 250;
8174 BEGIN
8175
8176 l_result_string := p_string;
8177
8178 LOOP
8179
8180 IF length (l_result_string) <= l_total_len THEN
8181 EXIT;
8182 END IF;
8183 --Get a 255 charachter string
8184 l_new_string := substr(l_result_string,1,l_total_len);
8185
8186 l_pos :=l_total_len;
8187
8188 -- Find space starting from end
8189 WHILE ( (substr(l_new_string,l_pos,1) <>' ') AND (substr(l_new_string,l_pos-1,l_pos) IS NOT NULL)) LOOP
8190 l_pos := l_pos -1;
8191 END LOOP;
8192
8193 l_new_string := substr(l_new_string,1,l_pos);
8194
8195 -- put to the file
8196 UTL_FILE.PUT_LINE ( p_file_ptr, l_new_string);
8197
8198 -- modify string
8199 l_result_string := substr(l_result_string,length(l_new_string)+1,4000);
8200
8201 END LOOP;
8202
8203 UTL_FILE.PUT_LINE ( p_file_ptr, l_result_string);
8204
8205 END Cut_String;
8206
8207 PROCEDURE Generate_Table_SQL (
8208 p_table_name IN VARCHAR2,
8209 p_where_clause IN VARCHAR2,
8210 p_pk_value IN VARCHAR2,
8211 p_file_ptr UTL_FILE.FILE_TYPE
8212 )
8213 IS
8214 l_query_str VARCHAR2(32000);
8215 l_result VARCHAR2(32000);
8216 l_col_list VARCHAR2(32000);
8217 l_concat_col_list VARCHAR2(32000);
8218 l_col_name VARCHAR2(80);
8219 l_object_num NUMBER(1):=0;
8220 TYPE cur_typ IS REF CURSOR;
8221 c_query cur_typ;
8222 l_str VARCHAR2(2000);
8223 l_status VARCHAR2(255);
8224 l_industry VARCHAR2(255);
8225 l_owner VARCHAR2(255);
8226
8227 CURSOR c_cols IS
8228 SELECT COLUMN_NAME
8229 FROM ALL_TAB_COLUMNS
8230 WHERE TABLE_NAME=p_table_name
8231 AND OWNER = l_owner
8232 ORDER BY COLUMN_NAME;
8233
8234 BEGIN
8235 -- Get application
8236 IF NOT FND_INSTALLATION.GET_APP_INFO (
8237 application_short_name => 'IGS',
8238 status => l_status,
8239 industry => l_industry,
8240 oracle_schema => l_owner) THEN
8241 l_owner := 'IGS';
8242 END IF;
8243
8244 FOR c_cols_rec IN c_cols LOOP
8245
8246 IF c_cols_rec.column_name = 'OBJECT_ID' THEN
8247 l_col_name := 'IGS_SC_DATA_SEC_APIS_PKG.get_obj_name('||c_cols_rec.column_name||')';
8248 l_object_num :=1;
8249 ELSE
8250 l_col_name := c_cols_rec.column_name;
8251 END IF;
8252
8253 IF l_col_list IS NULL THEN
8254 l_col_list := c_cols_rec.column_name;
8255
8256
8257 l_concat_col_list := '''''''''||'||l_col_name||'||''''''';
8258
8259 ELSE
8260 l_col_list := l_col_list||','||c_cols_rec.column_name;
8261 IF c_cols_rec.column_name = 'OBJECT_ID' THEN
8262 -- do not append '' at the beggining
8263
8264 l_concat_col_list := l_concat_col_list||',IGS_SC_DATA_SEED_PKG.get_obj_id(''''''||'||l_col_name||'||'''''')';
8265
8266 ELSIF c_cols_rec.column_name IN ('CREATION_DATE','START_DATE','LAST_UPDATE_DATE') THEN
8267
8268 l_concat_col_list := l_concat_col_list||',sysdate';
8269
8270 ELSE
8271
8272 l_concat_col_list := l_concat_col_list||',''''''||'||l_col_name||'||''''''';
8273
8274 END IF;
8275 END IF;
8276 END LOOP;
8277 -- l_concat_col_list := l_concat_col_list||'||''''''''';
8278 l_concat_col_list := l_concat_col_list||'''';
8279
8280 l_query_str := 'SELECT '||l_concat_col_list||' FROM '||p_table_name||' WHERE '||p_where_clause;
8281 -- UTL_FILE.PUT_LINE ( p_file_ptr, l_query_str);
8282
8283 OPEN c_query FOR l_query_str USING p_pk_value;
8284 LOOP
8285
8286 FETCH c_query INTO l_result;
8287 EXIT WHEN c_query%NOTFOUND;
8288
8289 l_str := 'INSERT INTO '||p_table_name||' ('||l_col_list||') VALUES ( ';
8290 Cut_String ( p_file_ptr, l_str);
8291
8292 l_str := l_result||');' ;
8293 Cut_String ( p_file_ptr, l_str);
8294
8295 UTL_FILE.FFLUSH ( p_file_ptr );
8296
8297 END LOOP;
8298 CLOSE c_query;
8299
8300
8301 END Generate_Table_SQL;
8302
8303 PROCEDURE Generate_Objects_SQL (
8304 p_file_ptr UTL_FILE.FILE_TYPE
8305 )
8306 IS
8307
8308 l_comm_string VARCHAR2(700) ;
8309 l_cur_object NUMBER;
8310
8311 CURSOR c_objects IS
8312 SELECT DATABASE_OBJECT_NAME,
8313 PK1_COLUMN_NAME ,
8314 PK2_COLUMN_NAME ,
8315 PK3_COLUMN_NAME ,
8316 PK4_COLUMN_NAME ,
8317 PK5_COLUMN_NAME ,
8318 PK1_COLUMN_TYPE ,
8319 PK2_COLUMN_TYPE ,
8320 PK3_COLUMN_TYPE ,
8321 PK4_COLUMN_TYPE ,
8322 PK5_COLUMN_TYPE ,
8323 APPLICATION_ID ,
8324 OBJ_NAME
8325 FROM FND_OBJECTS
8326 WHERE OBJ_NAME LIKE 'IGS%'
8327 ORDER BY OBJ_NAME;
8328
8329 BEGIN
8330
8331 -- Put script begginning part
8332
8333 UTL_FILE.PUT_LINE ( p_file_ptr,' DECLARE');
8334
8335 UTL_FILE.PUT_LINE ( p_file_ptr,' CURSOR c_obj (v_database_object_name VARCHAR2 ) IS');
8336 UTL_FILE.PUT_LINE ( p_file_ptr,' SELECT object_id');
8337 UTL_FILE.PUT_LINE ( p_file_ptr,' FROM fnd_objects ');
8338 UTL_FILE.PUT_LINE ( p_file_ptr,' WHERE database_object_name = v_database_object_name;');
8339
8340 UTL_FILE.PUT_LINE ( p_file_ptr,' TYPE l_obj_rec_tbl IS TABLE OF fnd_objects%ROWTYPE INDEX BY BINARY_INTEGER;');
8341
8342 UTL_FILE.PUT_LINE ( p_file_ptr,' l_obj_tbl l_obj_rec_tbl;');
8343 UTL_FILE.PUT_LINE ( p_file_ptr,' l_object_id fnd_objects.object_id%TYPE;');
8344 UTL_FILE.PUT_LINE ( p_file_ptr,' l_record_num NUMBER(10);');
8345 UTL_FILE.PUT_LINE ( p_file_ptr,' l_cur_num NUMBER(10) := 0;');
8346 UTL_FILE.PUT_LINE ( p_file_ptr,' l_total NUMBER(9) :=0;');
8347 UTL_FILE.PUT_LINE ( p_file_ptr,' l_rowid VARCHAR2(255);');
8348 UTL_FILE.PUT_LINE ( p_file_ptr,' BEGIN');
8349
8350 l_cur_object := 0;
8351
8352 FOR c_objects_rec IN c_objects LOOP
8353 l_comm_string := ' l_obj_tbl('||l_cur_object||').DATABASE_OBJECT_NAME := '''||c_objects_rec.DATABASE_OBJECT_NAME||''';';
8354 UTL_FILE.PUT_LINE ( p_file_ptr,l_comm_string );
8355 l_comm_string := ' l_obj_tbl('||l_cur_object||').PK1_COLUMN_NAME := '''||c_objects_rec.PK1_COLUMN_NAME||''';';
8356 UTL_FILE.PUT_LINE ( p_file_ptr,l_comm_string );
8357 l_comm_string := ' l_obj_tbl('||l_cur_object||').PK1_COLUMN_TYPE := '''||c_objects_rec.PK1_COLUMN_TYPE||''';';
8358 UTL_FILE.PUT_LINE ( p_file_ptr,l_comm_string );
8359 l_comm_string := ' l_obj_tbl('||l_cur_object||').PK2_COLUMN_NAME := '''||c_objects_rec.PK2_COLUMN_NAME||''';';
8360 UTL_FILE.PUT_LINE ( p_file_ptr,l_comm_string );
8361 l_comm_string := ' l_obj_tbl('||l_cur_object||').PK2_COLUMN_TYPE := '''||c_objects_rec.PK2_COLUMN_TYPE||''';';
8362 UTL_FILE.PUT_LINE ( p_file_ptr,l_comm_string );
8363
8364 l_comm_string := ' l_obj_tbl('||l_cur_object||').PK3_COLUMN_NAME := '''||c_objects_rec.PK3_COLUMN_NAME||''';';
8365 UTL_FILE.PUT_LINE ( p_file_ptr,l_comm_string );
8366 l_comm_string := ' l_obj_tbl('||l_cur_object||').PK3_COLUMN_TYPE := '''||c_objects_rec.PK3_COLUMN_TYPE||''';';
8367 UTL_FILE.PUT_LINE ( p_file_ptr,l_comm_string );
8368
8369 l_comm_string := ' l_obj_tbl('||l_cur_object||').PK4_COLUMN_NAME := '''||c_objects_rec.PK4_COLUMN_NAME||''';';
8370 UTL_FILE.PUT_LINE ( p_file_ptr,l_comm_string );
8371 l_comm_string := ' l_obj_tbl('||l_cur_object||').PK4_COLUMN_TYPE := '''||c_objects_rec.PK4_COLUMN_TYPE||''';';
8372 UTL_FILE.PUT_LINE ( p_file_ptr,l_comm_string );
8373
8374 l_comm_string := ' l_obj_tbl('||l_cur_object||').PK5_COLUMN_NAME := '''||c_objects_rec.PK5_COLUMN_NAME||''';';
8375 UTL_FILE.PUT_LINE ( p_file_ptr,l_comm_string );
8376 l_comm_string := ' l_obj_tbl('||l_cur_object||').PK5_COLUMN_TYPE := '''||c_objects_rec.PK5_COLUMN_TYPE||''';';
8377 UTL_FILE.PUT_LINE ( p_file_ptr,l_comm_string );
8378 l_comm_string := ' l_obj_tbl('||l_cur_object||').APPLICATION_ID := '''||c_objects_rec.APPLICATION_ID||''';';
8379 UTL_FILE.PUT_LINE ( p_file_ptr,l_comm_string );
8380 l_comm_string := ' l_obj_tbl('||l_cur_object||').OBJ_NAME := '''||c_objects_rec.OBJ_NAME||''';';
8381 UTL_FILE.PUT_LINE ( p_file_ptr,l_comm_string );
8382
8383 UTL_FILE.FFLUSH ( p_file_ptr );
8384 l_cur_object := l_cur_object+1;
8385
8386 END LOOP;
8387
8388 UTL_FILE.PUT_LINE ( p_file_ptr,' l_total :='||(l_cur_object-1)||';' );
8389 UTL_FILE.FFLUSH ( p_file_ptr );
8390
8391 --Add last part of the script
8392 UTL_FILE.PUT_LINE ( p_file_ptr,' FOR l_cur_num IN 0..l_total LOOP ');
8393 UTL_FILE.PUT_LINE ( p_file_ptr,' l_object_id := null; ');
8394
8395 UTL_FILE.PUT_LINE ( p_file_ptr,' OPEN c_obj ( l_obj_tbl(l_cur_num).DATABASE_OBJECT_NAME);');
8396 UTL_FILE.PUT_LINE ( p_file_ptr,' FETCH c_obj INTO l_object_id;');
8397 UTL_FILE.PUT_LINE ( p_file_ptr,' CLOSE c_obj;');
8398 UTL_FILE.PUT_LINE ( p_file_ptr,' IF l_object_id IS NULL THEN ');
8399 UTL_FILE.PUT_LINE ( p_file_ptr,' SELECT fnd_objects_s.nextval INTO l_object_id FROM DUAL;');
8400 UTL_FILE.PUT_LINE ( p_file_ptr,' FND_OBJECTS_PKG.INSERT_ROW (');
8401 UTL_FILE.PUT_LINE ( p_file_ptr,' x_rowid => l_rowid,');
8402 UTL_FILE.PUT_LINE ( p_file_ptr,' x_object_id =>l_object_id,');
8403 UTL_FILE.PUT_LINE ( p_file_ptr,' x_obj_name => l_obj_tbl(l_cur_num).OBJ_NAME,');
8404 UTL_FILE.PUT_LINE ( p_file_ptr,' x_pk1_column_name => l_obj_tbl(l_cur_num).PK1_COLUMN_NAME ,');
8405 UTL_FILE.PUT_LINE ( p_file_ptr,' x_pk2_column_name => l_obj_tbl(l_cur_num).PK2_COLUMN_NAME ,');
8406 UTL_FILE.PUT_LINE ( p_file_ptr,' x_pk3_column_name => l_obj_tbl(l_cur_num).PK3_COLUMN_NAME ,');
8407 UTL_FILE.PUT_LINE ( p_file_ptr,' x_pk4_column_name => l_obj_tbl(l_cur_num).PK4_COLUMN_NAME ,');
8408 UTL_FILE.PUT_LINE ( p_file_ptr,' x_pk5_column_name => l_obj_tbl(l_cur_num).PK5_COLUMN_NAME ,');
8409 UTL_FILE.PUT_LINE ( p_file_ptr,' x_pk1_column_type => l_obj_tbl(l_cur_num).PK1_COLUMN_TYPE ,');
8410 UTL_FILE.PUT_LINE ( p_file_ptr,' x_pk2_column_type => l_obj_tbl(l_cur_num).PK2_COLUMN_TYPE ,');
8411 UTL_FILE.PUT_LINE ( p_file_ptr,' x_pk3_column_type => l_obj_tbl(l_cur_num).PK3_COLUMN_TYPE ,');
8412 UTL_FILE.PUT_LINE ( p_file_ptr,' x_pk4_column_type => l_obj_tbl(l_cur_num).PK4_COLUMN_TYPE ,');
8413 UTL_FILE.PUT_LINE ( p_file_ptr,' x_pk5_column_type => l_obj_tbl(l_cur_num).PK5_COLUMN_TYPE ,');
8414 UTL_FILE.PUT_LINE ( p_file_ptr,' x_application_id => l_obj_tbl(l_cur_num).APPLICATION_ID ,');
8415 UTL_FILE.PUT_LINE ( p_file_ptr,' x_database_object_name => l_obj_tbl(l_cur_num).DATABASE_OBJECT_NAME,');
8416 UTL_FILE.PUT_LINE ( p_file_ptr,' x_display_name => l_obj_tbl(l_cur_num).OBJ_NAME,');
8417 UTL_FILE.PUT_LINE ( p_file_ptr,' x_description => l_obj_tbl(l_cur_num).OBJ_NAME,');
8418 UTL_FILE.PUT_LINE ( p_file_ptr,' x_creation_date => sysdate,');
8419 UTL_FILE.PUT_LINE ( p_file_ptr,' x_created_by => nvl(fnd_global.user_id,-1),');
8420 UTL_FILE.PUT_LINE ( p_file_ptr,' x_last_update_date => sysdate,');
8421 UTL_FILE.PUT_LINE ( p_file_ptr,' x_last_updated_by => nvl(fnd_global.user_id,-1),');
8422 UTL_FILE.PUT_LINE ( p_file_ptr,' x_last_update_login => nvl(fnd_global.login_id, -1));');
8423
8424 UTL_FILE.PUT_LINE ( p_file_ptr,' ELSE');
8425
8426 UTL_FILE.PUT_LINE ( p_file_ptr,' FND_OBJECTS_PKG.UPDATE_ROW (');
8427 UTL_FILE.PUT_LINE ( p_file_ptr,' x_object_id =>l_object_id,');
8428 UTL_FILE.PUT_LINE ( p_file_ptr,' x_obj_name => l_obj_tbl(l_cur_num).OBJ_NAME,');
8429 UTL_FILE.PUT_LINE ( p_file_ptr,' x_pk1_column_name => l_obj_tbl(l_cur_num).PK1_COLUMN_NAME ,');
8430 UTL_FILE.PUT_LINE ( p_file_ptr,' x_pk2_column_name => l_obj_tbl(l_cur_num).PK2_COLUMN_NAME ,');
8431 UTL_FILE.PUT_LINE ( p_file_ptr,' x_pk3_column_name => l_obj_tbl(l_cur_num).PK3_COLUMN_NAME ,');
8432 UTL_FILE.PUT_LINE ( p_file_ptr,' x_pk4_column_name => l_obj_tbl(l_cur_num).PK4_COLUMN_NAME ,');
8433 UTL_FILE.PUT_LINE ( p_file_ptr,' x_pk5_column_name => l_obj_tbl(l_cur_num).PK5_COLUMN_NAME ,');
8434 UTL_FILE.PUT_LINE ( p_file_ptr,' x_pk1_column_type => l_obj_tbl(l_cur_num).PK1_COLUMN_TYPE ,');
8435 UTL_FILE.PUT_LINE ( p_file_ptr,' x_pk2_column_type => l_obj_tbl(l_cur_num).PK2_COLUMN_TYPE ,');
8436 UTL_FILE.PUT_LINE ( p_file_ptr,' x_pk3_column_type => l_obj_tbl(l_cur_num).PK3_COLUMN_TYPE ,');
8437 UTL_FILE.PUT_LINE ( p_file_ptr,' x_pk4_column_type => l_obj_tbl(l_cur_num).PK4_COLUMN_TYPE ,');
8438 UTL_FILE.PUT_LINE ( p_file_ptr,' x_pk5_column_type => l_obj_tbl(l_cur_num).PK5_COLUMN_TYPE ,');
8439 UTL_FILE.PUT_LINE ( p_file_ptr,' x_application_id => l_obj_tbl(l_cur_num).APPLICATION_ID ,');
8440 UTL_FILE.PUT_LINE ( p_file_ptr,' x_database_object_name => l_obj_tbl(l_cur_num).DATABASE_OBJECT_NAME,');
8441 UTL_FILE.PUT_LINE ( p_file_ptr,' x_display_name => l_obj_tbl(l_cur_num).OBJ_NAME,');
8442 UTL_FILE.PUT_LINE ( p_file_ptr,' x_description => l_obj_tbl(l_cur_num).OBJ_NAME,');
8443 UTL_FILE.PUT_LINE ( p_file_ptr,' x_last_update_date => sysdate,');
8444 UTL_FILE.PUT_LINE ( p_file_ptr,' x_last_updated_by => nvl(fnd_global.user_id,-1),');
8445 UTL_FILE.PUT_LINE ( p_file_ptr,' x_last_update_login => nvl(fnd_global.login_id, -1));');
8446
8447 UTL_FILE.PUT_LINE ( p_file_ptr,' END IF;');
8448 UTL_FILE.PUT_LINE ( p_file_ptr,' END LOOP;');
8449
8450 UTL_FILE.PUT_LINE ( p_file_ptr,'END;');
8451 UTL_FILE.PUT_LINE ( p_file_ptr,'/');
8452 UTL_FILE.FFLUSH ( p_file_ptr );
8453
8454
8455 END Generate_Objects_SQL;
8456
8457
8458
8459
8460
8461
8462 PROCEDURE Generate_SQL_file(
8463 p_api_version IN NUMBER,
8464 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
8465 p_commit IN VARCHAR2 := FND_API.G_FALSE,
8466 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_NONE,
8467 x_return_status OUT NOCOPY VARCHAR2,
8468 x_msg_count OUT NOCOPY NUMBER,
8469 x_msg_data OUT NOCOPY VARCHAR2,
8470 p_dirpath IN VARCHAR2,
8471 p_in_file_name IN VARCHAR2,
8472 p_out_file_name IN VARCHAR2
8473 )
8474 IS
8475
8476
8477 l_api_name CONSTANT VARCHAR2(30) := 'Generate_SQL_file';
8478 l_api_version CONSTANT NUMBER := 1.0;
8479 l_in_file_ptr UTL_FILE.FILE_TYPE;
8480 l_out_file_ptr UTL_FILE.FILE_TYPE;
8481 l_line VARCHAR2(2000);
8482 l_line2 VARCHAR2(2000);
8483 l_attr_val VARCHAR2(255);
8484
8485 BEGIN
8486 -- Standard Start of API savepoint
8487 SAVEPOINT Generate_SQL_file;
8488
8489 -- Standard call to check for call compatibility.
8490 IF NOT FND_API.Compatible_API_Call (l_api_version,
8491 p_api_version,
8492 l_api_name,
8493 G_PKG_NAME)
8494 THEN
8495 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
8496 END IF;
8497
8498 -- Initialize message list if p_init_msg_list is set to TRUE.
8499
8500 x_return_status := FND_API.G_RET_STS_SUCCESS;
8501
8502 IF FND_API.to_Boolean (p_init_msg_list) THEN
8503 FND_MSG_PUB.initialize;
8504 END IF;
8505
8506 l_in_file_ptr := UTL_FILE.FOPEN ( p_dirpath, p_in_file_name, 'r',2000 );
8507 l_out_file_ptr := UTL_FILE.FOPEN ( p_dirpath, p_out_file_name, 'a',2000 );
8508
8509 -- Put header infomation
8510 UTL_FILE.PUT_LINE ( l_out_file_ptr,'REM +=======================================================================+' );
8511 UTL_FILE.PUT_LINE ( l_out_file_ptr,'REM | Copyright (c) 1998 Oracle Corporation, Redwood Shores, CA, USA |' );
8512 UTL_FILE.PUT_LINE ( l_out_file_ptr,'REM +=======================================================================+' );
8513 UTL_FILE.PUT_LINE ( l_out_file_ptr,'REM | FILENAME |' );
8514 UTL_FILE.PUT_LINE ( l_out_file_ptr,'REM | IGSSC001.sql |' );
8515 UTL_FILE.PUT_LINE ( l_out_file_ptr,'REM | |' );
8516 UTL_FILE.PUT_LINE ( l_out_file_ptr,'REM | DESCRIPTION |' );
8517 UTL_FILE.PUT_LINE ( l_out_file_ptr,'REM | this file si generated by IGS security package |' );
8518 UTL_FILE.PUT_LINE ( l_out_file_ptr,'REM | It contains seed data SQL for SEED115 ONLY | ' );
8519 UTL_FILE.PUT_LINE ( l_out_file_ptr,'REM | Never apply to any other environments |' );
8520 UTL_FILE.PUT_LINE ( l_out_file_ptr,'REM +=======================================================================+' );
8521
8522 UTL_FILE.PUT_LINE ( l_out_file_ptr,'SET VERIFY OFF;' );
8523 UTL_FILE.PUT_LINE ( l_out_file_ptr,'WHENEVER OSERROR EXIT FAILURE ROLLBACK;' );
8524 UTL_FILE.PUT_LINE ( l_out_file_ptr,'WHENEVER SQLERROR EXIT FAILURE ROLLBACK;' );
8525
8526
8527
8528 -- UTL_FILE.PUT_LINE ( l_out_file_ptr, '# ' );
8529 -- UTL_FILE.FFLUSH ( l_out_file_ptr );
8530 Generate_Objects_SQL (l_out_file_ptr);
8531
8532 BEGIN
8533 LOOP
8534 UTL_FILE.GET_LINE ( l_in_file_ptr, l_line );
8535 UTL_FILE.GET_LINE ( l_in_file_ptr, l_line2 );
8536
8537 UTL_FILE.PUT_LINE ( l_out_file_ptr, 'DELETE FROM '||ltrim(rtrim(l_line))||' WHERE '||replace_string(l_line2,':1','1')||';' );
8538 UTL_FILE.FFLUSH ( l_out_file_ptr );
8539
8540 Generate_Table_SQL (ltrim(rtrim(l_line)),l_line2,'1', l_out_file_ptr);
8541
8542
8543 END LOOP;
8544
8545 EXCEPTION
8546 WHEN NO_DATA_FOUND THEN
8547 NULL;
8548 WHEN OTHERS THEN
8549 RAISE;
8550 END;
8551
8552 UTL_FILE.PUT_LINE ( l_out_file_ptr,'COMMIT;');
8553 UTL_FILE.PUT_LINE ( l_out_file_ptr,'EXIT;');
8554 UTL_FILE.FFLUSH ( l_out_file_ptr );
8555
8556 IF (UTL_FILE.IS_OPEN ( l_out_file_ptr )) THEN
8557 UTL_FILE.FCLOSE ( l_out_file_ptr );
8558 END IF;
8559
8560 EXCEPTION
8561 WHEN UTL_FILE.INVALID_PATH THEN
8562 ROLLBACK TO Generate_SQL_file;
8563 x_return_status := FND_API.G_RET_STS_ERROR;
8564 FND_MESSAGE.set_name('IGS', 'IGS_DS_INVALID_PATH');
8565 FND_MSG_PUB.Add;
8566
8567 WHEN UTL_FILE.WRITE_ERROR THEN
8568 ROLLBACK TO Generate_SQL_file;
8569 x_return_status := FND_API.G_RET_STS_ERROR;
8570 FND_MESSAGE.set_name('IGS', 'IGS_DS_WRITE_ERROR');
8571 FND_MSG_PUB.Add;
8572
8573 WHEN UTL_FILE.INVALID_FILEHANDLE THEN
8574 ROLLBACK TO Generate_SQL_file;
8575 x_return_status := FND_API.G_RET_STS_ERROR;
8576 FND_MESSAGE.set_name('IGS', 'IGS_DS_INVALID_FILEHANDLE');
8577 FND_MSG_PUB.Add;
8578
8579 WHEN FND_API.G_EXC_ERROR THEN
8580
8581 ROLLBACK TO Generate_SQL_file;
8582 x_return_status := FND_API.G_RET_STS_ERROR;
8583 IF (UTL_FILE.IS_OPEN ( l_out_file_ptr )) THEN
8584 UTL_FILE.FCLOSE ( l_out_file_ptr );
8585 END IF;
8586 FND_MSG_PUB.Count_And_Get (p_count => x_msg_count,
8587 p_data => x_msg_data );
8588
8589 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
8590
8591 ROLLBACK TO Generate_SQL_file;
8592
8593 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
8594 IF (UTL_FILE.IS_OPEN ( l_out_file_ptr )) THEN
8595 UTL_FILE.FCLOSE ( l_out_file_ptr );
8596 END IF;
8597 FND_MSG_PUB.Count_And_Get ( p_count => x_msg_count,
8598 p_data => x_msg_data );
8599
8600 WHEN OTHERS THEN
8601
8602 ROLLBACK TO Generate_SQL_file;
8603 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
8604
8605 IF (FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) THEN
8606 FND_MSG_PUB.Add_Exc_Msg (G_PKG_NAME, l_api_name);
8607 END IF;
8608
8609 IF (UTL_FILE.IS_OPEN ( l_out_file_ptr )) THEN
8610 UTL_FILE.FCLOSE ( l_out_file_ptr );
8611 END IF;
8612
8613 END Generate_SQL_file;
8614
8615 END IGS_SC_DATA_SEC_APIS_PKG;