DBA Data[Home] [Help]

PACKAGE BODY: APPS.QP_UTIL_W

Source


1 package body qp_util_w as
2   /* $Header: amswqpub.pls 115.1 2002/07/31 20:32:44 julou noship $ */
3   rosetta_g_mistake_date date := to_date('01/01/+4713', 'MM/DD/SYYYY');
4   rosetta_g_miss_date date := to_date('01/01/-4712', 'MM/DD/SYYYY');
5 
6   function rosetta_g_miss_num_map(n number) return number as
7     a number := fnd_api.g_miss_num;
8     b number := 0-1962.0724;
9   begin
10     if n=a then return b; end if;
11     if n=b then return a; end if;
12     return n;
13   end;
14 
15   -- this is to workaround the JDBC bug regarding IN DATE of value GMiss
16   function rosetta_g_miss_date_in_map(d date) return date as
17   begin
18     if d = rosetta_g_mistake_date then return fnd_api.g_miss_date; end if;
19     return d;
20   end;
21 
22   procedure rosetta_table_copy_in_p1(t out qp_util.v_segs_upg_tab, a0 JTF_VARCHAR2_TABLE_100
23     , a1 JTF_VARCHAR2_TABLE_100
24     , a2 JTF_NUMBER_TABLE
25     , a3 JTF_VARCHAR2_TABLE_100
26     ) as
27     ddindx binary_integer; indx binary_integer;
28   begin
29   if a0 is not null and a0.count > 0 then
30       if a0.count > 0 then
31         indx := a0.first;
32         ddindx := 1;
33         while true loop
34           t(ddindx).context_code := a0(indx);
35           t(ddindx).segment_name := a1(indx);
36           t(ddindx).sequence := rosetta_g_miss_num_map(a2(indx));
37           t(ddindx).datatype := a3(indx);
38           ddindx := ddindx+1;
39           if a0.last =indx
40             then exit;
41           end if;
42           indx := a0.next(indx);
43         end loop;
44       end if;
45    end if;
46   end rosetta_table_copy_in_p1;
47   procedure rosetta_table_copy_out_p1(t qp_util.v_segs_upg_tab, a0 out JTF_VARCHAR2_TABLE_100
48     , a1 out JTF_VARCHAR2_TABLE_100
49     , a2 out JTF_NUMBER_TABLE
50     , a3 out JTF_VARCHAR2_TABLE_100
51     ) as
52     ddindx binary_integer; indx binary_integer;
53   begin
54   if t is null or t.count = 0 then
55     a0 := JTF_VARCHAR2_TABLE_100();
56     a1 := JTF_VARCHAR2_TABLE_100();
57     a2 := JTF_NUMBER_TABLE();
58     a3 := JTF_VARCHAR2_TABLE_100();
59   else
60       a0 := JTF_VARCHAR2_TABLE_100();
61       a1 := JTF_VARCHAR2_TABLE_100();
62       a2 := JTF_NUMBER_TABLE();
63       a3 := JTF_VARCHAR2_TABLE_100();
64       if t.count > 0 then
65         a0.extend(t.count);
66         a1.extend(t.count);
67         a2.extend(t.count);
68         a3.extend(t.count);
69         ddindx := t.first;
70         indx := 1;
71         while true loop
72           a0(indx) := t(ddindx).context_code;
73           a1(indx) := t(ddindx).segment_name;
74           a2(indx) := rosetta_g_miss_num_map(t(ddindx).sequence);
75           a3(indx) := t(ddindx).datatype;
76           indx := indx+1;
77           if t.last =ddindx
78             then exit;
79           end if;
80           ddindx := t.next(ddindx);
81         end loop;
82       end if;
83    end if;
84   end rosetta_table_copy_out_p1;
85 
86   procedure rosetta_table_copy_in_p41(t out qp_util.create_context_out_tbl, a0 JTF_VARCHAR2_TABLE_100
87     , a1 JTF_VARCHAR2_TABLE_300
88     ) as
89     ddindx binary_integer; indx binary_integer;
90   begin
91   if a0 is not null and a0.count > 0 then
92       if a0.count > 0 then
93         indx := a0.first;
94         ddindx := 1;
95         while true loop
96           t(ddindx).context_code := a0(indx);
97           t(ddindx).context_name := a1(indx);
98           ddindx := ddindx+1;
99           if a0.last =indx
100             then exit;
101           end if;
102           indx := a0.next(indx);
103         end loop;
104       end if;
105    end if;
106   end rosetta_table_copy_in_p41;
107   procedure rosetta_table_copy_out_p41(t qp_util.create_context_out_tbl, a0 out JTF_VARCHAR2_TABLE_100
108     , a1 out JTF_VARCHAR2_TABLE_300
109     ) as
110     ddindx binary_integer; indx binary_integer;
111   begin
112   if t is null or t.count = 0 then
113     a0 := JTF_VARCHAR2_TABLE_100();
114     a1 := JTF_VARCHAR2_TABLE_300();
115   else
116       a0 := JTF_VARCHAR2_TABLE_100();
117       a1 := JTF_VARCHAR2_TABLE_300();
118       if t.count > 0 then
119         a0.extend(t.count);
120         a1.extend(t.count);
121         ddindx := t.first;
122         indx := 1;
123         while true loop
124           a0(indx) := t(ddindx).context_code;
125           a1(indx) := t(ddindx).context_name;
126           indx := indx+1;
127           if t.last =ddindx
128             then exit;
129           end if;
130           ddindx := t.next(ddindx);
131         end loop;
132       end if;
133    end if;
134   end rosetta_table_copy_out_p41;
135 
136   procedure rosetta_table_copy_in_p43(t out qp_util.create_attribute_out_tbl, a0 JTF_VARCHAR2_TABLE_100
137     , a1 JTF_VARCHAR2_TABLE_300
138     , a2 JTF_VARCHAR2_TABLE_100
139     , a3 JTF_NUMBER_TABLE
140     , a4 JTF_NUMBER_TABLE
141     ) as
142     ddindx binary_integer; indx binary_integer;
143   begin
144   if a0 is not null and a0.count > 0 then
145       if a0.count > 0 then
146         indx := a0.first;
147         ddindx := 1;
148         while true loop
149           t(ddindx).segment_mapping_column := a0(indx);
150           t(ddindx).segment_name := a1(indx);
151           t(ddindx).segment_code := a2(indx);
152           t(ddindx).precedence := rosetta_g_miss_num_map(a3(indx));
153           t(ddindx).valueset_id := rosetta_g_miss_num_map(a4(indx));
154           ddindx := ddindx+1;
155           if a0.last =indx
156             then exit;
157           end if;
158           indx := a0.next(indx);
159         end loop;
160       end if;
161    end if;
162   end rosetta_table_copy_in_p43;
163   procedure rosetta_table_copy_out_p43(t qp_util.create_attribute_out_tbl, a0 out JTF_VARCHAR2_TABLE_100
164     , a1 out JTF_VARCHAR2_TABLE_300
165     , a2 out JTF_VARCHAR2_TABLE_100
166     , a3 out JTF_NUMBER_TABLE
167     , a4 out JTF_NUMBER_TABLE
168     ) as
169     ddindx binary_integer; indx binary_integer;
170   begin
171   if t is null or t.count = 0 then
172     a0 := JTF_VARCHAR2_TABLE_100();
173     a1 := JTF_VARCHAR2_TABLE_300();
174     a2 := JTF_VARCHAR2_TABLE_100();
175     a3 := JTF_NUMBER_TABLE();
176     a4 := JTF_NUMBER_TABLE();
177   else
178       a0 := JTF_VARCHAR2_TABLE_100();
179       a1 := JTF_VARCHAR2_TABLE_300();
180       a2 := JTF_VARCHAR2_TABLE_100();
181       a3 := JTF_NUMBER_TABLE();
182       a4 := JTF_NUMBER_TABLE();
183       if t.count > 0 then
184         a0.extend(t.count);
185         a1.extend(t.count);
186         a2.extend(t.count);
187         a3.extend(t.count);
188         a4.extend(t.count);
189         ddindx := t.first;
190         indx := 1;
191         while true loop
192           a0(indx) := t(ddindx).segment_mapping_column;
193           a1(indx) := t(ddindx).segment_name;
194           a2(indx) := t(ddindx).segment_code;
195           a3(indx) := rosetta_g_miss_num_map(t(ddindx).precedence);
196           a4(indx) := rosetta_g_miss_num_map(t(ddindx).valueset_id);
197           indx := indx+1;
198           if t.last =ddindx
199             then exit;
200           end if;
201           ddindx := t.next(ddindx);
202         end loop;
203       end if;
204    end if;
205   end rosetta_table_copy_out_p43;
206 
207   procedure validate_qp_flexfield(flexfield_name  VARCHAR2
208     , context  VARCHAR2
209     , attribute  VARCHAR2
210     , value  VARCHAR2
211     , application_short_name  VARCHAR2
212     , context_flag out  VARCHAR2
213     , attribute_flag out  VARCHAR2
214     , value_flag out  VARCHAR2
215     , datatype out  VARCHAR2
216     , precedence out  VARCHAR2
217     , error_code out  NUMBER
218     , check_enabled  number
219   )
220   as
221     ddcheck_enabled boolean;
222     ddindx binary_integer; indx binary_integer;
223   begin
224 
225     -- copy data to the local IN or IN-OUT args, if any
226 
227 
228 
229 
230 
231 
232 
233 
234 
235 
236 
237     if check_enabled is null
238       then ddcheck_enabled := null;
239     elsif check_enabled = 0
240       then ddcheck_enabled := false;
241     else ddcheck_enabled := true;
242     end if;
243 
244     -- here's the delegated call to the old PL/SQL routine
245     qp_util.validate_qp_flexfield(flexfield_name,
246       context,
247       attribute,
248       value,
249       application_short_name,
250       context_flag,
251       attribute_flag,
252       value_flag,
253       datatype,
254       precedence,
255       error_code,
256       ddcheck_enabled);
257 
258     -- copy data back from the local OUT or IN-OUT args, if any
259 
260 
261 
262 
263 
264 
265 
266 
267 
268 
269 
270   end;
271 
272   procedure get_segs_for_flex(flexfield_name  VARCHAR2
273     , application_short_name  VARCHAR2
274     , p2_a0 out JTF_VARCHAR2_TABLE_100
275     , p2_a1 out JTF_VARCHAR2_TABLE_100
276     , p2_a2 out JTF_NUMBER_TABLE
277     , p2_a3 out JTF_VARCHAR2_TABLE_100
278     , error_code out  NUMBER
279   )
280   as
281     ddx_segs_upg_t qp_util.v_segs_upg_tab;
282     ddindx binary_integer; indx binary_integer;
283   begin
284 
285     -- copy data to the local IN or IN-OUT args, if any
286 
287 
288 
289 
290     -- here's the delegated call to the old PL/SQL routine
291     qp_util.get_segs_for_flex(flexfield_name,
292       application_short_name,
293       ddx_segs_upg_t,
294       error_code);
295 
296     -- copy data back from the local OUT or IN-OUT args, if any
297 
298 
299     qp_util_w.rosetta_table_copy_out_p1(ddx_segs_upg_t, p2_a0
300       , p2_a1
301       , p2_a2
302       , p2_a3
303       );
304 
305   end;
306 
307   procedure get_segs_flex_precedence(p0_a0 JTF_VARCHAR2_TABLE_100
308     , p0_a1 JTF_VARCHAR2_TABLE_100
309     , p0_a2 JTF_NUMBER_TABLE
310     , p0_a3 JTF_VARCHAR2_TABLE_100
311     , p_context  VARCHAR2
312     , p_attribute  VARCHAR2
313     , x_precedence out  NUMBER
314     , x_datatype out  VARCHAR2
315   )
316   as
317     ddp_segs_upg_t qp_util.v_segs_upg_tab;
318     ddindx binary_integer; indx binary_integer;
319   begin
320 
321     -- copy data to the local IN or IN-OUT args, if any
322     qp_util_w.rosetta_table_copy_in_p1(ddp_segs_upg_t, p0_a0
323       , p0_a1
324       , p0_a2
325       , p0_a3
326       );
327 
328 
329 
330 
331 
332     -- here's the delegated call to the old PL/SQL routine
333     qp_util.get_segs_flex_precedence(ddp_segs_upg_t,
334       p_context,
335       p_attribute,
336       x_precedence,
337       x_datatype);
338 
339     -- copy data back from the local OUT or IN-OUT args, if any
340 
341 
342 
343 
344   end;
345 
346   procedure correct_active_dates(p_active_date_first_type in out  VARCHAR2
347     , p_start_date_active_first in out  date
348     , p_end_date_active_first in out  date
349     , p_active_date_second_type in out  VARCHAR2
350     , p_start_date_active_second in out  date
351     , p_end_date_active_second in out  date
352   )
353   as
354     ddp_start_date_active_first date;
355     ddp_end_date_active_first date;
356     ddp_start_date_active_second date;
357     ddp_end_date_active_second date;
358     ddindx binary_integer; indx binary_integer;
359   begin
360 
361     -- copy data to the local IN or IN-OUT args, if any
362 
363     ddp_start_date_active_first := rosetta_g_miss_date_in_map(p_start_date_active_first);
364 
365     ddp_end_date_active_first := rosetta_g_miss_date_in_map(p_end_date_active_first);
366 
367 
368     ddp_start_date_active_second := rosetta_g_miss_date_in_map(p_start_date_active_second);
369 
370     ddp_end_date_active_second := rosetta_g_miss_date_in_map(p_end_date_active_second);
371 
372     -- here's the delegated call to the old PL/SQL routine
373     qp_util.correct_active_dates(p_active_date_first_type,
374       ddp_start_date_active_first,
375       ddp_end_date_active_first,
376       p_active_date_second_type,
377       ddp_start_date_active_second,
378       ddp_end_date_active_second);
379 
380     -- copy data back from the local OUT or IN-OUT args, if any
381 
382     p_start_date_active_first := ddp_start_date_active_first;
383 
384     p_end_date_active_first := ddp_end_date_active_first;
385 
386 
387     p_start_date_active_second := ddp_start_date_active_second;
388 
389     p_end_date_active_second := ddp_end_date_active_second;
390   end;
391 
392   procedure web_create_context_lov(p_field_context  VARCHAR2
393     , p_context_type  VARCHAR2
394     , p_check_enabled  VARCHAR2
395     , p_limits  VARCHAR2
396     , p_list_line_type_code  VARCHAR2
397     , x_return_status out  VARCHAR2
398     , p6_a0 out JTF_VARCHAR2_TABLE_100
399     , p6_a1 out JTF_VARCHAR2_TABLE_300
400   )
401   as
402     ddx_context_out_tbl qp_util.create_context_out_tbl;
403     ddindx binary_integer; indx binary_integer;
404   begin
405 
406     -- copy data to the local IN or IN-OUT args, if any
407 
408 
409 
410 
411 
412 
413 
414     -- here's the delegated call to the old PL/SQL routine
415     qp_util.web_create_context_lov(p_field_context,
416       p_context_type,
417       p_check_enabled,
418       p_limits,
419       p_list_line_type_code,
420       x_return_status,
421       ddx_context_out_tbl);
422 
423     -- copy data back from the local OUT or IN-OUT args, if any
424 
425 
426 
427 
428 
429 
430     qp_util_w.rosetta_table_copy_out_p41(ddx_context_out_tbl, p6_a0
431       , p6_a1
432       );
433   end;
434 
435   procedure web_create_attribute_lov(p_context_code  VARCHAR2
436     , p_context_type  VARCHAR2
437     , p_check_enabled  VARCHAR2
438     , p_limits  VARCHAR2
439     , p_list_line_type_code  VARCHAR2
440     , p_segment_level  NUMBER
441     , p_field_context  VARCHAR2
442     , x_return_status out  VARCHAR2
443     , p8_a0 out JTF_VARCHAR2_TABLE_100
444     , p8_a1 out JTF_VARCHAR2_TABLE_300
445     , p8_a2 out JTF_VARCHAR2_TABLE_100
446     , p8_a3 out JTF_NUMBER_TABLE
447     , p8_a4 out JTF_NUMBER_TABLE
448   )
449   as
450     ddx_attribute_out_tbl qp_util.create_attribute_out_tbl;
451     ddindx binary_integer; indx binary_integer;
452   begin
453 
454     -- copy data to the local IN or IN-OUT args, if any
455 
456 
457 
458 
459 
460 
461 
462 
463 
464     -- here's the delegated call to the old PL/SQL routine
465     qp_util.web_create_attribute_lov(p_context_code,
466       p_context_type,
467       p_check_enabled,
468       p_limits,
469       p_list_line_type_code,
470       p_segment_level,
471       p_field_context,
472       x_return_status,
473       ddx_attribute_out_tbl);
474 
475     -- copy data back from the local OUT or IN-OUT args, if any
476 
477 
478 
479 
480 
481 
482 
483 
484     qp_util_w.rosetta_table_copy_out_p43(ddx_attribute_out_tbl, p8_a0
485       , p8_a1
486       , p8_a2
487       , p8_a3
488       , p8_a4
489       );
490   end;
491 
492 end qp_util_w;