DBA Data[Home] [Help]

PACKAGE: APPS.AMV_ITEM_PUB

Source


1 PACKAGE amv_item_pub AUTHID CURRENT_USER AS
2 /* $Header: amvpitms.pls 120.1 2005/06/22 16:41:29 appldev ship $ */
3 -- Start of Comments
4 --
5 -- NAME
6 --   AMV_ITEM_PUB
7 --
8 -- PURPOSE
9 --   This package is a public API managing MES items (contents) and
10 --   their related attributes.  It also define global variables.
11 --
12 --   PROCEDURES:
13 --      Item:
14 --            Creat_Item;
15 --            Delete_Item;
16 --            Update_Item;
17 --            Get_Item;
18 --            Find_Item;
19 --
20 --     Handle file:
21 --            Add_ItemFile
22 --            Delete_ItemFile
23 --            Update_ItemFile
24 --            Get_ItemFile
25 --
26 --     Handle keywords:
27 --            Add_ItemKeyword
28 --            Delete_ItemKeyword
29 --            Replace_ItemKeyword
30 --            Get_ItemKeyword
31 --
32 --     Handle authors:
33 --            Add_ItemAuthor
34 --            Delete_ItemAuthor
35 --            Replace_ItemAuthor
36 --            Get_ItemAuthor
37 --
38 -- NOTES
39 --
40 --     The API to handle item's perspective and content type are in separated
41 --     package (amv_perspective_pvt and amv_contenttype_pvt).
42 --     The API for item's author and keywords are also in jtf_item_pub.
43 --     Here we add checking user privileges.
44 --
45 -- HISTORY
46 --   08/30/1999        PWU            created
47 --   12/03/1999        PWU            modify to call jtf amv item api
48 -- End of Comments
49 --
50 
51 TYPE AMV_CHAR_VARRAY_TYPE IS TABLE OF VARCHAR2(4000);
52 
53 TYPE AMV_NUMBER_VARRAY_TYPE IS TABLE OF NUMBER;
54 
55 TYPE amv_return_obj_type IS RECORD(
56       returned_record_count           NUMBER,
57       next_record_position            NUMBER,
58       total_record_count              NUMBER
59 );
60 
61 TYPE amv_request_obj_type IS RECORD(
62       records_requested               NUMBER,
63       start_record_position           NUMBER,
64       return_total_count_flag         VARCHAR2(1)
65 );
66 
67 TYPE amv_item_obj_type IS RECORD(
68       item_id                   NUMBER,
69       object_version_number     NUMBER,
70       creation_date             DATE,
71       created_by                NUMBER,
72       last_update_date          DATE,
73       last_updated_by           NUMBER,
74       last_update_login         NUMBER,
75       application_id            NUMBER,
76       external_access_flag      VARCHAR2(1),
77       item_name                 VARCHAR2(240),
78       description               VARCHAR2(2000),
79       text_string               VARCHAR2(2000),
80       language_code             VARCHAR2(4),
81       status_code               VARCHAR2(30),
82       effective_start_date      DATE,
83       expiration_date           DATE,
84       item_type                 VARCHAR2(240),
85       url_string                VARCHAR2(2000),
86       publication_date          DATE,
87       priority                  VARCHAR2(30),
88       content_type_id           NUMBER,
89       owner_id                  NUMBER,
90       default_approver_id       NUMBER,
91       item_destination_type     VARCHAR2(240)
92 );
93 
94 TYPE amv_simple_item_obj_type IS RECORD(
95       item_id                   NUMBER,
96       object_version_number     NUMBER,
97       creation_date             DATE,
98       created_by                NUMBER,
99       last_update_date          DATE,
100       last_updated_by           NUMBER,
101       last_update_login         NUMBER,
102       application_id            NUMBER,
103       external_access_flag      VARCHAR2(1),
104       item_name                 VARCHAR2(240),
105       description               VARCHAR2(2000),
106       text_string               VARCHAR2(2000),
107       language_code             VARCHAR2(4),
108       status_code               VARCHAR2(30),
109       effective_start_date      DATE,
110       expiration_date           DATE,
111       item_type                 VARCHAR2(240),
112       url_string                VARCHAR2(2000),
113       publication_date          DATE,
114       priority                  VARCHAR2(30),
115       content_type_id           NUMBER,
116       owner_id                  NUMBER,
117       default_approver_id       NUMBER,
118       item_destination_type     VARCHAR2(240),
119       file_id_list              VARCHAR2(2000),
120       persp_id_list             VARCHAR2(2000),
121       persp_name_list           VARCHAR2(2000),
122       author_list               VARCHAR2(2000),
123       keyword_list              VARCHAR2(2000)
124 );
125 
126 TYPE amv_simple_item_obj_varray IS TABLE of amv_simple_item_obj_type;
127 
128 TYPE amv_nameid_obj_type IS RECORD(
129      id           NUMBER,
130      name         VARCHAR2(240)
131 );
132 
133 TYPE amv_nameid_varray_type IS TABLE OF amv_nameid_obj_type;
134 
135 --
136 -- The following constants are to be finalized.
137 --
138 G_VERSION CONSTANT    NUMBER    :=  1.0;
139 G_PUSH  	CONSTANT	 VARCHAR2(30) := AMV_UTILITY_PVT.G_PUSH;
140 G_MATCH  	CONSTANT	 VARCHAR2(30) := AMV_UTILITY_PVT.G_MATCH;
141 --
142 --
143 -- This package contains the following procedure
144 --
145 --------------------------------------------------------------------------------
146 -- Start of comments
147 --    API name   : Creat_Item
148 --    Type       : Public
149 --    Pre-reqs   : None
150 --    Function   : Create a new item in MES,
151 --                 given the item information.
152 --    Parameters :
153 --    IN           p_api_version                      NUMBER    Required
154 --                 p_init_msg_list                    VARCHAR2  Optional
155 --                        Default = FND_API.G_FALSE
156 --                 p_commit                           VARCHAR2  Optional
157 --                        Default = FND_API.G_FALSE
158 --                 p_check_login_user                 VARCHAR2  Optional
159 --                        Default = FND_API.G_TRUE
160 --                    Flag for checking user privilege and if user is login.
161 --                 p_channel_id_array                 AMV_NUMBER_VARRAY_TYPE
162 --                        Default = NULL.                       Optional
163 --                 p_item_obj                         AMV_ITEM_OBJ_TYPE
164 --                                                              Required
165 --    OUT        : x_return_status                    VARCHAR2
166 --                 x_msg_count                        NUMBER
167 --                 x_msg_data                         VARCHAR2
168 --                 x_item_id                          NUMBER
169 --                 item_id will be generated from sequence number.
170 --    Notes      :
171 --
172 -- End of comments
173 --
174 PROCEDURE Create_Item
175 (
176     p_api_version       IN  NUMBER,
177     p_init_msg_list     IN  VARCHAR2 := FND_API.G_FALSE,
178     p_commit            IN  VARCHAR2 := FND_API.G_FALSE,
179     x_return_status     OUT NOCOPY  VARCHAR2,
180     x_msg_count         OUT NOCOPY  NUMBER,
181     x_msg_data          OUT NOCOPY  VARCHAR2,
182     p_check_login_user  IN  VARCHAR2 := FND_API.G_TRUE,
183     p_channel_id_array  IN  AMV_NUMBER_VARRAY_TYPE := NULL,
184     p_item_obj          IN  AMV_ITEM_OBJ_TYPE,
185     p_file_array        IN  AMV_NUMBER_VARRAY_TYPE,
186     p_persp_array       IN  AMV_NAMEID_VARRAY_TYPE,
187     p_author_array      IN  AMV_CHAR_VARRAY_TYPE,
188     p_keyword_array     IN  AMV_CHAR_VARRAY_TYPE,
189     x_item_id           OUT NOCOPY  NUMBER
190 );
191 --
192 -- Algorithm:
193 --   BEGIN
194 --     Verify API version compatibility
195 --     Check that login user's status is active
196 --     IF user not active THEN
197 --         Return error 'user account currently suspended'
198 --     ENDIF
199 --     Check that user has administrative privileges
200 --     IF user not privileged THEN
201 --         Return error 'Administrative privileges required to perform'
202 --     ENDIF
203 --     Set rollback SAVEPOINT
204 --     Ensure that the passed item object has basic right information.
205 --     insert a new item with row = p_obj_type to
206 --     item table(ams_deliverables_all_b).
207 --     insert (via api) the item's attributes authors, keywords, files,
208 --        perspectives into the database.
209 --     Commit transaction if requested
210 --   END
211 --
212 --------------------------------------------------------------------------------
213 -- Start of comments
214 --    API name   : Delete_Item
215 --    Type       : Public
216 --    Pre-reqs   : None
217 --    Function   : Delete an item from MES given the item id.
218 --    Parameters :
219 --    IN           p_api_version                      NUMBER    Required
220 --                 p_init_msg_list                    VARCHAR2  Optional
221 --                        Default = FND_API.G_FALSE
222 --                 p_commit                           VARCHAR2  Optional
223 --                        Default = FND_API.G_FALSE
224 --                 p_check_login_user                 VARCHAR2  Optional
225 --                        Default = FND_API.G_TRUE
226 --                    Flag for checking user privilege and if user is login.
227 --                 p_item_id                          NUMBER    Required
228 --    OUT        : x_return_status                    VARCHAR2
229 --                 x_msg_count                        NUMBER
230 --                 x_msg_data                         VARCHAR2
231 --    Notes      :
232 --
233 -- End of comments
234 --
235 PROCEDURE Delete_Item
236 (
237     p_api_version       IN  NUMBER,
238     p_init_msg_list     IN  VARCHAR2 := FND_API.G_FALSE,
239     p_commit            IN  VARCHAR2 := FND_API.G_FALSE,
240     x_return_status     OUT NOCOPY  VARCHAR2,
241     x_msg_count         OUT NOCOPY  NUMBER,
242     x_msg_data          OUT NOCOPY  VARCHAR2,
243     p_check_login_user  IN  VARCHAR2 := FND_API.G_TRUE,
244     p_item_id           IN  NUMBER
245 );
246 --
247 -- Algorithm:
248 --   BEGIN
249 --     Verify API version compatibility
250 --     Check that login user's status is active
251 --     IF user not active THEN
252 --         Return error 'user account currently suspended'
253 --     ENDIF
254 --     Check that user has administrative privileges
255 --     IF user not privileged THEN
256 --         Return error 'Administrative privileges required to perform'
257 --     ENDIF
258 --       Set rollback SAVEPOINT
259 --       Get the item with item_id = p_item_id
260 --       Delete the item's attributes
261 --       Delete the item itself
262 --       (the file associated with the item will be deleted by batched job)
263 --       Commit transaction if requested
264 --     ENDIF
265 --   END
266 --------------------------------------------------------------------------------
267 -- Start of comments
268 --    API name   : Update_Item
269 --    Type       : Public
270 --    Pre-reqs   : None
271 --    Function   : Update the item based on the passed item object information.
272 --    Parameters :
273 --    IN           p_api_version                      NUMBER    Required
274 --                 p_init_msg_list                    VARCHAR2  Optional
275 --                        Default = FND_API.G_FALSE
276 --                 p_commit                           VARCHAR2  Optional
277 --                        Default = FND_API.G_FALSE
278 --                 p_check_login_user                 VARCHAR2  Optional
279 --                        Default = FND_API.G_TRUE
280 --                    Flag for checking user privilege and if user is login.
281 --                 p_item_obj                         AMV_ITEM_OBJ_TYPE
282 --                                                              Required
283 --                 The object for the new data of the item
284 --    OUT        : x_return_status                    VARCHAR2
285 --                 x_msg_count                        NUMBER
286 --                 x_msg_data                         VARCHAR2
287 --    Notes      :
288 --
289 -- End of comments
290 --
291 PROCEDURE Update_Item
292 (
293     p_api_version       IN  NUMBER,
294     p_init_msg_list     IN  VARCHAR2 := FND_API.G_FALSE,
295     p_commit            IN  VARCHAR2 := FND_API.G_FALSE,
296     x_return_status     OUT NOCOPY  VARCHAR2,
297     x_msg_count         OUT NOCOPY  NUMBER,
298     x_msg_data          OUT NOCOPY  VARCHAR2,
299     p_check_login_user  IN  VARCHAR2 := FND_API.G_TRUE,
300     p_channel_id_array  IN  AMV_NUMBER_VARRAY_TYPE := NULL,
301     p_item_obj          IN  AMV_ITEM_OBJ_TYPE,
302     p_file_array        IN  AMV_NUMBER_VARRAY_TYPE,
303     p_persp_array       IN  AMV_NAMEID_VARRAY_TYPE,
304     p_author_array      IN  AMV_CHAR_VARRAY_TYPE,
305     p_keyword_array     IN  AMV_CHAR_VARRAY_TYPE
306 );
307 --
308 -- Algorithm:
309 --   BEGIN
310 --     Verify API version compatibility
311 --     Check that login user's status is active
312 --     IF user not active THEN
313 --         Return error 'user account currently suspended'
314 --     ENDIF
315 --     Check that user has administrative privileges
316 --     IF user not privileged THEN
317 --         Return error 'Administrative privileges required to perform'
318 --     ENDIF
319 --     Set rollback SAVEPOINT
320 --     Ensure that the passed item object has basic right information.
321 --     update the item with row = p_obj_type to
322 --     item table(ams_deliverables_all_b).
323 --     update (via api) the item's attributes authors, keywords, files,
324 --        perspectives on the database.
325 --     Commit transaction if requested
326 --   END
327 --
328 --------------------------------------------------------------------------------
329 -- Start of comments
330 --    API name   : Get_Item
334 --    Parameters :
331 --    Type       : Public
332 --    Pre-reqs   : None
333 --    Function   : Get an item information from MES given the item id.
335 --    IN           p_api_version                      NUMBER    Required
336 --                 p_init_msg_list                    VARCHAR2  Optional
337 --                        Default = FND_API.G_FALSE
338 --                 p_check_login_user                 VARCHAR2  Optional
339 --                        Default = FND_API.G_TRUE
340 --                    Flag for checking user privilege and if user is login.
341 --                 p_item_id                          NUMBER    Required
342 --    OUT        : x_return_status                    VARCHAR2
343 --                 x_msg_count                        NUMBER
344 --                 x_msg_data                         VARCHAR2
345 --                 x_item_obj                         AMV_ITEM_OBJ_TYPE
346 --    Notes      :
347 --
348 -- End of comments
349 --
350 PROCEDURE Get_Item
351 (
352     p_api_version       IN  NUMBER,
353     p_init_msg_list     IN  VARCHAR2 := FND_API.G_FALSE,
354     x_return_status     OUT NOCOPY  VARCHAR2,
355     x_msg_count         OUT NOCOPY  NUMBER,
356     x_msg_data          OUT NOCOPY  VARCHAR2,
357     p_check_login_user  IN  VARCHAR2 := FND_API.G_TRUE,
358     p_item_id           IN  NUMBER,
359     x_item_obj          OUT NOCOPY  AMV_ITEM_OBJ_TYPE,
360     x_file_array        OUT NOCOPY   AMV_NUMBER_VARRAY_TYPE,
361     x_persp_array       OUT NOCOPY   AMV_NAMEID_VARRAY_TYPE,
362     x_author_array      OUT NOCOPY   AMV_CHAR_VARRAY_TYPE,
363     x_keyword_array     OUT NOCOPY   AMV_CHAR_VARRAY_TYPE
364 );
365 --
366 -- Algorithm:
367 --   BEGIN
368 --     Verify API version compatibility
369 --     Check that login user's status is active
370 --     IF user not active THEN
371 --         Return error 'user account currently suspended'
372 --     ENDIF
373 --     Base on the given item id, query and get the item and its attributes.
374 --   END
375 --------------------------------------------------------------------------------
376 -- Start of comments
377 --    API name   : Find_Item
378 --    Type       : Public
379 --    Pre-reqs   : None
380 --    Function   : Query and return items from MES based on the passed criteria.
381 --    Parameters :
382 --    IN           p_api_version                      NUMBER    Required
383 --                 p_init_msg_list                    VARCHAR2  Optional
384 --                        Default = FND_API.G_FALSE
385 --                 p_check_login_user                 VARCHAR2  Optional
386 --                        Default = FND_API.G_TRUE
387 --                    Flag for checking user privilege and if user is login.
388 --                 p_item_name                        VARCHAR2  Optional
389 --                     search criterion on item name
390 --                     default to FND_API.G_MISS_CHAR
391 --                 p_description                      VARCHAR2  Optional
392 --                     search criterion on item description
393 --                     default to FND_API.G_MISS_CHAR
394 --                 p_item_type                        VARCHAR2  Optional
395 --                     search criterion on item type
396 --                     default to FND_API.G_MISS_CHAR
397 --                 p_subset_request_obj               AMV_REQUEST_OBJ_TYPE,
398 --                                                              Required.
399 --    OUT        : x_return_status                    VARCHAR2
400 --                 x_msg_count                        NUMBER
401 --                 x_msg_data                         VARCHAR2
402 --                 x_subset_return_obj                AMV_RETURN_OBJ_TYPE,
403 --                 x_item_obj_array                   AMV_SIMPLE_ITEM_OBJ_VARRAY
404 --    Notes      : For more sophisticated search, check with the search engine.
405 --
406 -- End of comments
407 --
408 PROCEDURE Find_Item
409 (
410     p_api_version         IN  NUMBER,
411     p_init_msg_list       IN  VARCHAR2 := FND_API.G_FALSE,
412     x_return_status       OUT NOCOPY  VARCHAR2,
413     x_msg_count           OUT NOCOPY  NUMBER,
414     x_msg_data            OUT NOCOPY  VARCHAR2,
415     p_check_login_user    IN  VARCHAR2 := FND_API.G_TRUE,
416     p_item_name           IN  VARCHAR2 := FND_API.G_MISS_CHAR,
417     p_description         IN  VARCHAR2 := FND_API.G_MISS_CHAR,
418     p_item_type           IN  VARCHAR2 := FND_API.G_MISS_CHAR,
419     p_subset_request_obj  IN  AMV_REQUEST_OBJ_TYPE,
420     x_subset_return_obj   OUT NOCOPY  AMV_RETURN_OBJ_TYPE,
421     x_item_obj_array      OUT NOCOPY  AMV_SIMPLE_ITEM_OBJ_VARRAY
422 );
423 --
424 -- Algorithm:
425 --   BEGIN
426 --     Verify API version compatibility
427 --     Check that login user's status is active
428 --     IF user not active THEN
429 --         Return error 'user account currently suspended'
430 --     ENDIF
431 --     Base on the given item name, description, and item type,
432 --       query and get the item and its attributes.
433 --   END
434 --------------------------------------------------------------------------------
435 ------------------------------ ITEM_KEYWORD ------------------------------------
436 -- Start of comments
437 --    API name   : Add_ItemKeyword
438 --    Type       : Public
439 --    Pre-reqs   : None
440 --    Function   : Add the keywords passed in the array to the specified item.
441 --    Parameters :
445 --                 p_commit                           VARCHAR2  Optional
442 --    IN           p_api_version                      NUMBER    Required
443 --                 p_init_msg_list                    VARCHAR2  Optional
444 --                        Default = FND_API.G_FALSE
446 --                        Default = FND_API.G_FALSE
447 --                 p_check_login_user                 VARCHAR2  Optional
448 --                        Default = FND_API.G_TRUE
449 --                    Flag for checking user privilege and if user is login.
450 --                 p_item_id                          NUMBER    Required
451 --                    The item id to be add the keywords.
452 --                 p_keyword_varray                   AMV_CHAR_VARRAY_TYPE
453 --                                                              Required
454 --                    The keywords array
455 --    OUT        : x_return_status                    VARCHAR2
456 --                 x_msg_count                        NUMBER
457 --                 x_msg_data                         VARCHAR2
458 --    Notes      :
459 --
460 -- End of comments
461 --
462 PROCEDURE Add_ItemKeyword
463 (
464     p_api_version       IN  NUMBER,
465     p_init_msg_list     IN  VARCHAR2 := FND_API.G_FALSE,
466     p_commit            IN  VARCHAR2 := FND_API.G_FALSE,
467     x_return_status     OUT NOCOPY  VARCHAR2,
468     x_msg_count         OUT NOCOPY  NUMBER,
469     x_msg_data          OUT NOCOPY  VARCHAR2,
470     p_check_login_user  IN  VARCHAR2 := FND_API.G_TRUE,
471     p_item_id           IN  NUMBER,
472     p_keyword_varray    IN  AMV_CHAR_VARRAY_TYPE
473 );
474 -- Algorithm:
475 --   BEGIN
476 --     Verify API version compatibility
477 --     Check that login user's status is active
478 --     IF user not active THEN
479 --       Return error 'user account currently suspended'
480 --     ENDIF
481 --     Check that user has administrative privileges
482 --     IF user not privileged THEN
483 --       Return error 'Administrative privileges required to perform'
484 --     ENDIF
485 --     check if this item id is in MES
486 --     IF not THEN
487 --         return error 'invalid item id';
488 --     END IF
489 --     Set rollback SAVEPOINT
490 --       Loop for each keyword in the passed array
491 --           check if the keyword is already in the item.
492 --           If so, don't add it.
493 --           add the keyword to the item.
494 --     Commit transaction if requested
495 --
496 --------------------------------------------------------------------------------
497 -- Start of comments
498 --    API name   : Add_ItemKeyword
499 --    Type       : Public
500 --    Pre-reqs   : None
501 --    Function   : Add the specified keywords to the specified item.
502 --    Parameters :
503 --    IN           p_api_version                      NUMBER    Required
504 --                 p_init_msg_list                    VARCHAR2  Optional
505 --                        Default = FND_API.G_FALSE
506 --                 p_commit                           VARCHAR2  Optional
507 --                        Default = FND_API.G_FALSE
508 --                 p_check_login_user                 VARCHAR2  Optional
509 --                        Default = FND_API.G_TRUE
510 --                    Flag for checking user privilege and if user is login.
511 --                 p_item_id                          NUMBER    Required
512 --                    The item id to be add the keywords.
513 --                 p_keyword                          VARCHAR2  Required
514 --                    The keyword to be added to the item.
515 --    OUT        : x_return_status                    VARCHAR2
516 --                 x_msg_count                        NUMBER
517 --                 x_msg_data                         VARCHAR2
518 --    Notes      :
519 --
520 -- End of comments
521 --
522 PROCEDURE Add_ItemKeyword
523 (
524     p_api_version       IN  NUMBER,
525     p_init_msg_list     IN  VARCHAR2 := FND_API.G_FALSE,
526     p_commit            IN  VARCHAR2 := FND_API.G_FALSE,
527     x_return_status     OUT NOCOPY  VARCHAR2,
528     x_msg_count         OUT NOCOPY  NUMBER,
529     x_msg_data          OUT NOCOPY  VARCHAR2,
530     p_check_login_user  IN  VARCHAR2 := FND_API.G_TRUE,
531     p_item_id           IN  NUMBER,
532     p_keyword           IN  VARCHAR2
533 );
534 -- Algorithm:
535 --   BEGIN
536 --     Verify API version compatibility
537 --     Check that login user's status is active
538 --     IF user not active THEN
539 --       Return error 'user account currently suspended'
540 --     ENDIF
541 --     Check that user has administrative privileges
542 --     IF user not privileged THEN
543 --       Return error 'Administrative privileges required to perform'
544 --     ENDIF
545 --     check if this item id is in MES
546 --     IF not THEN
547 --         return error 'invalid item id';
548 --     END IF
549 --     Set rollback SAVEPOINT
550 --     check if the keyword is in the item.
551 --     If so, don't add it.
552 --     otherwise, add the keyword to the item.
553 --     Commit transaction if requested
554 --
555 --
556 --------------------------------------------------------------------------------
557 -- Start of comments
558 --    API name   : Delete_ItemKeyword
559 --    Type       : Public
560 --    Pre-reqs   : None
561 --    Function   : Remove the keywords passed in the array
562 --                 from the specified item.
566 --                        Default = FND_API.G_FALSE
563 --    Parameters :
564 --    IN           p_api_version                      NUMBER    Required
565 --                 p_init_msg_list                    VARCHAR2  Optional
567 --                 p_commit                           VARCHAR2  Optional
568 --                        Default = FND_API.G_FALSE
569 --                 p_check_login_user                 VARCHAR2  Optional
570 --                        Default = FND_API.G_TRUE
571 --                    Flag for checking user privilege and if user is login.
572 --                 p_item_id                          NUMBER    Required
573 --                    The item id to be add the keywords.
574 --                 p_keyword_varray                   AMV_CHAR_VARRAY_TYPE
575 --                                                              Required
576 --                    The keywords array
577 --    OUT        : x_return_status                    VARCHAR2
578 --                 x_msg_count                        NUMBER
579 --                 x_msg_data                         VARCHAR2
580 --    Notes      :
581 --
582 -- End of comments
583 --
584 PROCEDURE Delete_ItemKeyword
585 (
586     p_api_version       IN  NUMBER,
587     p_init_msg_list     IN  VARCHAR2 := FND_API.G_FALSE,
588     p_commit            IN  VARCHAR2 := FND_API.G_FALSE,
589     x_return_status     OUT NOCOPY  VARCHAR2,
590     x_msg_count         OUT NOCOPY  NUMBER,
591     x_msg_data          OUT NOCOPY  VARCHAR2,
592     p_check_login_user  IN  VARCHAR2 := FND_API.G_TRUE,
593     p_item_id           IN  NUMBER,
594     p_keyword_varray    IN  AMV_CHAR_VARRAY_TYPE
595 );
596 -- Algorithm:
597 --   BEGIN
598 --     Verify API version compatibility
599 --     Check that login user's status is active
600 --     IF user not active THEN
601 --       Return error 'user account currently suspended'
602 --     ENDIF
603 --     Check that user has administrative privileges
604 --     IF user not privileged THEN
605 --       Return error 'Administrative privileges required to perform'
606 --     ENDIF
607 --     check if this item id is in MES
608 --     IF not THEN
609 --         return error 'invalid item id';
610 --     END IF
611 --     Set rollback SAVEPOINT
612 --       Loop for each keyword in the passed array
613 --           remove the keyword from the item.
614 --     Commit transaction if requested
615 --
616 --------------------------------------------------------------------------------
617 -- Start of comments
618 --    API name   : Delete_ItemKeyword
619 --    Type       : Public
620 --    Pre-reqs   : None
621 --    Function   : Remove the passed keyword from the specified item.
622 --    Parameters :
623 --    IN           p_api_version                      NUMBER    Required
624 --                 p_init_msg_list                    VARCHAR2  Optional
625 --                        Default = FND_API.G_FALSE
626 --                 p_commit                           VARCHAR2  Optional
627 --                        Default = FND_API.G_FALSE
628 --                 p_check_login_user                 VARCHAR2  Optional
629 --                        Default = FND_API.G_TRUE
630 --                    Flag for checking user privilege and if user is login.
631 --                 p_item_id                          NUMBER    Required
632 --                    The id of the item to remove the keyword from.
633 --                 p_keyword                          VARCHAR2  Required
634 --                    The keyword to be removed.
635 --    OUT        : x_return_status                    VARCHAR2
636 --                 x_msg_count                        NUMBER
637 --                 x_msg_data                         VARCHAR2
638 --    Notes      :
639 --
640 -- End of comments
641 --
642 PROCEDURE Delete_ItemKeyword
643 (
644     p_api_version       IN  NUMBER,
645     p_init_msg_list     IN  VARCHAR2 := FND_API.G_FALSE,
646     p_commit            IN  VARCHAR2 := FND_API.G_FALSE,
647     x_return_status     OUT NOCOPY  VARCHAR2,
648     x_msg_count         OUT NOCOPY  NUMBER,
649     x_msg_data          OUT NOCOPY  VARCHAR2,
650     p_check_login_user  IN  VARCHAR2 := FND_API.G_TRUE,
651     p_item_id           IN  NUMBER,
652     p_keyword           IN  VARCHAR2
653 );
654 -- Algorithm:
655 --   BEGIN
656 --     Verify API version compatibility
657 --     Check that login user's status is active
658 --     IF user not active THEN
659 --       Return error 'user account currently suspended'
660 --     ENDIF
661 --     Check that user has administrative privileges
662 --     IF user not privileged THEN
663 --       Return error 'Administrative privileges required to perform'
664 --     ENDIF
665 --     check if this item id is in MES
666 --     IF not THEN
667 --         return error 'invalid item id';
668 --     END IF
669 --     Set rollback SAVEPOINT
670 --     remove the keyword from the item.
671 --     Commit transaction if requested
672 --
673 --------------------------------------------------------------------------------
674 -- Start of comments
675 --    API name   : Replace_ItemKeyword
676 --    Type       : Public
677 --    Pre-reqs   : None
678 --    Function   : Set the keywords of the specified item
679 --                 to the keywords passed in the array
680 --                 Effectively, this delete all the orignal keywords
681 --                 and add the passed keywords to the item.
685 --                        Default = FND_API.G_FALSE
682 --    Parameters :
683 --    IN           p_api_version                      NUMBER    Required
684 --                 p_init_msg_list                    VARCHAR2  Optional
686 --                 p_commit                           VARCHAR2  Optional
687 --                        Default = FND_API.G_FALSE
688 --                 p_check_login_user                 VARCHAR2  Optional
689 --                        Default = FND_API.G_TRUE
690 --                    Flag for checking user privilege and if user is login.
691 --                 p_item_id                          NUMBER    Required
692 --                    The item id to be add the keywords.
693 --                 p_keyword_varray                   AMV_CHAR_VARRAY_TYPE
694 --                                                              Required
695 --                    The keywords array
696 --    OUT        : x_return_status                    VARCHAR2
697 --                 x_msg_count                        NUMBER
698 --                 x_msg_data                         VARCHAR2
699 --    Notes      :
700 --
701 -- End of comments
702 --
703 PROCEDURE Replace_ItemKeyword
704 (
705     p_api_version       IN  NUMBER,
706     p_init_msg_list     IN  VARCHAR2 := FND_API.G_FALSE,
707     p_commit            IN  VARCHAR2 := FND_API.G_FALSE,
708     x_return_status     OUT NOCOPY  VARCHAR2,
709     x_msg_count         OUT NOCOPY  NUMBER,
710     x_msg_data          OUT NOCOPY  VARCHAR2,
711     p_check_login_user  IN  VARCHAR2 := FND_API.G_TRUE,
712     p_item_id           IN  NUMBER,
713     p_keyword_varray    IN  AMV_CHAR_VARRAY_TYPE
714 );
715 -- Algorithm:
716 --   BEGIN
717 --     Call delete_ItemKeyword to delete all the original keywords
718 --     Then call Add_ItemKeyword to add the keywords to the item.
719 --   END
720 --
721 --------------------------------------------------------------------------------
722 -- Start of comments
723 --    API name   : Get_ItemKeyword
724 --    Type       : Public
725 --    Pre-reqs   : None
726 --    Function   : Query and return all the keywords of the specified item
727 --    Parameters :
728 --    IN           p_api_version                      NUMBER    Required
729 --                 p_init_msg_list                    VARCHAR2  Optional
730 --                        Default = FND_API.G_FALSE
731 --                 p_check_login_user                 VARCHAR2  Optional
732 --                        Default = FND_API.G_TRUE
733 --                    Flag for checking user privilege and if user is login.
734 --                 p_item_id                          NUMBER    Required
735 --                    The item id to be add the keywords.
736 --    OUT        : x_return_status                    VARCHAR2
737 --                 x_msg_count                        NUMBER
738 --                 x_msg_data                         VARCHAR2
739 --                 x_keyword_varray                   AMV_CHAR_VARRAY_TYPE
740 --                    All the keywords of the item.
741 --    Notes      :
742 --
743 -- End of comments
744 --
745 PROCEDURE Get_ItemKeyword
746 (
747     p_api_version       IN  NUMBER,
748     p_init_msg_list     IN  VARCHAR2 := FND_API.G_FALSE,
749     x_return_status     OUT NOCOPY  VARCHAR2,
750     x_msg_count         OUT NOCOPY  NUMBER,
751     x_msg_data          OUT NOCOPY  VARCHAR2,
752     p_check_login_user  IN  VARCHAR2 := FND_API.G_TRUE,
753     p_item_id           IN  NUMBER,
754     x_keyword_varray    OUT NOCOPY  AMV_CHAR_VARRAY_TYPE
755 );
756 --
757 -- Algorithm:
758 --   BEGIN
759 --     Verify API version compatibility
760 --     Check that login user's status is active
761 --     IF user not active THEN
762 --       Return error 'user account currently suspended'
763 --     ENDIF
764 --     check if this item id is in MES
765 --     IF not THEN
766 --         return error 'invalid item id';
767 --     END IF
768 --     Query all the keywords belonged to the specified item
769 --     And return the results in the output array.
770 --
771 --------------------------------------------------------------------------------
772 ------------------------------ ITEM_AUTHOR -------------------------------------
773 -- Start of comments
774 --    API name   : Add_ItemAuthor
775 --    Type       : Public
776 --    Pre-reqs   : None
777 --    Function   : Add the authors passed in the array to the specified item.
778 --    Parameters :
779 --    IN           p_api_version                      NUMBER    Required
780 --                 p_init_msg_list                    VARCHAR2  Optional
781 --                        Default = FND_API.G_FALSE
782 --                 p_commit                           VARCHAR2  Optional
783 --                        Default = FND_API.G_FALSE
784 --                 p_check_login_user                 VARCHAR2  Optional
785 --                        Default = FND_API.G_TRUE
786 --                    Flag for checking user privilege and if user is login.
787 --                 p_item_id                          NUMBER    Required
788 --                    The item id to be add the authors.
789 --                 p_author_varray                    AMV_CHAR_VARRAY_TYPE
790 --                                                              Required
791 --                    The authors array
792 --    OUT        : x_return_status                    VARCHAR2
793 --                 x_msg_count                        NUMBER
797 -- End of comments
794 --                 x_msg_data                         VARCHAR2
795 --    Notes      :
796 --
798 --
799 PROCEDURE Add_ItemAuthor
800 (
801     p_api_version       IN  NUMBER,
802     p_init_msg_list     IN  VARCHAR2 := FND_API.G_FALSE,
803     p_commit            IN  VARCHAR2 := FND_API.G_FALSE,
804     x_return_status     OUT NOCOPY  VARCHAR2,
805     x_msg_count         OUT NOCOPY  NUMBER,
806     x_msg_data          OUT NOCOPY  VARCHAR2,
807     p_check_login_user  IN  VARCHAR2 := FND_API.G_TRUE,
808     p_item_id           IN  NUMBER,
809     p_author_varray     IN  AMV_CHAR_VARRAY_TYPE
810 );
811 -- Algorithm:
812 --   BEGIN
813 --     Verify API version compatibility
814 --     Check that login user's status is active
815 --     IF user not active THEN
816 --       Return error 'user account currently suspended'
817 --     ENDIF
818 --     Check that user has administrative privileges
819 --     IF user not privileged THEN
820 --       Return error 'Administrative privileges required to perform'
821 --     ENDIF
822 --     check if this item id is in MES
823 --     IF not THEN
824 --         return error 'invalid item id';
825 --     END IF
826 --     Set rollback SAVEPOINT
827 --       Loop for each author in the passed array
828 --           check if the author is already in the item.
829 --           If so, don't add it.
830 --           add the author to the item.
831 --     Commit transaction if requested
832 --
833 --------------------------------------------------------------------------------
834 -- Start of comments
835 --    API name   : Add_ItemAuthor
836 --    Type       : Public
837 --    Pre-reqs   : None
838 --    Function   : Add the specified author to the specified item.
839 --    Parameters :
840 --    IN           p_api_version                      NUMBER    Required
841 --                 p_init_msg_list                    VARCHAR2  Optional
842 --                        Default = FND_API.G_FALSE
843 --                 p_commit                           VARCHAR2  Optional
844 --                        Default = FND_API.G_FALSE
845 --                 p_check_login_user                 VARCHAR2  Optional
846 --                        Default = FND_API.G_TRUE
847 --                    Flag for checking user privilege and if user is login.
848 --                 p_item_id                          NUMBER    Required
849 --                    The item id to be add the authors.
850 --                 p_author                          VARCHAR2  Required
851 --                    The author to be added to the item.
852 --    OUT        : x_return_status                    VARCHAR2
853 --                 x_msg_count                        NUMBER
854 --                 x_msg_data                         VARCHAR2
855 --    Notes      :
856 --
857 -- End of comments
858 --
859 PROCEDURE Add_ItemAuthor
860 (
861     p_api_version       IN  NUMBER,
862     p_init_msg_list     IN  VARCHAR2 := FND_API.G_FALSE,
863     p_commit            IN  VARCHAR2 := FND_API.G_FALSE,
864     x_return_status     OUT NOCOPY  VARCHAR2,
865     x_msg_count         OUT NOCOPY  NUMBER,
866     x_msg_data          OUT NOCOPY  VARCHAR2,
867     p_check_login_user  IN  VARCHAR2 := FND_API.G_TRUE,
868     p_item_id           IN  NUMBER,
869     p_author            IN  VARCHAR2
870 );
871 -- Algorithm:
872 --   BEGIN
873 --     Verify API version compatibility
874 --     Check that login user's status is active
875 --     IF user not active THEN
876 --       Return error 'user account currently suspended'
877 --     ENDIF
878 --     Check that user has administrative privileges
879 --     IF user not privileged THEN
880 --       Return error 'Administrative privileges required to perform'
881 --     ENDIF
882 --     check if this item id is in MES
883 --     IF not THEN
884 --         return error 'invalid item id';
885 --     END IF
886 --     Set rollback SAVEPOINT
887 --     check if the author is in the item.
888 --     If so, don't add it.
889 --     otherwise, add the author to the item.
890 --     Commit transaction if requested
891 --
892 --------------------------------------------------------------------------------
893 -- Start of comments
894 --    API name   : Delete_ItemAuthor
895 --    Type       : Public
896 --    Pre-reqs   : None
897 --    Function   : Remove the authors passed in the array
898 --                 from the specified item.
899 --    Parameters :
900 --    IN           p_api_version                      NUMBER    Required
901 --                 p_init_msg_list                    VARCHAR2  Optional
902 --                        Default = FND_API.G_FALSE
903 --                 p_commit                           VARCHAR2  Optional
904 --                        Default = FND_API.G_FALSE
905 --                 p_check_login_user                 VARCHAR2  Optional
906 --                        Default = FND_API.G_TRUE
907 --                    Flag for checking user privilege and if user is login.
908 --                 p_item_id                          NUMBER    Required
909 --                    The item id to be add the authors.
910 --                 p_author_varray                    AMV_CHAR_VARRAY_TYPE
911 --                                                              Required
912 --                    The authors array
913 --    OUT        : x_return_status                    VARCHAR2
917 --
914 --                 x_msg_count                        NUMBER
915 --                 x_msg_data                         VARCHAR2
916 --    Notes      :
918 -- End of comments
919 --
920 PROCEDURE Delete_ItemAuthor
921 (
922     p_api_version       IN  NUMBER,
923     p_init_msg_list     IN  VARCHAR2 := FND_API.G_FALSE,
924     p_commit            IN  VARCHAR2 := FND_API.G_FALSE,
925     x_return_status     OUT NOCOPY  VARCHAR2,
926     x_msg_count         OUT NOCOPY  NUMBER,
927     x_msg_data          OUT NOCOPY  VARCHAR2,
928     p_check_login_user  IN  VARCHAR2 := FND_API.G_TRUE,
929     p_item_id           IN  NUMBER,
930     p_author_varray     IN  AMV_CHAR_VARRAY_TYPE
931 );
932 -- Algorithm:
933 --   BEGIN
934 --     Verify API version compatibility
935 --     Check that login user's status is active
936 --     IF user not active THEN
937 --       Return error 'user account currently suspended'
938 --     ENDIF
939 --     Check that user has administrative privileges
940 --     IF user not privileged THEN
941 --       Return error 'Administrative privileges required to perform'
942 --     ENDIF
943 --     check if this item id is in MES
944 --     IF not THEN
945 --         return error 'invalid item id';
946 --     END IF
947 --     Set rollback SAVEPOINT
948 --       Loop for each author in the passed array
949 --           remove the author from the item.
950 --     Commit transaction if requested
951 --
952 --------------------------------------------------------------------------------
953 -- Start of comments
954 --    API name   : Delete_ItemAuthor
955 --    Type       : Public
956 --    Pre-reqs   : None
957 --    Function   : Remove the passed author from the specified item.
958 --    Parameters :
959 --    IN           p_api_version                      NUMBER    Required
960 --                 p_init_msg_list                    VARCHAR2  Optional
961 --                        Default = FND_API.G_FALSE
962 --                 p_commit                           VARCHAR2  Optional
963 --                        Default = FND_API.G_FALSE
964 --                 p_check_login_user                 VARCHAR2  Optional
965 --                        Default = FND_API.G_TRUE
966 --                    Flag for checking user privilege and if user is login.
967 --                 p_item_id                          NUMBER    Required
968 --                    The item id to be add the author.
969 --                 p_author                           VARCHAR2  Required
970 --                    The author to be removed.
971 --    OUT        : x_return_status                    VARCHAR2
972 --                 x_msg_count                        NUMBER
973 --                 x_msg_data                         VARCHAR2
974 --    Notes      :
975 --
976 -- End of comments
977 --
978 PROCEDURE Delete_ItemAuthor
979 (
980     p_api_version       IN  NUMBER,
981     p_init_msg_list     IN  VARCHAR2 := FND_API.G_FALSE,
982     p_commit            IN  VARCHAR2 := FND_API.G_FALSE,
983     x_return_status     OUT NOCOPY  VARCHAR2,
984     x_msg_count         OUT NOCOPY  NUMBER,
985     x_msg_data          OUT NOCOPY  VARCHAR2,
986     p_check_login_user  IN  VARCHAR2 := FND_API.G_TRUE,
987     p_item_id           IN  NUMBER,
988     p_author            IN  VARCHAR2
989 );
990 -- Algorithm:
991 --   BEGIN
992 --     Verify API version compatibility
993 --     Check that login user's status is active
994 --     IF user not active THEN
995 --       Return error 'user account currently suspended'
996 --     ENDIF
997 --     Check that user has administrative privileges
998 --     IF user not privileged THEN
999 --       Return error 'Administrative privileges required to perform'
1000 --     ENDIF
1001 --     check if this item id is in MES
1002 --     IF not THEN
1003 --         return error 'invalid item id';
1004 --     END IF
1005 --     Set rollback SAVEPOINT
1006 --     remove the author from the item.
1007 --     Commit transaction if requested
1008 --
1009 --------------------------------------------------------------------------------
1010 -- Start of comments
1011 --    API name   : Replace_ItemAuthor
1012 --    Type       : Public
1013 --    Pre-reqs   : None
1014 --    Function   : Set the authors of the specified item
1015 --                 to the authors passed in the array
1016 --                 Effectively, this delete all the orignal authors
1017 --                 and add the passed authors to the item.
1018 --    Parameters :
1019 --    IN           p_api_version                      NUMBER    Required
1020 --                 p_init_msg_list                    VARCHAR2  Optional
1021 --                        Default = FND_API.G_FALSE
1022 --                 p_commit                           VARCHAR2  Optional
1023 --                        Default = FND_API.G_FALSE
1024 --                 p_check_login_user                 VARCHAR2  Optional
1025 --                        Default = FND_API.G_TRUE
1026 --                    Flag for checking user privilege and if user is login.
1027 --                 p_item_id                          NUMBER    Required
1028 --                    The item id to be add the authors.
1029 --                 p_author_varray                    AMV_CHAR_VARRAY_TYPE
1030 --                                                              Required
1031 --                    The authors array
1032 --    OUT        : x_return_status                    VARCHAR2
1036 --
1033 --                 x_msg_count                        NUMBER
1034 --                 x_msg_data                         VARCHAR2
1035 --    Notes      :
1037 -- End of comments
1038 --
1039 PROCEDURE Replace_ItemAuthor
1040 (
1041     p_api_version       IN  NUMBER,
1042     p_init_msg_list     IN  VARCHAR2 := FND_API.G_FALSE,
1043     p_commit            IN  VARCHAR2 := FND_API.G_FALSE,
1044     x_return_status     OUT NOCOPY  VARCHAR2,
1045     x_msg_count         OUT NOCOPY  NUMBER,
1046     x_msg_data          OUT NOCOPY  VARCHAR2,
1047     p_check_login_user  IN  VARCHAR2 := FND_API.G_TRUE,
1048     p_item_id           IN  NUMBER,
1049     p_author_varray     IN  AMV_CHAR_VARRAY_TYPE
1050 );
1051 -- Algorithm:
1052 --   BEGIN
1053 --     Call delete_ItemAuthor to delete all the original authors
1054 --     Then call Add_ItemAuthor to add the authors to the item.
1055 --   END
1056 --
1057 --------------------------------------------------------------------------------
1058 -- Start of comments
1059 --    API name   : Get_ItemAuthor
1060 --    Type       : Public
1061 --    Pre-reqs   : None
1062 --    Function   : Query and return all the authors of the specified item
1063 --    Parameters :
1064 --    IN           p_api_version                      NUMBER    Required
1065 --                 p_init_msg_list                    VARCHAR2  Optional
1066 --                        Default = FND_API.G_FALSE
1067 --                 p_check_login_user                 VARCHAR2  Optional
1068 --                        Default = FND_API.G_TRUE
1069 --                    Flag for checking user privilege and if user is login.
1070 --                 p_item_id                          NUMBER    Required
1071 --                    The item id to be add the authors.
1072 --    OUT        : x_return_status                    VARCHAR2
1073 --                 x_msg_count                        NUMBER
1074 --                 x_msg_data                         VARCHAR2
1075 --                 x_author_varray                    AMV_CHAR_VARRAY_TYPE
1076 --                    All the authors of the item.
1077 --    Notes      :
1078 --
1079 -- End of comments
1080 --
1081 PROCEDURE Get_ItemAuthor
1082 (
1083     p_api_version       IN  NUMBER,
1084     p_init_msg_list     IN  VARCHAR2 := FND_API.G_FALSE,
1085     x_return_status     OUT NOCOPY  VARCHAR2,
1086     x_msg_count         OUT NOCOPY  NUMBER,
1087     x_msg_data          OUT NOCOPY  VARCHAR2,
1088     p_check_login_user  IN  VARCHAR2 := FND_API.G_TRUE,
1089     p_item_id           IN  NUMBER,
1090     x_author_varray     OUT NOCOPY  AMV_CHAR_VARRAY_TYPE
1091 );
1092 --
1093 -- Algorithm:
1094 --   BEGIN
1095 --     Verify API version compatibility
1096 --     Check that login user's status is active
1097 --     IF user not active THEN
1098 --       Return error 'user account currently suspended'
1099 --     ENDIF
1100 --     check if this item id is in MES
1101 --     IF not THEN
1102 --         return error 'invalid item id';
1103 --     END IF
1104 --     Query all the authors belonged to the specified item
1105 --     And return the results in the output array.
1106 --
1107 --------------------------------------------------------------------------------
1108 --------------------------------- ITEM_FILE ------------------------------------
1109 -- Start of comments
1110 --    API name   : Add_ItemFile
1111 --    Type       : Public
1112 --    Pre-reqs   : None
1113 --    Function   : Add the files passed in the id array to the specified item.
1114 --    Parameters :
1115 --    IN           p_api_version                      NUMBER    Required
1116 --                 p_init_msg_list                    VARCHAR2  Optional
1117 --                        Default = FND_API.G_FALSE
1118 --                 p_commit                           VARCHAR2  Optional
1119 --                        Default = FND_API.G_FALSE
1120 --                 p_check_login_user                 VARCHAR2  Optional
1121 --                        Default = FND_API.G_TRUE
1122 --                    Flag for checking user privilege and if user is login.
1123 --                 p_application_id                   NUMBER    Optional
1124 --                    The id of application that attaches the file to item.
1125 --                     Default to AMV_UTILITY_PVT.G_AMV_APP_ID (520)
1126 --                 p_item_id                          NUMBER    Required
1127 --                    The item id to be add the files.
1128 --                 p_file_id_varray                   AMV_NUMBER_VARRAY_TYPE
1129 --                                                              Required
1130 --                    The file ids array
1131 --    OUT        : x_return_status                    VARCHAR2
1132 --                 x_msg_count                        NUMBER
1133 --                 x_msg_data                         VARCHAR2
1134 --    Notes      :
1135 --
1136 -- End of comments
1137 --
1138 PROCEDURE Add_ItemFile
1139 (
1140     p_api_version       IN  NUMBER,
1141     p_init_msg_list     IN  VARCHAR2 := FND_API.G_FALSE,
1142     p_commit            IN  VARCHAR2 := FND_API.G_FALSE,
1143     x_return_status     OUT NOCOPY  VARCHAR2,
1144     x_msg_count         OUT NOCOPY  NUMBER,
1145     x_msg_data          OUT NOCOPY  VARCHAR2,
1146     p_check_login_user  IN  VARCHAR2 := FND_API.G_TRUE,
1147     p_application_id    IN  NUMBER := AMV_UTILITY_PVT.G_AMV_APP_ID,
1148     p_item_id           IN  NUMBER,
1149     p_file_id_varray    IN  AMV_NUMBER_VARRAY_TYPE
1150 );
1151 -- Algorithm:
1155 --     IF user not active THEN
1152 --   BEGIN
1153 --     Verify API version compatibility
1154 --     Check that login user's status is active
1156 --       Return error 'user account currently suspended'
1157 --     ENDIF
1158 --     Check that user has administrative privileges
1159 --     IF user not privileged THEN
1160 --       Return error 'Administrative privileges required to perform'
1161 --     ENDIF
1162 --     check if this item id is in MES
1163 --     IF not THEN
1164 --         return error 'invalid item id';
1165 --     END IF
1166 --     Set rollback SAVEPOINT
1167 --       Loop for each file id in the passed array
1168 --           check if the file id is already in the item.
1169 --           If so, don't add it.
1170 --           otherwise, add the file to the item.
1171 --     Commit transaction if requested
1172 --
1173 --------------------------------------------------------------------------------
1174 -- Start of comments
1175 --    API name   : Add_ItemFile
1176 --    Type       : Public
1177 --    Pre-reqs   : None
1178 --    Function   : Add the specified file to the specified item.
1179 --    Parameters :
1180 --    IN           p_api_version                      NUMBER    Required
1181 --                 p_init_msg_list                    VARCHAR2  Optional
1182 --                        Default = FND_API.G_FALSE
1183 --                 p_commit                           VARCHAR2  Optional
1184 --                        Default = FND_API.G_FALSE
1185 --                 p_check_login_user                 VARCHAR2  Optional
1186 --                        Default = FND_API.G_TRUE
1187 --                    Flag for checking user privilege and if user is login.
1188 --                 p_application_id                   NUMBER    Optional
1189 --                    The id of application that attaches the file to item.
1190 --                     Default to AMV_UTILITY_PVT.G_AMV_APP_ID (520)
1191 --                 p_item_id                          NUMBER    Required
1192 --                    The id of the item to be add the file to.
1193 --                 p_file_id                          NUMBER    Required
1194 --                    The id of the file to be added to the item.
1195 --    OUT        : x_return_status                    VARCHAR2
1196 --                 x_msg_count                        NUMBER
1197 --                 x_msg_data                         VARCHAR2
1198 --    Notes      :
1199 --
1200 -- End of comments
1201 --
1202 PROCEDURE Add_ItemFile
1203 (
1204     p_api_version       IN  NUMBER,
1205     p_init_msg_list     IN  VARCHAR2 := FND_API.G_FALSE,
1206     p_commit            IN  VARCHAR2 := FND_API.G_FALSE,
1207     x_return_status     OUT NOCOPY  VARCHAR2,
1208     x_msg_count         OUT NOCOPY  NUMBER,
1209     x_msg_data          OUT NOCOPY  VARCHAR2,
1210     p_check_login_user  IN  VARCHAR2 := FND_API.G_TRUE,
1211     p_application_id    IN  NUMBER := AMV_UTILITY_PVT.G_AMV_APP_ID,
1212     p_item_id           IN  NUMBER,
1213     p_file_id           IN  NUMBER
1214 );
1215 -- Algorithm:
1216 --   BEGIN
1217 --     Verify API version compatibility
1218 --     Check that login user's status is active
1219 --     IF user not active THEN
1220 --       Return error 'user account currently suspended'
1221 --     ENDIF
1222 --     Check that user has administrative privileges
1223 --     IF user not privileged THEN
1224 --       Return error 'Administrative privileges required to perform'
1225 --     ENDIF
1226 --     check if this item id is in MES
1227 --     IF not THEN
1228 --         return error 'invalid item id';
1229 --     END IF
1230 --     Set rollback SAVEPOINT
1231 --     check if the file is in the item.
1232 --     If so, don't add it.
1233 --     otherwise, add the file to the item.
1234 --     Commit transaction if requested
1235 --
1236 --
1237 --------------------------------------------------------------------------------
1238 -- Start of comments
1239 --    API name   : Delete_ItemFile
1240 --    Type       : Public
1241 --    Pre-reqs   : None
1242 --    Function   : Remove the files passed in the array
1243 --                 from the specified item.
1244 --    Parameters :
1245 --    IN           p_api_version                      NUMBER    Required
1246 --                 p_init_msg_list                    VARCHAR2  Optional
1247 --                        Default = FND_API.G_FALSE
1248 --                 p_commit                           VARCHAR2  Optional
1249 --                        Default = FND_API.G_FALSE
1250 --                 p_check_login_user                 VARCHAR2  Optional
1251 --                        Default = FND_API.G_TRUE
1252 --                    Flag for checking user privilege and if user is login.
1253 --                 p_item_id                          NUMBER    Required
1254 --                    The id of the item to be add the files to.
1255 --                 p_file_id_varray                   AMV_NUMBER_VARRAY_TYPE
1256 --                                                              Required
1257 --                    The file id array
1258 --    OUT        : x_return_status                    VARCHAR2
1259 --                 x_msg_count                        NUMBER
1260 --                 x_msg_data                         VARCHAR2
1261 --    Notes      :
1262 --
1263 -- End of comments
1264 --
1265 PROCEDURE Delete_ItemFile
1266 (
1267     p_api_version       IN  NUMBER,
1268     p_init_msg_list     IN  VARCHAR2 := FND_API.G_FALSE,
1269     p_commit            IN  VARCHAR2 := FND_API.G_FALSE,
1273     p_check_login_user  IN  VARCHAR2 := FND_API.G_TRUE,
1270     x_return_status     OUT NOCOPY  VARCHAR2,
1271     x_msg_count         OUT NOCOPY  NUMBER,
1272     x_msg_data          OUT NOCOPY  VARCHAR2,
1274     p_item_id           IN  NUMBER,
1275     p_file_id_varray    IN  AMV_NUMBER_VARRAY_TYPE
1276 );
1277 -- Algorithm:
1278 --   BEGIN
1279 --     Verify API version compatibility
1280 --     Check that login user's status is active
1281 --     IF user not active THEN
1282 --       Return error 'user account currently suspended'
1283 --     ENDIF
1284 --     Check that user has administrative privileges
1285 --     IF user not privileged THEN
1286 --       Return error 'Administrative privileges required to perform'
1287 --     ENDIF
1288 --     check if this item id is in MES
1289 --     IF not THEN
1290 --         return error 'invalid item id';
1291 --     END IF
1292 --     Set rollback SAVEPOINT
1293 --       Loop for each file id in the passed array
1294 --           remove the file from the item.
1295 --     Commit transaction if requested
1296 --
1297 --------------------------------------------------------------------------------
1298 -- Start of comments
1299 --    API name   : Delete_ItemFile
1300 --    Type       : Public
1301 --    Pre-reqs   : None
1302 --    Function   : Remove the passed file from the specified item.
1303 --    Parameters :
1304 --    IN           p_api_version                      NUMBER    Required
1305 --                 p_init_msg_list                    VARCHAR2  Optional
1306 --                        Default = FND_API.G_FALSE
1307 --                 p_commit                           VARCHAR2  Optional
1308 --                        Default = FND_API.G_FALSE
1309 --                 p_check_login_user                 VARCHAR2  Optional
1310 --                        Default = FND_API.G_TRUE
1311 --                    Flag for checking user privilege and if user is login.
1312 --                 p_item_id                          NUMBER    Required
1313 --                    The id of item to remove the file from.
1314 --                 p_file_id                          NUMBER    Required
1315 --                    The file to be removed.
1316 --    OUT        : x_return_status                    VARCHAR2
1317 --                 x_msg_count                        NUMBER
1318 --                 x_msg_data                         VARCHAR2
1319 --    Notes      :
1320 --
1321 -- End of comments
1322 --
1323 PROCEDURE Delete_ItemFile
1324 (
1325     p_api_version       IN  NUMBER,
1326     p_init_msg_list     IN  VARCHAR2 := FND_API.G_FALSE,
1327     p_commit            IN  VARCHAR2 := FND_API.G_FALSE,
1328     x_return_status     OUT NOCOPY  VARCHAR2,
1329     x_msg_count         OUT NOCOPY  NUMBER,
1330     x_msg_data          OUT NOCOPY  VARCHAR2,
1331     p_check_login_user  IN  VARCHAR2 := FND_API.G_TRUE,
1332     p_item_id           IN  NUMBER,
1333     p_file_id           IN  NUMBER
1334 );
1335 -- Algorithm:
1336 --   BEGIN
1337 --     Verify API version compatibility
1338 --     Check that login user's status is active
1339 --     IF user not active THEN
1340 --       Return error 'user account currently suspended'
1341 --     ENDIF
1342 --     Check that user has administrative privileges
1343 --     IF user not privileged THEN
1344 --       Return error 'Administrative privileges required to perform'
1345 --     ENDIF
1346 --     check if this item id is in MES
1347 --     IF not THEN
1348 --         return error 'invalid item id';
1349 --     END IF
1350 --     Set rollback SAVEPOINT
1351 --     remove the file from the item.
1352 --     Commit transaction if requested
1353 --
1354 --------------------------------------------------------------------------------
1355 -- Start of comments
1356 --    API name   : Replace_ItemFile
1357 --    Type       : Public
1358 --    Pre-reqs   : None
1359 --    Function   : Set the files of the specified item
1360 --                 to the files passed in the array
1361 --                 Effectively, this delete all the orignal files
1362 --                 and add the passed files to the item.
1363 --    Parameters :
1364 --    IN           p_api_version                      NUMBER    Required
1365 --                 p_init_msg_list                    VARCHAR2  Optional
1366 --                        Default = FND_API.G_FALSE
1367 --                 p_commit                           VARCHAR2  Optional
1368 --                        Default = FND_API.G_FALSE
1369 --                 p_check_login_user                 VARCHAR2  Optional
1370 --                        Default = FND_API.G_TRUE
1371 --                    Flag for checking user privilege and if user is login.
1372 --                 p_item_id                          NUMBER    Required
1373 --                    The id of item to remove the file from.
1374 --                 p_file_id_varray                   AMV_NUMBER_VARRAY_TYPE
1375 --                                                              Required
1376 --                    The files id array which will replace the original files.
1377 --    OUT        : x_return_status                    VARCHAR2
1378 --                 x_msg_count                        NUMBER
1379 --                 x_msg_data                         VARCHAR2
1380 --    Notes      :
1381 --
1382 -- End of comments
1383 --
1384 PROCEDURE Replace_ItemFile
1385 (
1386     p_api_version       IN  NUMBER,
1387     p_init_msg_list     IN  VARCHAR2 := FND_API.G_FALSE,
1391     x_msg_data          OUT NOCOPY  VARCHAR2,
1388     p_commit            IN  VARCHAR2 := FND_API.G_FALSE,
1389     x_return_status     OUT NOCOPY  VARCHAR2,
1390     x_msg_count         OUT NOCOPY  NUMBER,
1392     p_check_login_user  IN  VARCHAR2 := FND_API.G_TRUE,
1393     p_item_id           IN  NUMBER,
1394     p_file_id_varray    IN  AMV_NUMBER_VARRAY_TYPE
1395 );
1396 -- Algorithm:
1397 --   BEGIN
1398 --     Call delete_ItemFile to delete all the original files
1399 --     Then call Add_ItemFile to add the files to the item.
1400 --   END
1401 --
1402 --------------------------------------------------------------------------------
1403 -- Start of comments
1404 --    API name   : Get_ItemFile
1405 --    Type       : Public
1406 --    Pre-reqs   : None
1407 --    Function   : Query and return all the files of the specified item
1408 --    Parameters :
1409 --    IN           p_api_version                      NUMBER    Required
1410 --                 p_init_msg_list                    VARCHAR2  Optional
1411 --                        Default = FND_API.G_FALSE
1412 --                 p_check_login_user                 VARCHAR2  Optional
1413 --                        Default = FND_API.G_TRUE
1414 --                    Flag for checking user privilege and if user is login.
1415 --                 p_item_id                          NUMBER    Required
1416 --                    The item id to be add the files.
1417 --    OUT        : x_return_status                    VARCHAR2
1418 --                 x_msg_count                        NUMBER
1419 --                 x_msg_data                         VARCHAR2
1420 --                 x_file_id_varray                   AMV_NUMBER_VARRAY_TYPE
1421 --                    file id array for all the files of the item.
1422 --    Notes      :
1423 --
1424 -- End of comments
1425 --
1426 PROCEDURE Get_ItemFile
1427 (
1428     p_api_version       IN  NUMBER,
1429     p_init_msg_list     IN  VARCHAR2 := FND_API.G_FALSE,
1430     x_return_status     OUT NOCOPY  VARCHAR2,
1431     x_msg_count         OUT NOCOPY  NUMBER,
1432     x_msg_data          OUT NOCOPY  VARCHAR2,
1433     p_check_login_user  IN  VARCHAR2 := FND_API.G_TRUE,
1434     p_item_id           IN  NUMBER,
1435     x_file_id_varray    OUT NOCOPY  AMV_NUMBER_VARRAY_TYPE
1436 );
1437 --
1438 -- Algorithm:
1439 --   BEGIN
1440 --     Verify API version compatibility
1441 --     Check that login user's status is active
1442 --     IF user not active THEN
1443 --       Return error 'user account currently suspended'
1444 --     ENDIF
1445 --     check if this item id is in MES
1446 --     IF not THEN
1447 --         return error 'invalid item id';
1448 --     END IF
1449 --     Query all the files belonged to the specified item
1450 --     And return the results in the output array.
1451 --
1452 --------------------------------------------------------------------------------
1453 --------------------------------------------------------------------------------
1454 -- Start of comments
1455 --    API name   : Get_UserMessage
1456 --    Type       : Public
1457 --    Pre-reqs   : None
1458 --    Function   : return all the messages(id and name) for the specified user.
1459 --    Parameters :
1460 --    IN           p_api_version                      NUMBER    Required
1461 --                 p_init_msg_list                    VARCHAR2  Optional
1462 --                        Default = FND_API.G_FALSE
1463 --                 p_check_login_user                 VARCHAR2  Optional
1464 --                        Default = FND_API.G_TRUE
1465 --                    Flag for checking user privilege and if user is login.
1466 --                 p_user_id                          NUMBER    Required
1467 --                    The should be the resource id.
1468 --    OUT        : x_return_status                    VARCHAR2
1469 --                 x_msg_count                        NUMBER
1470 --                 x_msg_data                         VARCHAR2
1471 --                 x_item_id_varray                   AMV_NUMBER_VARRAY_TYPE
1472 --                 x_message_varray                   AMV_CHAR_VARRAY_TYPE
1473 --    Notes      :
1474 --
1475 -- End of comments
1476 --
1477 PROCEDURE Get_UserMessage
1478 (
1479     p_api_version       IN  NUMBER,
1480     p_init_msg_list     IN  VARCHAR2 := FND_API.G_FALSE,
1481     x_return_status     OUT NOCOPY  VARCHAR2,
1482     x_msg_count         OUT NOCOPY  NUMBER,
1483     x_msg_data          OUT NOCOPY  VARCHAR2,
1484     p_check_login_user  IN  VARCHAR2 := FND_API.G_TRUE,
1485     p_user_id           IN  NUMBER,
1486     x_item_id_varray    OUT NOCOPY  AMV_NUMBER_VARRAY_TYPE,
1487     x_message_varray    OUT NOCOPY  AMV_CHAR_VARRAY_TYPE
1488 );
1489 --
1490 --------------------------------------------------------------------------------
1491 -- Start of comments
1492 --    API name   : Get_UserMessage2
1493 --    Type       : Public
1494 --    Pre-reqs   : None
1495 --    Function   : return all the messages(all info) for the specified user.
1496 --    Parameters :
1497 --    IN           p_api_version                      NUMBER    Required
1498 --                 p_init_msg_list                    VARCHAR2  Optional
1499 --                        Default = FND_API.G_FALSE
1500 --                 p_check_login_user                 VARCHAR2  Optional
1501 --                        Default = FND_API.G_TRUE
1502 --                    Flag for checking user privilege and if user is login.
1503 --                 p_user_id                          NUMBER    Required
1507 --                 x_msg_data                         VARCHAR2
1504 --                    The should be the resource id.
1505 --    OUT        : x_return_status                    VARCHAR2
1506 --                 x_msg_count                        NUMBER
1508 --                 x_item_varray                      AMV_SIMPLE_ITEM_OBJ_VARRAY
1509 --    Notes      :
1510 --
1511 -- End of comments
1512 --
1513 PROCEDURE Get_UserMessage2
1514 (
1515     p_api_version       IN  NUMBER,
1516     p_init_msg_list     IN  VARCHAR2 := FND_API.G_FALSE,
1517     x_return_status     OUT NOCOPY  VARCHAR2,
1518     x_msg_count         OUT NOCOPY  NUMBER,
1519     x_msg_data          OUT NOCOPY  VARCHAR2,
1520     p_check_login_user  IN  VARCHAR2 := FND_API.G_TRUE,
1521     p_user_id           IN  NUMBER,
1522     x_item_varray       OUT NOCOPY  AMV_SIMPLE_ITEM_OBJ_VARRAY
1523 );
1524 --------------------------------------------------------------------------------
1525 --------------------------------------------------------------------------------
1526 -- Start of comments
1527 --    API name   : Get_ChannelsPerItem
1528 --    Type       : Public
1529 --    Pre-reqs   : None
1530 --    Function   : Query and return all the channels matched the specified item
1531 --    Parameters :
1532 --    IN           p_api_version                      NUMBER    Required
1533 --                 p_init_msg_list                    VARCHAR2  Optional
1534 --                        Default = FND_API.G_FALSE
1535 --                 p_check_login_user                 VARCHAR2  Optional
1536 --                        Default = FND_API.G_TRUE
1537 --                    Flag for checking user privilege and if user is login.
1538 --			    p_match_type				    VARCHAR2  Optional
1539 --                 p_item_id                          NUMBER    Required
1540 --                    The item id to be add the files.
1541 --    OUT        : x_return_status                    VARCHAR2
1542 --                 x_msg_count                        NUMBER
1543 --                 x_msg_data                         VARCHAR2
1544 --                 x_channel_array                    AMV_NAMEID_VARRAY_TYPE
1545 --                    file id array for all the files of the item.
1546 --    Notes      :
1547 --
1548 -- End of comments
1549 --
1550 PROCEDURE Get_ChannelsPerItem
1551 (
1552     p_api_version       IN  NUMBER,
1553     p_init_msg_list     IN  VARCHAR2 := FND_API.G_FALSE,
1554     x_return_status     OUT NOCOPY  VARCHAR2,
1555     x_msg_count         OUT NOCOPY  NUMBER,
1556     x_msg_data          OUT NOCOPY  VARCHAR2,
1557     p_check_login_user  IN  VARCHAR2 := FND_API.G_TRUE,
1558     p_item_id           IN  NUMBER,
1559     p_match_type	    IN  VARCHAR2 := FND_API.G_MISS_CHAR,
1560     x_channel_array     OUT NOCOPY  AMV_NAMEID_VARRAY_TYPE
1561 );
1562 --
1563 -- Algorithm:
1564 --   BEGIN
1565 --
1566 --------------------------------------------------------------------------------
1567 --------------------------------------------------------------------------------
1568 --
1569 END amv_item_pub;