DBA Data[Home] [Help]

PACKAGE: APPS.CZ_CF_API

Source


1 PACKAGE CZ_CF_API AUTHID CURRENT_USER AS
2 /*      $Header: czcfapis.pls 120.8.12020000.2 2012/08/17 14:45:35 smanna ship $  */
3 /*#
4  * This package provides procedures and functions to perform various operations on configurations.
5  * @rep:scope public
6  * @rep:product CZ
7  * @rep:displayname Configuration API
8  * @rep:lifecycle active
9  * @rep:compatibility S
10  * @rep:category BUSINESS_ENTITY CZ_MODEL_PUB
11  * @rep:category BUSINESS_ENTITY CZ_CONFIG
12  */
13 
14 -- batch validation operation code
15 BV_OPERATION_UPDATE  CONSTANT  NUMBER := 1;
16 BV_OPERATION_DELETE  CONSTANT  NUMBER := 2;
17 BV_OPERATION_INSERT  CONSTANT  NUMBER := 3;
18 BV_OPERATION_REVERT  CONSTANT  NUMBER := 4;
19 
20 -- seeded ui def
21 NATIVEBOM_UI_DEF     CONSTANT  NUMBER := 101;
22 
23 TYPE config_item_rec_type IS RECORD
24   (config_item_id cz_config_items.config_item_id%TYPE
25   ,component_code cz_config_items.node_identifier%TYPE
26   ,sequence_nbr   cz_config_items.sequence_nbr%TYPE
27   ,operation      number
28   ,quantity       cz_config_items.item_num_val%TYPE
29   ,instance_name  cz_config_items.name%TYPE
30   ,location_id    cz_config_items.location_id%TYPE
31   ,location_type_code  cz_config_items.location_type_code%TYPE
32   );
33 
34 TYPE config_ext_attr_rec_type IS RECORD
35   (config_item_id  cz_config_ext_attributes.config_item_id%TYPE
36   ,component_code  VARCHAR2(1200)
37   ,sequence_nbr    NUMBER
38   ,attribute_name  cz_config_ext_attributes.attribute_name%TYPE
39   ,attribute_group cz_config_ext_attributes.attribute_group%TYPE
40   ,attribute_value cz_config_ext_attributes.attribute_value%TYPE
41   );
42 
43 TYPE config_item_tbl_type IS TABLE OF config_item_rec_type
44        INDEX BY BINARY_INTEGER;
45 
46 TYPE config_ext_attr_tbl_type IS TABLE OF config_ext_attr_rec_type
47        INDEX BY BINARY_INTEGER;
48 
49 TYPE INPUT_SELECTION IS RECORD(component_code  varchar2(1200),
50                                quantity   number,
51                                input_seq  number,
52                                config_item_id number default NULL);
53 
54 TYPE CFG_INPUT_LIST IS table of INPUT_SELECTION index by binary_integer;
55 
56 SUBTYPE CFG_OUTPUT_PIECES IS UTL_HTTP.HTML_PIECES;
57 
58 TYPE NUMBER_TBL_TYPE IS table of NUMBER;
59 TYPE DATE_TBL_TYPE IS table of DATE;
60 TYPE VARCHAR2_TBL_TYPE IS table of VARCHAR2(255);
61 
62 TYPE NUMBER_TBL_INDEXBY_TYPE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
63 TYPE DATE_TBL_INDEXBY_TYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER;
64 TYPE NUMBER_TBL_INDEXBY_CHAR_TYPE IS TABLE OF NUMBER INDEX BY VARCHAR2(15);
65 --------------------------------------------------------------------------------------------
66 
67 INIT_MESSAGE_LIMIT            constant NUMBER := 8096;
68 
69 --------------------------Validation status return codes----------------------------------
70 CONFIG_PROCESSED              constant NUMBER :=0;
71 CONFIG_PROCESSED_NO_TERMINATE constant NUMBER :=1;
72 INIT_TOO_LONG                 constant NUMBER :=2;
73 INVALID_OPTION_REQUEST        constant NUMBER :=3;
74 CONFIG_EXCEPTION              constant NUMBER :=4;
75 DATABASE_ERROR                constant NUMBER :=5;
76 UTL_HTTP_INIT_FAILED          constant NUMBER :=6;
77 UTL_HTTP_REQUEST_FAILED       constant NUMBER :=7;
78 --vsingava 14th Jul '09 bug7674190
79 -- CZ_CF_API would never use this. status code '8' is thrown by
80 -- CZ_BATCH_VALIDATE package if the hosting applications still calls the older version
81 -- INVALID_VALIDATION_TYPE       constant NUMBER :=8;
82 
83 INVALID_ALTBATCHVALIDATE_URL  constant NUMBER :=9;
84 ------------------------------------------------------------------------------------------
85 
86 /*#
87  * This procedure copies a configuration in the database. It cannot be used to copy networked configuration models.
88  * If the NEW_CONFIG_FLAG is 1, then a new CONFIG_HDR_ID value is generated for the new configuration and it has a
89  * CONFIG_REV_NBR of 1. If NEW_CONFIG_FLAG is 0, the copy keeps the CONFIG_HDR_ID and has a CONFIG_REV_NBR
90  * incremented to be greater than the original.
91  * @param config_hdr_id Configuration header ID
92  * @param config_rev_nbr Configuration revision number
93  * @param new_config_flag A value of '1' indicates that the copied configuration should have a new CONFIG_HDR_ID.
94  *                        A value of '0' creates a new revision of the existing configuration.  This new revision
95  *                        will have the same CONFIG_HDR_ID as the original and a unique CONFIG_REV_NBR.
96  * @param out_config_hdr_id Configuration header ID of the new copy of the configuration.
97  * @param out_config_rev_nbr Configuration revision number of the new copy of the configuration.
98  * @param error_message If there is an error in the procedure execution, this field contains a message describing the error.
99  * @param return_value If the return value is 1, then the configuration was successfully copied. If the return value is 0,
100  *                     then the copy of the configuration failed.
101  * @param handle_deleted_flag When '0', it will undelete the copied configuration if the original configuration is deleted.
102  * @param new_name Applies a new name for the configuration.
103  * @rep:scope public
104  * @rep:lifecycle active
105  * @rep:displayname Copy Configuration
106  * @rep:category BUSINESS_ENTITY CZ_CONFIG
107  */
108 PROCEDURE copy_configuration(config_hdr_id       IN  NUMBER,
109                              config_rev_nbr      IN  NUMBER,
110                              new_config_flag     IN  VARCHAR2,
111                              out_config_hdr_id   IN OUT NOCOPY NUMBER,
112                              out_config_rev_nbr  IN OUT NOCOPY NUMBER,
113                              error_message       IN OUT NOCOPY VARCHAR2,
114                              return_value        IN OUT NOCOPY NUMBER,
115                              handle_deleted_flag IN  VARCHAR2 DEFAULT NULL,
116                              new_name            IN  VARCHAR2 DEFAULT NULL);
117 ------------------------------------------------------------------------------------------
118 
119 /*#
120  * This procedure runs COPY_CONFIGURATION within an autonomous transaction.
121  * If the copy is successful, new data will be committed to the database without affecting the caller's transaction.
122  * See COPY_CONFIGURATION documentation for more details.
123  * @param config_hdr_id Configuration header ID
124  * @param config_rev_nbr Configuration revision number
125  * @param new_config_flag A value of '1' indicates that the copied configuration should have a new CONFIG_HDR_ID.
126  *                        A value of '0' creates a new revision of the existing configuration.  This new revision
127  *                        will have the same CONFIG_HDR_ID as the original and a unique CONFIG_REV_NBR.
128  * @param out_config_hdr_id Configuration header ID of the new copy of the configuration.
129  * @param out_config_rev_nbr Configuration revision number of the new copy of the configuration.
130  * @param error_message If there is an error in the procedure execution, this field contains a message describing the error.
131  * @param return_value If the return value is 1, then the configuration was successfully copied. If the return value is 0,
132  *                     then the copy of the configuration failed.
133  * @param handle_deleted_flag When '0', it will undelete the copied configuration if the original configuration is deleted.
134  * @param new_name Applies a new name for the configuration.
135  * @rep:scope public
136  * @rep:lifecycle active
137  * @rep:displayname Copy Configuration
138  * @rep:category BUSINESS_ENTITY CZ_CONFIG
139  */
140 PROCEDURE copy_configuration_auto(config_hdr_id  IN  NUMBER,
141                              config_rev_nbr      IN  NUMBER,
142                              new_config_flag     IN  VARCHAR2,
143                              out_config_hdr_id   IN OUT NOCOPY NUMBER,
144                              out_config_rev_nbr  IN OUT NOCOPY NUMBER,
145                              Error_message       IN OUT NOCOPY VARCHAR2,
146                              Return_value        IN OUT NOCOPY NUMBER,
147                              handle_deleted_flag IN  VARCHAR2 DEFAULT NULL,
148                              new_name            IN  VARCHAR2 DEFAULT NULL);
149 ---------------------------------------------------------------------------------------
150 
151 /*#
152  * This procedure removes a configuration from the database.
153  * @param config_hdr_id Specifies the header ID of the configuration to be deleted.
154  * @param config_rev_nbr Specifies the revision number of the configuration to be deleted.
155  * @param usage_exists This returns 1 if a configuration usage record exists and the configuration is not deleted.
156  *                     Note that configuration usages are obsolete.
157  * @param error_message If there is an error, this field contains a message describing the error.
158  * @param return_value If the return value is 1, then the configuration was successfully deleted.
159  *                     If the return value is 0, then the deletion of the configuration failed.
160  * @rep:scope public
161  * @rep:lifecycle active
162  * @rep:displayname Delete Configuration
163  * @rep:category BUSINESS_ENTITY CZ_CONFIG
164  */
165 PROCEDURE delete_configuration(config_hdr_id  IN  NUMBER,
166                                config_rev_nbr IN  NUMBER,
167                                usage_exists   IN OUT NOCOPY NUMBER,
168                                Error_message  IN OUT NOCOPY VARCHAR2,
169                                Return_value   IN OUT NOCOPY NUMBER);
170 ------------------------------------------------------------------------------------------
171 
172 /*#
173  * Deletes a configuration usage.  Note that configuration usages are only created by custom code.
174  * @param calling_application_id Application ID
175  * @param calling_application_ref_key Application reference key
176  * @param error_message If there is an error, this field contains a message describing the error.
177  * @param return_value If the return value is 1, then the configuration usage was successfully deleted.
178  *                     If the return value is 0, then the deletion of the configuration usage failed.
179  * @rep:scope public
180  * @rep:lifecycle obsolete
181  * @rep:displayname Delete Configuration Usage
182  * @rep:category BUSINESS_ENTITY CZ_CONFIG
183  */
184 PROCEDURE delete_configuration_usage(calling_application_id      IN  NUMBER,
185                                      calling_application_ref_key IN  NUMBER,
186                                      Error_message               IN OUT NOCOPY VARCHAR2,
187                                      Return_value                IN OUT NOCOPY NUMBER);
188 ------------------------------------------------------------------------------------------
189 
190 /*#
191  * This procedure updates a configuration usage.
192  * @param calling_application_id Application ID
193  * @param calling_application_ref_key Application reference key
194  * @param config_hdr_id Config header id
195  * @param config_rev_nbr Config revision number
196  * @param config_item_id Config item id
197  * @param uom_code UOM code
198  * @param list_price List price
199  * @param discounted_price Discounted price
200  * @param auto_discount_id Auto discount id
201  * @param auto_discount_line_id Auto discount line id
202  * @param auto_discount_pct Auto discount pct
203  * @param manual_discount_id Manual discount id
204  * @param manual_discount_line_id Manual discount line id
205  * @param manual_discount_pct Manual discount percentage
206  * @param error_message If there is an error, this field contains a message describing the error.
207  * @param return_value If the return value is 1, then the configuration usage was successfully updated.
208  *                     If the return value is 0, then the update of the configuration usage failed.
209  * @rep:scope public
210  * @rep:lifecycle obsolete
211  * @rep:displayname Update Configuration Usage
212  * @rep:category BUSINESS_ENTITY CZ_CONFIG
213  */
214 PROCEDURE update_configuration_usage(calling_application_id      IN  NUMBER,
215                                      calling_application_ref_key IN  NUMBER,
216                                      config_hdr_id               IN  NUMBER,
217                                      config_rev_nbr              IN  NUMBER,
218                                      config_item_id              IN  NUMBER,
219                                      uom_code                    IN  VARCHAR2,
220                                      list_price                  IN  NUMBER,
221                                      discounted_price            IN  NUMBER,
222                                      auto_discount_id            IN  NUMBER,
223                                      auto_discount_line_id       IN  NUMBER,
224                                      auto_discount_pct           IN  NUMBER,
225                                      manual_discount_id          IN  NUMBER,
226                                      manual_discount_line_id     IN  NUMBER,
227                                      manual_discount_pct         IN  NUMBER,
228                                      Error_message               IN OUT NOCOPY VARCHAR2,
229                                      Return_value                IN OUT NOCOPY NUMBER);
230 
231 --------------------------------------------------------------------------------
232 -- API name:      validate
233 -- Package Name:  cz_cf_api
234 -- Type:          Public
235 -- Pre-reqs:      None
236 -- Function:      Validates a configuration
237 -- Version:       Current version 1.0
238 --                Initial version 1.0
239 
240 procedure validate(p_api_version         IN  NUMBER
241                   ,p_config_item_tbl     IN  config_item_tbl_type
242                   ,p_config_ext_attr_tbl IN  config_ext_attr_tbl_type
243                   ,p_url                 IN  VARCHAR2
244                   ,p_init_msg            IN  VARCHAR2
245                   ,p_validation_type     IN  VARCHAR2
246                   ,x_config_xml_msg  OUT NOCOPY CFG_OUTPUT_PIECES
247                   ,x_return_status   OUT NOCOPY VARCHAR2
248                   ,x_msg_count       OUT NOCOPY NUMBER
249                   ,x_msg_data        OUT NOCOPY VARCHAR2
250                   );
251 --------------------------------------------------------------------------------
252 /*#
253  * This procedure validates a configuration. You can use this procedure to check whether a configuration is still valid after an event
254  * that may cause it to become invalid. Such events might include the following:
255  *      A change in the configuration rules.
256  *      The importing of the configuration from another system.
257  *      A change to the configuration inputs by another program.
258  * @param config_input_list This is a list of input selections.
259  * @param init_message XML initialization message
260  * @param config_messages This is a table of the output XML messages produced by validating the configuration.
261  * @param validation_status The status code returned by validating the configuration: CONFIG_PROCESSED (0),
262  *                          CONFIG_PROCESSED_NO_TERMINATE (1), INIT_TOO_LONG (2), INVALID_OPTION_REQUEST (3),
263  *                          CONFIG_EXCEPTION (4), DATABASE_ERROR (5), UTL_HTTP_INIT_FAILED (6), UTL_HTTP_REQUEST_FAILED (7)
264  * @param URL The URL for the Oracle Configurator Servlet. Default will interrogate the current profile for this URL,
265  *                        using FND_PROFILE.Value('CZ_UIMGR_URL').
266  * @param p_validation_type The possible values are CZ_API_PUB.VALIDATE_ORDER, CZ_API_PUB.VALIDATE_FULFILLMENT,
267                             and CZ_API_PUB.INTERACTIVE. The default is CZ_API_PUB.VALIDATE_ORDER.
268  * @rep:scope public
269  * @rep:lifecycle active
270  * @rep:displayname Validate
271  * @rep:category BUSINESS_ENTITY CZ_CONFIG
272  */
273 PROCEDURE VALIDATE (
274 -- single-call validation function uses tables to exchange multi-valued data
275     config_input_list IN  CFG_INPUT_LIST,    -- input selections
276     init_message      IN  VARCHAR2,          -- additional XML
277     config_messages   IN OUT NOCOPY CFG_OUTPUT_PIECES, -- table of output XML messages
278     validation_status IN OUT NOCOPY NUMBER,            -- status return
279     URL               IN  VARCHAR2 DEFAULT FND_PROFILE.Value('CZ_UIMGR_URL'),
280     p_validation_type IN  VARCHAR2 DEFAULT CZ_API_PUB.VALIDATE_ORDER);
281 
282 --------------------------------------------------------------------------------
283 -- API name:      validate. For Qouting ER#9348864
284 -- Package Name:  cz_cf_api
285 -- Type:          Public
286 -- Pre-reqs:      None
287 -- Function:      Validates a configuration
288 -- Version:       Current version 1.0
289 --                Initial version 1.0
290 -- One new IN and OUT param added for Quoting requirement to check any configuration has changed or not.
291 ----------------------------------------------------------------------------------
292 PROCEDURE VALIDATE (
293     config_input_list IN  CFG_INPUT_LIST,    -- input selections
294     init_message      IN  VARCHAR2,          -- additional XML
295     config_messages   IN OUT NOCOPY CFG_OUTPUT_PIECES, -- table of output XML messages
296     validation_status IN OUT NOCOPY NUMBER,            -- status return
297     URL               IN  VARCHAR2 DEFAULT FND_PROFILE.Value('CZ_UIMGR_URL'),
298     p_validation_type IN  VARCHAR2 DEFAULT CZ_API_PUB.VALIDATE_ORDER,
299     p_check_config_flag IN  VARCHAR2 DEFAULT 'N', -- Flag to indicate if caller wants to know the config change status
300     x_return_config_changed  OUT NOCOPY VARCHAR2); -- Return the config_changed_status
301 
302 --------------------------------------------------------------------------------
303 
304 /*#
305  * This function returns a published Model based on the input inventory item ID, organization ID, and applicability.
306  * @param inventory_item_id If the Model was imported from Oracle BOM,
307  *                          this is the Inventory Item ID of the item on which the configuration model is based.
308  * @param organization_id If the Model was imported from Oracle BOM, this is the organization ID of the item
309  *                        on which the configuration model is based.
310  * @param config_creation_date This is the lookup date for the publication.
311  * @param user_id This is the ID of the Oracle Applications user that is logged in.
312  * @param responsibility_id This is the responsibility of the Oracle Applications user in the host application.
313  * @param calling_application_id The registered ID of an application for which the Model is published.
314  * @return Devl_project_id of the configuration model published for this combination of inputs. NULL is returned if there is no matching publication.
315  * @rep:scope public
316  * @rep:lifecycle active
317  * @rep:displayname Model For Item
318  * @rep:category BUSINESS_ENTITY CZ_MODEL_PUB
319  */
320 FUNCTION model_for_item(inventory_item_id  	NUMBER,
321 				organization_id		NUMBER,
322 				config_creation_date	DATE,
323 				user_id			NUMBER,
324 				responsibility_id 	NUMBER,
325 				calling_application_id  NUMBER
326 			)
327 
328 RETURN NUMBER;
329 --------------------------------------------------------------------------------------------
330 
331 /*#
332  * This function finds a published configuration model for an item based on applicability parameters.
333  * The function returns NULL if the Model cannot be found.
334  * @param inventory_item_id If the Model was imported from Oracle BOM,
335  *                          this is the Inventory Item ID of the item on which the published configuration model is based.
336  * @param organization_id If the Model was imported from Oracle BOM, this is the organization ID of the item
337  *                        on which the published configuration model is based.
338  * @param config_lookup_date Date to search for inside the applicable range for the publication.
339  * @param calling_application_id The registered ID of an application for which the Model is published.
340  * @param usage_name Usage name to search for in the publication.
341  * @param publication_mode Publication mode to search for in the publication.
342  * @param language Language code to search for in the publication.
343  * @return Devl_project_id of the configuration model published for this combination of inputs. NULL is returned if there is no matching publication.
344  * @rep:scope public
345  * @rep:lifecycle active
346  * @rep:displayname Config Model For Item
347  * @rep:category BUSINESS_ENTITY CZ_MODEL_PUB
348  */
349 FUNCTION config_model_for_item (inventory_item_id  IN	NUMBER,
350 				organization_id		   IN	NUMBER,
351 				config_lookup_date	   IN	DATE,
352 				calling_application_id     IN	NUMBER,
353 				usage_name			   IN	VARCHAR2,
354  				publication_mode		   IN	VARCHAR2 DEFAULT NULL,
355 				language			   IN	VARCHAR2 DEFAULT NULL
356 				)
357 RETURN NUMBER;
358 --------------------------------------------------------------------------------------------
359 
360 /*#
361  * This function finds the Models that are associated with each entry in a list of Inventory Items
362  * that are published with the matching applicability parameters. The function returns the list of Model IDs (devl_project_id values)
363  * that meet the specified parameters.
364  * @param inventory_item_id If the Model was imported from Oracle BOM,
365  *                          this is the Inventory Item ID of the item on which the published configuration model is based.
366  * @param organization_id If the Model was imported from Oracle BOM, this is the organization ID of the item
367  *                        on which the configuration model is based.
368  * @param config_lookup_date Date to search for inside the applicable range for the publication.
369  * @param calling_application_id The registered ID of an application for which the Model is published.
370  * @param usage_name Usage name to search for in the publication.
371  * @param publication_mode Publication mode to search for in the publication.
372  * @param language Language code to search for in the publication.
373  * @return An array in which each element is a devl_project_id value for the associated item. NULL is returned if there is no matching publication.
374  * @rep:scope public
375  * @rep:lifecycle active
376  * @rep:displayname Config Models For Items
377  * @rep:category BUSINESS_ENTITY CZ_MODEL_PUB
378  */
379 FUNCTION config_models_for_items (inventory_item_id   IN	NUMBER_TBL_TYPE,
380 				organization_id			IN	NUMBER_TBL_TYPE,
381 				config_lookup_date		IN	DATE_TBL_TYPE,
382 				calling_application_id  	IN	NUMBER_TBL_TYPE,
383 				usage_name			      IN	VARCHAR2_TBL_TYPE,
384  				publication_mode	      	IN	VARCHAR2_TBL_TYPE,
385 				language			      IN	VARCHAR2_TBL_TYPE
386 				)
387 RETURN NUMBER_TBL_TYPE;
388 --------------------------------------------------------------------------------------------
389 
390 /*#
391  * This function returns a UI definition (ui_def_id) for a given inventory item identified by inventory_item_id and
392  * organization_id based on publication applicability parameters.
393  * @param inventory_item_id If the Model was imported from Oracle BOM,
394  *                          this is the Inventory Item ID of the item on which the configuration model is based.
395  * @param organization_id If the Model was imported from Oracle BOM, this is the organization ID of the item
396  *                        on which the configuration model is based.
397  * @param config_creation_date This is the date the configuration was or will be created.
398  * @param ui_type This is the type of UI sought and found for each product. Values are 'APPLET', 'DHTML', or 'JRAD'.
399  *                If either DHTML or JRAD is passed, then the publication UI type must be either DHTML or JRAD.
400  *                Otherwise NULL is returned.
401  *                If APPLET is passed, then the publication UI type can be either APPLET, DHTML, or JRAD.
402  *                If DHTML or JRAD is passed and there is no publication available for the item, then the API returns
403  *                the user interface ID of the Generic Configurator UI.
404  * @param user_id This is the ID for the Oracle Applications user that is logged in.
405  * @param responsibility_id This is the responsibility that the Oracle Applications user has in the host application.
406  * @param calling_application_id The registered ID of an application for which the model is published.
407  * @return UI definition (ui_def_id) for a given inventory item identified by inventory_item_id and
408  *         organization_id based on publication applicability parameters.
409  * @rep:scope public
410  * @rep:lifecycle active
411  * @rep:displayname UI For Item
412  * @rep:category BUSINESS_ENTITY CZ_MODEL_PUB
413  */
414 FUNCTION ui_for_item(inventory_item_id     NUMBER,
415 		     organization_id		 NUMBER,
416 		     config_creation_date	 DATE,
417 		     ui_type			 VARCHAR2,
418 		     user_id			 NUMBER,
419 		     responsibility_id		 NUMBER,
420 		     calling_application_id	 NUMBER
421 		    )
422 RETURN NUMBER;
423 --------------------------------------------------------------------------------------------
424 
425 /*#
426  * This function returns the user interface ID associated with the publication found for the input item,
427  * organization ID, and applicability.
428  * @param inventory_item_id If the Model was imported from Oracle BOM,
429  *                          this is the Inventory Item ID of the item on which the configuration model is based.
430  * @param organization_id If the Model was imported from Oracle BOM, this is the organization ID of the item
431  *                        on which configuration model is based.
432  * @param config_lookup_date Date to search for inside the applicable range for the publication.
433  * @param ui_type This is the type of UI sought and found for each product. Values are 'APPLET', 'DHTML', or 'JRAD'.
434  *                If either DHTML or JRAD is passed, then the publication UI type must be either DHTML or JRAD.
435  *                Otherwise NULL is returned.  If APPLET is passed, then the publication UI type can be APPLET,
436  *                DHTML, or JRAD.  If DHTML or JRAD is passed and there is no publication available for the item,
437  *                then the API returns the user interface ID of the Generic Configurator UI.
438  * @param calling_application_id The registered ID of an application for which the model is published.
439  * @param usage_name Usage name to search for in the publication.
440  * @param publication_mode Publication mode to search for in the publication.
441  * @param language Language code to search for in the publication.
442  * @return User interface ID associated with the selected publication.
443  * @rep:scope public
444  * @rep:lifecycle active
445  * @rep:displayname Config UI For Item
446  * @rep:category BUSINESS_ENTITY CZ_MODEL_PUB
447  */
448 FUNCTION config_ui_for_item (inventory_item_id		IN	NUMBER,
449 		             organization_id			IN	NUMBER,
450 		             config_lookup_date		IN	DATE,
451 		             ui_type				IN OUT NOCOPY  VARCHAR2,
452 		             calling_application_id  	IN	NUMBER,
453 		             usage_name				IN	VARCHAR2,
454   		             publication_mode			IN	VARCHAR2 DEFAULT NULL,
455 		             language				IN	VARCHAR2 DEFAULT NULL
456 		            )
457 RETURN NUMBER;
458 
459 ---------------------------------------------------------------------------
460 
461 /*#
462  * This function does the same work as CONFIG_UI_FOR_ITEM, but also returns the "look and feel" of the UI ('APPLET', 'BLAF', or 'FORMS').
463  * @param inventory_item_id If the Model was imported from Oracle BOM,
464  *                          this is the Inventory Item ID of the item on which the published configuration model is based.
465  * @param organization_id If the Model was imported from Oracle BOM, this is the organization ID of the item
466  *                        on which the published configuration model is based.
467  * @param config_lookup_date Date to search for inside the applicable range for the publication.
468  * @param ui_type Type of UI sought and found for each product. Values are 'APPLET', 'DHTML', or 'JRAD'.
469  *                If either DHTML or JRAD is passed, then the publication UI type must be either DHTML or
470  *                JRAD. Otherwise NULL is returned.  If APPLET is passed, then the publication UI type can be
471  *                APPLET, DHTML, or JRAD.  If DHTML or JRAD is passed and there is no publication available for
472  *                the item, then the API returns the user interface ID of the Generic Configurator UI.
473  * @param calling_application_id The registered ID of an application for which the model is published.
474  * @param usage_name Usage name to search for in the publication.
475  * @param look_and_feel This is a tag that overrides the default look and feel for component-style UIs (when UI_STYLE=0) in the CZ_UI_DEFS table.
476  * @param publication_mode Publication mode to search for in the publication.
477  * @param language Language code to search for in the publication.
478  * @return User interface ID associated with the selected publication.
479  * @rep:scope public
480  * @rep:lifecycle active
481  * @rep:displayname Config UI For Item
482  * @rep:category BUSINESS_ENTITY CZ_MODEL_PUB
483  */
484 FUNCTION config_ui_for_item_lf (inventory_item_id	IN	NUMBER,
485 		             organization_id			IN	NUMBER,
486 		             config_lookup_date		IN	DATE,
487 		             ui_type				IN OUT NOCOPY  VARCHAR2,
488 		             calling_application_id  	IN	NUMBER,
489 		             usage_name				IN	VARCHAR2,
490 		             look_and_feel			OUT NOCOPY	VARCHAR2,
491   		             publication_mode			IN	VARCHAR2 DEFAULT NULL,
492 		             language				IN	VARCHAR2 DEFAULT NULL
493 		            )
494 RETURN NUMBER;
495 
496 ---------------------------------------------------------------------------
497 
498 /*#
499  * This function returns a list of user interfaces that are associated with each entry in the list of Inventory Items
500  * that are published with matching applicability parameters.
501  * @param inventory_item_id If the Model was imported from Oracle BOM,
502  *                          this is the Inventory Item ID of the item on which the published configuration model is based.
503  * @param organization_id If the Model was imported from Oracle BOM, this is the organization ID of the item on which
504  *                        the published configuration model is based.
505  * @param config_lookup_date Date to search for inside the applicable range for the publication.
506  * @param ui_type This is the type of UI sought and found for each product. Values are 'APPLET' or 'DHTML'.
507  * @param calling_application_id The registered ID of an application for which the model is published.
508  * @param usage_name Usage name to search for in the publication.
509  * @param publication_mode Publication mode to search for in the publication.
510  * @param language Language code to search for in the publication.
511  * @return List of user interfaces that are associated with each entry in the list of Inventory Items that are published with matching applicability parameters.
512  * @rep:scope public
513  * @rep:lifecycle active
514  * @rep:displayname Config UIs For Items
515  * @rep:category BUSINESS_ENTITY CZ_MODEL_PUB
516  */
517 FUNCTION config_uis_for_items (inventory_item_id	IN	NUMBER_TBL_TYPE,
518 		             organization_id			IN	NUMBER_TBL_TYPE,
519 		             config_lookup_date		IN	DATE_TBL_TYPE,
520 		             ui_type				IN OUT NOCOPY  VARCHAR2_TBL_TYPE,
521 		             calling_application_id  	IN	NUMBER_TBL_TYPE,
522 		             usage_name				IN	VARCHAR2_TBL_TYPE,
523  		             publication_mode			IN	VARCHAR2_TBL_TYPE,
524 		             language				IN	VARCHAR2_TBL_TYPE
525 		            )
526 RETURN NUMBER_TBL_TYPE;
527 
528 ---------------------------------------------------------------------------
529 
530 /*#
531  * This function returns the Model ID (devl_project_id) for a specified publication.
532  * @param publication_id This is the specified publication ID in the CZ_MODEL_PUBLICATIONS table.
533  * @return Model ID for a specified publication.
534  * @rep:scope public
535  * @rep:lifecycle active
536  * @rep:displayname Model For Publication ID
537  * @rep:category BUSINESS_ENTITY CZ_MODEL_PUB
538  */
539 FUNCTION model_for_publication_id (publication_id NUMBER)
540 RETURN NUMBER;
541 
542 --------------------------------------------------------------------------------
543 
544 /*#
545  * This function returns a UI definition (ui_def_id) for a specified publication ID.
546  * @param publication_id This is the specified publication id in the CZ_MODEL_PUBLICATIONS table.
547  * @return UI definition (ui_def_id) for a specified publication ID.
548  * @rep:scope public
549  * @rep:lifecycle active
550  * @rep:displayname UI For Publication ID
551  * @rep:category BUSINESS_ENTITY CZ_MODEL_PUB
552  */
553 FUNCTION ui_for_publication_id (publication_id NUMBER)
554 RETURN NUMBER;
555 
556 ------------------------------------------------------------------------------
557 FUNCTION config_model_for_product ( product_key			IN	VARCHAR2,
558 				    config_lookup_date	 	IN	DATE,
559 				    calling_application_id  	IN	NUMBER,
560 				    usage_name			IN	VARCHAR2,
561   				    publication_mode		IN	VARCHAR2 DEFAULT NULL,
562 				    language			IN	VARCHAR2 DEFAULT NULL
563 				  )
564 RETURN NUMBER;
565 
566 -----------------------------------------------------------------------------------
567 
568 FUNCTION config_models_for_products ( product_key			IN	VARCHAR2_TBL_TYPE,
569 				    config_lookup_date	 	IN	DATE_TBL_TYPE,
570 				    calling_application_id  	IN	NUMBER_TBL_TYPE,
571 				    usage_name			IN	VARCHAR2_TBL_TYPE,
572  				    publication_mode		IN	VARCHAR2_TBL_TYPE,
573 				    language			IN	VARCHAR2_TBL_TYPE
574 				  )
575 RETURN NUMBER_TBL_TYPE;
576 
577 -----------------------------------------------------------------------------------
578 
579 FUNCTION config_ui_for_product (product_key			IN	VARCHAR2,
580 		                config_lookup_date		IN	DATE,
581 		                ui_type				IN OUT NOCOPY  VARCHAR2,
582 		                calling_application_id  	IN	NUMBER,
583 		                usage_name			IN	VARCHAR2,
584  		                publication_mode		IN	VARCHAR2 DEFAULT NULL,
585 		                language			IN	VARCHAR2 DEFAULT NULL
586 		               )
587 RETURN NUMBER;
588 
589 -----------------------------------------------------------------------------------
590 
591 FUNCTION config_uis_for_products (product_key		IN	VARCHAR2_TBL_TYPE,
592 		                config_lookup_date		IN	DATE_TBL_TYPE,
593 		                ui_type				IN OUT NOCOPY  VARCHAR2_TBL_TYPE,
594 		                calling_application_id  	IN	NUMBER_TBL_TYPE,
595 		                usage_name			IN	VARCHAR2_TBL_TYPE,
596  		                publication_mode		IN	VARCHAR2_TBL_TYPE,
597 		                language			IN	VARCHAR2_TBL_TYPE
598 		               )
599 RETURN NUMBER_TBL_TYPE;
600 
601 -----------------------------------------------------------------------------------
602 
603 FUNCTION publication_for_item   (inventory_item_id		IN	NUMBER,
604 		               	 organization_id		IN	NUMBER,
605 		      		 config_lookup_date		IN	DATE,
606 		      		 calling_application_id  	IN	NUMBER,
607 		     		 	 usage_name			IN	VARCHAR2,
608  		      		 publication_mode		IN	VARCHAR2 DEFAULT NULL,
609 		      		 language			IN	VARCHAR2 DEFAULT NULL
610 		      		)
611 RETURN NUMBER;
612 
613 -----------------------------------------------------------------------------------
614 FUNCTION publication_for_saved_config   (config_hdr_id		IN	NUMBER,
615 		               	 config_rev_nbr		IN	NUMBER,
616 		      		 config_lookup_date		IN	DATE,
617 		      		 calling_application_id  	IN	NUMBER,
618 		     		 	 usage_name			IN	VARCHAR2,
619  		      		 publication_mode		IN	VARCHAR2 DEFAULT NULL,
620 		      		 language			IN	VARCHAR2 DEFAULT NULL
621 		      		)
622 RETURN NUMBER;
623 
624 -----------------------------------------------------------------------------------
625 /*#
626  * This function returns the publication ID for a specified product key and applicability parameters.
627  * @param product_key Product key to search for in the publication.
628  * @param config_lookup_date Date to search for inside the applicable range for the publication.
629  * @param calling_application_id The registered ID of an application for which the Model is published.
630  * @param usage_name Usage name to search for in the publication.
631  * @param publication_mode Publication mode to search for in the publication.
632  * @param language Language code to search for in the publication.
633  * @return Publication ID for a product key.
634  * @rep:scope public
635  * @rep:lifecycle active
636  * @rep:displayname Publication For Product
637  * @rep:category BUSINESS_ENTITY CZ_MODEL_PUB
638  */
639 FUNCTION publication_for_product(product_key 		IN	VARCHAR2,
640 		      		 config_lookup_date	IN	DATE,
641 		      		 calling_application_id IN	NUMBER,
642 		     		 	 usage_name			IN	VARCHAR2,
643  		      		 publication_mode		IN	VARCHAR2 DEFAULT NULL,
644 		     		 	 language			IN	VARCHAR2 DEFAULT NULL
645 		      		)
646 RETURN NUMBER;
647 
648 -------------------------------------------------------
649 
650 -- Utility procedure for providing default date values for a
651 -- new configuration to the UI server.  The UI server will
652 -- pass all available dates, the procedure will return a value
653 -- for any dates not passed in.
654 /*#
655  * This utility procedure provides default date values used by Oracle Configurator for a new configuration.
656  * The caller should pass in dates that will be included in the initialization message for the runtime Oracle Configurator.
657  * The procedure will return the value that will be used by the runtime Oracle Configurator for any date not passed in.
658  * @param p_creation_date This specifies the creation date for the new configuration.
659  * @param p_lookup_date This specifies the lookup date for the new configuration.
660  * @param p_effective_date This specifies the effective date for the new configuration.
661  * @rep:scope public
662  * @rep:lifecycle active
663  * @rep:displayname Default New Config Dates
664  * @rep:category BUSINESS_ENTITY CZ_CONFIG
665  */
666 PROCEDURE DEFAULT_NEW_CFG_DATES(p_creation_date  IN OUT NOCOPY DATE,
667                                 p_lookup_date    IN OUT NOCOPY DATE,
668                                 p_effective_date IN OUT NOCOPY DATE);
669 
670 -------------------------------------------------------
671 
672 -- Utility procedure for providing default date values for
673 -- a restored configuration to the UI server.  The UI server
674 -- will pass all available dates, the procedure will return a
675 -- value for any dates not passed in.  Config header ID and
676 -- config revision number must be supplied.
677 /*#
678  * This utility procedure provides default date values used by Oracle Configurator for a restored configuration.
679  * The caller should pass in dates that will be included in the initialization message for the runtime Oracle Configurator.
680  * The procedure will return the value that will be used by the runtime Oracle Configurator for any dates not passed in.
681  * The CONFIG_HEADER_ID and CONFIG_REV_NBR of the configuration to be restored must be supplied.
682  * Default date values are determined differently for a restored configuration that for a new configuration.
683  * @param p_config_hdr_id Specifies which configuration to use.
684  * @param p_config_rev_nbr Specifies which configuration to use.
685  * @param p_creation_date If this is not null, it will be returned as is. Otherwise, the existing setting for this configuration is returned.
686  * @param p_lookup_date If this is not null, it will be returned as is. Otherwise, the existing setting for this configuration is returned.
687  * @param p_effective_date If this is not null, it will be returned as is. Otherwise, the existing setting for this configuration is returned.
688  * @rep:scope public
689  * @rep:lifecycle active
690  * @rep:displayname Default Restored Config Dates
691  * @rep:category BUSINESS_ENTITY CZ_CONFIG
692  */
693 PROCEDURE DEFAULT_RESTORED_CFG_DATES(p_config_hdr_id  IN NUMBER,
694                                      p_config_rev_nbr IN NUMBER,
695                                      p_creation_date  IN OUT NOCOPY DATE,
696 				     p_lookup_date    IN OUT NOCOPY DATE,
697                                      p_effective_date IN OUT NOCOPY DATE);
698 
699 -------------------------------------------------------
700 
701 -- Returns session ticket that Applications should pass as
702 -- "icx_session_ticket" to the configurator.  This ticket
703 -- allows the configurator maintain the Apps session identity.
704 --
705 -- Returns NULL if user_id, resp_id, or appl_id are not defined
706 -- within Apps session, or if the icx calls fail.
707 /*#
708  * This function returns a value for the session ticket that Oracle Applications should pass as "icx_session_ticket"
709  * when calling Oracle Configurator. This ticket allows the runtime Oracle Configurator to maintain the Oracle
710  * Applications session identity. A null value is returned if user_id, resp_id, or appl_id are not defined within
711  * the Oracle Applications session or if the ICX calls to generate the ticket fail.
712  * @return ICX ticket that represents the Oracle Applications session.
713  * @rep:scope public
714  * @rep:lifecycle active
715  * @rep:displayname ICX Session Ticket
716  * @rep:category BUSINESS_ENTITY CZ_CONFIG
717  */
718  FUNCTION icx_session_ticket RETURN VARCHAR2;
719  FUNCTION icx_session_ticket (p_session_id IN NUMBER) RETURN VARCHAR2;
720 
721 ------------------------------------------------------------------------------------------
722 -- Procedure to retrieve the inventory item and organization for the common bill by item,
723 -- for the organization and inventory_item passed in
724 -- This procedure is used by publication_for_item to retrieve the common bill's details
725 -- if the model has not been published
726 /*#
727  * This procedure retrieves the common bill item, if any, for the organization ID and inventory item
728  * ID that are passed in as parameters.
729  * @param in_inventory_item_id Inventory Item ID of item for which a common bill may be defined.
730  * @param in_organization_id Organization ID of item for which a common bill may be defined.
731  * @param common_inventory_item_id Inventory Item ID of the common bill item. NULL if no common bill is defined.
732  * @param common_organization_id Organization ID of the common bill Item. NULL if no common bill is defined.
733  * @rep:scope public
734  * @rep:lifecycle active
735  * @rep:displayname Common Bill For Item
736  * @rep:category BUSINESS_ENTITY CZ_MODEL_PUB
737  */
738 PROCEDURE common_bill_for_item ( in_inventory_item_id		IN	NUMBER,
739 				         in_organization_id		IN	NUMBER,
740 					   common_inventory_item_id	OUT NOCOPY 	NUMBER,
741 				         common_organization_id	OUT NOCOPY	NUMBER
742 		      		 );
743 
744 ------------------------------------------------------------------------------------------
745 
746 -- Procedure to retrieve the inventory item and organization for the common bill by product key,
747 -- for the product_key passed in
748 -- This procedure is used by publication_for_product to retrieve the common bill's details
749 -- if the model with the given product key has has not been published
750 PROCEDURE common_bill_for_product(v_product_key IN	VARCHAR2, c_product_key OUT NOCOPY VARCHAR2);
751 
752 --------------------------------------------------------------------------------
753 -- Mobile application publication lookup
754 -- Returns publications which meet the following criteria for the input item
755 --   1. publication_mode is production
756 --   2. DHMTL UI
757 --   3. effectivity range overlapps with the input date range
758 --   4. fnd_application_id is the same as input p_calling_application_id
759 --   5. language is session language
760 -- Returns null arrays if no pub found
761 -- Note: if no pub found with the input usage, lookup for ANY_USAGE
762 --       if no pub found for the input org, lookup for common bill
763 PROCEDURE publication_for_item_mobile
764              (p_inventory_item_id  IN  NUMBER
765              ,p_organization_id    IN  NUMBER
766              ,p_calling_application_id IN  NUMBER
767              ,p_usage_name             IN  VARCHAR2
768              ,p_pub_start_date         IN  DATE
769              ,p_pub_end_date           IN  DATE
770              ,x_publication_id_tbl    OUT NOCOPY number_tbl_indexby_type
771              ,x_model_id_tbl          OUT NOCOPY number_tbl_indexby_type
772              ,x_ui_def_id_tbl         OUT NOCOPY number_tbl_indexby_type
773              ,x_start_date_tbl        OUT NOCOPY date_tbl_indexby_type
774              ,x_last_update_date_tbl  OUT NOCOPY date_tbl_indexby_type
775              ,x_model_type            OUT NOCOPY VARCHAR2
776              );
777 --------------------------------------------------------------------------------
778 /*#
779  * This function returns the product_key for a saved configuration.
780  * @param p_config_hdr_id Specifies which configuration to use
781  * @param p_config_rev_nbr Specifies which configuration to use
782  * @rep:scope public
783  * @rep:lifecycle active
784  * @rep:displayname Product Key For Saved Configuration
785  * @rep:category BUSINESS_ENTITY CZ_MODEL_PUB
786  */
787 FUNCTION product_key_for_saved_config(p_config_hdr_id       IN  NUMBER,
788                                       p_config_rev_nbr      IN  NUMBER
789 		      		      )
790 RETURN VARCHAR2;
791 --------------------------------------------------------------------------------
792 /*#
793  * This function returns the defined pool for a given Product Key.
794  * @param p_product_key Product Key of a model for which the pool information is required.
795  * @rep:scope public
796  * @rep:lifecycle active
797  * @rep:displayname Pool Token For a Product Key
798  * @rep:category BUSINESS_ENTITY CZ_MODEL_PUB
799  */
800 FUNCTION pool_token_for_product_key(p_product_key  IN VARCHAR2)
801 RETURN VARCHAR2;
802 --------------------------------------------------------------------------------
803 /*#
804  * This procedure registers a given model to a given pool. If there doesn't exist any other models for this pool,
805  * it would implicitly register Pool too to the application, with an autonomous transaction.
806  * @param p_pool_identifier The pool to which the given model is to be registered
807  * @param p_model_product_key Product Key of the model which is to be registered
808  * @rep:scope public
809  * @rep:lifecycle active
810  * @rep:displayname Register a model to Pool
811  * @rep:category BUSINESS_ENTITY CZ_MODEL_PUB
812  */
813 PROCEDURE register_model_to_pool(errbuf  IN OUT NOCOPY VARCHAR2,
814                                  retcode IN OUT NOCOPY NUMBER,
815                                  p_pool_identifier IN VARCHAR2,
816                                  p_model_product_key IN VARCHAR2);
817 --------------------------------------------------------------------------------
818 --Bug 13031083 Changed parameter from product key to org_id and inv_item_id
819 --to support models that are not imported in CZ
820 PROCEDURE register_model_to_pool_cp(errbuf  IN OUT NOCOPY VARCHAR2,
821                                     retcode IN OUT NOCOPY NUMBER,
822                                     p_pool_identifier IN VARCHAR2,
823                                     p_org_id IN VARCHAR2,
824                                     dp_org_id IN VARCHAR2,
825                                     p_inventory_item_id IN VARCHAR2);
826 --------------------------------------------------------------------------------
827 /*#
828  * This procedure unregisters a given model from a given pool with an autonomous transaction.
829  * @param p_pool_identifier The pool from which the given model is to be unregistered
830  * @param p_model_product_key Product Key of the model which is to be unregistered
831  * @rep:scope public
832  * @rep:lifecycle active
833  * @rep:displayname Unregister a model from Pool
834  * @rep:category BUSINESS_ENTITY CZ_MODEL_PUB
835  */
836 PROCEDURE unregister_model_from_pool(errbuf  IN OUT NOCOPY VARCHAR2,
837                                      retcode IN OUT NOCOPY NUMBER,
838                                      p_pool_identifier IN VARCHAR2,
839                                      p_model_product_key IN VARCHAR2);
840 --------------------------------------------------------------------------------
841 --Bug 13031083 Changed parameter from product key to org_id and inv_item_id
842 --to support models that are not imported in CZ
843 PROCEDURE unregister_model_from_pool_cp(errbuf  IN OUT NOCOPY VARCHAR2,
844                                         retcode IN OUT NOCOPY NUMBER,
845                                         p_pool_identifier IN VARCHAR2,
846                                         p_org_id IN VARCHAR2,
847                                         dp_org_id IN VARCHAR2,
848                                         p_inventory_item_id IN VARCHAR2);
849 --------------------------------------------------------------------------------
850 /*#
851  * This procedure unregisters a given pool and all it's registered models with an autonomous transaction.
852  * @param p_pool_identifier The pool which is to be unregistered
853  * @rep:scope public
854  * @rep:lifecycle active
855  * @rep:displayname Unregister a given Pool
856  * @rep:category BUSINESS_ENTITY CZ_MODEL_PUB
857  */
858 PROCEDURE unregister_pool(errbuf  IN OUT NOCOPY VARCHAR2,
859                           retcode IN OUT NOCOPY NUMBER,
860                           p_pool_identifier IN VARCHAR2);
861 --------------------------------------------------------------------------------
862 PROCEDURE unregister_pool_cp(errbuf  IN OUT NOCOPY VARCHAR2,
863                              retcode IN OUT NOCOPY NUMBER,
864                              p_pool_identifier IN VARCHAR2);
865 --------------------------------------------------------------------------------
866 --LA 9595142
867 -- Procedure to enable or disable the BOM model by setting import_enabled flag
868 -- for the BOM Models for Importing purposes
869 
870 PROCEDURE  enable_model_for_import(inDevlProjectId  IN NUMBER,xStatus IN OUT NOCOPY VARCHAR2);
871 
872 PROCEDURE  disable_model_for_import(inDevlProjectId  IN NUMBER,xStatus IN OUT NOCOPY VARCHAR2);
873 --------------------------------------------------------------------------------
874 
875 
876 END CZ_CF_API;