DBA Data[Home] [Help]

PACKAGE: APPS.ONT_DEF_UTIL

Source


1 Package ONT_Def_Util AS
2 /* $Header: OEXDUTLS.pls 120.0 2005/05/31 23:58:02 appldev noship $ */
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    -- database default
71    Function Get_Database_Default_Varchar2(
72       p_column_name in varchar2,
73       p_table_name  in varchar2
74    ) Return Varchar2;
75 
76    -- web apps dictionary attribute default
77    Function Get_Attr_Default_Varchar2(
78       p_attribute_code in varchar2,
79       p_application_id in varchar2
80    ) Return Varchar2;
81 
82    -- web apps dictionary object attribute default
83    Function Get_ObjAttr_Default_Varchar2(
84       p_attribute_code        in varchar2,
85       p_database_object_name  in varchar2,
86       p_application_id        in varchar2
87    ) Return Varchar2;
88 
89    -- resolve system variable/expression
90    Function Get_Expression_Value_Varchar2(
91       p_expression_string in varchar2
92    ) Return Varchar2;
93 
94    -- resolve system variable/expression for attributes with datatype = DATE
95    -- Do not use function Get_Expression_Value_Varchar2 as converting
96    -- from date to varchar2 loses the time components
97    Function Get_Expression_Value_Date(
98       p_expression_string in varchar2
99    ) Return Date;
100 
101    Function Validate_Value(p_required_value in varchar2,
102                         p_validation_op  in varchar2,
103                         p_actual_value   in varchar2
104    ) Return Boolean;
105 
106    -- resolve default value by calling a custom API
107 	FUNCTION Get_API_Value_Varchar2  (
108 	p_api_name	in	varchar2,
109 	p_database_object_name in varchar2,
110 	p_attribute_code in varchar2
111 	)
112 	RETURN VARCHAR2;
113 
114    -- resolve default DATE value by calling a custom API
115 	FUNCTION Get_API_Value_Date  (
116 	p_api_name	in	varchar2,
117 	p_database_object_name in varchar2,
118 	p_attribute_code in varchar2
119 	)
120 	RETURN DATE;
121 
122    -- default is next number in the sequence
123 	FUNCTION Get_Sequence_Value (
124 	p_sequence_name	in	varchar2
125 	)
126 	RETURN VARCHAR2;
127 
128 	---------------------------------------------------------------------
129 	-- PROCEDURE Add_Invalid_Rule_Message
130 	-- Fix bug#1063896
131 	-- This procedure is called from the generated attribute handlers
132 	-- packages when there is a runtime error when evaluating a defaulting
133 	-- rule.
134 	-- This procedure adds an error message (OE_DEF_INVALID_RULE)
135 	-- to the stack after resolving the tokens for the attribute being
136 	-- defaulted and the default source type, default source/value and
137 	-- also prints out the SQL error message.
138 	---------------------------------------------------------------------
139 	PROCEDURE Add_Invalid_Rule_Message
140 	(p_attribute_code		IN VARCHAR2
141         ,p_rule_id                      IN NUMBER   DEFAULT NULL
142 	,p_src_type			IN VARCHAR2 DEFAULT NULL
143 	,p_src_api_name			IN VARCHAR2 DEFAULT NULL
144 	,p_src_database_object_name	IN VARCHAR2 DEFAULT NULL
145 	,p_src_attribute_code		IN VARCHAR2 DEFAULT NULL
146 	,p_src_constant_value		IN VARCHAR2 DEFAULT NULL
147 	,p_src_profile_option		IN VARCHAR2 DEFAULT NULL
148 	,p_src_system_variable_expr	IN VARCHAR2 DEFAULT NULL
149 	,p_src_sequence_name		IN VARCHAR2 DEFAULT NULL
150 	);
151 
152 End ONT_Def_Util;
153 -----------------------------------------------------------
154