DBA Data[Home] [Help]

PACKAGE BODY: APPS.AD_MANUAL_STEP_OBJECT

Source


1 package body ad_manual_step_object as
2 /* $Header: admsib.pls 120.4.12000000.2 2007/03/16 13:43:38 nshahi ship $ */
3 
4    --
5    -- Checks whether the manual step exists in history with the given
6    -- version and status.
7    --
8    function manual_step_hist_exists(p_step_key varchar2,
9                                     p_step_version varchar2,
10                                     p_status char)
11       return number is
12          hist_count number :=0;
13    begin
14       select count(0) into hist_count
15          from ad_manual_step_history
16          where step_key = p_step_key and
17          step_version = p_step_version and
18          status = p_status;
19 
20       if hist_count > 0 then
21          return 1;
22        else
23          return 0;
24       end if;
25    end manual_step_hist_exists;
26 
27    --
28    -- Function that checks whether the manual steps is already applied in
29    -- this instance.
30    --
31    function is_step_already_done(p_step_key varchar2,
32                                  p_step_version varchar2)
33       return number is
34    begin
35       return manual_step_hist_exists(p_step_key,
36                                      p_step_version,
37                                      'Y');
38    end is_step_already_done;
39 
40 
41    --
42    -- Procedure that adds manual steps in to ad_manual_step_history table
43    -- with the given parameters.
44    --
45    procedure add_manual_step_history(p_patch_number varchar2,
46                                      p_step_key varchar2,
47                                      p_step_version varchar2,
48                                      p_step_text varchar2,
49                                      p_cond_code varchar2,
50                                      p_username varchar2,
51                                      p_status char)
52       is
53          l_step_key varchar2(100);
54       begin
55          select step_key
56             into l_step_key
57             from ad_manual_step_history
58             where step_key = p_step_key and
59             step_version = p_step_version;
60 
61          update ad_manual_step_history
62             set status = p_status,
63             patch_number = p_patch_number
64             where step_key = p_step_key and
65             step_version = p_step_version;
66 
67       exception
68          when NO_DATA_FOUND then
69             insert into ad_manual_step_history
70                (history_id, step_key, step_version,step_text, cond_code,
71                 patch_number, status, updated_by)
72                values
73                (ad_manual_step_history_s.nextval, p_step_key, p_step_version,
74                 p_step_text, p_cond_code, p_patch_number,
75                 p_status, p_username);
76       end;
77 
78       --
79       -- Procedure that updates given manual steps as completed.
80       --
81       procedure update_step_as_completed(p_patch_number varchar2) is
82       begin
83          update ad_manual_step_history
84             set status = 'Y'
85             where
86             status='D' and patch_number=p_patch_number;
87       end;
88 
89       --
90       -- Function that checks whether the customer instance is on a
91       -- codelevel passed.
92       -- returns : 1, if the customer is not in that codelevel.
93       --           0, if the customer is on or above the given codelevel
94       --
95       function is_on_codelevel (p_entity varchar2,
96                                 p_level varchar2)
97          return number
98          is
99             l_level ad_trackable_entities.codelevel%type;
100             l_baseline ad_trackable_entities.baseline%type;
101             l_status varchar2(10);
102       begin
103 
104          ad_trackable_entities_pkg.get_code_level(p_entity,
105                                                   l_level,
106                                                   l_baseline,
107                                                   l_status);
108          if (l_status = 'TRUE' and
109              ad_patch_analysis_engine.compareLevel(p_level, l_level)=1) then
110             return 1;
111          end if;
112 
113          return 0;
114 
115       end;
116 
117       --
118       -- Function that checks whether the customer instance is on a
119       -- baseline.
120       -- returns : 0, if the customer is not in that baseline
121       --           1, if the customer is on or above the given baseline.
122       --
123       function is_on_baseline (p_entity varchar2,
124                                p_baseline varchar2)
125          return number
126          is
127             l_level ad_trackable_entities.codelevel%type;
128             l_baseline ad_trackable_entities.baseline%type;
129             l_status varchar2(10);
130       begin
131 
132          ad_trackable_entities_pkg.get_code_level(p_entity,
133                                                   l_level,
134                                                   l_baseline,
135                                                   l_status);
136          if (l_status = 'TRUE' and
137              ad_patch_analysis_engine.compareLevel(p_baseline,
138                                                    l_baseline)=1) then
139             return 0;
140          end if;
141 
142          return 1;
143 
144       end;
145 
146 end ad_manual_step_object;