DBA Data[Home] [Help]

PACKAGE BODY: APPS.FND_CONC_QUEUES_PKG

Source


4 function check_deletability (qid   in number,
1 package body FND_CONC_QUEUES_PKG as
2 /* $Header: AFCPFCQB.pls 115.1 99/07/16 23:10:49 porting sh $ */
3 
5 			     appid in number,
6 			     qname in varchar2)
7 	    		     return boolean is
8 
9   dummy		number;
10   icm_error	exception;
11   crm_error	exception;
12   in_use	exception;
13 
14 begin
15   if ((qid = 1) and (appid = 0)) then
16     raise icm_error;
17   end if;
18 
19   if ((qid = 4) and (appid = 0)) then
20     raise crm_error;
21   end if;
22 
23   select 1
24     into dummy
25     from fnd_concurrent_queues fcq,
26          fnd_concurrent_processes fcp
27    where ((fcq.application_id = appid and
28 	   fcq.concurrent_queue_id = qid and
29 	   fcq.max_processes > 0)
30 	  or
31 	  (fcp.queue_application_id = appid and
32 	   fcp.concurrent_queue_id  = qid and
33 	   fcp.process_status_code in ('A', 'R', 'T')))
34      and rownum = 1;
35 
36   raise in_use;
37 
38   exception
39     when no_data_found then
40       return (TRUE);
41     when icm_error then
42       fnd_message.set_name ('FND', 'CONC-Cannot update ICM defn');
43       return (FALSE);
44     when crm_error then
45       fnd_message.set_name ('FND', 'CONC-Cannot delete CRM');
46       return (FALSE);
47     when in_use then
48       fnd_message.set_name ('FND', 'CONC-Delete Manager');
49       fnd_message.set_token ('MANAGER', qname, FALSE);
50       return (FALSE);
51     when others then
52       fnd_message.set_name ('FND', 'CP-Generic oracle error');
53       fnd_message.set_token ('ERROR', substr (sqlerrm, 1, 30), FALSE);
54       fnd_message.set_token ('ROUTINE', 'check_deletability', FALSE);
55       return (FALSE);
56 end check_deletability;
57 
58 
59 procedure check_unique_queue	(ro_id	in varchar2,
60 				 appid	in number,
61 				 qname	in varchar2,
62                                  uqname in varchar2) is
63   dummy number;
64 begin
65   begin
66     select 1
67       into dummy
68       from sys.dual
72 		          and concurrent_queue_name = qname
69      where not exists (select 1
70 	  	       from fnd_concurrent_queues_vl
71 		        where application_id = appid
73 		          and (row_id <> chartorowid (ro_id)
74 			       or ro_id is null));
75 
76   exception
77     when no_data_found then
78       fnd_message.set_name ('FND', 'CONC-Duplicate Manager SN');
79       app_exception.raise_exception;
80     when others then
81       fnd_message.set_name ('FND', 'CP-Generic oracle error');
82       fnd_message.set_token ('ERROR', substr (sqlerrm, 1, 30), FALSE);
83       fnd_message.set_token ('ROUTINE', 'check_unique_queue', FALSE);
84       app_exception.raise_exception;
85   end;
86 
87   begin
88     select 1
89       into dummy
90       from sys.dual
91      where not exists (select 1
92 	  	       from fnd_concurrent_queues_vl
93 		        where application_id = appid
94 		          and user_concurrent_queue_name = uqname
95 		          and (row_id <> chartorowid (ro_id)
96 			       or ro_id is null));
97 
98     exception
99       when no_data_found then
100         fnd_message.set_name ('FND', 'CONC-Duplicate Manager');
101         app_exception.raise_exception;
102     when others then
103       fnd_message.set_name ('FND', 'CP-Generic oracle error');
104       fnd_message.set_token ('ERROR', substr (sqlerrm, 1, 30), FALSE);
105       fnd_message.set_token ('ROUTINE', 'check_unique_queue', FALSE);
106       app_exception.raise_exception;
107   end;
108 
109 end check_unique_queue;
110 
111 
112 procedure check_unique_wkshift (appid	in number,
113 				qid	in number,
114 				ro_id	in varchar2,
115 				pappid	in number,
116 				tpid	in number) is
117   dummy number;
118 begin
119   select 1
120     into dummy
121     from sys.dual
122    where not exists (select 1
123 		       from fnd_concurrent_queue_size
124 		      where queue_application_id = appid
125 			and concurrent_queue_id = qid
126 			and period_application_id = pappid
127 			and concurrent_time_period_id = tpid
128 			and (rowid <> chartorowid (ro_id)
129 			     or ro_id is null));
130 
131   exception
132     when no_data_found then
133       fnd_message.set_name ('FND', 'CONC-Duplicate period name');
134       app_exception.raise_exception;
135     when others then
136       fnd_message.set_name ('FND', 'CP-Generic oracle error');
137       fnd_message.set_token ('ERROR', substr (sqlerrm, 1, 30), FALSE);
138       fnd_message.set_token ('ROUTINE', 'check_unique_wkshift', FALSE);
139       app_exception.raise_exception;
140 end check_unique_wkshift;
141 
142 
143 procedure check_conflicts (iflag  in varchar2,
144 			   qid    in number,
145 			   qappid in number,
146 			   tcode  in varchar2,
147 			   tid    in number,
148 			   tappid in number,
149 			   ro_id  in varchar2) is
150 
151   conflict_checker	char;
152   duplicate_error	exception;
153   conflict_error	exception;
154 
155 begin
156   select include_flag
157     into conflict_checker
158     from fnd_concurrent_queue_content
159    where queue_application_id = qappid
160      and concurrent_queue_id = qid
161      and type_code = tcode
162      and (type_application_id = tappid
163           or (type_application_id is null
164               and tappid is null))
165      and (type_id = tid
166           or (type_id is null
167 	      and tid is null))
168      and (rowid <> chartorowid (ro_id)
169           or ro_id is null);
170 
171   if (conflict_checker = iflag) then
172     raise duplicate_error;
173   else
174     raise conflict_error;
175   end if;
176 
177   exception
178     when no_data_found then
179       null;
180     when duplicate_error then
181       fnd_message.set_name ('FND', 'CONC-Duplicate specialization');
182       app_exception.raise_exception;
183     when conflict_error then
184       fnd_message.set_name ('FND', 'CONC-Conflicting specializatin');
185       app_exception.raise_exception;
186     when others then
187       fnd_message.set_name ('FND', 'CP-Generic oracle error');
188       fnd_message.set_token ('ERROR', substr (sqlerrm, 1, 30), FALSE);
189       fnd_message.set_token ('ROUTINE', 'check_deletability', FALSE);
190       app_exception.raise_exception;
191 end check_conflicts;
192 
193 end FND_CONC_QUEUES_PKG;