DBA Data[Home] [Help]

PACKAGE BODY: APPS.BIS_CUSTOMIZATIONS_PVT

Source


1 PACKAGE BODY BIS_CUSTOMIZATIONS_PVT AS
2 /* $Header: BISVCUSB.pls 120.1.12000000.2 2007/01/30 08:30:07 ankgoel ship $ */
3 --
4 /*
5 REM +=======================================================================+
6 REM |    Copyright (c) 1998 Oracle Corporation, Redwood Shores, CA, USA     |
7 REM |                         All rights reserved.                          |
8 REM +=======================================================================+
9 REM | FILENAME                                                              |
10 REM |     BISVCUSB.pls                                                      |
11 REM |                                                                       |
12 REM | DESCRIPTION                                                           |
13 REM |     Private API for seeding ak Customization Data at function level   |
14 REM |                                                                       |
15 REM | NOTES                                                                 |
16 REM |                                                                       |
17 REM | HISTORY                                                               |
18 REM | 16-Dec-02 nkishore Creation                                           |
19 REM | 09-Apr-03 rcmuthuk Added deleteCustomView Enh:2897956                 |
20 REM | 05-Aug-03 rcmuthuk Added exception block for deleting rows            |
21 REM | 09-Aug-06 ankgoel  Bug#5412517 Del all customizations for a ak region |
22 REM | 12-Oct-06 ankgoel  Bug#5559016 Modified delete_region_customizations  |
23 REM |                    to delete from 2 BIS AK customization tables       |
24 REM +=======================================================================+
25 */
26 --
27 
28 -- creates rows in ak_customizations/tl
29 --
30 PROCEDURE Create_Customizations
31 ( p_api_version      IN  NUMBER
32 , p_commit           IN  VARCHAR2   := 'N'
33 , p_Customizations_Rec      IN  BIS_CUSTOMIZATIONS_PVT.customizations_type
34 , x_return_status    OUT NOCOPY VARCHAR2
35 )
36 
37 IS
38 l_language  VARCHAR2(4);
39 cursor c_languages IS
40 SELECT language_code
41 FROM   fnd_languages
42 WHERE  installed_flag in ('I','B');
43 
44 BEGIN
45   insert into ak_customizations
46 	   ( CUSTOMIZATION_APPLICATION_ID,CUSTOMIZATION_CODE
47 	   , REGION_APPLICATION_ID, REGION_CODE
48 	   , VERTICALIZATION_ID, LOCALIZATION_CODE
49 	   , ORG_ID,SITE_ID,RESPONSIBILITY_ID
50 	   , WEB_USER_ID, DEFAULT_CUSTOMIZATION_FLAG
51 	   , CUSTOMIZATION_LEVEL_ID,CREATED_BY,CREATION_DATE, LAST_UPDATED_BY, LAST_UPDATE_DATE,LAST_UPDATE_LOGIN
52 	   , START_DATE_ACTIVE,END_DATE_ACTIVE,REFERENCE_PATH
53 	   , FUNCTION_NAME,DEVELOPER_MODE)
54 
55   values( p_Customizations_Rec.CUSTOMIZATION_APPLICATION_ID ,p_Customizations_Rec.CUSTOMIZATION_CODE
56         , p_Customizations_Rec.REGION_APPLICATION_ID,p_Customizations_Rec.REGION_CODE
57 	, p_Customizations_Rec.VERTICALIZATION_ID,p_Customizations_Rec.LOCALIZATION_CODE
58 	, p_Customizations_Rec.ORG_ID,p_Customizations_Rec.SITE_ID,p_Customizations_Rec.RESPONSIBILITY_ID
59 	, p_Customizations_Rec.WEB_USER_ID,p_Customizations_Rec.DEFAULT_CUSTOMIZATION_FLAG
60 	, p_Customizations_Rec.CUSTOMIZATION_LEVEL_ID,0,sysdate,0,sysdate,-1
61 	, p_Customizations_Rec.START_DATE_ACTIVE,p_Customizations_Rec.END_DATE_ACTIVE,p_Customizations_Rec.REFERENCE_PATH
62 	, p_Customizations_Rec.FUNCTION_NAME,p_Customizations_Rec.DEVELOPER_MODE);
63 
64   if c_languages%ISOPEN then
65      close c_languages;
66   end if;
67 
68   open c_languages;
69   loop
70     fetch c_languages into l_language;
71     exit when c_languages%NOTFOUND;
72 
73     insert into ak_customizations_tl
74        (CUSTOMIZATION_APPLICATION_ID,CUSTOMIZATION_CODE
75 	,REGION_APPLICATION_ID,REGION_CODE,NAME
76         ,DESCRIPTION,LANGUAGE,SOURCE_LANG,CREATED_BY,CREATION_DATE
77 	,LAST_UPDATED_BY,LAST_UPDATE_DATE,LAST_UPDATE_LOGIN
78         )
79     values(p_Customizations_Rec.CUSTOMIZATION_APPLICATION_ID,p_Customizations_Rec.CUSTOMIZATION_CODE
80 	  ,p_Customizations_Rec.REGION_APPLICATION_ID,p_Customizations_Rec.REGION_CODE,p_Customizations_Rec.NAME
81 	  ,p_Customizations_Rec.DESCRIPTION,l_language,l_language,0,sysdate,0,sysdate,-1);
82 
83   end loop;
84 
85   if c_languages%ISOPEN then
86      close c_languages;
87   end if;
88 
89   if (p_commit = 'Y') then
90     COMMIT;
91   end if;
92   x_return_status := FND_API.G_RET_STS_SUCCESS;
93 
94 EXCEPTION
95    when FND_API.G_EXC_ERROR then
96       x_return_status := FND_API.G_RET_STS_ERROR ;
97    when FND_API.G_EXC_UNEXPECTED_ERROR then
98       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
99    when others then
100       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
101 
102 END Create_Customizations;
103 --
104 --
105 
106 PROCEDURE Update_Customizations
107 ( p_api_version      IN  NUMBER
108 , p_commit           IN  VARCHAR2   := 'N'
109 , p_Customizations_Rec      IN  BIS_CUSTOMIZATIONS_PVT.customizations_type
110 , x_return_status    OUT NOCOPY VARCHAR2
111 )
112 
113 IS
114 l_custom_appl_id VARCHAR2(150);
115 l_custom_code    VARCHAR2(150);
116 l_reg_appl_id    VARCHAR2(150);
117 cursor getCustomizationProperty IS
118 SELECT customization_application_id, customization_code, region_application_id
119 FROM   ak_customizations
120 WHERE  region_code = p_Customizations_Rec.region_code
121 AND    function_name = p_Customizations_Rec.function_name;
122 BEGIN
123   --BugFix 3500031
124   IF getCustomizationProperty%ISOPEN THEN
125     CLOSE getCustomizationProperty;
126   END IF;
127   OPEN getCustomizationProperty;
128   FETCH getCustomizationProperty into l_custom_appl_id, l_custom_code, l_reg_appl_id;
129   IF getCustomizationProperty%ISOPEN THEN
130     CLOSE getCustomizationProperty;
131   END IF;
132 
133   BEGIN
134     deleteCustomView
135     (  p_regionCode 	    => p_Customizations_Rec.region_code
136      , p_customizationCode  => l_custom_code
137      , p_regionAppId 	    => l_reg_appl_id
138      , p_customizationAppId => l_custom_appl_id
139      , x_return_status      => x_return_status
140     );
141   EXCEPTION
142    when no_data_found then
143 	null;
144   END;
145    Create_Customizations(p_api_version, p_commit,p_Customizations_Rec,x_return_status);
146 
147    x_return_status := FND_API.G_RET_STS_SUCCESS;
148 
149 EXCEPTION
150    when FND_API.G_EXC_ERROR then
151       x_return_status := FND_API.G_RET_STS_ERROR ;
152    when FND_API.G_EXC_UNEXPECTED_ERROR then
153       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
154    when others then
155       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
156 
157 END Update_Customizations;
158 
159 PROCEDURE Create_Custom_Regions
160 ( p_api_version      IN  NUMBER
161 , p_commit           IN  VARCHAR2   := 'N'
162 , p_Custom_Regions_Rec      IN  BIS_CUSTOMIZATIONS_PVT.custom_regions_type
163 , x_return_status    OUT NOCOPY VARCHAR2
164 )
165 
166 IS
167 l_rowid     VARCHAR2(100);
168 BEGIN
169 
170   ak_custom_regions_pkg.insert_row(
171      X_ROWID => l_rowid
172    , X_CUSTOMIZATION_APPLICATION_ID => p_Custom_Regions_Rec.CUSTOMIZATION_APPLICATION_ID
173    , X_CUSTOMIZATION_CODE => p_Custom_Regions_Rec.CUSTOMIZATION_CODE
174    , X_REGION_APPLICATION_ID => p_Custom_Regions_Rec.REGION_APPLICATION_ID
175    , X_REGION_CODE => p_Custom_Regions_Rec.REGION_CODE
176    , X_PROPERTY_NAME => p_Custom_Regions_Rec.PROPERTY_NAME
177    , X_PROPERTY_VARCHAR2_VALUE => p_Custom_Regions_Rec.PROPERTY_VARCHAR2_VALUE
178    , X_PROPERTY_NUMBER_VALUE => p_Custom_Regions_Rec.PROPERTY_NUMBER_VALUE
179    , X_CRITERIA_JOIN_CONDITION => p_Custom_Regions_Rec.CRITERIA_JOIN_CONDITION
180    , X_CREATED_BY => 0
181    , X_CREATION_DATE => sysdate
182    , X_LAST_UPDATED_BY => 0
183    , X_LAST_UPDATE_DATE => sysdate
184    , X_LAST_UPDATE_LOGIN => -1
185   );
186   if (p_commit = 'Y') then
187     COMMIT;
188   end if;
189    x_return_status := FND_API.G_RET_STS_SUCCESS;
190 EXCEPTION
191    when FND_API.G_EXC_ERROR then
192       x_return_status := FND_API.G_RET_STS_ERROR ;
193    when FND_API.G_EXC_UNEXPECTED_ERROR then
194       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
195    when others then
196       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
197 
198 END Create_Custom_Regions;
199 --
200 --
201 PROCEDURE Update_Custom_Regions
202 ( p_api_version      IN  NUMBER
203 , p_commit           IN  VARCHAR2   := 'N'
204 , p_Custom_Regions_Rec      IN  BIS_CUSTOMIZATIONS_PVT.custom_regions_type
205 , x_return_status    OUT NOCOPY VARCHAR2
206 )
207 
208 IS
209 BEGIN
210   --BugFix 3500031
211 /*
212   BEGIN
213   ak_custom_regions_pkg.delete_row(
214      X_CUSTOMIZATION_APPLICATION_ID => p_Custom_Regions_Rec.customization_application_id
215    , X_CUSTOMIZATION_CODE => p_Custom_Regions_Rec.customization_code
216    , X_REGION_APPLICATION_ID => p_Custom_Regions_Rec.region_application_id
217    , X_REGION_CODE => p_Custom_Regions_Rec.region_code
218    , X_PROPERTY_NAME => p_Custom_Regions_Rec.property_name
219    );
220   EXCEPTION
221    when no_data_found then
222 	null;
223   END;
224 */
225    Create_Custom_Regions(p_api_version, p_commit,p_Custom_Regions_Rec,x_return_status);
226 
227    x_return_status := FND_API.G_RET_STS_SUCCESS;
228 
229 EXCEPTION
230    when FND_API.G_EXC_ERROR then
231       x_return_status := FND_API.G_RET_STS_ERROR ;
232    when FND_API.G_EXC_UNEXPECTED_ERROR then
233       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
234    when others then
235       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
236 
237 
238 END Update_Custom_Regions;
239 
240 PROCEDURE Create_Custom_Region_Items
241 ( p_api_version      IN  NUMBER
242 , p_commit           IN  VARCHAR2   := 'N'
243 , p_Custom_Region_Items_Rec      IN  BIS_CUSTOMIZATIONS_PVT.custom_region_items_type
244 , x_return_status    OUT NOCOPY VARCHAR2
245 )
246 
247 IS
248 l_rowid  VARCHAR2(100);
249 BEGIN
250 
251   ak_custom_region_items_pkg.insert_row(
252     X_ROWID =>l_rowid
253    ,X_CUSTOMIZATION_APPLICATION_ID => p_Custom_Region_Items_Rec.CUSTOMIZATION_APPLICATION_ID
254    ,X_CUSTOMIZATION_CODE => p_Custom_Region_Items_Rec.CUSTOMIZATION_CODE
255    ,X_REGION_APPLICATION_ID => p_Custom_Region_Items_Rec.REGION_APPLICATION_ID
256    ,X_REGION_CODE =>p_Custom_Region_Items_Rec.REGION_CODE
257    ,X_ATTRIBUTE_APPLICATION_ID => p_Custom_Region_Items_Rec.ATTRIBUTE_APPLICATION_ID
258    ,X_ATTRIBUTE_CODE => p_Custom_Region_Items_Rec.ATTRIBUTE_CODE
259    ,X_PROPERTY_NAME => p_Custom_Region_Items_Rec.PROPERTY_NAME
260    ,X_PROPERTY_VARCHAR2_VALUE => p_Custom_Region_Items_Rec.PROPERTY_VARCHAR2_VALUE
261    ,X_PROPERTY_NUMBER_VALUE => p_Custom_Region_Items_Rec.PROPERTY_NUMBER_VALUE
262    ,X_PROPERTY_DATE_VALUE => p_Custom_Region_Items_Rec.PROPERTY_DATE_VALUE
263    ,X_CREATED_BY => 0
264    ,X_CREATION_DATE => SYSDATE
265    ,X_LAST_UPDATED_BY => 0
266    ,X_LAST_UPDATE_DATE => SYSDATE
267    ,X_LAST_UPDATE_LOGIN => -1
268    );
269   if (p_commit = 'Y') then
270     COMMIT;
271   end if;
272 
273   x_return_status := FND_API.G_RET_STS_SUCCESS;
274 
275 EXCEPTION
276    when FND_API.G_EXC_ERROR then
277       x_return_status := FND_API.G_RET_STS_ERROR ;
278    when FND_API.G_EXC_UNEXPECTED_ERROR then
279       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
280    when others then
281       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
282 
283 END Create_Custom_Region_Items;
284 --
285 --
286 PROCEDURE Update_Custom_Region_Items
287 ( p_api_version      IN  NUMBER
288 , p_commit           IN  VARCHAR2   := 'N'
289 , p_Custom_Region_Items_Rec      IN  BIS_CUSTOMIZATIONS_PVT.custom_Region_Items_type
290 , x_return_status    OUT NOCOPY VARCHAR2
291 )
292 
293 IS
294 BEGIN
295   --BugFix 3500031
296 /*
297    BEGIN
298    ak_custom_region_items_pkg.delete_row(
299      X_CUSTOMIZATION_APPLICATION_ID => p_Custom_Region_Items_Rec.customization_application_id
300     ,X_CUSTOMIZATION_CODE => p_Custom_Region_Items_Rec.customization_code
301     ,X_REGION_APPLICATION_ID => p_Custom_Region_Items_Rec.region_application_id
302     ,X_REGION_CODE => p_Custom_Region_Items_Rec.region_code
303     ,X_ATTRIBUTE_APPLICATION_ID => p_Custom_Region_Items_Rec.attribute_application_id
304     ,X_ATTRIBUTE_CODE => p_Custom_Region_Items_Rec.attribute_code
305     ,X_PROPERTY_NAME => p_Custom_Region_Items_Rec.property_name
306    );
307    EXCEPTION
308    when no_data_found then
309 	null;
310    END;
311 */
312    Create_Custom_Region_items(p_api_version, p_commit,p_Custom_Region_Items_Rec,x_return_status);
313 
314    x_return_status := FND_API.G_RET_STS_SUCCESS;
315 
316 EXCEPTION
317    when FND_API.G_EXC_ERROR then
318       x_return_status := FND_API.G_RET_STS_ERROR ;
319    when FND_API.G_EXC_UNEXPECTED_ERROR then
320       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
321    when others then
322       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
323 
324 
325 END Update_Custom_Region_items;
326 
327 
328 -- rcmuthuk deleteCustomView Enh:2897956
329 
330 PROCEDURE deleteCustomView
331 ( p_regionCode 	      IN VARCHAR2
332 , p_customizationCode   IN VARCHAR2
333 , p_regionAppId 	    	IN NUMBER
334 , p_customizationAppId 	IN NUMBER
335 , x_return_status       OUT NOCOPY VARCHAR2
336 )
337 IS
338 BEGIN
339 
340  IF (p_customizationCode is not null AND p_regionCode is not null) THEN
341       DELETE FROM ak_customizations WHERE region_code = p_regionCode AND region_application_id = p_regionAppId AND customization_code = p_customizationCode AND customization_application_id = p_customizationAppId;
342 	  DELETE FROM ak_customizations_tl WHERE region_code = p_regionCode AND region_application_id = p_regionAppId AND customization_code = p_customizationCode AND customization_application_id = p_customizationAppId;
343 	  DELETE FROM ak_custom_regions WHERE region_code = p_regionCode AND region_application_id = p_regionAppId AND customization_code = p_customizationCode AND customization_application_id = p_customizationAppId;
344 	  DELETE FROM ak_custom_regions_tl WHERE region_code = p_regionCode AND region_application_id = p_regionAppId AND customization_code = p_customizationCode AND customization_application_id = p_customizationAppId;
345 	  DELETE FROM ak_custom_region_items WHERE region_code = p_regionCode AND region_application_id = p_regionAppId AND customization_code = p_customizationCode AND customization_application_id = p_customizationAppId;
346   	  DELETE FROM ak_custom_region_items_tl WHERE region_code = p_regionCode AND region_application_id = p_regionAppId AND customization_code = p_customizationCode AND customization_application_id = p_customizationAppId;
347  END IF;
348 
349 x_return_status := FND_API.G_RET_STS_SUCCESS;
350 
351 EXCEPTION
352    when others then
353       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
354 
355 END deleteCustomView;
356 
357 -- Delete all customizations for a ak region
358 PROCEDURE delete_region_customizations
359 ( p_region_code            IN VARCHAR2
360 , p_region_application_id  IN NUMBER
361 , x_return_status          OUT NOCOPY VARCHAR2
362 , x_msg_count              OUT NOCOPY NUMBER
363 , x_msg_data               OUT NOCOPY VARCHAR2
364 )
365 IS
366 BEGIN
367 
368   DELETE FROM ak_custom_region_items_tl
369     WHERE region_code = p_region_code
370     AND   region_application_id = p_region_application_id;
371   DELETE FROM ak_custom_region_items
372     WHERE region_code = p_region_code
373     AND   region_application_id = p_region_application_id;
374   DELETE FROM ak_custom_regions_tl
375     WHERE region_code = p_region_code
376     AND   region_application_id = p_region_application_id;
377   DELETE FROM ak_custom_regions
378     WHERE region_code = p_region_code
379     AND   region_application_id = p_region_application_id;
380   DELETE FROM ak_customizations_tl
381     WHERE region_code = p_region_code
382     AND   region_application_id = p_region_application_id;
383   DELETE FROM ak_customizations
384     WHERE region_code = p_region_code
385     AND   region_application_id = p_region_application_id;
386   DELETE FROM bis_ak_custom_region_items
387     WHERE region_code = p_region_code
388     AND   region_application_id = p_region_application_id;
389   DELETE FROM bis_ak_custom_regions
390     WHERE region_code = p_region_code
391     AND   region_application_id = p_region_application_id;
392 
393 EXCEPTION
394   WHEN FND_API.G_EXC_ERROR THEN
395     x_return_status := FND_API.G_RET_STS_ERROR;
396     FND_MSG_PUB.Count_And_Get( p_encoded => 'F'
397                              , p_count   => x_msg_count
398                              , p_data    => x_msg_data);
399   WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
400     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
401     FND_MSG_PUB.Count_And_Get( p_encoded => 'F'
402                              , p_count   => x_msg_count
403                              , p_data    => x_msg_data);
404   WHEN NO_DATA_FOUND THEN
405     x_return_status := FND_API.G_RET_STS_ERROR;
406     FND_MSG_PUB.Count_And_Get( p_encoded => 'F'
407                              , p_count   => x_msg_count
408                              , p_data    => x_msg_data);
409   WHEN OTHERS THEN
410     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
411     FND_MSG_PUB.Count_And_Get( p_encoded => 'F'
412                              , p_count   => x_msg_count
413                              , p_data    => x_msg_data);
414     IF (x_msg_data IS NULL) THEN
415         x_msg_data := 'BIS_CUSTOMIZATIONS_PVT.delete_region_customizations: ' || SQLERRM;
416     END IF;
417 END delete_region_customizations;
418 
419 END BIS_CUSTOMIZATIONS_PVT;