DBA Data[Home] [Help]

PACKAGE BODY: APPS.XLE_ASSOCIATIONS_PUB

Source


1 PACKAGE BODY XLE_ASSOCIATIONS_PUB AS
2 /* $Header: xleassmb.pls 120.1 2005/05/03 12:37:13 ttran ship $ */
3 
4 /* =======================================================================
5  | Global Data Types
6  * ======================================================================*/
7 
8 G_PKG_NAME     CONSTANT VARCHAR2(30) :=' XLE_ASSOCIATIONS_PUB';
9 
10 /*==========================================================================
11  |  PROCEDURE
12  |    Create_Association
13  |
14  |  DESCRIPTION
15  |    Creates a Legal Association
16  |
17  |  ARGUMENTS
18  |      IN     :
19  |               p_init_msg_list
20  |               p_commit
21  |               p_context
22  |               p_subject_type
23  |               p_subject_id
24  |               p_object_type
25  |               p_object_id
26  |               p_effective_from
27  |               p_assoc_information_context
28  |               p_assoc_information1
29  |               p_assoc_information2
30  |               p_assoc_information3
31  |               p_assoc_information4
32  |               p_assoc_information5
33  |               p_assoc_information6
34  |               p_assoc_information7
35  |               p_assoc_information8
36  |               p_assoc_information9
37  |               p_assoc_information10
38  |               p_assoc_information11
39  |               p_assoc_information12
40  |               p_assoc_information13
41  |               p_assoc_information14
42  |               p_assoc_information15
43  |               p_assoc_information16
44  |               p_assoc_information17
45  |               p_assoc_information18
46  |               p_assoc_information19
47  |               p_assoc_information20
48  |
49  |      OUT    :
50  |               x_return_status
51  |               x_msg_count
52  |               x_msg_data
53  |               x_association_id
54  |
55  |      IN/OUT :
56  |
57  |
58  |  MODIFICATION HISTORY
59  |
60  |    18-MAR-2005   T.Tran          Created.
61  |
62  |===========================================================================*/
63 
64 
65 PROCEDURE Create_Association(
66 
67   --   *****  Standard API parameters *****
68   p_init_msg_list             IN  VARCHAR2 := FND_API.G_TRUE,
69   p_commit                    IN  VARCHAR2 := FND_API.G_FALSE,
70   x_return_status             OUT NOCOPY VARCHAR2,
71   x_msg_count                 OUT NOCOPY NUMBER,
72   x_msg_data                  OUT NOCOPY VARCHAR2,
73 
74 
75   --   *****  Legal Association information parameters *****
76   p_context                   IN  VARCHAR2,
77   p_subject_type              IN  VARCHAR2,
78   p_subject_id                IN  NUMBER,
79   p_object_type               IN  VARCHAR2,
80   p_object_id                 IN  NUMBER,
81   p_effective_from            IN  DATE,
82   p_assoc_information_context IN  VARCHAR2 := NULL,
83   p_assoc_information1        IN  VARCHAR2 := NULL,
84   p_assoc_information2        IN  VARCHAR2 := NULL,
85   p_assoc_information3        IN  VARCHAR2 := NULL,
86   p_assoc_information4        IN  VARCHAR2 := NULL,
87   p_assoc_information5        IN  VARCHAR2 := NULL,
88   p_assoc_information6        IN  VARCHAR2 := NULL,
89   p_assoc_information7        IN  VARCHAR2 := NULL,
90   p_assoc_information8        IN  VARCHAR2 := NULL,
91   p_assoc_information9        IN  VARCHAR2 := NULL,
92   p_assoc_information10       IN  VARCHAR2 := NULL,
93   p_assoc_information11       IN  VARCHAR2 := NULL,
94   p_assoc_information12       IN  VARCHAR2 := NULL,
95   p_assoc_information13       IN  VARCHAR2 := NULL,
96   p_assoc_information14       IN  VARCHAR2 := NULL,
97   p_assoc_information15       IN  VARCHAR2 := NULL,
98   p_assoc_information16       IN  VARCHAR2 := NULL,
99   p_assoc_information17       IN  VARCHAR2 := NULL,
100   p_assoc_information18       IN  VARCHAR2 := NULL,
101   p_assoc_information19       IN  VARCHAR2 := NULL,
102   p_assoc_information20       IN  VARCHAR2 := NULL,
103   x_association_ID            OUT NOCOPY NUMBER)
104 
105 
106 IS
107 
108   l_api_name  CONSTANT  VARCHAR2(20) := 'Create_Association';
109   l_association_id      NUMBER;
110   l_association_type_id NUMBER;
111   l_subject_parent_id   NUMBER;
112 
113 BEGIN
114 
115   x_msg_count	:=	NULL;
116   x_msg_data	:=	NULL;
117 
118   -- ****   Standard start of API savepoint  ****
119   SAVEPOINT Create_Association_SP;
120 
121 
122   -- ****  Initialize message list if p_init_msg_list is set to TRUE. ****
123   IF FND_API.to_Boolean( p_init_msg_list ) THEN
124      FND_MSG_PUB.initialize;
125   END IF;
126 
127 
128   -- ****  Initialize return status to SUCCESS   *****
129   x_return_status := FND_API.G_RET_STS_SUCCESS;
130 
131 
132   /*-----------------------------------------------+
133   |   ========  START OF API BODY  ============   |
134   +-----------------------------------------------*/
135 
136   --  Validation of the Legal Associations Rules
137   --  Returns Association Type ID and Subject Parent ID
138 
139   XLE_ASSOC_VALIDATIONS_PVT.Validate_Create_Association (
140       p_context,
141       p_subject_type,
142       p_subject_id,
143       p_object_type,
144       p_object_id,
145       p_effective_from,
146       p_assoc_information_context,
147       p_assoc_information1,
148       p_assoc_information2,
149       p_assoc_information3,
150       p_assoc_information4,
151       p_assoc_information5,
152       p_assoc_information6,
153       p_assoc_information7,
154       p_assoc_information8,
155       p_assoc_information9,
156       p_assoc_information10,
157       p_assoc_information11,
158       p_assoc_information12,
159       p_assoc_information13,
160       p_assoc_information14,
161       p_assoc_information15,
162       p_assoc_information16,
163       p_assoc_information17,
164       p_assoc_information18,
165       p_assoc_information19,
166       p_assoc_information20,
167       l_association_type_id,
168       l_subject_parent_id);
169 
170   --  Call the table handler to create a record in XLE_ASSOCIATIONS
171   XLE_ASSOCIATION_PKG.Insert_Row (
172       x_association_id           =>  x_association_id,
173       p_association_type_id      =>  l_association_type_id,
174       p_subject_id               =>  p_subject_id,
175       p_object_id	         =>  p_object_id,
176       p_subject_parent_id        =>  l_subject_parent_id,
177       p_effective_from	         =>  p_effective_from,
178       p_assoc_information_context =>  p_assoc_information_context,
179       p_assoc_information1        =>  p_assoc_information1,
180       p_assoc_information2        =>  p_assoc_information2,
181       p_assoc_information3        =>  p_assoc_information3,
182       p_assoc_information4        =>  p_assoc_information4,
183       p_assoc_information5        =>  p_assoc_information5,
184       p_assoc_information6        =>  p_assoc_information6,
185       p_assoc_information7        =>  p_assoc_information7,
186       p_assoc_information8        =>  p_assoc_information8,
187       p_assoc_information9        =>  p_assoc_information9,
188       p_assoc_information10       =>  p_assoc_information10,
189       p_assoc_information11       =>  p_assoc_information11,
190       p_assoc_information12       =>  p_assoc_information12,
191       p_assoc_information13       =>  p_assoc_information13,
192       p_assoc_information14       =>  p_assoc_information14,
193       p_assoc_information15       =>  p_assoc_information15,
194       p_assoc_information16       =>  p_assoc_information16,
195       p_assoc_information17       =>  p_assoc_information17,
196       p_assoc_information18       =>  p_assoc_information18,
197       p_assoc_information19       =>  p_assoc_information19,
198       p_assoc_information20       =>  p_assoc_information20,
199       p_object_version_number =>  1);
200 
201 
202   /*-----------------------------------------------+
203   |   ========  END OF API BODY  ============   |
204   +-----------------------------------------------*/
205 
206   -- Standard check of p_commit.
207   IF FND_API.To_Boolean( p_commit ) THEN
208      COMMIT WORK;
209   END IF;
210 
211   -- Standard call to get message count and if count is 1,
212   -- get message info.
213   FND_MSG_PUB.Count_And_Get (
214       p_count    =>  x_msg_count,
215       p_data     =>  x_msg_data );
216 
217 EXCEPTION
218 
219   WHEN FND_API.G_EXC_ERROR THEN
220        ROLLBACK TO Create_Association_SP;
221        x_return_status := FND_API.G_RET_STS_ERROR;
222        FND_MSG_PUB.Count_And_Get (
223            p_count    =>  x_msg_count,
224            p_data     =>  x_msg_data );
225 
226   WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
227        ROLLBACK TO Create_Association_SP;
228        x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
229        FND_MSG_PUB.Count_And_Get (
230            p_count    =>  x_msg_count,
231            p_data     =>  x_msg_data );
232 
233   WHEN OTHERS THEN
234        ROLLBACK TO Create_Association_SP;
235        x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
236        IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
237           FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME, l_api_name);
238        END IF;
239        FND_MSG_PUB.Count_And_Get (
240            p_count    =>  x_msg_count,
241            p_data     =>  x_msg_data );
242 
243 END Create_Association;
244 
245 
246 /*==========================================================================
247  |  PROCEDURE
248  |    Update_Association
249  |
250  |
251  |  DESCRIPTION
252  |    Updates a Legal Association 					                |
253  |
254  |  ARGUMENTS
255  |      IN     :
256  |               p_init_msg_list
257  |               p_commit
258  |               p_context
259  |               p_subject_type
260  |               p_subject_id
261  |               p_object_type
262  |               p_object_id
263  |               p_effective_from
264  |               p_assoc_information_context
265  |               p_assoc_information1
266  |               p_assoc_information2
267  |               p_assoc_information3
268  |               p_assoc_information4
269  |               p_assoc_information5
270  |               p_assoc_information6
271  |               p_assoc_information7
272  |               p_assoc_information8
273  |               p_assoc_information9
274  |               p_assoc_information10
275  |               p_assoc_information11
276  |               p_assoc_information12
277  |               p_assoc_information13
278  |               p_assoc_information14
279  |               p_assoc_information15
280  |               p_assoc_information16
281  |               p_assoc_information17
282  |               p_assoc_information18
283  |               p_assoc_information19
284  |               p_assoc_information20
285  |
286  |      OUT    :
287  |               x_return_status
288  |               x_msg_count
289  |               x_msg_data
290  |               x_association_id
291  |
292  |      IN/OUT :
293  |
294  |
295  |  MODIFICATION HISTORY
296  |
297  |    18-MAR-2005   T.Tran          Created.
298  |
299  |===========================================================================*/
300 
301 
302 PROCEDURE Update_Association(
303 
304   --   *****  Standard API parameters *****
305   p_init_msg_list             IN  VARCHAR2 := FND_API.G_TRUE,
306   p_commit                    IN  VARCHAR2 := FND_API.G_FALSE,
307   x_return_status             OUT NOCOPY VARCHAR2,
308   x_msg_count                 OUT NOCOPY NUMBER,
309   x_msg_data                  OUT NOCOPY VARCHAR2,
310 
311   --   *****  Legal Association information parameters *****
312   p_association_id            IN  NUMBER   := NULL,
313   p_context                   IN  VARCHAR2 := NULL,
314   p_subject_type              IN  VARCHAR2 := NULL,
315   p_subject_id                IN  NUMBER   := NULL,
316   p_object_type               IN  VARCHAR2 := NULL,
317   p_object_id                 IN  NUMBER   := NULL,
318   p_effective_from            IN  DATE     := NULL,
319   p_effective_to              IN  DATE     := NULL,
320   p_assoc_information_context IN VARCHAR2  := NULL,
321   p_assoc_information1        IN VARCHAR2  := NULL,
322   p_assoc_information2        IN VARCHAR2  := NULL,
323   p_assoc_information3        IN VARCHAR2  := NULL,
324   p_assoc_information4        IN VARCHAR2  := NULL,
325   p_assoc_information5        IN VARCHAR2  := NULL,
326   p_assoc_information6        IN VARCHAR2  := NULL,
327   p_assoc_information7        IN VARCHAR2  := NULL,
328   p_assoc_information8        IN VARCHAR2  := NULL,
329   p_assoc_information9        IN VARCHAR2  := NULL,
330   p_assoc_information10       IN VARCHAR2  := NULL,
331   p_assoc_information11       IN VARCHAR2  := NULL,
332   p_assoc_information12       IN VARCHAR2  := NULL,
333   p_assoc_information13       IN VARCHAR2  := NULL,
334   p_assoc_information14       IN VARCHAR2  := NULL,
335   p_assoc_information15       IN VARCHAR2  := NULL,
336   p_assoc_information16       IN VARCHAR2  := NULL,
337   p_assoc_information17       IN VARCHAR2  := NULL,
338   p_assoc_information18       IN VARCHAR2  := NULL,
339   p_assoc_information19       IN VARCHAR2  := NULL,
340   p_assoc_information20       IN VARCHAR2  := NULL,
341   p_object_version_number     IN OUT NOCOPY NUMBER)
342 
343 IS
344 
345   l_api_name  CONSTANT  VARCHAR2(20) := 'Update_Association';
346   l_association_id      NUMBER;
347   l_association_type_id NUMBER;
348 
349 BEGIN
350 
351   x_msg_count				:=	NULL;
352   x_msg_data				:=	NULL;
353 
354   -- ****   Standard start of API savepoint  ****
355   SAVEPOINT Update_Association_SP;
356 
357   -- ****  Initialize message list if p_init_msg_list is set to TRUE. ****
358   IF FND_API.to_Boolean( p_init_msg_list ) THEN
359      FND_MSG_PUB.initialize;
360   END IF;
361 
362   -- ****  Initialize return status to SUCCESS   *****
363   x_return_status := FND_API.G_RET_STS_SUCCESS;
364 
365 
366   /*-----------------------------------------------+
367   |   ========  START OF API BODY  ============   |
368   +-----------------------------------------------*/
369 
370   -- ****    Validation of the Legal Associations Rules  ****
371 
372   l_association_id := p_association_id;
373 
374   XLE_ASSOC_VALIDATIONS_PVT.Validate_Update_Association (
375       l_association_id,
376       p_context,
377       p_subject_type,
378       p_subject_id,
379       p_object_type,
380       p_object_id,
381       p_effective_from,
382       p_effective_to,
383       p_assoc_information_context,
384       p_assoc_information1,
385       p_assoc_information2,
386       p_assoc_information3,
387       p_assoc_information4,
388       p_assoc_information5,
389       p_assoc_information6,
390       p_assoc_information7,
391       p_assoc_information8,
392       p_assoc_information9,
393       p_assoc_information10,
394       p_assoc_information11,
395       p_assoc_information12,
396       p_assoc_information13,
397       p_assoc_information14,
398       p_assoc_information15,
399       p_assoc_information16,
400       p_assoc_information17,
401       p_assoc_information18,
402       p_assoc_information19,
403       p_assoc_information20 );
404 
405 
406   --  ****    Call the table handler to lock the record in XLE_ASSOCIATIONS
407 
408   XLE_ASSOCIATION_PKG.Lock_Row (
409       p_association_id        =>  l_association_id,
410       p_object_version_number =>  p_object_version_number);
411 
412   p_object_version_number := NVL(p_object_version_number, 1) + 1;
413 
414 
415   --  ****    Call the table handler to update a record in XLE_ASSOCIATIONS
416 
417   XLE_ASSOCIATION_PKG.Update_Row (
418       p_association_id           =>  l_association_id,
419       p_effective_from	         =>  p_effective_from,
420       p_effective_to             =>  p_effective_to,
421       p_assoc_information_context =>  p_assoc_information_context,
422       p_assoc_information1        =>  p_assoc_information1,
423       p_assoc_information2        =>  p_assoc_information2,
424       p_assoc_information3        =>  p_assoc_information3,
425       p_assoc_information4        =>  p_assoc_information4,
426       p_assoc_information5        =>  p_assoc_information5,
427       p_assoc_information6        =>  p_assoc_information6,
428       p_assoc_information7        =>  p_assoc_information7,
429       p_assoc_information8        =>  p_assoc_information8,
430       p_assoc_information9        =>  p_assoc_information9,
431       p_assoc_information10       =>  p_assoc_information10,
432       p_assoc_information11       =>  p_assoc_information11,
433       p_assoc_information12       =>  p_assoc_information12,
434       p_assoc_information13       =>  p_assoc_information13,
435       p_assoc_information14       =>  p_assoc_information14,
436       p_assoc_information15       =>  p_assoc_information15,
437       p_assoc_information16       =>  p_assoc_information16,
438       p_assoc_information17       =>  p_assoc_information17,
439       p_assoc_information18       =>  p_assoc_information18,
440       p_assoc_information19       =>  p_assoc_information19,
441       p_assoc_information20       =>  p_assoc_information20,
442       p_object_version_number    =>  p_object_version_number,
443       p_last_update_date         =>  XLE_UTILITY_PUB.LAST_UPDATE_DATE,
444       p_last_updated_by          =>  XLE_UTILITY_PUB.LAST_UPDATED_BY,
445       p_last_update_login        =>  XLE_UTILITY_PUB.LAST_UPDATE_LOGIN);
446 
447 
448 
449   /*-----------------------------------------------+
450   |   ========  END OF API BODY  ============   |
451   +-----------------------------------------------*/
452 
453   -- Standard check of p_commit.
454   IF FND_API.To_Boolean( p_commit ) THEN
455      COMMIT WORK;
456   END IF;
457 
458   -- Standard call to get message count and if count is 1,
459   -- get message info.
460   FND_MSG_PUB.Count_And_Get (
461       p_count    =>  x_msg_count,
462       p_data     =>  x_msg_data );
463 
464 EXCEPTION
465 
466   WHEN FND_API.G_EXC_ERROR THEN
467        ROLLBACK TO Update_Association_SP;
468        x_return_status := FND_API.G_RET_STS_ERROR;
469        FND_MSG_PUB.Count_And_Get (
470            p_count    =>  x_msg_count,
471            p_data     =>  x_msg_data );
472 
473   WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
474        ROLLBACK TO Update_Association_SP;
475        x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
476        FND_MSG_PUB.Count_And_Get (
477            p_count    =>  x_msg_count,
478            p_data     =>  x_msg_data );
479 
480   WHEN OTHERS THEN
481        ROLLBACK TO Update_Association_SP;
482        x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
483        IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
484           FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME, l_api_name);
485        END IF;
486        FND_MSG_PUB.Count_And_Get (
487            p_count    =>  x_msg_count,
488            p_data     =>  x_msg_data );
489 END Update_Association;
490 
491 
492 END XLE_ASSOCIATIONS_PUB;
493