DBA Data[Home] [Help]

PACKAGE BODY: APPS.EAM_SAFETY_REPORTS_PVT_W

Source


1 package body eam_safety_reports_pvt_w as
2   /* $Header: EAMWSRPB.pls 120.2 2011/06/01 10:15:58 vboddapa 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   rosetta_g_mistake_date_high date := to_date('01/01/+4710', 'MM/DD/SYYYY');
6   rosetta_g_mistake_date_low date := to_date('01/01/-4710', 'MM/DD/SYYYY');
7 
8   -- this is to workaround the JDBC bug regarding IN DATE of value GMiss
9   function rosetta_g_miss_date_in_map(d date) return date as
10   begin
11     if d > rosetta_g_mistake_date_high then return fnd_api.g_miss_date; end if;
12     if d < rosetta_g_mistake_date_low then return fnd_api.g_miss_date; end if;
13     return d;
14   end;
15 
16   function rosetta_g_miss_num_map(n number) return number as
17     a number := fnd_api.g_miss_num;
18     b number := 0-1962.0724;
19   begin
20     if n=a then return b; end if;
21     if n=b then return a; end if;
22     return n;
23   end;
24 
25   procedure rosetta_table_copy_in_p1(t out nocopy eam_safety_reports_pvt.eam_permit_tab_type, a0 JTF_NUMBER_TABLE
26     ) as
27     ddindx binary_integer; indx binary_integer;
28   begin
29   if a0 is not null and a0.count=0 then
30     t := eam_safety_reports_pvt.eam_permit_tab_type();
31   elsif a0 is not null and a0.count > 0 then
32       if a0.count > 0 then
33       t := eam_safety_reports_pvt.eam_permit_tab_type();
34       t.extend(a0.count);
35         indx := a0.first;
36         ddindx := 1;
37         while true loop
38           t(ddindx).permit_id := rosetta_g_miss_num_map(a0(indx));
39           ddindx := ddindx+1;
40           if a0.last =indx
41             then exit;
42           end if;
43           indx := a0.next(indx);
44         end loop;
45       end if;
46    end if;
47   end rosetta_table_copy_in_p1;
48   procedure rosetta_table_copy_out_p1(t eam_safety_reports_pvt.eam_permit_tab_type, a0 out nocopy JTF_NUMBER_TABLE
49     ) as
50     ddindx binary_integer; indx binary_integer;
51   begin
52   if t is null then
53     a0 := null;
54   elsif t.count = 0 then
55     a0 := JTF_NUMBER_TABLE();
56   else
57       a0 := JTF_NUMBER_TABLE();
58       if t.count > 0 then
59         a0.extend(t.count);
60         ddindx := t.first;
61         indx := 1;
62         while true loop
63           a0(indx) := rosetta_g_miss_num_map(t(ddindx).permit_id);
64           indx := indx+1;
65           if t.last =ddindx
66             then exit;
67           end if;
68           ddindx := t.next(ddindx);
69         end loop;
70       end if;
71    end if;
72   end rosetta_table_copy_out_p1;
73 
74   function getworkpermitreportxml(p0_a0 JTF_NUMBER_TABLE
75     , p_work_clearance_flag  NUMBER
76     , p_work_order_flag  NUMBER
77     , p_text_attachment_flag  NUMBER
78     , p_url_attachment_flag  NUMBER
79     , p_file_attachment_flag  NUMBER
80   ) return clob
81 
82   as
83     ddp_permit_ids eam_safety_reports_pvt.eam_permit_tab_type;
84     ddindx binary_integer; indx binary_integer;
85     ddrosetta_retval clob;
86   begin
87 
88     -- copy data to the local IN or IN-OUT args, if any
89     eam_safety_reports_pvt_w.rosetta_table_copy_in_p1(ddp_permit_ids, p0_a0
90       );
91 
92 
93 
94 
95 
96 
97     -- here's the delegated call to the old PL/SQL routine
98     ddrosetta_retval := eam_safety_reports_pvt.getworkpermitreportxml(ddp_permit_ids,
99       p_work_clearance_flag,
100       p_work_order_flag,
101       p_text_attachment_flag,
102       p_url_attachment_flag,
103       p_file_attachment_flag);
104 
105     -- copy data back from the local variables to OUT or IN-OUT args, if any
106 
107 
108 
109 
110 
111 
112     return ddrosetta_retval;
113   end;
114 
115   function convert_to_client_time(p_server_time  date
116   ) return date
117 
118   as
119     ddp_server_time date;
120     ddindx binary_integer; indx binary_integer;
121     ddrosetta_retval date;
122   begin
123 
124     -- copy data to the local IN or IN-OUT args, if any
125     ddp_server_time := rosetta_g_miss_date_in_map(p_server_time);
126 
127     -- here's the delegated call to the old PL/SQL routine
128     ddrosetta_retval := eam_safety_reports_pvt.convert_to_client_time(ddp_server_time);
129 
130     -- copy data back from the local variables to OUT or IN-OUT args, if any
131 
132     return ddrosetta_retval;
133   end;
134 
135 end eam_safety_reports_pvt_w;