DBA Data[Home] [Help]

PACKAGE BODY: APPS.FND_CONC_WEB_UTIL

Source


1 PACKAGE BODY FND_CONC_WEB_UTIL AS
2 /* $Header: AFCPINRB.pls 120.8 2006/01/11 22:23:42 ddhulla noship $ */
3 
4   --Package global variables to hold the request_id
5   --and Tool Tip text
6   TOOL_TIP_TEXT  VARCHAR2(2000) := '';
7   REQUEST_ID     NUMBER  := -1;
8 
9   -- Name
10   --   GET_REQUEST_STATUS_IMAGE
11   -- Purpose
12   --   This function returns the iconic image name for a request
13   --   based on the phase code and status code of the request.
14   -- Arguments (input)
15   --   request_id - Request id for which the iconic image name has to be returned.
16   -- Return Value
17   --   Image name which represent the phase and status of the request.
18 
19   FUNCTION GET_REQUEST_STATUS_IMAGE(P_REQUEST_ID NUMBER) RETURN VARCHAR2 AS
20 
21        l_request_id          number;
22        l_phase               varchar2(400);
23        l_status              varchar2(400);
24        l_dev_status          varchar2(400);
25        l_dev_phase           varchar2(400);
26        l_message             varchar2(4000);
27 
28        l_image_name      varchar2(4000);
29        l_result         boolean;
30 
31        v_running_processes	number;
32 
33   BEGIN
34 
35     --Storing the requestid in the package global variable.
36     --It will be accessed from GET_REQUEST_STATUS_IMG_TIP function.
37     REQUEST_ID := P_REQUEST_ID;
38 
39     l_image_name := '';
40     l_request_id := P_REQUEST_ID;
41 
42     -- To get the request's pahse and status
43     l_result := FND_CONCURRENT.GET_REQUEST_STATUS(
44                                 REQUEST_ID => l_request_id,
45                                 PHASE      => l_phase,
46                                 STATUS     => l_status,
47                                 DEV_PHASE  => l_dev_phase,
48                                 DEV_STATUS => l_dev_status,
49                                 MESSAGE    => l_message) ;
50 
51 
52      TOOL_TIP_TEXT := l_status;
53 
54      --bug4598673
55      --obtain manager status to detect manager-not-running condition
56      --if manager is not running, we have to force no_manager condition
57      --when the status is pending/normal
58      --bug4923725
59      --modified the query as there could be zero or more than 1 rows of managers
60      --as the request could be waiting in multiple managers queue
61 
62 
63      select nvl(sum(running_processes),0) into v_running_processes from fnd_concurrent_worker_requests where
64      (CONTROL_CODE not in ('D', 'T', 'E', 'X', 'R', 'N') OR CONTROL_CODE is NULL)
65      and request_id=P_REQUEST_ID;
66 
67      IF (l_dev_phase = 'PENDING') THEN
68 
69            IF ((l_dev_status = 'NORMAL') OR (l_dev_status = 'STANDBY') OR (l_dev_status = 'WAITING')) THEN
70              IF v_running_processes = 0 THEN
71                 l_image_name := 'erroricon_active.gif';
72              ELSE
73                 l_image_name := 'notstartedind_active.gif';
74              END IF;
75            ELSIF (l_dev_status = 'SCHEDULED')  THEN
76              l_image_name := 'scheduled_active.gif';
77            END IF;
78 
79      ELSIF (l_dev_phase = 'RUNNING') THEN
80 
81            IF ((l_dev_status = 'NORMAL') OR (l_dev_status = 'PAUSED') OR (l_dev_status = 'RESUMING')) THEN
82              l_image_name := 'inprogressind_active.gif';
83            ELSIF (l_dev_status = 'TERMINATING') THEN
84              l_image_name := 'cancelind_active.gif';
85            END IF;
86 
87      ELSIF (l_dev_phase = 'COMPLETE') THEN
88 
89            IF (l_dev_status = 'NORMAL') THEN
90              l_image_name := 'completeind_active.gif';
91            ELSIF (l_dev_status = 'ERROR') THEN
92              l_image_name := 'erroricon_active.gif';
93            ELSIF (l_dev_status = 'WARNING') THEN
94              l_image_name := 'warningicon_status.gif';
95            ELSIF ((l_dev_status = 'DELETED') OR (l_dev_status = 'TERMINATED')) THEN
96 	   --Here there are 2 deviation from Original Specification.
97 	   --Cancelled cahnged to DELETED and Terminating changed to TERMINATED
98 	   --Cancelled-  DELETED | Terminating - TERMINATED
99              l_image_name := 'cancelind_active.gif';
100            END IF;
101 
102      ELSIF (l_dev_phase = 'INACTIVE') THEN
103 
104            IF ((l_dev_status = 'DISABLED') OR (l_dev_status = 'NO_MANAGER')) THEN
105              l_image_name := 'erroricon_active.gif';
106            ELSIF (l_dev_status = 'ON_HOLD')  THEN
107              l_image_name := 'onholdind_active.gif';
108            END IF;
109 
110      END IF;
111 
112     RETURN l_image_name;
113   END;
114 
115 
116 
117   -- Name
118   --   GET_REQUEST_DETAILS_URL
119   -- Purpose
120   --   This function returns the URL  parameters for the
121   --   view request details page.
122   -- Arguments (input)
123   --   request_id - Request id for which URL  parameters has to be returned.
124   -- Return Value
125   --   URL  parameters required for viewing the request details.
126 
127   FUNCTION GET_REQUEST_DETAILS_URL(P_REQUEST_ID NUMBER) RETURN VARCHAR2 AS
128 
129 	l_url		varchar2(4000);
130 	l_request_id    number;
131 	l_phase         varchar2(400);
132 	l_status        varchar2(400);
133 	l_dev_status    varchar2(400);
134 	l_dev_phase     varchar2(400);
135 	l_message       varchar2(4000);
136 	l_result	boolean;
137 
138   BEGIN
139 
140     l_request_id := P_REQUEST_ID;
141 
142     if(nvl(l_request_id,0)=0) then
143 	return null;
144     end if;
145 
146     l_result := FND_CONCURRENT.GET_REQUEST_STATUS(
147                                 REQUEST_ID => l_request_id,
148                                 PHASE      => l_phase,
149                                 STATUS     => l_status,
150                                 DEV_PHASE  => l_dev_phase,
151                                 DEV_STATUS => l_dev_status,
152                                 MESSAGE    => l_message) ;
153 
154     IF (l_result = FALSE) THEN
155 	return null;
156     END IF;
157 
158     l_url := 'akRegionCode=FNDCPREQDETAILSTOPREGION'
159              || '&' || 'akRegionApplicationId=0'
160              || '&' || 'REQUESTID='|| TO_CHAR(P_REQUEST_ID)
161 	     || '&' || 'retainAM=Y'
162 	     || '&' || 'addBreadCrumb=Y';
163 
164 
165     RETURN l_url;
166 
167   END;
168 
169 
170 
171   -- Name
172   --   GET_REQUEST_STATUS_IMG_TIP
173   -- Purpose
174   --   This function returns the tool tip for the  request status image
175   --   based on the phase code and status code of the request.
176   -- Arguments (input)
177   --   request_id - Request id for which the iconic image name has to be returned.
178   -- Return Value
179   --   Tool tip text which represent the phase and status of the request.
180 
181   FUNCTION GET_REQUEST_STATUS_IMG_TIP(P_REQUEST_ID NUMBER) RETURN VARCHAR2 AS
182 
183       l_img_name varchar2(4000);
184 
185   BEGIN
186 
187       IF (REQUEST_ID <> P_REQUEST_ID) THEN
188         l_img_name := GET_REQUEST_STATUS_IMAGE(P_REQUEST_ID);
189       END IF;
190 
191       return TOOL_TIP_TEXT;
192 
193   END;
194 
195 
196 END FND_CONC_WEB_UTIL;