[Home] [Help]
PACKAGE BODY: APPS.FF_LOAD_CONTEXTS_PKG
Source
1 PACKAGE BODY FF_LOAD_CONTEXTS_PKG as
2 /* $Header: ffconapi.pkb 120.1 2005/09/23 10:37 arashid noship $ */
3 -- ----------------------------------------------------------------------------
4 -- | Data Structure Definitions |
5 -- ----------------------------------------------------------------------------
6 type r_context is record
7 (context_name ff_contexts.context_name%type
8 ,data_type ff_contexts.data_type%type
9 );
10
11 type t_contexts is table of r_context index by binary_integer;
12 -- ----------------------------------------------------------------------------
13 -- | Private Global Definitions |
14 -- ----------------------------------------------------------------------------
15 --
16 g_package varchar2(33) := ' ff_load_ftypes_pkg.'; -- Global package name
17 g_permitted_list t_contexts;
18 g_list_not_built boolean := true;
19 --
20 --
21 -- ----------------------------------------------------------------------------
22 -- | Private Procedures |
23 -- ----------------------------------------------------------------------------
24 -- Called from load row and will insert new rows into ff_formula_types table
25 Procedure insert_contexts(
26 p_context_name in ff_contexts.context_name%TYPE
27 ,p_context_level in ff_contexts.context_level%TYPE
28 ,p_data_type in ff_contexts.data_type%TYPE);
29
30 --
31 -- Build the list of permitted contexts.
32 --
33 Procedure build_permitted_list is
34 i binary_integer := 1;
35 begin
36 g_permitted_list(i).context_name := 'ACCRUAL_PLAN_ID';
37 g_permitted_list(i).data_type := 'N';
38 i := i + 1;
39
40 g_permitted_list(i).context_name := 'ACT_TYP_ID';
41 g_permitted_list(i).data_type := 'N';
42 i := i + 1;
43
44 g_permitted_list(i).context_name := 'ASSIGNMENT_ACTION_ID';
45 g_permitted_list(i).data_type := 'N';
46 i := i + 1;
47
48 g_permitted_list(i).context_name := 'ASSIGNMENT_ID';
49 g_permitted_list(i).data_type := 'N';
50 i := i + 1;
51
52 g_permitted_list(i).context_name := 'BALANCE_DATE';
53 g_permitted_list(i).data_type := 'D';
54 i := i + 1;
55
56 g_permitted_list(i).context_name := 'BUSINESS_GROUP_ID';
57 g_permitted_list(i).data_type := 'N';
58 i := i + 1;
59
60 g_permitted_list(i).context_name := 'COMM_TYP_ID';
61 g_permitted_list(i).data_type := 'N';
62 i := i + 1;
63
64 g_permitted_list(i).context_name := 'DATE_EARNED';
65 g_permitted_list(i).data_type := 'D';
66 i := i + 1;
67
68 g_permitted_list(i).context_name := 'ELEMENT_ENTRY_ID';
69 g_permitted_list(i).data_type := 'N';
70 i := i + 1;
71
72 g_permitted_list(i).context_name := 'ELEMENT_TYPE_ID';
73 g_permitted_list(i).data_type := 'N';
74 i := i + 1;
75
76 g_permitted_list(i).context_name := 'JURISDICTION_CODE';
77 g_permitted_list(i).data_type := 'T';
78 i := i + 1;
79
80 g_permitted_list(i).context_name := 'LER_ID';
81 g_permitted_list(i).data_type := 'N';
82 i := i + 1;
83
84 g_permitted_list(i).context_name := 'LOCAL_UNIT_ID';
85 g_permitted_list(i).data_type := 'N';
86 i := i + 1;
87
88 g_permitted_list(i).context_name := 'OPT_ID';
89 g_permitted_list(i).data_type := 'N';
90 i := i + 1;
91
92 g_permitted_list(i).context_name := 'ORGANIZATION_ID';
93 g_permitted_list(i).data_type := 'N';
94 i := i + 1;
95
96 g_permitted_list(i).context_name := 'ORG_PAY_METHOD_ID';
97 g_permitted_list(i).data_type := 'N';
98 i := i + 1;
99
100 g_permitted_list(i).context_name := 'ORIGINAL_ENTRY_ID';
101 g_permitted_list(i).data_type := 'N';
102 i := i + 1;
103
104 g_permitted_list(i).context_name := 'PAYROLL_ACTION_ID';
105 g_permitted_list(i).data_type := 'N';
106 i := i + 1;
107
108 g_permitted_list(i).context_name := 'PAYROLL_ID';
109 g_permitted_list(i).data_type := 'N';
110 i := i + 1;
111
112 g_permitted_list(i).context_name := 'PERSON_ID';
113 g_permitted_list(i).data_type := 'N';
114 i := i + 1;
115
116 g_permitted_list(i).context_name := 'PER_PAY_METHOD_ID';
117 g_permitted_list(i).data_type := 'N';
118 i := i + 1;
119
120 g_permitted_list(i).context_name := 'PGM_ID';
121 g_permitted_list(i).data_type := 'N';
122 i := i + 1;
123
124 g_permitted_list(i).context_name := 'PL_ID';
125 g_permitted_list(i).data_type := 'N';
126 i := i + 1;
127
128 g_permitted_list(i).context_name := 'PL_TYP_ID';
129 g_permitted_list(i).data_type := 'N';
130 i := i + 1;
131
132 g_permitted_list(i).context_name := 'SOURCE_ID';
133 g_permitted_list(i).data_type := 'N';
134 i := i + 1;
135
136 g_permitted_list(i).context_name := 'SOURCE_NUMBER';
137 g_permitted_list(i).data_type := 'N';
138 i := i + 1;
139
140 g_permitted_list(i).context_name := 'SOURCE_NUMBER2';
141 g_permitted_list(i).data_type := 'N';
142 i := i + 1;
143
144 g_permitted_list(i).context_name := 'SOURCE_TEXT';
145 g_permitted_list(i).data_type := 'T';
146 i := i + 1;
147
148 g_permitted_list(i).context_name := 'SOURCE_TEXT2';
149 g_permitted_list(i).data_type := 'T';
150 i := i + 1;
151
152 g_permitted_list(i).context_name := 'TAX_GROUP';
153 g_permitted_list(i).data_type := 'T';
154 i := i + 1;
155
156 g_permitted_list(i).context_name := 'TAX_UNIT_ID';
157 g_permitted_list(i).data_type := 'N';
158 i := i + 1;
159
160 g_permitted_list(i).context_name := 'TIME_DEFINITION_ID';
161 g_permitted_list(i).data_type := 'N';
162 i := i + 1;
163 end build_permitted_list;
164
165 -- ----------------------------------------------------------------------------
166 -- |-------------------------< VALIDATE_NAME >--------------------------------|
167 -- ----------------------------------------------------------------------------
168 Procedure validate_name
169 (p_context_name in varchar2
170 ,p_data_type in varchar2
171 ) is
172 begin
173 --
174 -- Build the permitted list if necessary.
175 --
176 if g_list_not_built then
177 build_permitted_list;
178 g_list_not_built := false;
179 end if;
180 --
181 -- Try to match the contexts. Be super strict - insist on uppercase
182 -- input.
183 --
184 for i in 1 .. g_permitted_list.count loop
185 if p_context_name = g_permitted_list(i).context_name and
186 p_data_type = g_permitted_list(i).data_type
187 then
188 return;
189 end if;
190 end loop;
191
192 --
193 -- The context does not match any in the list.
194 --
195 hr_utility.set_message(801, 'FF_33290_CONTEXT_NOT_ALLOWED');
196 hr_utility.set_message_token('1', p_context_name);
197 hr_utility.raise_error;
198 end validate_name;
199
200 -- ----------------------------------------------------------------------------
201 -- |---------------------------< LOAD_ROW >------------------------------------|
202 -- ----------------------------------------------------------------------------
203 Procedure load_row (
204 p_context_name in ff_contexts.context_name%TYPE
205 ,p_context_level in ff_contexts.context_level%TYPE
206 ,p_data_type in ff_contexts.data_type%TYPE) is
207 --
208 l_existing_con_id number;
209 l_proc varchar2(100) := g_package || 'load_row';
210 --
211 --Cursor to see if the existing formula type is updated.....
212 cursor csr_existing is
213 select fcon.context_id
214 from ff_contexts fcon
215 where fcon.context_name = p_context_name;
216
217 BEGIN
218 --
219 hr_utility.set_location('Entering:'|| l_proc, 10);
220
221 open csr_existing;
222 fetch csr_existing into l_existing_con_id;
223
224 if csr_existing%FOUND
225 then
226 close csr_existing;
227 --Do nothing, since update of contexts is not allowed
228 else
229 close csr_existing;
230 -- call the insert procedure
231 --
232 insert_contexts(
233 p_context_name => p_context_name
234 ,p_context_level => p_context_level
235 ,p_data_type => p_data_type);
236 end if;
237 --
238 -- do not pass back any out parameters from the API calls
239 --
240 hr_utility.set_location(' Leaving:'|| l_proc, 20);
241 --
242 end load_row;
243
244 --
245 -- ----------------------------------------------------------------------------
246 -- | Private Procedures |
247 -- ----------------------------------------------------------------------------
248 -- Called from load row and will insert new rows into ff_formula_types table
249 Procedure insert_contexts(
250 p_context_name in ff_contexts.context_name%TYPE
251 ,p_context_level in ff_contexts.context_level%TYPE
252 ,p_data_type in ff_contexts.data_type%TYPE) Is
253 --
254 l_proc varchar2(100) := g_package || 'insert_contexts';
255 --
256 Begin
257 --
258 hr_utility.set_location('Entering:'|| l_proc, 10);
259
260 --Insert into ff_formula_types table
261 Insert Into FF_CONTEXTS(
262 CONTEXT_ID
263 ,CONTEXT_LEVEL
264 ,CONTEXT_NAME
265 ,DATA_TYPE) Values
266 (FF_CONTEXTS_S.NEXTVAL
267 ,p_context_level
268 ,p_context_name
269 ,p_data_type);
270 --
271 hr_utility.set_location('Leaving:'|| l_proc, 10);
272
273 End insert_contexts;
274 --
275 ------------------------------------------------------------------------------------------------
276 End FF_LOAD_CONTEXTS_PKG;
277