DBA Data[Home] [Help]

PACKAGE: APPS.CZ_CF_API

Source


1 PACKAGE CZ_CF_API AS
2 /*      $Header: czcfapis.pls 120.3 2007/11/26 07:38:48 kdande 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 INVALID_VALIDATION_TYPE       constant NUMBER :=8;
79 
80 ------------------------------------------------------------------------------------------
81 
82 /*#
83  * This procedure copies a configuration in the database. It cannot be used to copy networked configuration models.
84  * If the NEW_CONFIG_FLAG is 1, then a new CONFIG_HDR_ID value is generated for the new configuration and it has a
85  * CONFIG_REV_NBR of 1. If NEW_CONFIG_FLAG is 0, the copy keeps the CONFIG_HDR_ID and has a CONFIG_REV_NBR
86  * incremented to be greater than the original.
87  * @param config_hdr_id Configuration header ID
88  * @param config_rev_nbr Configuration revision number
89  * @param new_config_flag A value of '1' indicates that the copied configuration should have a new CONFIG_HDR_ID.
90  *                        A value of '0' creates a new revision of the existing configuration.  This new revision
91  *                        will have the same CONFIG_HDR_ID as the original and a unique CONFIG_REV_NBR.
92  * @param out_config_hdr_id Configuration header ID of the new copy of the configuration.
93  * @param out_config_rev_nbr Configuration revision number of the new copy of the configuration.
94  * @param error_message If there is an error in the procedure execution, this field contains a message describing the error.
95  * @param return_value If the return value is 1, then the configuration was successfully copied. If the return value is 0,
96  *                     then the copy of the configuration failed.
97  * @param handle_deleted_flag When '0', it will undelete the copied configuration if the original configuration is deleted.
98  * @param new_name Applies a new name for the configuration.
99  * @rep:scope public
100  * @rep:lifecycle active
101  * @rep:displayname Copy Configuration
102  * @rep:category BUSINESS_ENTITY CZ_CONFIG
103  */
104 PROCEDURE copy_configuration(config_hdr_id       IN  NUMBER,
105                              config_rev_nbr      IN  NUMBER,
106                              new_config_flag     IN  VARCHAR2,
107                              out_config_hdr_id   IN OUT NOCOPY NUMBER,
108                              out_config_rev_nbr  IN OUT NOCOPY NUMBER,
109                              error_message       IN OUT NOCOPY VARCHAR2,
110                              return_value        IN OUT NOCOPY NUMBER,
111                              handle_deleted_flag IN  VARCHAR2 DEFAULT NULL,
112                              new_name            IN  VARCHAR2 DEFAULT NULL);
113 ------------------------------------------------------------------------------------------
114 
115 /*#
116  * This procedure runs COPY_CONFIGURATION within an autonomous transaction.
117  * If the copy is successful, new data will be committed to the database without affecting the caller's transaction.
118  * See COPY_CONFIGURATION documentation for more details.
119  * @param config_hdr_id Configuration header ID
120  * @param config_rev_nbr Configuration revision number
121  * @param new_config_flag A value of '1' indicates that the copied configuration should have a new CONFIG_HDR_ID.
122  *                        A value of '0' creates a new revision of the existing configuration.  This new revision
123  *                        will have the same CONFIG_HDR_ID as the original and a unique CONFIG_REV_NBR.
124  * @param out_config_hdr_id Configuration header ID of the new copy of the configuration.
125  * @param out_config_rev_nbr Configuration revision number of the new copy of the configuration.
126  * @param error_message If there is an error in the procedure execution, this field contains a message describing the error.
127  * @param return_value If the return value is 1, then the configuration was successfully copied. If the return value is 0,
128  *                     then the copy of the configuration failed.
129  * @param handle_deleted_flag When '0', it will undelete the copied configuration if the original configuration is deleted.
130  * @param new_name Applies a new name for the configuration.
131  * @rep:scope public
132  * @rep:lifecycle active
133  * @rep:displayname Copy Configuration
134  * @rep:category BUSINESS_ENTITY CZ_CONFIG
135  */
136 PROCEDURE copy_configuration_auto(config_hdr_id  IN  NUMBER,
137                              config_rev_nbr      IN  NUMBER,
138                              new_config_flag     IN  VARCHAR2,
139                              out_config_hdr_id   IN OUT NOCOPY NUMBER,
140                              out_config_rev_nbr  IN OUT NOCOPY NUMBER,
141                              Error_message       IN OUT NOCOPY VARCHAR2,
142                              Return_value        IN OUT NOCOPY NUMBER,
143                              handle_deleted_flag IN  VARCHAR2 DEFAULT NULL,
144                              new_name            IN  VARCHAR2 DEFAULT NULL);
145 ---------------------------------------------------------------------------------------
146 
147 /*#
148  * This procedure removes a configuration from the database.
149  * @param config_hdr_id Specifies the header ID of the configuration to be deleted.
150  * @param config_rev_nbr Specifies the revision number of the configuration to be deleted.
151  * @param usage_exists This returns 1 if a configuration usage record exists and the configuration is not deleted.
152  *                     Note that configuration usages are obsolete.
153  * @param error_message If there is an error, this field contains a message describing the error.
154  * @param return_value If the return value is 1, then the configuration was successfully deleted.
155  *                     If the return value is 0, then the deletion of the configuration failed.
156  * @rep:scope public
157  * @rep:lifecycle active
158  * @rep:displayname Delete Configuration
159  * @rep:category BUSINESS_ENTITY CZ_CONFIG
160  */
161 PROCEDURE delete_configuration(config_hdr_id  IN  NUMBER,
162                                config_rev_nbr IN  NUMBER,
163                                usage_exists   IN OUT NOCOPY NUMBER,
164                                Error_message  IN OUT NOCOPY VARCHAR2,
165                                Return_value   IN OUT NOCOPY NUMBER);
166 ------------------------------------------------------------------------------------------
167 
168 /*#
169  * Deletes a configuration usage.  Note that configuration usages are only created by custom code.
170  * @param calling_application_id Application ID
171  * @param calling_application_ref_key Application reference key
172  * @param error_message If there is an error, this field contains a message describing the error.
173  * @param return_value If the return value is 1, then the configuration usage was successfully deleted.
174  *                     If the return value is 0, then the deletion of the configuration usage failed.
175  * @rep:scope public
176  * @rep:lifecycle obsolete
177  * @rep:displayname Delete Configuration Usage
178  * @rep:category BUSINESS_ENTITY CZ_CONFIG
179  */
180 PROCEDURE delete_configuration_usage(calling_application_id      IN  NUMBER,
181                                      calling_application_ref_key IN  NUMBER,
182                                      Error_message               IN OUT NOCOPY VARCHAR2,
183                                      Return_value                IN OUT NOCOPY NUMBER);
184 ------------------------------------------------------------------------------------------
185 
186 /*#
187  * This procedure updates a configuration usage.
188  * @param calling_application_id Application ID
189  * @param calling_application_ref_key Application reference key
190  * @param config_hdr_id Config header id
191  * @param config_rev_nbr Config revision number
192  * @param config_item_id Config item id
193  * @param uom_code UOM code
194  * @param list_price List price
195  * @param discounted_price Discounted price
196  * @param auto_discount_id Auto discount id
197  * @param auto_discount_line_id Auto discount line id
198  * @param auto_discount_pct Auto discount pct
199  * @param manual_discount_id Manual discount id
200  * @param manual_discount_line_id Manual discount line id
201  * @param manual_discount_pct Manual discount percentage
202  * @param error_message If there is an error, this field contains a message describing the error.
203  * @param return_value If the return value is 1, then the configuration usage was successfully updated.
204  *                     If the return value is 0, then the update of the configuration usage failed.
205  * @rep:scope public
206  * @rep:lifecycle obsolete
207  * @rep:displayname Update Configuration Usage
208  * @rep:category BUSINESS_ENTITY CZ_CONFIG
209  */
210 PROCEDURE update_configuration_usage(calling_application_id      IN  NUMBER,
211                                      calling_application_ref_key IN  NUMBER,
212                                      config_hdr_id               IN  NUMBER,
213                                      config_rev_nbr              IN  NUMBER,
214                                      config_item_id              IN  NUMBER,
215                                      uom_code                    IN  VARCHAR2,
216                                      list_price                  IN  NUMBER,
217                                      discounted_price            IN  NUMBER,
218                                      auto_discount_id            IN  NUMBER,
219                                      auto_discount_line_id       IN  NUMBER,
220                                      auto_discount_pct           IN  NUMBER,
221                                      manual_discount_id          IN  NUMBER,
222                                      manual_discount_line_id     IN  NUMBER,
223                                      manual_discount_pct         IN  NUMBER,
224                                      Error_message               IN OUT NOCOPY VARCHAR2,
225                                      Return_value                IN OUT NOCOPY NUMBER);
226 
227 --------------------------------------------------------------------------------
228 -- API name:      validate
229 -- Package Name:  cz_cf_api
230 -- Type:          Public
231 -- Pre-reqs:      None
232 -- Function:      Validates a configuration
233 -- Version:       Current version 1.0
234 --                Initial version 1.0
235 
236 procedure validate(p_api_version         IN  NUMBER
237                   ,p_config_item_tbl     IN  config_item_tbl_type
238                   ,p_config_ext_attr_tbl IN  config_ext_attr_tbl_type
239                   ,p_url                 IN  VARCHAR2
240                   ,p_init_msg            IN  VARCHAR2
241                   ,p_validation_type     IN  VARCHAR2
242                   ,x_config_xml_msg  OUT NOCOPY CFG_OUTPUT_PIECES
243                   ,x_return_status   OUT NOCOPY VARCHAR2
244                   ,x_msg_count       OUT NOCOPY NUMBER
245                   ,x_msg_data        OUT NOCOPY VARCHAR2
246                   );
247 ----------------------------------------------------------------------------------
248 
249 /*#
250  * This procedure validates a configuration. You can use this procedure to check whether a configuration is still valid after an event
251  * that may cause it to become invalid. Such events might include the following:
252  *      A change in the configuration rules.
253  *      The importing of the configuration from another system.
254  *      A change to the configuration inputs by another program.
255  * @param config_input_list This is a list of input selections.
256  * @param init_message XML initialization message
257  * @param config_messages This is a table of the output XML messages produced by validating the configuration.
258  * @param validation_status The status code returned by validating the configuration: CONFIG_PROCESSED (0),
259  *                          CONFIG_PROCESSED_NO_TERMINATE (1), INIT_TOO_LONG (2), INVALID_OPTION_REQUEST (3),
260  *                          CONFIG_EXCEPTION (4), DATABASE_ERROR (5), UTL_HTTP_INIT_FAILED (6), UTL_HTTP_REQUEST_FAILED (7)
261  * @param URL The URL for the Oracle Configurator Servlet. Default will interrogate the current profile for this URL,
262  *                        using FND_PROFILE.Value('CZ_UIMGR_URL').
263  * @param p_validation_type The possible values are CZ_API_PUB.VALIDATE_ORDER, CZ_API_PUB.VALIDATE_FULFILLMENT,
264                             and CZ_API_PUB.INTERACTIVE. The default is CZ_API_PUB.VALIDATE_ORDER.
265  * @rep:scope public
266  * @rep:lifecycle active
267  * @rep:displayname Validate
268  * @rep:category BUSINESS_ENTITY CZ_CONFIG
269  */
270 PROCEDURE VALIDATE (
271 -- single-call validation function uses tables to exchange multi-valued data
272     config_input_list IN  CFG_INPUT_LIST,    -- input selections
273     init_message      IN  VARCHAR2,          -- additional XML
274     config_messages   IN OUT NOCOPY CFG_OUTPUT_PIECES, -- table of output XML messages
275     validation_status IN OUT NOCOPY NUMBER,            -- status return
276     URL               IN  VARCHAR2 DEFAULT FND_PROFILE.Value('CZ_UIMGR_URL'),
277     p_validation_type IN  VARCHAR2 DEFAULT CZ_API_PUB.VALIDATE_ORDER);
278 
279 --------------------------------------------------------------------------------
280 
281 /*#
282  * This function returns a published Model based on the input inventory item ID, organization ID, and applicability.
283  * @param inventory_item_id If the Model was imported from Oracle BOM,
284  *                          this is the Inventory Item ID of the item on which the configuration model is based.
285  * @param organization_id If the Model was imported from Oracle BOM, this is the organization ID of the item
286  *                        on which the configuration model is based.
287  * @param config_creation_date This is the lookup date for the publication.
288  * @param user_id This is the ID of the Oracle Applications user that is logged in.
289  * @param responsibility_id This is the responsibility of the Oracle Applications user in the host application.
290  * @param calling_application_id The registered ID of an application for which the Model is published.
291  * @return Devl_project_id of the configuration model published for this combination of inputs. NULL is returned if there is no matching publication.
292  * @rep:scope public
293  * @rep:lifecycle active
294  * @rep:displayname Model For Item
295  * @rep:category BUSINESS_ENTITY CZ_MODEL_PUB
296  */
297 FUNCTION model_for_item(inventory_item_id  	NUMBER,
298 				organization_id		NUMBER,
299 				config_creation_date	DATE,
300 				user_id			NUMBER,
301 				responsibility_id 	NUMBER,
302 				calling_application_id  NUMBER
303 			)
304 
305 RETURN NUMBER;
306 --------------------------------------------------------------------------------------------
307 
308 /*#
309  * This function finds a published configuration model for an item based on applicability parameters.
310  * The function returns NULL if the Model cannot be found.
311  * @param inventory_item_id If the Model was imported from Oracle BOM,
312  *                          this is the Inventory Item ID of the item on which the published configuration model is based.
313  * @param organization_id If the Model was imported from Oracle BOM, this is the organization ID of the item
314  *                        on which the published configuration model is based.
315  * @param config_lookup_date Date to search for inside the applicable range for the publication.
316  * @param calling_application_id The registered ID of an application for which the Model is published.
317  * @param usage_name Usage name to search for in the publication.
318  * @param publication_mode Publication mode to search for in the publication.
319  * @param language Language code to search for in the publication.
320  * @return Devl_project_id of the configuration model published for this combination of inputs. NULL is returned if there is no matching publication.
321  * @rep:scope public
322  * @rep:lifecycle active
323  * @rep:displayname Config Model For Item
324  * @rep:category BUSINESS_ENTITY CZ_MODEL_PUB
325  */
326 FUNCTION config_model_for_item (inventory_item_id  IN	NUMBER,
327 				organization_id		   IN	NUMBER,
328 				config_lookup_date	   IN	DATE,
329 				calling_application_id     IN	NUMBER,
330 				usage_name			   IN	VARCHAR2,
331  				publication_mode		   IN	VARCHAR2 DEFAULT NULL,
332 				language			   IN	VARCHAR2 DEFAULT NULL
333 				)
334 RETURN NUMBER;
335 --------------------------------------------------------------------------------------------
336 
337 /*#
338  * This function finds the Models that are associated with each entry in a list of Inventory Items
339  * that are published with the matching applicability parameters. The function returns the list of Model IDs (devl_project_id values)
340  * that meet the specified parameters.
341  * @param inventory_item_id If the Model was imported from Oracle BOM,
342  *                          this is the Inventory Item ID of the item on which the published configuration model is based.
343  * @param organization_id If the Model was imported from Oracle BOM, this is the organization ID of the item
344  *                        on which the configuration model is based.
345  * @param config_lookup_date Date to search for inside the applicable range for the publication.
346  * @param calling_application_id The registered ID of an application for which the Model is published.
347  * @param usage_name Usage name to search for in the publication.
348  * @param publication_mode Publication mode to search for in the publication.
349  * @param language Language code to search for in the publication.
350  * @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.
351  * @rep:scope public
352  * @rep:lifecycle active
353  * @rep:displayname Config Models For Items
354  * @rep:category BUSINESS_ENTITY CZ_MODEL_PUB
355  */
356 FUNCTION config_models_for_items (inventory_item_id   IN	NUMBER_TBL_TYPE,
357 				organization_id			IN	NUMBER_TBL_TYPE,
358 				config_lookup_date		IN	DATE_TBL_TYPE,
359 				calling_application_id  	IN	NUMBER_TBL_TYPE,
360 				usage_name			      IN	VARCHAR2_TBL_TYPE,
361  				publication_mode	      	IN	VARCHAR2_TBL_TYPE,
362 				language			      IN	VARCHAR2_TBL_TYPE
363 				)
364 RETURN NUMBER_TBL_TYPE;
365 --------------------------------------------------------------------------------------------
366 
367 /*#
368  * This function returns a UI definition (ui_def_id) for a given inventory item identified by inventory_item_id and
369  * organization_id based on publication applicability parameters.
370  * @param inventory_item_id If the Model was imported from Oracle BOM,
371  *                          this is the Inventory Item ID of the item on which the configuration model is based.
372  * @param organization_id If the Model was imported from Oracle BOM, this is the organization ID of the item
373  *                        on which the configuration model is based.
374  * @param config_creation_date This is the date the configuration was or will be created.
375  * @param ui_type This is the type of UI sought and found for each product. Values are 'APPLET', 'DHTML', or 'JRAD'.
376  *                If either DHTML or JRAD is passed, then the publication UI type must be either DHTML or JRAD.
377  *                Otherwise NULL is returned.
378  *                If APPLET is passed, then the publication UI type can be either APPLET, DHTML, or JRAD.
379  *                If DHTML or JRAD is passed and there is no publication available for the item, then the API returns
380  *                the user interface ID of the Generic Configurator UI.
381  * @param user_id This is the ID for the Oracle Applications user that is logged in.
382  * @param responsibility_id This is the responsibility that the Oracle Applications user has in the host application.
383  * @param calling_application_id The registered ID of an application for which the model is published.
384  * @return UI definition (ui_def_id) for a given inventory item identified by inventory_item_id and
385  *         organization_id based on publication applicability parameters.
386  * @rep:scope public
387  * @rep:lifecycle active
388  * @rep:displayname UI For Item
389  * @rep:category BUSINESS_ENTITY CZ_MODEL_PUB
390  */
391 FUNCTION ui_for_item(inventory_item_id     NUMBER,
392 		     organization_id		 NUMBER,
393 		     config_creation_date	 DATE,
394 		     ui_type			 VARCHAR2,
395 		     user_id			 NUMBER,
396 		     responsibility_id		 NUMBER,
397 		     calling_application_id	 NUMBER
398 		    )
399 RETURN NUMBER;
400 --------------------------------------------------------------------------------------------
401 
402 /*#
403  * This function returns the user interface ID associated with the publication found for the input item,
404  * organization ID, and applicability.
405  * @param inventory_item_id If the Model was imported from Oracle BOM,
406  *                          this is the Inventory Item ID of the item on which the configuration model is based.
407  * @param organization_id If the Model was imported from Oracle BOM, this is the organization ID of the item
408  *                        on which configuration model is based.
409  * @param config_lookup_date Date to search for inside the applicable range for the publication.
410  * @param ui_type This is the type of UI sought and found for each product. Values are 'APPLET', 'DHTML', or 'JRAD'.
411  *                If either DHTML or JRAD is passed, then the publication UI type must be either DHTML or JRAD.
412  *                Otherwise NULL is returned.  If APPLET is passed, then the publication UI type can be APPLET,
413  *                DHTML, or JRAD.  If DHTML or JRAD is passed and there is no publication available for the item,
414  *                then the API returns the user interface ID of the Generic Configurator UI.
415  * @param calling_application_id The registered ID of an application for which the model is published.
416  * @param usage_name Usage name to search for in the publication.
417  * @param publication_mode Publication mode to search for in the publication.
418  * @param language Language code to search for in the publication.
419  * @return User interface ID associated with the selected publication.
420  * @rep:scope public
421  * @rep:lifecycle active
422  * @rep:displayname Config UI For Item
423  * @rep:category BUSINESS_ENTITY CZ_MODEL_PUB
424  */
425 FUNCTION config_ui_for_item (inventory_item_id		IN	NUMBER,
426 		             organization_id			IN	NUMBER,
427 		             config_lookup_date		IN	DATE,
428 		             ui_type				IN OUT NOCOPY  VARCHAR2,
429 		             calling_application_id  	IN	NUMBER,
430 		             usage_name				IN	VARCHAR2,
431   		             publication_mode			IN	VARCHAR2 DEFAULT NULL,
432 		             language				IN	VARCHAR2 DEFAULT NULL
433 		            )
434 RETURN NUMBER;
435 
436 ---------------------------------------------------------------------------
437 
438 /*#
439  * 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').
440  * @param inventory_item_id If the Model was imported from Oracle BOM,
441  *                          this is the Inventory Item ID of the item on which the published configuration model is based.
442  * @param organization_id If the Model was imported from Oracle BOM, this is the organization ID of the item
443  *                        on which the published configuration model is based.
444  * @param config_lookup_date Date to search for inside the applicable range for the publication.
445  * @param ui_type Type of UI sought and found for each product. Values are 'APPLET', 'DHTML', or 'JRAD'.
446  *                If either DHTML or JRAD is passed, then the publication UI type must be either DHTML or
447  *                JRAD. Otherwise NULL is returned.  If APPLET is passed, then the publication UI type can be
448  *                APPLET, DHTML, or JRAD.  If DHTML or JRAD is passed and there is no publication available for
449  *                the item, then the API returns the user interface ID of the Generic Configurator UI.
450  * @param calling_application_id The registered ID of an application for which the model is published.
451  * @param usage_name Usage name to search for in the publication.
452  * @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.
453  * @param publication_mode Publication mode to search for in the publication.
454  * @param language Language code to search for in the publication.
455  * @return User interface ID associated with the selected publication.
456  * @rep:scope public
457  * @rep:lifecycle active
458  * @rep:displayname Config UI For Item
459  * @rep:category BUSINESS_ENTITY CZ_MODEL_PUB
460  */
461 FUNCTION config_ui_for_item_lf (inventory_item_id	IN	NUMBER,
462 		             organization_id			IN	NUMBER,
463 		             config_lookup_date		IN	DATE,
464 		             ui_type				IN OUT NOCOPY  VARCHAR2,
465 		             calling_application_id  	IN	NUMBER,
466 		             usage_name				IN	VARCHAR2,
467 		             look_and_feel			OUT NOCOPY	VARCHAR2,
468   		             publication_mode			IN	VARCHAR2 DEFAULT NULL,
469 		             language				IN	VARCHAR2 DEFAULT NULL
470 		            )
471 RETURN NUMBER;
472 
473 ---------------------------------------------------------------------------
474 
475 /*#
476  * This function returns a list of user interfaces that are associated with each entry in the list of Inventory Items
477  * that are published with matching applicability parameters.
478  * @param inventory_item_id If the Model was imported from Oracle BOM,
479  *                          this is the Inventory Item ID of the item on which the published configuration model is based.
480  * @param organization_id If the Model was imported from Oracle BOM, this is the organization ID of the item on which
481  *                        the published configuration model is based.
482  * @param config_lookup_date Date to search for inside the applicable range for the publication.
483  * @param ui_type This is the type of UI sought and found for each product. Values are 'APPLET' or 'DHTML'.
484  * @param calling_application_id The registered ID of an application for which the model is published.
485  * @param usage_name Usage name to search for in the publication.
486  * @param publication_mode Publication mode to search for in the publication.
487  * @param language Language code to search for in the publication.
488  * @return List of user interfaces that are associated with each entry in the list of Inventory Items that are published with matching applicability parameters.
489  * @rep:scope public
490  * @rep:lifecycle active
491  * @rep:displayname Config UIs For Items
492  * @rep:category BUSINESS_ENTITY CZ_MODEL_PUB
493  */
494 FUNCTION config_uis_for_items (inventory_item_id	IN	NUMBER_TBL_TYPE,
495 		             organization_id			IN	NUMBER_TBL_TYPE,
496 		             config_lookup_date		IN	DATE_TBL_TYPE,
497 		             ui_type				IN OUT NOCOPY  VARCHAR2_TBL_TYPE,
498 		             calling_application_id  	IN	NUMBER_TBL_TYPE,
499 		             usage_name				IN	VARCHAR2_TBL_TYPE,
500  		             publication_mode			IN	VARCHAR2_TBL_TYPE,
501 		             language				IN	VARCHAR2_TBL_TYPE
502 		            )
503 RETURN NUMBER_TBL_TYPE;
504 
505 ---------------------------------------------------------------------------
506 
507 /*#
508  * This function returns the Model ID (devl_project_id) for a specified publication.
509  * @param publication_id This is the specified publication ID in the CZ_MODEL_PUBLICATIONS table.
510  * @return Model ID for a specified publication.
511  * @rep:scope public
512  * @rep:lifecycle active
513  * @rep:displayname Model For Publication ID
514  * @rep:category BUSINESS_ENTITY CZ_MODEL_PUB
515  */
516 FUNCTION model_for_publication_id (publication_id NUMBER)
517 RETURN NUMBER;
518 
519 --------------------------------------------------------------------------------
520 
521 /*#
522  * This function returns a UI definition (ui_def_id) for a specified publication ID.
523  * @param publication_id This is the specified publication id in the CZ_MODEL_PUBLICATIONS table.
524  * @return UI definition (ui_def_id) for a specified publication ID.
525  * @rep:scope public
526  * @rep:lifecycle active
527  * @rep:displayname UI For Publication ID
528  * @rep:category BUSINESS_ENTITY CZ_MODEL_PUB
529  */
530 FUNCTION ui_for_publication_id (publication_id NUMBER)
531 RETURN NUMBER;
532 
533 ------------------------------------------------------------------------------
534 FUNCTION config_model_for_product ( product_key			IN	VARCHAR2,
535 				    config_lookup_date	 	IN	DATE,
536 				    calling_application_id  	IN	NUMBER,
537 				    usage_name			IN	VARCHAR2,
538   				    publication_mode		IN	VARCHAR2 DEFAULT NULL,
539 				    language			IN	VARCHAR2 DEFAULT NULL
540 				  )
541 RETURN NUMBER;
542 
543 -----------------------------------------------------------------------------------
544 
545 FUNCTION config_models_for_products ( product_key			IN	VARCHAR2_TBL_TYPE,
546 				    config_lookup_date	 	IN	DATE_TBL_TYPE,
547 				    calling_application_id  	IN	NUMBER_TBL_TYPE,
548 				    usage_name			IN	VARCHAR2_TBL_TYPE,
549  				    publication_mode		IN	VARCHAR2_TBL_TYPE,
550 				    language			IN	VARCHAR2_TBL_TYPE
551 				  )
552 RETURN NUMBER_TBL_TYPE;
553 
554 -----------------------------------------------------------------------------------
555 
556 FUNCTION config_ui_for_product (product_key			IN	VARCHAR2,
557 		                config_lookup_date		IN	DATE,
558 		                ui_type				IN OUT NOCOPY  VARCHAR2,
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_uis_for_products (product_key		IN	VARCHAR2_TBL_TYPE,
569 		                config_lookup_date		IN	DATE_TBL_TYPE,
570 		                ui_type				IN OUT NOCOPY  VARCHAR2_TBL_TYPE,
571 		                calling_application_id  	IN	NUMBER_TBL_TYPE,
572 		                usage_name			IN	VARCHAR2_TBL_TYPE,
573  		                publication_mode		IN	VARCHAR2_TBL_TYPE,
574 		                language			IN	VARCHAR2_TBL_TYPE
575 		               )
576 RETURN NUMBER_TBL_TYPE;
577 
578 -----------------------------------------------------------------------------------
579 
580 FUNCTION publication_for_item   (inventory_item_id		IN	NUMBER,
581 		               	 organization_id		IN	NUMBER,
582 		      		 config_lookup_date		IN	DATE,
583 		      		 calling_application_id  	IN	NUMBER,
584 		     		 	 usage_name			IN	VARCHAR2,
585  		      		 publication_mode		IN	VARCHAR2 DEFAULT NULL,
586 		      		 language			IN	VARCHAR2 DEFAULT NULL
587 		      		)
588 RETURN NUMBER;
589 
590 -----------------------------------------------------------------------------------
591 FUNCTION publication_for_saved_config   (config_hdr_id		IN	NUMBER,
592 		               	 config_rev_nbr		IN	NUMBER,
593 		      		 config_lookup_date		IN	DATE,
594 		      		 calling_application_id  	IN	NUMBER,
595 		     		 	 usage_name			IN	VARCHAR2,
596  		      		 publication_mode		IN	VARCHAR2 DEFAULT NULL,
597 		      		 language			IN	VARCHAR2 DEFAULT NULL
598 		      		)
599 RETURN NUMBER;
600 
601 -----------------------------------------------------------------------------------
602 /*#
603  * This function returns the publication ID for a specified product key and applicability parameters.
604  * @param product_key Product key to search for in the publication.
605  * @param config_lookup_date Date to search for inside the applicable range for the publication.
606  * @param calling_application_id The registered ID of an application for which the Model is published.
607  * @param usage_name Usage name to search for in the publication.
608  * @param publication_mode Publication mode to search for in the publication.
609  * @param language Language code to search for in the publication.
610  * @return Publication ID for a product key.
611  * @rep:scope public
612  * @rep:lifecycle active
613  * @rep:displayname Publication For Product
614  * @rep:category BUSINESS_ENTITY CZ_MODEL_PUB
615  */
616 FUNCTION publication_for_product(product_key 		IN	VARCHAR2,
617 		      		 config_lookup_date	IN	DATE,
618 		      		 calling_application_id IN	NUMBER,
619 		     		 	 usage_name			IN	VARCHAR2,
620  		      		 publication_mode		IN	VARCHAR2 DEFAULT NULL,
621 		     		 	 language			IN	VARCHAR2 DEFAULT NULL
622 		      		)
623 RETURN NUMBER;
624 
625 -------------------------------------------------------
626 
627 -- Utility procedure for providing default date values for a
628 -- new configuration to the UI server.  The UI server will
629 -- pass all available dates, the procedure will return a value
630 -- for any dates not passed in.
631 /*#
632  * This utility procedure provides default date values used by Oracle Configurator for a new configuration.
633  * The caller should pass in dates that will be included in the initialization message for the runtime Oracle Configurator.
634  * The procedure will return the value that will be used by the runtime Oracle Configurator for any date not passed in.
635  * @param p_creation_date This specifies the creation date for the new configuration.
636  * @param p_lookup_date This specifies the lookup date for the new configuration.
637  * @param p_effective_date This specifies the effective date for the new configuration.
638  * @rep:scope public
639  * @rep:lifecycle active
640  * @rep:displayname Default New Config Dates
641  * @rep:category BUSINESS_ENTITY CZ_CONFIG
642  */
643 PROCEDURE DEFAULT_NEW_CFG_DATES(p_creation_date  IN OUT NOCOPY DATE,
644                                 p_lookup_date    IN OUT NOCOPY DATE,
645                                 p_effective_date IN OUT NOCOPY DATE);
646 
647 -------------------------------------------------------
648 
649 -- Utility procedure for providing default date values for
650 -- a restored configuration to the UI server.  The UI server
651 -- will pass all available dates, the procedure will return a
652 -- value for any dates not passed in.  Config header ID and
653 -- config revision number must be supplied.
654 /*#
655  * This utility procedure provides default date values used by Oracle Configurator for a restored 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 dates not passed in.
658  * The CONFIG_HEADER_ID and CONFIG_REV_NBR of the configuration to be restored must be supplied.
659  * Default date values are determined differently for a restored configuration that for a new configuration.
660  * @param p_config_hdr_id Specifies which configuration to use.
661  * @param p_config_rev_nbr Specifies which configuration to use.
662  * @param p_creation_date If this is not null, it will be returned as is. Otherwise, the existing setting for this configuration is returned.
663  * @param p_lookup_date If this is not null, it will be returned as is. Otherwise, the existing setting for this configuration is returned.
664  * @param p_effective_date If this is not null, it will be returned as is. Otherwise, the existing setting for this configuration is returned.
665  * @rep:scope public
666  * @rep:lifecycle active
667  * @rep:displayname Default Restored Config Dates
668  * @rep:category BUSINESS_ENTITY CZ_CONFIG
669  */
670 PROCEDURE DEFAULT_RESTORED_CFG_DATES(p_config_hdr_id  IN NUMBER,
671                                      p_config_rev_nbr IN NUMBER,
672                                      p_creation_date  IN OUT NOCOPY DATE,
673 				     p_lookup_date    IN OUT NOCOPY DATE,
674                                      p_effective_date IN OUT NOCOPY DATE);
675 
676 -------------------------------------------------------
677 
678 -- Returns session ticket that Applications should pass as
679 -- "icx_session_ticket" to the configurator.  This ticket
680 -- allows the configurator maintain the Apps session identity.
681 --
682 -- Returns NULL if user_id, resp_id, or appl_id are not defined
683 -- within Apps session, or if the icx calls fail.
684 /*#
685  * This function returns a value for the session ticket that Oracle Applications should pass as "icx_session_ticket"
686  * when calling Oracle Configurator. This ticket allows the runtime Oracle Configurator to maintain the Oracle
687  * Applications session identity. A null value is returned if user_id, resp_id, or appl_id are not defined within
688  * the Oracle Applications session or if the ICX calls to generate the ticket fail.
689  * @return ICX ticket that represents the Oracle Applications session.
690  * @rep:scope public
691  * @rep:lifecycle active
692  * @rep:displayname ICX Session Ticket
693  * @rep:category BUSINESS_ENTITY CZ_CONFIG
694  */
695  FUNCTION icx_session_ticket RETURN VARCHAR2;
696  FUNCTION icx_session_ticket (p_session_id IN NUMBER) RETURN VARCHAR2;
697 
698 ------------------------------------------------------------------------------------------
699 -- Procedure to retrieve the inventory item and organization for the common bill by item,
700 -- for the organization and inventory_item passed in
701 -- This procedure is used by publication_for_item to retrieve the common bill's details
702 -- if the model has not been published
703 /*#
704  * This procedure retrieves the common bill item, if any, for the organization ID and inventory item
705  * ID that are passed in as parameters.
706  * @param in_inventory_item_id Inventory Item ID of item for which a common bill may be defined.
707  * @param in_organization_id Organization ID of item for which a common bill may be defined.
708  * @param common_inventory_item_id Inventory Item ID of the common bill item. NULL if no common bill is defined.
709  * @param common_organization_id Organization ID of the common bill Item. NULL if no common bill is defined.
710  * @rep:scope public
711  * @rep:lifecycle active
712  * @rep:displayname Common Bill For Item
713  * @rep:category BUSINESS_ENTITY CZ_MODEL_PUB
714  */
715 PROCEDURE common_bill_for_item ( in_inventory_item_id		IN	NUMBER,
716 				         in_organization_id		IN	NUMBER,
717 					   common_inventory_item_id	OUT NOCOPY 	NUMBER,
718 				         common_organization_id	OUT NOCOPY	NUMBER
719 		      		 );
720 
721 ------------------------------------------------------------------------------------------
722 
723 -- Procedure to retrieve the inventory item and organization for the common bill by product key,
724 -- for the product_key passed in
725 -- This procedure is used by publication_for_product to retrieve the common bill's details
726 -- if the model with the given product key has has not been published
727 PROCEDURE common_bill_for_product(v_product_key IN	VARCHAR2, c_product_key OUT NOCOPY VARCHAR2);
728 
729 --------------------------------------------------------------------------------
730 -- Mobile application publication lookup
731 -- Returns publications which meet the following criteria for the input item
732 --   1. publication_mode is production
733 --   2. DHMTL UI
734 --   3. effectivity range overlapps with the input date range
735 --   4. fnd_application_id is the same as input p_calling_application_id
736 --   5. language is session language
737 -- Returns null arrays if no pub found
738 -- Note: if no pub found with the input usage, lookup for ANY_USAGE
739 --       if no pub found for the input org, lookup for common bill
740 PROCEDURE publication_for_item_mobile
741              (p_inventory_item_id  IN  NUMBER
742              ,p_organization_id    IN  NUMBER
743              ,p_calling_application_id IN  NUMBER
744              ,p_usage_name             IN  VARCHAR2
745              ,p_pub_start_date         IN  DATE
746              ,p_pub_end_date           IN  DATE
747              ,x_publication_id_tbl    OUT NOCOPY number_tbl_indexby_type
748              ,x_model_id_tbl          OUT NOCOPY number_tbl_indexby_type
749              ,x_ui_def_id_tbl         OUT NOCOPY number_tbl_indexby_type
750              ,x_start_date_tbl        OUT NOCOPY date_tbl_indexby_type
751              ,x_last_update_date_tbl  OUT NOCOPY date_tbl_indexby_type
752              ,x_model_type            OUT NOCOPY VARCHAR2
753              );
754 --------------------------------------------------------------------------------
755 
756 END CZ_CF_API;