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