DBA Data[Home] [Help]

PACKAGE BODY: APPS.IBE_DSP_HIERARCHY_SETUP_PUB

Source


1 PACKAGE BODY IBE_DSP_HIERARCHY_SETUP_PUB AS
2 /* $Header: IBEPCHSB.pls 120.5 2006/01/11 15:54:45 abhandar ship $ */
3   --
4   --
5   -- Start of Comments
6   --
7   -- NAME
8   --   IBE_DSP_HIERARCHY_SETUP_PUB
9   --
10   -- PURPOSE
11   --   Private API for saving, retrieving and updating sections.
12   --
13   -- NOTES
14   --   This is a pulicly accessible pacakge.  It should be used by all
15   --   sources for saving, retrieving and updating personalized queries
16   -- within the personalization framework.
17   --
18 
19   -- HISTORY
20   --   09/05/00           VPALAIYA         Created
21   --   09/17/05           ABHANDAR         Modified
22   -- **************************************************************************
23 
24 G_PKG_NAME  CONSTANT VARCHAR2(30):='IBE_DSP_HIERAHCY_SETUP_PUB';
25 G_FILE_NAME CONSTANT VARCHAR2(12):='IBEPCHSB.pls';
26 
27 --
28 -- Start of comments
29 --  API name    : Create_Hierarchy_Section
30 --  Type        : Public
31 --  Pre-reqs    : None.
32 --  Function    : Creates a section in the catalog hierarchy
33 --  Parameters  :
34 --    IN        : p_api_version     IN NUMBER    Required
35 --    Version   : Current version    1.0
36 --                Previous version   1.0
37 --                Initial version    1.0
38 -- End of comments
39 --
40 --
41 -- Start of comments
42 --  API name    : Create_Hierarchy_Section
43 --  Type        : Public
44 --  Pre-reqs    : None.
45 --  Function    : Creates a section in the catalog hierarchy
46 --  Parameters  :
47 --    IN        : p_api_version     IN NUMBER    Required
48 --    Version   : Current version    1.0
49 --                Previous version   1.0
50 --                Initial version    1.0
51 -- End of comments
52 --
53 
54 PROCEDURE Create_Section(
55    p_api_version                   	IN NUMBER,
56    p_init_msg_list                 	IN VARCHAR2 := FND_API.G_FALSE,
57    p_commit                        	IN VARCHAR2 := FND_API.G_FALSE,
58    x_return_status 	                OUT NOCOPY VARCHAR2,
59    x_msg_count                     	OUT NOCOPY NUMBER,
60    x_msg_data                       OUT NOCOPY VARCHAR2,
61    p_hierachy_section_rec           IN  SECTION_REC_TYPE,
62    x_section_id                     OUT NOCOPY NUMBER)
63 IS
64   l_api_name          CONSTANT VARCHAR2(30):='Create_Hierarchy_Section';
65   l_api_version       CONSTANT NUMBER := 1.0;
66   l_debug             VARCHAR2(1);
67 
68 BEGIN
69   -- Standard Start of API savepoint
70   SAVEPOINT  CREATE_HIERARCHY_SECTION_PUB;
71 
72   -- Standard call to check for call compatibility.
73   IF NOT FND_API.Compatible_API_Call(l_api_version,
74                                      p_api_version,
75                                      l_api_name,
76                                      G_PKG_NAME)
77   THEN
78     RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
79   END IF;
80 
81   -- Initialize message list if p_init_msg_list is set to TRUE.
82   IF FND_API.to_Boolean(p_init_msg_list) THEN
83       FND_MSG_PUB.initialize;
84   END IF;
85   l_debug  := NVL(FND_PROFILE.VALUE('IBE_DEBUG'),'N');
86 
87    -- Initialize API return status to success
88   x_return_status := FND_API.G_RET_STS_SUCCESS;
89   IF (l_debug='Y') THEN
90      IBE_UTIL.debug('parameters: parent id=' ||p_hierachy_section_rec.parent_section_id||
91     ' start_date='||p_hierachy_section_rec.start_date_active ||
92     ' type_code='||p_hierachy_section_rec.section_type_code||
93     ' status_code=' ||p_hierachy_section_rec.status_code ||
94     ' display_name='||p_hierachy_section_rec.display_name);
95    END IF;
96 
97   IBE_DSP_HIERARCHY_SETUP_PVT.Create_Hierarchy_Section
98     (
99     p_api_version                    => p_api_version,
100     p_init_msg_list                  => p_init_msg_list,
101     p_commit                         => p_commit,
102     p_validation_level               => FND_API.G_VALID_LEVEL_FULL,
103     p_parent_section_id              => p_hierachy_section_rec.parent_section_id,
104     p_parent_section_access_name     => p_hierachy_section_rec.parent_section_access_name,
105     p_access_name                    => p_hierachy_section_rec.access_name,
106     p_start_date_active              => p_hierachy_section_rec.start_date_active,
107     p_end_date_active                => p_hierachy_section_rec.end_date_active,
108     p_section_type_code              => p_hierachy_section_rec.section_type_code,
109     p_status_code                    => p_hierachy_section_rec.status_code,
110    --- p_display_context_id             => p_hierachy_section_rec.display_context_id,
111    --- p_deliverable_id                 => p_hierachy_section_rec.deliverable_id,
112     p_display_name                   => p_hierachy_section_rec.display_name,
113     p_description                    => p_hierachy_section_rec.description,
114     p_long_description               => p_hierachy_section_rec.long_description,
115     p_keywords                       => p_hierachy_section_rec.keywords,
116     p_attribute_category             => p_hierachy_section_rec.attribute_category,
117     p_attribute1                     => p_hierachy_section_rec.attribute1,
118     p_attribute2                     => p_hierachy_section_rec.attribute2,
119     p_attribute3                     => p_hierachy_section_rec.attribute3,
120     p_attribute4                     => p_hierachy_section_rec.attribute4,
121     p_attribute5                     => p_hierachy_section_rec.attribute5,
122     p_attribute6                     => p_hierachy_section_rec.attribute6,
123     p_attribute7                     => p_hierachy_section_rec.attribute7,
124     p_attribute8                     => p_hierachy_section_rec.attribute8,
125     p_attribute9                     => p_hierachy_section_rec.attribute9,
126     p_attribute10                    => p_hierachy_section_rec.attribute10,
127     p_attribute11                    => p_hierachy_section_rec.attribute11,
128     p_attribute12                    => p_hierachy_section_rec.attribute12,
129     p_attribute13                    => p_hierachy_section_rec.attribute13,
130     p_attribute14                    => p_hierachy_section_rec.attribute14,
131     p_attribute15                    => p_hierachy_section_rec.attribute15,
132     x_section_id                     => x_section_id,
133     x_return_status                  => x_return_status,
134     x_msg_count                      => x_msg_count,
135     x_msg_data                       => x_msg_data
136     );
137   --
138   -- End of main API body.
139     IF  (l_debug='Y') AND ( x_return_status <> FND_API.G_RET_STS_ERROR) THEN
140         FOR i in 1..x_msg_count loop
141 	       IBE_UTIL.debug(FND_MSG_PUB.get(i,FND_API.G_FALSE));
142 	    END LOOP;
143     END IF;
144 
145   -- Standard check of p_commit.
146   IF (FND_API.To_Boolean(p_commit)) THEN
147     COMMIT WORK;
148   END IF;
149 
150   -- Standard call to get message count and if count is 1, get message info.
151   FND_MSG_PUB.Count_And_Get(p_count   =>      x_msg_count,
152                             p_data    =>      x_msg_data,
153                             p_encoded =>      'F');
154 
155 EXCEPTION
156 
157    WHEN FND_API.G_EXC_ERROR THEN
158      ROLLBACK TO CREATE_HIERARCHY_SECTION_PUB;
159      x_return_status := FND_API.G_RET_STS_ERROR;
160      FND_MSG_PUB.Count_And_Get(p_count      =>      x_msg_count,
161                                p_data       =>      x_msg_data,
162                                p_encoded    =>      'F');
163 
164    WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
165      ROLLBACK TO CREATE_HIERARCHY_SECTION_PUB;
166      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
167      FND_MSG_PUB.Count_And_Get(p_count      =>      x_msg_count,
168                                p_data       =>      x_msg_data,
169                                p_encoded    =>      'F');
170 
171    WHEN OTHERS THEN
172      ROLLBACK TO CREATE_HIERARCHY_SECTION_PUB;
173      FND_MESSAGE.Set_Name('FND', 'SQL_PLSQL_ERROR');
174      FND_MESSAGE.Set_Token('ROUTINE', l_api_name);
175      FND_MESSAGE.Set_Token('ERRNO', SQLCODE);
176      FND_MESSAGE.Set_Token('REASON', SQLERRM);
177      FND_MSG_PUB.Add;
178      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
179 
180      IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
181      THEN
182        FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name);
183      END IF;
184 
185      FND_MSG_PUB.Count_And_Get(p_count      =>      x_msg_count,
186                                p_data       =>      x_msg_data,
187                                p_encoded    =>      'F');
188 
189 END Create_Section;
190 
191 
192 PROCEDURE Create_Section_Items(
193    p_api_version                    	IN NUMBER,
194    p_init_msg_list                    	IN VARCHAR2 := FND_API.G_FALSE,
195    p_commit                         	IN VARCHAR2 := FND_API.G_FALSE,
196    x_return_status                  	OUT NOCOPY VARCHAR2,
197    x_msg_count                      	OUT NOCOPY NUMBER,
198    x_msg_data                       	OUT NOCOPY VARCHAR2,
199    p_section_id                        	IN NUMBER,
200    p_section_item_tbl               	IN SECTION_ITEM_TBL_TYPE,
201    x_section_item_out_tbl            	OUT NOCOPY SECTION_ITEM_OUT_TBL_TYPE)
202   IS
203 
204   l_api_name          CONSTANT VARCHAR2(30) := 'Associate_Items_To_Section';
205   l_api_version       CONSTANT NUMBER   := 1.0;
206 
207 
208 BEGIN
209 
210   -- Standard Start of API savepoint
211   SAVEPOINT  ASSOCIATE_ITEMS_TO_SECTION_PUB;
212 
213   -- Standard call to check for call compatibility.
214   IF NOT FND_API.Compatible_API_Call(l_api_version,
215                                      p_api_version,
216                                      l_api_name,
217                                      G_PKG_NAME)
218   THEN
219     RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
220   END IF;
221 
222   -- Initialize message list if p_init_msg_list is set to TRUE.
223   IF FND_API.to_Boolean(p_init_msg_list) THEN
224       FND_MSG_PUB.initialize;
225   END IF;
226 
227   -- Initialize API return status to success
228   x_return_status := FND_API.G_RET_STS_SUCCESS;
229 
230   -- API Body start
231 
232   -- call the private API for the association
233   IBE_DSP_HIERARCHY_SETUP_PVT.Associate_Items_To_Section(
234    p_api_version                    => p_api_version,
235    p_init_msg_list                  => p_init_msg_list,
236    p_commit                         => p_commit,
237    p_validation_level               => FND_API.G_VALID_LEVEL_FULL,
238    x_return_status                  => x_return_status,
239    x_msg_count                      => x_msg_count,
240    x_msg_data                       => x_msg_data,
241    p_section_id                     => p_section_id,
242    p_section_item_tbl               => p_section_item_tbl,
243    x_section_item_out_tbl           => x_section_item_out_tbl);
244 
245    -- End of main API body.
246 
247   -- Standard check of p_commit.
248   IF (FND_API.To_Boolean(p_commit)) THEN
249     COMMIT WORK;
250   END IF;
251 
252   -- Standard call to get message count and if count is 1, get message info.
253   FND_MSG_PUB.Count_And_Get(p_count   =>      x_msg_count,
254                             p_data    =>      x_msg_data,
255                             p_encoded =>      'F');
256 
257 EXCEPTION
258 
259    WHEN FND_API.G_EXC_ERROR THEN
260      ROLLBACK TO ASSOCIATE_ITEMS_TO_SECTION_PUB;
261      x_return_status := FND_API.G_RET_STS_ERROR;
262      FND_MSG_PUB.Count_And_Get(p_count      =>      x_msg_count,
263                                p_data       =>      x_msg_data,
264                                p_encoded    =>      'F');
265 
266    WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
267      ROLLBACK TO ASSOCIATE_ITEMS_TO_SECTION_PUB;
268      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
269      FND_MSG_PUB.Count_And_Get(p_count      =>      x_msg_count,
270                                p_data       =>      x_msg_data,
271                                p_encoded    =>      'F');
272 
273    WHEN OTHERS THEN
274      ROLLBACK TO ASSOCIATE_ITEMS_TO_SECTION_PUB;
275      FND_MESSAGE.Set_Name('FND', 'SQL_PLSQL_ERROR');
276      FND_MESSAGE.Set_Token('ROUTINE', l_api_name);
277      FND_MESSAGE.Set_Token('ERRNO', SQLCODE);
278      FND_MESSAGE.Set_Token('REASON', SQLERRM);
279      FND_MSG_PUB.Add;
280      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
281 
282      IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
283      THEN
284        FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name);
285      END IF;
286 
287      FND_MSG_PUB.Count_And_Get(p_count      =>      x_msg_count,
288                                p_data       =>      x_msg_data,
289                                p_encoded    =>      'F');
290 
291  END Create_Section_Items;
292 
293 /* Procedure to Associate Content to Section and Items ; And templates for Items */
294 PROCEDURE Create_Object_Logical_Content (
295   p_api_version        		    IN  NUMBER,
296   p_init_msg_list       		IN  VARCHAR2 := FND_API.g_false,
297   p_commit              		IN  VARCHAR2 := FND_API.g_false,
298   p_object_type			        IN  VARCHAR2,
299   p_obj_lgl_ctnt_tbl		    IN  OBJ_LGL_CTNT_TBL_TYPE,
300   x_return_status       		OUT NOCOPY VARCHAR2,
301   x_msg_count           		OUT NOCOPY  NUMBER,
302   x_msg_data            		OUT NOCOPY  VARCHAR2,
303   x_obj_lgl_ctnt_out_tbl        OUT NOCOPY OBJ_LGL_CTNT_OUT_TBL_TYPE)
304 
305 IS
306   l_api_name                CONSTANT VARCHAR2(30) := 'Associate_Logical_Content';
307   l_api_version             CONSTANT NUMBER   := 1.0;
308   l_obj_rec_i               IBE_LogicalContent_GRP.obj_lgl_ctnt_rec_type;
309   l_obj_tbl_i               IBE_LogicalContent_GRP.obj_lgl_ctnt_tbl_type;
310   l_debug                   VARCHAR2(1);
311   l_obj_tbl_out             IBE_DSP_HIERARCHY_SETUP_PUB.OBJ_LGL_CTNT_OUT_TBL_TYPE;
312   l_overall_return_status   VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
313 
314 BEGIN
315 
316   -- Standard Start of API savepoint
317   SAVEPOINT ASSOCIATE_LOGICAL_CONTENT_PUB;
318 
319   -- Standard call to check for call compatibility.
320   IF NOT FND_API.Compatible_API_Call(l_api_version,
321                                      p_api_version,
322                                      l_api_name,
323                                      G_PKG_NAME)
324   THEN
325     RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
326   END IF;
327 
328   -- Initialize message list if p_init_msg_list is set to TRUE.
329   IF FND_API.to_Boolean(p_init_msg_list) THEN
330       FND_MSG_PUB.initialize;
331   END IF;
332 
333   l_debug  := NVL(FND_PROFILE.VALUE('IBE_DEBUG'),'N');
334 
335   IF (l_debug = 'Y') THEN
336         IBE_UTIL.debug('start of Associate_Logical_Content');
337   END If;
338 
339   -- API Body start
340 
341   -- Initialize API return status to success
342   x_return_status := FND_API.G_RET_STS_SUCCESS;
343   FOR i in p_obj_lgl_ctnt_tbl.FIRST..p_obj_lgl_ctnt_tbl.COUNT() LOOP
344 
345         l_obj_rec_i.OBJ_lgl_ctnt_id       := NULL; -- to insert a new one
346         l_obj_rec_i.Object_Version_Number := NULL; -- internally set as 1
347         l_obj_rec_i.Object_id             := p_obj_lgl_ctnt_tbl(i).object_id;
348         l_obj_rec_i.Context_id            := p_obj_lgl_ctnt_tbl(i).context_id;
349         l_obj_rec_i.deliverable_id        := p_obj_lgl_ctnt_tbl(i).deliverable_id;
350         l_obj_rec_i.obj_lgl_ctnt_delete   := FND_API.g_false;
351 
352         -- Now call the API to do the association.
353         -- Always passing a collection of 1 element
354         l_obj_tbl_i(1) := l_obj_rec_i;
355 
356         -- Call private API to associate the items to the section
357         IBE_LogicalContent_GRP.save_delete_lgl_ctnt(
358             p_api_version         => p_api_version,
359             p_init_msg_list       => p_init_msg_list,
360             p_commit              => p_commit,
361             x_return_status       => x_return_status,
362             x_msg_count           => x_msg_count,
363             x_msg_data            => x_msg_data,
364             p_object_type_code	  => p_object_type,
365             p_lgl_ctnt_tbl	      => l_obj_tbl_i);
366 
367         l_obj_tbl_out(i).object_id       := l_obj_tbl_i(1).OBJECT_ID;
368         l_obj_tbl_out(i).context_id      := l_obj_tbl_i(1).CONTEXT_ID;
369         l_obj_tbl_out(i).deliverable_id  := l_obj_tbl_i(1).DELIVERABLE_ID;
370         l_obj_tbl_out(i).x_return_status := x_return_status;
371 
372         -- derive the API overall status
373         IF (x_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
374             l_overall_return_status:= FND_API.G_RET_STS_ERROR;
375             IF (l_debug = 'Y') THEN
376 	            FOR i in 1..x_msg_count loop
377 	              IBE_UTIL.debug(FND_MSG_PUB.get(i,FND_API.G_FALSE));
378 	            END LOOP;
379               END IF;
380          END IF;
381   END LOOP;
382 
383   x_obj_lgl_ctnt_out_tbl :=  l_obj_tbl_out;
384 
385   -- set the x_return status to the API overall status
386   x_return_status:= l_overall_return_status;
387 
388   if(l_debug='Y') then
389      IBE_UTIL.debug('API overall status='||l_overall_return_status);
390   end if;
391 
392   -- End of main API body.
393 
394   -- Standard call to get message count and if count is 1, get message info.
395   FND_MSG_PUB.Count_And_Get(p_count   =>      x_msg_count,
396                             p_data    =>      x_msg_data,
397                             p_encoded =>      'F');
398 
399 EXCEPTION
400 
401    WHEN FND_API.G_EXC_ERROR THEN
402      ROLLBACK TO ASSOCIATE_LOGICAL_CONTENT_PUB;
403      x_return_status := FND_API.G_RET_STS_ERROR;
404      FND_MSG_PUB.Count_And_Get(p_count      =>      x_msg_count,
405                                p_data       =>      x_msg_data,
406                                p_encoded    =>      'F');
407 
408    WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
409      ROLLBACK TO ASSOCIATE_LOGICAL_CONTENT_PUB;
410      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
411      FND_MSG_PUB.Count_And_Get(p_count      =>      x_msg_count,
412                                p_data       =>      x_msg_data,
413                                p_encoded    =>      'F');
414 
415    WHEN OTHERS THEN
416      ROLLBACK TO ASSOCIATE_LOGICAL_CONTENT_PUB;
417      FND_MESSAGE.Set_Name('FND', 'SQL_PLSQL_ERROR');
418      FND_MESSAGE.Set_Token('ROUTINE', l_api_name);
419      FND_MESSAGE.Set_Token('ERRNO', SQLCODE);
420      FND_MESSAGE.Set_Token('REASON', SQLERRM);
421      FND_MSG_PUB.Add;
422      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
423 
424      IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
425      THEN
426        FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name);
427      END IF;
428 
429      FND_MSG_PUB.Count_And_Get(p_count      =>      x_msg_count,
430                                p_data       =>      x_msg_data,
431                                p_encoded    =>      'F');
432 
433  END Create_Object_Logical_Content;
434 
435 END IBE_DSP_HIERARCHY_SETUP_PUB;