DBA Data[Home] [Help]

PACKAGE: APPS.ONT_DEF_UTIL

Source


1 Package ONT_Def_Util AUTHID CURRENT_USER AS
2 /* $Header: OEXDUTLS.pls 120.0.12020000.2 2012/11/29 12:12:12 aparava ship $ */
3 
4 
5 l_api_return_value VARCHAR2(255);
6 G_MAX_DEF_ITERATIONS NUMBER :=10;
7 NONE		   VARCHAR2(4) := 'NONE';
8 
9 -- Maximum number of defaulting conditions for an attribute in the
10 -- table oe_def_attr_condns. For each attribute, the attribute
11 -- conditions cache will hold the conditions for that attribute
12 -- from the index, attribute constant * G_MAX_ATTR_CONDNS
13 -- to (attribute constant * G_MAX_ATTR_CONDN + G_MAX_ATTR_CONDN - 1)
14 -- For e.g. for attribute accounting_rule_id, the value of
15 -- attribute constant is OE_HEADER_UTIL.G_ACCOUNTING_RULE_ID = 1
16 -- therefore the conditions are stored in the cache from index
17 -- 100 to 199
18 G_MAX_ATTR_CONDNS		CONSTANT			NUMBER := 100;
19 
20 -- Attribute Conditions Record
21 -- Used to cache the defaulting conditions setup for each
22 -- attribute.
23 -- e.g. ONT_LINE_Def_Util.g_attr_condns_cache
24 -- As the rules are cached for each attribute per condition,
25 -- the start and end index for the rules in the rules cache
26 -- is also updated.
27 
28     TYPE Attr_Condn_Rec_Type IS RECORD (
29     condition_id        NUMBER ,
30     attribute_code      VARCHAR2(30) ,
31     conditions_defined  VARCHAR2(1),
32     rules_start_index   NUMBER,
33     rules_stop_index    NUMBER
34         );
35 
36     TYPE Attr_Condn_Tbl_Type IS TABLE OF Attr_Condn_Rec_Type
37     INDEX BY BINARY_INTEGER;
38 
39 
40 -- Defaulting Rules Record Definition
41 -- Used to cache the rules for each entity's attributes
42 -- In the entity defaulting util package
43 -- e.g. ONT_LINE_DEF_UTIL.g_attr_rules_cache
44 
45    TYPE Attr_Def_Rule_REC_Type IS RECORD
46 	( SRC_TYPE			     VARCHAR2(30)
47 	, SRC_ATTRIBUTE_CODE		VARCHAR2(30)
48 	, SRC_DATABASE_OBJECT_NAME	VARCHAR2(30)
49 	, SRC_PARAMETER_NAME		VARCHAR2(30)
50 	, SRC_SYSTEM_VARIABLE_EXPR	VARCHAR2(255)
51 	, SRC_PROFILE_OPTION		VARCHAR2(30)
52 	, SRC_API_NAME			     VARCHAR2(2031)
53 	, SRC_CONSTANT_VALUE		VARCHAR2(240)
54 	, SRC_SEQUENCE_NAME		     VARCHAR2(30)
55 	);
56 
57     TYPE Attr_Def_Rule_TBL_Type IS TABLE OF Attr_Def_Rule_Rec_Type
58     INDEX BY BINARY_INTEGER;
59 
60    Procedure Set_Parameter_Value(
61       p_param_name  IN  varchar2,
62       p_value       in  varchar2
63    );
64 
65    --
66    Function Get_Parameter_Value(
67       p_param_name  IN  varchar2
68    ) Return Varchar2;
69 
70    -- web apps dictionary attribute default
71    Function Get_Attr_Default_Varchar2(
72       p_attribute_code in varchar2,
73       p_application_id in varchar2
74    ) Return Varchar2;
75 
76    -- web apps dictionary object attribute default
77    Function Get_ObjAttr_Default_Varchar2(
78       p_attribute_code        in varchar2,
79       p_database_object_name  in varchar2,
80       p_application_id        in varchar2
81    ) Return Varchar2;
82 
83    -- resolve system variable/expression
84    Function Get_Expression_Value_Varchar2(
85       p_expression_string in varchar2
86    ) Return Varchar2;
87 
88    -- resolve system variable/expression for attributes with datatype = DATE
89    -- Do not use function Get_Expression_Value_Varchar2 as converting
90    -- from date to varchar2 loses the time components
91    Function Get_Expression_Value_Date(
92       p_expression_string in varchar2
93    ) Return Date;
94 
95    Function Validate_Value(p_required_value in varchar2,
96                         p_validation_op  in varchar2,
97                         p_actual_value   in varchar2
98    ) Return Boolean;
99 
100    -- resolve default value by calling a custom API
101 	FUNCTION Get_API_Value_Varchar2  (
102 	p_api_name	in	varchar2,
103 	p_database_object_name in varchar2,
104 	p_attribute_code in varchar2
105 	)
106 	RETURN VARCHAR2;
107 
108    -- resolve default DATE value by calling a custom API
109 	FUNCTION Get_API_Value_Date  (
110 	p_api_name	in	varchar2,
111 	p_database_object_name in varchar2,
112 	p_attribute_code in varchar2
113 	)
114 	RETURN DATE;
115 
116    -- default is next number in the sequence
117 	FUNCTION Get_Sequence_Value (
118 	p_sequence_name	in	varchar2
119 	)
120 	RETURN VARCHAR2;
121 
122 	---------------------------------------------------------------------
123 	-- PROCEDURE Add_Invalid_Rule_Message
124 	-- Fix bug#1063896
125 	-- This procedure is called from the generated attribute handlers
126 	-- packages when there is a runtime error when evaluating a defaulting
127 	-- rule.
128 	-- This procedure adds an error message (OE_DEF_INVALID_RULE)
129 	-- to the stack after resolving the tokens for the attribute being
130 	-- defaulted and the default source type, default source/value and
131 	-- also prints out the SQL error message.
132 	---------------------------------------------------------------------
133 	PROCEDURE Add_Invalid_Rule_Message
134 	(p_attribute_code		IN VARCHAR2
135         ,p_rule_id                      IN NUMBER   DEFAULT NULL
136 	,p_src_type			IN VARCHAR2 DEFAULT NULL
137 	,p_src_api_name			IN VARCHAR2 DEFAULT NULL
138 	,p_src_database_object_name	IN VARCHAR2 DEFAULT NULL
139 	,p_src_attribute_code		IN VARCHAR2 DEFAULT NULL
140 	,p_src_constant_value		IN VARCHAR2 DEFAULT NULL
141 	,p_src_profile_option		IN VARCHAR2 DEFAULT NULL
142 	,p_src_system_variable_expr	IN VARCHAR2 DEFAULT NULL
143 	,p_src_sequence_name		IN VARCHAR2 DEFAULT NULL
144 	);
145 
146 End ONT_Def_Util;
147 -----------------------------------------------------------
148