[Home] [Help]
PACKAGE BODY: APPS.HXC_APP_ATTRIBUTE_UTILS
Source
1 package BODY HXC_APP_ATTRIBUTE_UTILS as
2 /* $Header: hxcappattut.pkb 120.3 2006/08/30 10:29:06 gkrishna noship $ */
3
4 c_deposit_process CONSTANT VARCHAR2(7) := 'DEPOSIT';
5 c_retrieval_process CONSTANT VARCHAR2(9) := 'RETRIEVAL';
6
7 g_mappings mappings;
8 g_retrieval_map mapping_info;
9 g_deposit_map mapping_info;
10 g_retrieval_bbit_map mapping_info;
11 g_deposit_bbit_map mapping_info;
12 g_appset_recips appset_recipient_table;
13 g_package varchar2(35) := 'hxc_application_attribute_utils.';
14 g_bbit_multiplier pls_integer;
15
16 function get_bbit_index
17 (p_comp_index in pls_integer,
18 p_bbit_index in pls_integer) return pls_integer is
19 cursor c_multiplier is
20 select round(ceil(max(bld_blk_info_type_id)/1000),0)*1000
21 from hxc_bld_blk_info_types;
22
23 l_index pls_integer;
24 begin
25 if(g_bbit_multiplier is null) then
26 open c_multiplier;
27 fetch c_multiplier into g_bbit_multiplier;
28 close c_multiplier;
29 end if;
30
31 l_index := p_comp_index*g_bbit_multiplier + p_bbit_index;
32
33 return l_index;
34
35 end get_bbit_index;
36
37 Procedure cache_mappings is
38
39 cursor c_mappings is
40 select mc.segment
41 ,mc.field_name
42 ,bbui.building_block_category category
43 ,bbit.bld_blk_info_type info_type
44 ,rp.retrieval_process_id
45 ,dp.deposit_process_id
46 ,mc.mapping_component_id
47 ,bbit.bld_blk_info_type_id
48 ,to_number(nvl(replace(replace(mc.segment,'ATTRIBUTE'),'_CATEGORY'),0))
49 from hxc_mapping_components mc
50 ,hxc_mapping_comp_usages mcu
51 ,hxc_mappings m1
52 ,hxc_mappings m2
53 ,hxc_retrieval_processes rp
54 ,hxc_deposit_processes dp
55 ,hxc_bld_blk_info_types bbit
56 ,hxc_bld_blk_info_type_usages bbui
57 where rp.mapping_id (+) = m1.mapping_id
58 and dp.mapping_id (+) = m2.mapping_id
59 and m1.mapping_id = mcu.mapping_id
60 and m2.mapping_id = mcu.mapping_id
61 and mcu.mapping_component_id = mc.mapping_component_id
62 and mc.bld_blk_info_type_id = bbit.bld_blk_info_type_id
63 AND bbit.bld_blk_info_type_id = bbui.bld_blk_info_type_id
64 order by 6,5,8,9;
65
66 mapping_rec c_mappings%rowtype;
67 l_index number;
68 l_proc varchar2(72) := g_package||'cache_mappings';
69 l_start_rindex number := null;
70 l_comp_rindex number := null;
71 l_start_dindex number := null;
72 l_comp_dindex number := null;
73 l_bb_index pls_integer;
74 l_bb_start_index pls_integer;
75 l_bb_rindex pls_integer;
76 l_bb_start_rindex pls_integer;
77 --
78 -- For Debugging
79 --
80 l_map_idx number := null;
81
82
83 Begin
84
85 If ((g_mappings.count <1) or (g_deposit_bbit_map.count <1) or (g_retrieval_bbit_map.count<1)) then
86 l_index := 0;
87 --
88 -- Cache the mappings
89 --
90 open c_mappings;
91 Loop
92 fetch c_mappings into mapping_rec;
93 Exit When c_mappings%NOTFOUND;
94 l_index := l_index +1;
95
96 g_mappings(l_index).segment := mapping_rec.segment ;
97 g_mappings(l_index).field_name := mapping_rec.field_name ;
98 g_mappings(l_index).category := mapping_rec.category ;
99 g_mappings(l_index).info_type := mapping_rec.info_type ;
100 g_mappings(l_index).retrieval_process_id := mapping_rec.retrieval_process_id ;
101 g_mappings(l_index).deposit_process_id := mapping_rec.deposit_process_id ;
102 g_mappings(l_index).mapping_component_id := mapping_rec.mapping_component_id ;
103
104 if(mapping_rec.deposit_process_id is not null) then
105 if(l_comp_dindex is null) then
106 l_start_dindex := l_index;
107 l_comp_dindex := mapping_rec.deposit_process_id;
108 l_bb_index := mapping_rec.bld_blk_info_type_id;
109 l_bb_start_index := l_index;
110 else
111 if(mapping_rec.deposit_process_id <> l_comp_dindex) then
112 g_deposit_map(l_comp_dindex).start_index := l_start_dindex;
113 g_deposit_map(l_comp_dindex).stop_index := l_index-1;
114 g_deposit_bbit_map(get_bbit_index(l_comp_dindex,l_bb_index)).start_index := l_bb_start_index;
115 g_deposit_bbit_map(get_bbit_index(l_comp_dindex,l_bb_index)).stop_index := l_index -1;
116 l_start_dindex := l_index;
117 l_comp_dindex := mapping_rec.deposit_process_id;
118 l_bb_index := mapping_rec.bld_blk_info_type_id;
119 l_bb_start_index := l_index;
120 else
121 if(mapping_rec.bld_blk_info_type_id <> l_bb_index) then
122 g_deposit_bbit_map(get_bbit_index(l_comp_dindex,l_bb_index)).start_index := l_bb_start_index;
123 g_deposit_bbit_map(get_bbit_index(l_comp_dindex,l_bb_index)).stop_index := l_index -1;
124 l_bb_index := mapping_rec.bld_blk_info_type_id;
125 l_bb_start_index := l_index;
126 end if;
127 end if;
128 end if;
129 else
130 if(l_comp_dindex is not null) then
131 g_deposit_map(l_comp_dindex).start_index := l_start_dindex;
132 g_deposit_map(l_comp_dindex).stop_index := l_index-1;
133 g_deposit_bbit_map(get_bbit_index(l_comp_dindex,l_bb_index)).start_index := l_bb_start_index;
134 g_deposit_bbit_map(get_bbit_index(l_comp_dindex,l_bb_index)).stop_index := l_index -1;
135 l_start_dindex := null;
136 l_comp_dindex := null;
137 l_bb_index := null;
138 l_bb_start_index := null;
139 end if;
140 end if;
141
142 if(mapping_rec.retrieval_process_id is not null) then
143 if(l_comp_rindex is null) then
144 l_start_rindex := l_index;
145 l_comp_rindex := mapping_rec.retrieval_process_id;
146 l_bb_rindex := mapping_rec.bld_blk_info_type_id;
147 l_bb_start_rindex := l_index;
148 else
149 if(mapping_rec.retrieval_process_id <> l_comp_rindex) then
150 g_retrieval_map(l_comp_rindex).start_index := l_start_rindex;
151 g_retrieval_map(l_comp_rindex).stop_index := l_index-1;
152 g_retrieval_bbit_map(get_bbit_index(l_comp_rindex,l_bb_rindex)).start_index := l_bb_start_rindex;
153 g_retrieval_bbit_map(get_bbit_index(l_comp_rindex,l_bb_rindex)).stop_index := l_index -1;
154 l_start_rindex := l_index;
155 l_comp_rindex := mapping_rec.retrieval_process_id;
156 l_bb_rindex := mapping_rec.bld_blk_info_type_id;
157 l_bb_start_rindex := l_index;
158 else
159 if(mapping_rec.bld_blk_info_type_id <> l_bb_rindex) then
160 g_retrieval_bbit_map(get_bbit_index(l_comp_rindex,l_bb_rindex)).start_index := l_bb_start_rindex;
161 g_retrieval_bbit_map(get_bbit_index(l_comp_rindex,l_bb_rindex)).stop_index := l_index -1;
162 l_bb_rindex := mapping_rec.bld_blk_info_type_id;
163 l_bb_start_rindex := l_index;
164 end if;
165 end if;
166 end if;
167 else
168 if(l_comp_rindex is not null) then
169 g_retrieval_map(l_comp_rindex).start_index := l_start_rindex;
170 g_retrieval_map(l_comp_rindex).stop_index := l_index-1;
171 g_retrieval_bbit_map(get_bbit_index(l_comp_rindex,l_bb_rindex)).start_index := l_bb_start_rindex;
172 g_retrieval_bbit_map(get_bbit_index(l_comp_rindex,l_bb_rindex)).stop_index := l_index -1;
173 l_start_rindex := null;
174 l_comp_rindex := null;
175 l_bb_start_rindex := null;
176 l_bb_rindex := null;
177 end if;
178 end if;
179
180 End Loop;
181 --
182 -- Do the final deposit/retrieval process map caching
183 --
184 if(l_comp_rindex is not null) then
185 g_retrieval_map(l_comp_rindex).start_index := l_start_rindex;
186 g_retrieval_map(l_comp_rindex).stop_index := l_index;
187 g_retrieval_bbit_map(get_bbit_index(l_comp_rindex,l_bb_rindex)).start_index := l_bb_start_rindex;
188 g_retrieval_bbit_map(get_bbit_index(l_comp_rindex,l_bb_rindex)).stop_index := l_index;
189 end if;
190 if(l_comp_dindex is not null) then
191 g_deposit_map(l_comp_dindex).start_index := l_start_dindex;
192 g_deposit_map(l_comp_dindex).stop_index := l_index;
193 g_deposit_bbit_map(get_bbit_index(l_comp_dindex,l_bb_index)).start_index := l_bb_start_index;
194 g_deposit_bbit_map(get_bbit_index(l_comp_dindex,l_bb_index)).stop_index := l_index;
195 end if;
196
197 close c_mappings;
198
199 end if;
200
201 end cache_mappings;
202
203 Procedure clear_mapping_cache is
204
205 Begin
206 g_mappings.delete;
207 g_deposit_map.delete;
208 g_deposit_bbit_map.delete;
209 g_retrieval_map.delete;
210 g_retrieval_bbit_map.delete;
211 End clear_mapping_cache;
212
213 Procedure set_recip_value
214 (p_appset_id in number
215 ,p_time_recip_id in number
216 ) is
217
218 Begin
219
220 if(g_appset_recips(p_appset_id).recipient1 is null) then
221 g_appset_recips(p_appset_id).recipient1 := p_time_recip_id;
222 elsif(g_appset_recips(p_appset_id).recipient2 is null) then
223 g_appset_recips(p_appset_id).recipient2 := p_time_recip_id;
224 elsif(g_appset_recips(p_appset_id).recipient3 is null) then
225 g_appset_recips(p_appset_id).recipient3 := p_time_recip_id;
226 elsif(g_appset_recips(p_appset_id).recipient4 is null) then
227 g_appset_recips(p_appset_id).recipient4 := p_time_recip_id;
228 elsif(g_appset_recips(p_appset_id).recipient5 is null) then
229 g_appset_recips(p_appset_id).recipient5 := p_time_recip_id;
230 elsif(g_appset_recips(p_appset_id).recipient6 is null) then
231 g_appset_recips(p_appset_id).recipient6 := p_time_recip_id;
232 elsif(g_appset_recips(p_appset_id).recipient7 is null) then
233 g_appset_recips(p_appset_id).recipient7 := p_time_recip_id;
234 elsif(g_appset_recips(p_appset_id).recipient8 is null) then
235 g_appset_recips(p_appset_id).recipient8 := p_time_recip_id;
236 elsif(g_appset_recips(p_appset_id).recipient9 is null) then
237 g_appset_recips(p_appset_id).recipient9 := p_time_recip_id;
238 elsif(g_appset_recips(p_appset_id).recipient10 is null) then
239 g_appset_recips(p_appset_id).recipient10 := p_time_recip_id;
240 elsif(g_appset_recips(p_appset_id).recipient11 is null) then
241 g_appset_recips(p_appset_id).recipient11 := p_time_recip_id;
242 elsif(g_appset_recips(p_appset_id).recipient12 is null) then
243 g_appset_recips(p_appset_id).recipient12 := p_time_recip_id;
244 elsif(g_appset_recips(p_appset_id).recipient13 is null) then
245 g_appset_recips(p_appset_id).recipient13 := p_time_recip_id;
246 elsif(g_appset_recips(p_appset_id).recipient14 is null) then
247 g_appset_recips(p_appset_id).recipient14 := p_time_recip_id;
248 else
249 g_appset_recips(p_appset_id).recipient15 := p_time_recip_id;
250 end if;
251
252 End set_recip_value;
253
254 Procedure cache_appset_recipient is
255
256 Cursor c_appset_rets is
257 select ascv.application_set_id
258 ,ascv.time_recipient_id
259 from hxc_application_Set_comps_v ascv;
260
261 l_application_set_id number;
262 l_time_recipient_id number;
263
264 Begin
265
266 if(g_appset_recips.count <1) then
267
268 open c_appset_rets;
269
270 LOOP
271 fetch c_appset_rets into l_application_set_id, l_time_recipient_id;
272 EXIT when c_appset_rets%notfound;
273
274 if(g_appset_recips.exists(l_application_set_id)) then
275 set_recip_value(l_application_set_id,l_time_recipient_id);
276 else
277 g_appset_recips(l_application_set_id).recipient1 := l_time_recipient_id;
278 end if;
279
280 END LOOP;
281
282 end if;
283
284 End cache_appset_recipient;
285
286 Function findSegmentFromFieldName
287 (p_field_name in hxc_mapping_components.field_name%type
288 ) return varchar2 is
289
290 cursor c_otl_deposit_process is
291 select deposit_process_id
292 from hxc_deposit_processes
293 where name = 'OTL Deposit Process';
294
295 cursor c_prompt_name(p_comp_id in number) is
296 select substr(fcu.form_left_prompt,1,30) prompt
297 from hxc_mapping_components mc
298 ,hxc_bld_blk_info_types bbit
299 ,fnd_descr_flex_col_usage_tl fcu
300 where mc.mapping_component_id = p_comp_id
301 and mc.bld_blk_info_type_id = bbit.bld_blk_info_type_id
302 and fcu.application_column_name = mc.segment
303 and fcu.descriptive_flex_context_code = bbit.bld_blk_info_type
304 and fcu.descriptive_flexfield_name = 'OTC Information Types'
305 and fcu.application_id = 809
306 and fcu.language = userenv('LANG');
307
308 l_index number;
309 l_found boolean := false;
310 l_segment hxc_mapping_components.segment%type;
311 l_field_prompt fnd_descr_flex_col_usage_tl.form_left_prompt%type;
312 l_prompt fnd_descr_flex_col_usage_tl.form_left_prompt%type;
313 l_field_no number;
314 l_field_names hxc_deposit_wrapper_utilities.t_simple_table;
315 l_ret_string varchar2(4000) := '';
316 l_deposit_proc number;
317
318 Begin
319
320 if(g_mappings.count <1) then
321 cache_mappings;
322 end if;
323
324 open c_otl_deposit_process;
325 fetch c_otl_deposit_process into l_deposit_proc;
326 close c_otl_deposit_process;
327
328 hxc_deposit_wrapper_utilities.string_to_table
329 (':'
330 ,':'||p_field_name
331 ,l_field_names);
332
333 for l_field_no in 0..l_field_names.count-1 loop
334
335 l_found := false;
336 l_index := g_mappings.first;
337 Loop
338 Exit when ((not g_mappings.exists(l_index)) or (l_found));
339 if(
340 (g_mappings(l_index).field_name = l_field_names(l_field_no))
341 AND
342 (g_mappings(l_index).deposit_process_id=l_deposit_proc)
343 ) then
344 l_found := true;
345 open c_prompt_name(g_mappings(l_index).mapping_component_id);
346 fetch c_prompt_name into l_field_prompt;
347 if(c_prompt_name%notfound) then
348 l_prompt := initcap(replace(g_mappings(l_index).field_name,'_',' '));
349 else
350 l_prompt := l_field_prompt;
351 end if;
352 close c_prompt_name;
353 l_ret_string := g_mappings(l_index).info_type||'|'||
354 g_mappings(l_index).segment||'|'||
355 l_prompt||':'||l_ret_string;
356 end if;
357 l_index := g_mappings.next(l_index);
358 End Loop;
359
360 end loop;
361
362 return l_ret_string;
363
364 End findSegmentFromFieldName;
365
366 Procedure set_value
367 (p_attributes in hxc_attribute_table_type
368 ,p_attribute_index in number
369 ,p_mapping_index in number
370 ,p_app_attributes in out nocopy hxc_self_service_time_deposit.app_attributes_info
371 ,p_app_attribute_index in number
372 ) is
373
374 Begin
375
376 if(g_mappings(p_mapping_index).segment='ATTRIBUTE_CATEGORY') then
377 -- If the attribute category is like PAEXPITDFFC-NNNN then the attribute value needs
378 --to be populated with the original attribute category that is like PAEXPITDFF- ABCDSGS
379
380
381 p_app_attributes(p_app_attribute_index).attribute_value :=
382 hxc_deposit_wrapper_utilities.get_dupdff_name(p_attributes(p_attribute_index).attribute_category);
383
384 -- p_app_attributes(p_app_attribute_index).attribute_value := p_attributes(p_attribute_index).ATTRIBUTE_CATEGORY;
385 elsif(g_mappings(p_mapping_index).segment='ATTRIBUTE1') then
386 p_app_attributes(p_app_attribute_index).attribute_value := p_attributes(p_attribute_index).ATTRIBUTE1;
387 elsif(g_mappings(p_mapping_index).segment='ATTRIBUTE2') then
388 p_app_attributes(p_app_attribute_index).attribute_value := p_attributes(p_attribute_index).ATTRIBUTE2;
389 elsif(g_mappings(p_mapping_index).segment='ATTRIBUTE3') then
390 p_app_attributes(p_app_attribute_index).attribute_value := p_attributes(p_attribute_index).ATTRIBUTE3;
391 elsif(g_mappings(p_mapping_index).segment='ATTRIBUTE4') then
392 p_app_attributes(p_app_attribute_index).attribute_value := p_attributes(p_attribute_index).ATTRIBUTE4;
393 elsif(g_mappings(p_mapping_index).segment='ATTRIBUTE5') then
394 p_app_attributes(p_app_attribute_index).attribute_value := p_attributes(p_attribute_index).ATTRIBUTE5;
395 elsif(g_mappings(p_mapping_index).segment='ATTRIBUTE6') then
396 p_app_attributes(p_app_attribute_index).attribute_value := p_attributes(p_attribute_index).ATTRIBUTE6;
397 elsif(g_mappings(p_mapping_index).segment='ATTRIBUTE7') then
398 p_app_attributes(p_app_attribute_index).attribute_value := p_attributes(p_attribute_index).ATTRIBUTE7;
399 elsif(g_mappings(p_mapping_index).segment='ATTRIBUTE8') then
400 p_app_attributes(p_app_attribute_index).attribute_value := p_attributes(p_attribute_index).ATTRIBUTE8;
401 elsif(g_mappings(p_mapping_index).segment='ATTRIBUTE9') then
402 p_app_attributes(p_app_attribute_index).attribute_value := p_attributes(p_attribute_index).ATTRIBUTE9;
403 elsif(g_mappings(p_mapping_index).segment='ATTRIBUTE10') then
404 p_app_attributes(p_app_attribute_index).attribute_value := p_attributes(p_attribute_index).ATTRIBUTE10;
405 elsif(g_mappings(p_mapping_index).segment='ATTRIBUTE11') then
406 p_app_attributes(p_app_attribute_index).attribute_value := p_attributes(p_attribute_index).ATTRIBUTE11;
407 elsif(g_mappings(p_mapping_index).segment='ATTRIBUTE12') then
408 p_app_attributes(p_app_attribute_index).attribute_value := p_attributes(p_attribute_index).ATTRIBUTE12;
409 elsif(g_mappings(p_mapping_index).segment='ATTRIBUTE13') then
410 p_app_attributes(p_app_attribute_index).attribute_value := p_attributes(p_attribute_index).ATTRIBUTE13;
411 elsif(g_mappings(p_mapping_index).segment='ATTRIBUTE14') then
412 p_app_attributes(p_app_attribute_index).attribute_value := p_attributes(p_attribute_index).ATTRIBUTE14;
413 elsif(g_mappings(p_mapping_index).segment='ATTRIBUTE15') then
414 p_app_attributes(p_app_attribute_index).attribute_value := p_attributes(p_attribute_index).ATTRIBUTE15;
415 elsif(g_mappings(p_mapping_index).segment='ATTRIBUTE16') then
416 p_app_attributes(p_app_attribute_index).attribute_value := p_attributes(p_attribute_index).ATTRIBUTE16;
417 elsif(g_mappings(p_mapping_index).segment='ATTRIBUTE17') then
418 p_app_attributes(p_app_attribute_index).attribute_value := p_attributes(p_attribute_index).ATTRIBUTE17;
419 elsif(g_mappings(p_mapping_index).segment='ATTRIBUTE18') then
420 p_app_attributes(p_app_attribute_index).attribute_value := p_attributes(p_attribute_index).ATTRIBUTE18;
421 elsif(g_mappings(p_mapping_index).segment='ATTRIBUTE19') then
422 p_app_attributes(p_app_attribute_index).attribute_value := p_attributes(p_attribute_index).ATTRIBUTE19;
423 elsif(g_mappings(p_mapping_index).segment='ATTRIBUTE20') then
424 p_app_attributes(p_app_attribute_index).attribute_value := p_attributes(p_attribute_index).ATTRIBUTE20;
425 elsif(g_mappings(p_mapping_index).segment='ATTRIBUTE21') then
426 p_app_attributes(p_app_attribute_index).attribute_value := p_attributes(p_attribute_index).ATTRIBUTE21;
427 elsif(g_mappings(p_mapping_index).segment='ATTRIBUTE22') then
428 p_app_attributes(p_app_attribute_index).attribute_value := p_attributes(p_attribute_index).ATTRIBUTE22;
429 elsif(g_mappings(p_mapping_index).segment='ATTRIBUTE23') then
430 p_app_attributes(p_app_attribute_index).attribute_value := p_attributes(p_attribute_index).ATTRIBUTE23;
431 elsif(g_mappings(p_mapping_index).segment='ATTRIBUTE24') then
432 p_app_attributes(p_app_attribute_index).attribute_value := p_attributes(p_attribute_index).ATTRIBUTE24;
433 elsif(g_mappings(p_mapping_index).segment='ATTRIBUTE25') then
434 p_app_attributes(p_app_attribute_index).attribute_value := p_attributes(p_attribute_index).ATTRIBUTE25;
435 elsif(g_mappings(p_mapping_index).segment='ATTRIBUTE26') then
436 p_app_attributes(p_app_attribute_index).attribute_value := p_attributes(p_attribute_index).ATTRIBUTE26;
437 elsif(g_mappings(p_mapping_index).segment='ATTRIBUTE27') then
438 p_app_attributes(p_app_attribute_index).attribute_value := p_attributes(p_attribute_index).ATTRIBUTE27;
439 elsif(g_mappings(p_mapping_index).segment='ATTRIBUTE28') then
440 p_app_attributes(p_app_attribute_index).attribute_value := p_attributes(p_attribute_index).ATTRIBUTE28;
441 elsif(g_mappings(p_mapping_index).segment='ATTRIBUTE29') then
442 p_app_attributes(p_app_attribute_index).attribute_value := p_attributes(p_attribute_index).ATTRIBUTE29;
443 elsif(g_mappings(p_mapping_index).segment='ATTRIBUTE30') then
444 p_app_attributes(p_app_attribute_index).attribute_value := p_attributes(p_attribute_index).ATTRIBUTE30;
445 end if;
446
447 End set_value;
448
449 Function mapping_applies
450 (p_attribute in hxc_attribute_type
451 ,p_mapping_index in number
452 ,p_retrieval_process_id in number
453 ,p_deposit_process_id in number
454 ) return boolean is
455
456 Begin
457
458 if(p_attribute.bld_blk_info_type = g_mappings(p_mapping_index).info_type) then
459 if(p_deposit_process_id is NULL) then
460 if(p_retrieval_process_id = g_mappings(p_mapping_index).retrieval_process_id) then
461 return true;
462 else
463 return false;
464 end if;
465 else
466 if(p_deposit_process_id = g_mappings(p_mapping_index).deposit_process_id) then
467 return true;
468 else
469 return false;
470 end if;
471 end if;
472 else
473 return false;
474 end if;
475
476 End mapping_applies;
477
478 Function retrieval_applies
479 (p_application_set_id in number
480 ,p_retrieval_process_id in number
481 ,p_recipients in hxc_timecard_validation.recipient_application_table
482 ) return BOOLEAN is
483
484 l_recipient_id hxc_time_recipients.time_recipient_id%type := null;
485 l_index number;
486 l_found boolean;
487
488 Begin
489
490 l_index := p_recipients.first;
491 Loop
492 Exit when ((not p_recipients.exists(l_index)) or (l_found));
493 if(p_recipients(l_index).appl_retrieval_process_id = p_retrieval_process_id) then
494 l_found := true;
495 l_recipient_id := p_recipients(l_index).time_recipient_id;
496 end if;
497 l_index := p_recipients.next(l_index);
498 End Loop;
499
500 if(l_recipient_id is not null) then
501
502 if(g_appset_recips(p_application_set_id).recipient1 = l_recipient_id) then
503 return true;
504 elsif(g_appset_recips(p_application_set_id).recipient2 = l_recipient_id) then
505 return true;
506 elsif(g_appset_recips(p_application_set_id).recipient3 = l_recipient_id) then
507 return true;
508 elsif(g_appset_recips(p_application_set_id).recipient4 = l_recipient_id) then
509 return true;
510 elsif(g_appset_recips(p_application_set_id).recipient5 = l_recipient_id) then
511 return true;
512 elsif(g_appset_recips(p_application_set_id).recipient6 = l_recipient_id) then
513 return true;
514 elsif(g_appset_recips(p_application_set_id).recipient7 = l_recipient_id) then
515 return true;
516 elsif(g_appset_recips(p_application_set_id).recipient8 = l_recipient_id) then
517 return true;
518 elsif(g_appset_recips(p_application_set_id).recipient9 = l_recipient_id) then
519 return true;
520 elsif(g_appset_recips(p_application_set_id).recipient10 = l_recipient_id) then
521 return true;
522 elsif(g_appset_recips(p_application_set_id).recipient11 = l_recipient_id) then
523 return true;
524 elsif(g_appset_recips(p_application_set_id).recipient12 = l_recipient_id) then
525 return true;
526 elsif(g_appset_recips(p_application_set_id).recipient13 = l_recipient_id) then
527 return true;
528 elsif(g_appset_recips(p_application_set_id).recipient14 = l_recipient_id) then
529 return true;
530 elsif(g_appset_recips(p_application_set_id).recipient15= l_recipient_id) then
531 return true;
532 else
533 return false;
534 end if;
535 else
536 return false;
537 end if;
538
539 End retrieval_applies;
540
541 Function appsetid_applies
542 (p_application_set_id in number
543 ,p_retrieval_process_id in number
544 ,p_recipients in hxc_timecard_validation.recipient_application_table
545 ) return BOOLEAN is
546
547 Begin
548 if(g_appset_recips.exists(p_application_set_id)) then
549 if(retrieval_applies(p_application_set_id,p_retrieval_process_id,p_recipients)) then
550 return true;
551 else
552 return false;
553 end if;
554 else
555 return false;
556 end if;
557
558 End appsetid_applies;
559
560 Function mapping_applies
561 (p_attribute in hxc_attribute_type
562 ,p_mapping_index in number
563 ,p_retrieval_process_id in number
564 ,p_deposit_process_id in number
565 ,p_application_set_id in number
566 ,p_recipients in hxc_timecard_validation.recipient_application_table
567 ) return boolean is
568
569 Begin
570
571 if(appsetid_applies(p_application_set_id,p_retrieval_process_id,p_recipients)) then
572 if(p_attribute.bld_blk_info_type = g_mappings(p_mapping_index).info_type) then
573 if(p_deposit_process_id is NULL) then
574 if(p_retrieval_process_id = g_mappings(p_mapping_index).retrieval_process_id) then
575 return true;
576 else
577 return false;
578 end if;
579 else
580 if(p_deposit_process_id = g_mappings(p_mapping_index).deposit_process_id) then
581 return true;
582 else
583 return false;
584 end if;
585 end if;
586 else
587 return false;
588 end if;
589 else
590 return false;
591 end if;
592
593 End mapping_applies;
594
595 Function maximumAttribute
596 (p_attribute in HXC_ATTRIBUTE_TYPE) return pls_integer is
597 l_max_populated_attribute pls_integer;
598 Begin
599
600 l_max_populated_attribute := 0;
601
602 if(p_attribute.attribute1 is not null) then
603 l_max_populated_attribute := 1;
604 end if;
605 if(p_attribute.attribute2 is not null) then
606 l_max_populated_attribute := 2;
607 end if;
608 if(p_attribute.attribute3 is not null) then
609 l_max_populated_attribute := 3;
610 end if;
611 if(p_attribute.attribute4 is not null) then
612 l_max_populated_attribute := 4;
613 end if;
614 if(p_attribute.attribute5 is not null) then
615 l_max_populated_attribute := 5;
616 end if;
617 if(p_attribute.attribute6 is not null) then
618 l_max_populated_attribute := 6;
619 end if;
620 if(p_attribute.attribute7 is not null) then
621 l_max_populated_attribute := 7;
622 end if;
623 if(p_attribute.attribute8 is not null) then
624 l_max_populated_attribute := 8;
625 end if;
626 if(p_attribute.attribute9 is not null) then
627 l_max_populated_attribute := 9;
628 end if;
629 if(p_attribute.attribute10 is not null) then
630 l_max_populated_attribute := 10;
631 end if;
632 if(p_attribute.attribute11 is not null) then
633 l_max_populated_attribute := 11;
634 end if;
635 if(p_attribute.attribute12 is not null) then
636 l_max_populated_attribute := 12;
637 end if;
638 if(p_attribute.attribute13 is not null) then
639 l_max_populated_attribute := 13;
640 end if;
641 if(p_attribute.attribute14 is not null) then
642 l_max_populated_attribute := 14;
643 end if;
644 if(p_attribute.attribute15 is not null) then
645 l_max_populated_attribute := 15;
646 end if;
647 if(p_attribute.attribute16 is not null) then
648 l_max_populated_attribute := 16;
649 end if;
650 if(p_attribute.attribute17 is not null) then
651 l_max_populated_attribute := 17;
652 end if;
653 if(p_attribute.attribute18 is not null) then
654 l_max_populated_attribute := 18;
655 end if;
656 if(p_attribute.attribute19 is not null) then
657 l_max_populated_attribute := 19;
658 end if;
659 if(p_attribute.attribute20 is not null) then
660 l_max_populated_attribute := 20;
661 end if;
662 if(p_attribute.attribute21 is not null) then
663 l_max_populated_attribute := 21;
664 end if;
665 if(p_attribute.attribute22 is not null) then
666 l_max_populated_attribute := 22;
667 end if;
668 if(p_attribute.attribute23 is not null) then
669 l_max_populated_attribute := 23;
670 end if;
671 if(p_attribute.attribute24 is not null) then
672 l_max_populated_attribute := 24;
673 end if;
674 if(p_attribute.attribute25 is not null) then
675 l_max_populated_attribute := 25;
676 end if;
677 if(p_attribute.attribute26 is not null) then
678 l_max_populated_attribute := 26;
679 end if;
680 if(p_attribute.attribute27 is not null) then
681 l_max_populated_attribute := 27;
682 end if;
683 if(p_attribute.attribute28 is not null) then
684 l_max_populated_attribute := 28;
685 end if;
686 if(p_attribute.attribute29 is not null) then
687 l_max_populated_attribute := 29;
688 end if;
689 if(p_attribute.attribute30 is not null) then
690 l_max_populated_attribute := 30;
691 end if;
692
693 return l_max_populated_attribute;
694
695 End maximumAttribute;
696
697 Function skip_attribute_entry(p_attribute in HXC_ATTRIBUTE_TYPE) return BOOLEAN is
698 l_return boolean := FALSE;
699 begin
700 if(p_attribute.attribute_category = 'APPROVAL') AND (maximumAttribute(p_attribute)=0) then
701 return true;
702 else
703 return false;
704 end if;
705 END skip_attribute_entry;
706
707
708 Procedure setMappings
709 (p_process_id in number,
710 p_process_type in varchar2,
711 p_attributes in hxc_attribute_table_type,
712 p_app_attributes in out nocopy hxc_self_service_time_deposit.app_attributes_info) is
713
714 l_attribute HXC_ATTRIBUTE_TYPE;
715
716 l_mapping_index pls_integer;
717 l_mapping_end pls_integer;
718 l_attribute_index pls_integer;
719 l_max_attribute_number pls_integer;
720 l_index pls_integer;
721 l_attribute_required boolean;
722
723 l_map_complete boolean;
724
725 Begin
726 l_index := 0;
727 l_attribute_index := p_attributes.first;
728 Loop
729 Exit when not p_attributes.exists(l_attribute_index);
730 l_attribute := p_attributes(l_attribute_index);
731 l_attribute_required := true;
732 if(p_process_type = c_deposit_process) then
733 l_attribute_required := g_deposit_bbit_map.exists(get_bbit_index(p_process_id,l_attribute.bld_blk_info_type_id));
734 else
735 l_attribute_required := g_retrieval_bbit_map.exists(get_bbit_index(p_process_id,l_attribute.bld_blk_info_type_id));
736 end if;
737
738 if(l_attribute_required) then
739
740 l_max_attribute_number := maximumAttribute(l_attribute);
741 l_map_complete := false;
742
743 if(p_process_type = c_deposit_process) then
744 l_mapping_index := g_deposit_bbit_map(get_bbit_index(p_process_id,l_attribute.bld_blk_info_type_id)).start_index;
745 l_mapping_end := g_deposit_bbit_map(get_bbit_index(p_process_id,l_attribute.bld_blk_info_type_id)).stop_index;
746 else
747 l_mapping_index := g_retrieval_bbit_map(get_bbit_index(p_process_id,l_attribute.bld_blk_info_type_id)).start_index;
748 l_mapping_end := g_retrieval_bbit_map(get_bbit_index(p_process_id,l_attribute.bld_blk_info_type_id)).stop_index;
749 end if;
750 --
751 -- Attribute Category
752 --
753 if((NOT l_map_complete) AND (l_max_attribute_number >= 0)) then
754 if(g_mappings.exists(l_mapping_index)) then
755 if(g_mappings(l_mapping_index).segment = 'ATTRIBUTE_CATEGORY') then
756 l_index := l_index + 1;
757 p_app_attributes(l_index).time_attribute_id := l_attribute.time_attribute_id;
758 p_app_attributes(l_index).building_block_id := l_attribute.building_block_id;
759 p_app_attributes(l_index).category := g_mappings(l_mapping_index).category;
760 p_app_attributes(l_index).bld_blk_info_type := l_attribute.bld_blk_info_type;
761 p_app_attributes(l_index).attribute_index := l_attribute_index;
762 p_app_attributes(l_index).segment := g_mappings(l_mapping_index).segment;
763 p_app_attributes(l_index).changed := l_attribute.changed;
764 p_app_attributes(l_index).process := l_attribute.process; --SHIV
765 p_app_attributes(l_index).attribute_name := g_mappings(l_mapping_index).field_name;
766 p_app_attributes(l_index).attribute_value := l_attribute.attribute_category;
767 l_mapping_index := l_mapping_index +1;
768 if(l_mapping_index > l_mapping_end) then
769 l_map_complete := true;
770 end if;
771 end if;
772 end if;
773 end if;
774 --
775 -- Attribute1
776 --
777 if((NOT l_map_complete) AND (l_max_attribute_number >= 1)) then
778 if(g_mappings.exists(l_mapping_index)) then
779 if(g_mappings(l_mapping_index).segment = 'ATTRIBUTE1') then
780 l_index := l_index + 1;
781 p_app_attributes(l_index).time_attribute_id := l_attribute.time_attribute_id;
782 p_app_attributes(l_index).building_block_id := l_attribute.building_block_id;
783 p_app_attributes(l_index).category := g_mappings(l_mapping_index).category;
784 p_app_attributes(l_index).bld_blk_info_type := l_attribute.bld_blk_info_type;
785 p_app_attributes(l_index).attribute_index := l_attribute_index;
786 p_app_attributes(l_index).segment := g_mappings(l_mapping_index).segment;
787 p_app_attributes(l_index).changed := l_attribute.changed;
788 p_app_attributes(l_index).process := l_attribute.process; --SHIV
789 p_app_attributes(l_index).attribute_name := g_mappings(l_mapping_index).field_name;
790 p_app_attributes(l_index).attribute_value := l_attribute.attribute1;
791 l_mapping_index := l_mapping_index +1;
792 if(l_mapping_index > l_mapping_end) then
793 l_map_complete := true;
794 end if;
795 end if;
796 end if;
797 end if;
798 --
799 -- Attribute2
800 --
801 if((NOT l_map_complete) AND (l_max_attribute_number >= 2)) then
802 if(g_mappings.exists(l_mapping_index)) then
803 if(g_mappings(l_mapping_index).segment = 'ATTRIBUTE2') then
804 l_index := l_index + 1;
805 p_app_attributes(l_index).time_attribute_id := l_attribute.time_attribute_id;
806 p_app_attributes(l_index).building_block_id := l_attribute.building_block_id;
807 p_app_attributes(l_index).category := g_mappings(l_mapping_index).category;
808 p_app_attributes(l_index).bld_blk_info_type := l_attribute.bld_blk_info_type;
809 p_app_attributes(l_index).attribute_index := l_attribute_index;
810 p_app_attributes(l_index).segment := g_mappings(l_mapping_index).segment;
811 p_app_attributes(l_index).changed := l_attribute.changed;
812 p_app_attributes(l_index).process := l_attribute.process; --SHIV
813 p_app_attributes(l_index).attribute_name := g_mappings(l_mapping_index).field_name;
814 p_app_attributes(l_index).attribute_value := l_attribute.attribute2;
815 l_mapping_index := l_mapping_index +1;
816 if(l_mapping_index > l_mapping_end) then
817 l_map_complete := true;
818 end if;
819 end if;
820 end if;
821 end if;
822 --
823 -- Attribute3
824 --
825 if((NOT l_map_complete) AND (l_max_attribute_number >= 3)) then
826 if(g_mappings.exists(l_mapping_index)) then
827 if(g_mappings(l_mapping_index).segment = 'ATTRIBUTE3') then
828 l_index := l_index + 1;
829 p_app_attributes(l_index).time_attribute_id := l_attribute.time_attribute_id;
830 p_app_attributes(l_index).building_block_id := l_attribute.building_block_id;
831 p_app_attributes(l_index).category := g_mappings(l_mapping_index).category;
832 p_app_attributes(l_index).bld_blk_info_type := l_attribute.bld_blk_info_type;
833 p_app_attributes(l_index).attribute_index := l_attribute_index;
834 p_app_attributes(l_index).segment := g_mappings(l_mapping_index).segment;
835 p_app_attributes(l_index).changed := l_attribute.changed;
836 p_app_attributes(l_index).process := l_attribute.process; --SHIV
837 p_app_attributes(l_index).attribute_name := g_mappings(l_mapping_index).field_name;
838 p_app_attributes(l_index).attribute_value := l_attribute.attribute3;
839 l_mapping_index := l_mapping_index +1;
840 if(l_mapping_index > l_mapping_end) then
841 l_map_complete := true;
842 end if;
843 end if;
844 end if;
845 end if;
846 --
847 -- Attribute4
848 --
849 if((NOT l_map_complete) AND (l_max_attribute_number >= 4)) then
850 if(g_mappings.exists(l_mapping_index)) then
851 if(g_mappings(l_mapping_index).segment = 'ATTRIBUTE4') then
852 l_index := l_index + 1;
853 p_app_attributes(l_index).time_attribute_id := l_attribute.time_attribute_id;
854 p_app_attributes(l_index).building_block_id := l_attribute.building_block_id;
855 p_app_attributes(l_index).category := g_mappings(l_mapping_index).category;
856 p_app_attributes(l_index).bld_blk_info_type := l_attribute.bld_blk_info_type;
857 p_app_attributes(l_index).attribute_index := l_attribute_index;
858 p_app_attributes(l_index).segment := g_mappings(l_mapping_index).segment;
859 p_app_attributes(l_index).changed := l_attribute.changed;
860 p_app_attributes(l_index).process := l_attribute.process; --SHIV
861 p_app_attributes(l_index).attribute_name := g_mappings(l_mapping_index).field_name;
862 p_app_attributes(l_index).attribute_value := l_attribute.attribute4;
863 l_mapping_index := l_mapping_index +1;
864 if(l_mapping_index > l_mapping_end) then
865 l_map_complete := true;
866 end if;
867 end if;
868 end if;
869 end if;
870 --
871 -- Attribute5
872 --
873 if((NOT l_map_complete) AND (l_max_attribute_number >= 5)) then
874 if(g_mappings.exists(l_mapping_index)) then
875 if(g_mappings(l_mapping_index).segment = 'ATTRIBUTE5') then
876 l_index := l_index + 1;
877 p_app_attributes(l_index).time_attribute_id := l_attribute.time_attribute_id;
878 p_app_attributes(l_index).building_block_id := l_attribute.building_block_id;
879 p_app_attributes(l_index).category := g_mappings(l_mapping_index).category;
880 p_app_attributes(l_index).bld_blk_info_type := l_attribute.bld_blk_info_type;
881 p_app_attributes(l_index).attribute_index := l_attribute_index;
882 p_app_attributes(l_index).segment := g_mappings(l_mapping_index).segment;
883 p_app_attributes(l_index).changed := l_attribute.changed;
884 p_app_attributes(l_index).process := l_attribute.process; --SHIV
885 p_app_attributes(l_index).attribute_name := g_mappings(l_mapping_index).field_name;
886 p_app_attributes(l_index).attribute_value := l_attribute.attribute5;
887 l_mapping_index := l_mapping_index +1;
888 if(l_mapping_index > l_mapping_end) then
889 l_map_complete := true;
890 end if;
891 end if;
892 end if;
893 end if;
894 --
895 -- Attribute6
896 --
897 if((NOT l_map_complete) AND (l_max_attribute_number >= 6)) then
898 if(g_mappings.exists(l_mapping_index)) then
899 if(g_mappings(l_mapping_index).segment = 'ATTRIBUTE6') then
900 l_index := l_index + 1;
901 p_app_attributes(l_index).time_attribute_id := l_attribute.time_attribute_id;
902 p_app_attributes(l_index).building_block_id := l_attribute.building_block_id;
903 p_app_attributes(l_index).category := g_mappings(l_mapping_index).category;
904 p_app_attributes(l_index).bld_blk_info_type := l_attribute.bld_blk_info_type;
905 p_app_attributes(l_index).attribute_index := l_attribute_index;
906 p_app_attributes(l_index).segment := g_mappings(l_mapping_index).segment;
907 p_app_attributes(l_index).changed := l_attribute.changed;
908 p_app_attributes(l_index).process := l_attribute.process; --SHIV
909 p_app_attributes(l_index).attribute_name := g_mappings(l_mapping_index).field_name;
910 p_app_attributes(l_index).attribute_value := l_attribute.attribute6;
911 l_mapping_index := l_mapping_index +1;
912 if(l_mapping_index > l_mapping_end) then
913 l_map_complete := true;
914 end if;
915 end if;
916 end if;
917 end if;
918 --
919 -- Attribute7
920 --
921 if((NOT l_map_complete) AND (l_max_attribute_number >= 7)) then
922 if(g_mappings.exists(l_mapping_index)) then
923 if(g_mappings(l_mapping_index).segment = 'ATTRIBUTE7') then
924 l_index := l_index + 1;
925 p_app_attributes(l_index).time_attribute_id := l_attribute.time_attribute_id;
926 p_app_attributes(l_index).building_block_id := l_attribute.building_block_id;
927 p_app_attributes(l_index).category := g_mappings(l_mapping_index).category;
928 p_app_attributes(l_index).bld_blk_info_type := l_attribute.bld_blk_info_type;
929 p_app_attributes(l_index).attribute_index := l_attribute_index;
930 p_app_attributes(l_index).segment := g_mappings(l_mapping_index).segment;
931 p_app_attributes(l_index).changed := l_attribute.changed;
932 p_app_attributes(l_index).process := l_attribute.process; --SHIV
933 p_app_attributes(l_index).attribute_name := g_mappings(l_mapping_index).field_name;
934 p_app_attributes(l_index).attribute_value := l_attribute.attribute7;
935 l_mapping_index := l_mapping_index +1;
936 if(l_mapping_index > l_mapping_end) then
937 l_map_complete := true;
938 end if;
939 end if;
940 end if;
941 end if;
942 --
943 -- Attribute8
944 --
945 if((NOT l_map_complete) AND (l_max_attribute_number >= 8)) then
946 if(g_mappings.exists(l_mapping_index)) then
947 if(g_mappings(l_mapping_index).segment = 'ATTRIBUTE8') then
948 l_index := l_index + 1;
949 p_app_attributes(l_index).time_attribute_id := l_attribute.time_attribute_id;
950 p_app_attributes(l_index).building_block_id := l_attribute.building_block_id;
951 p_app_attributes(l_index).category := g_mappings(l_mapping_index).category;
952 p_app_attributes(l_index).bld_blk_info_type := l_attribute.bld_blk_info_type;
953 p_app_attributes(l_index).attribute_index := l_attribute_index;
954 p_app_attributes(l_index).segment := g_mappings(l_mapping_index).segment;
955 p_app_attributes(l_index).changed := l_attribute.changed;
956 p_app_attributes(l_index).process := l_attribute.process; --SHIV
957 p_app_attributes(l_index).attribute_name := g_mappings(l_mapping_index).field_name;
958 p_app_attributes(l_index).attribute_value := l_attribute.attribute8;
959 l_mapping_index := l_mapping_index +1;
960 if(l_mapping_index > l_mapping_end) then
961 l_map_complete := true;
962 end if;
963 end if;
964 end if;
965 end if;
966 --
967 -- Attribute9
968 --
969 if((NOT l_map_complete) AND (l_max_attribute_number >= 9)) then
970 if(g_mappings.exists(l_mapping_index)) then
971 if(g_mappings(l_mapping_index).segment = 'ATTRIBUTE9') then
972 l_index := l_index + 1;
973 p_app_attributes(l_index).time_attribute_id := l_attribute.time_attribute_id;
974 p_app_attributes(l_index).building_block_id := l_attribute.building_block_id;
975 p_app_attributes(l_index).category := g_mappings(l_mapping_index).category;
976 p_app_attributes(l_index).bld_blk_info_type := l_attribute.bld_blk_info_type;
977 p_app_attributes(l_index).attribute_index := l_attribute_index;
978 p_app_attributes(l_index).segment := g_mappings(l_mapping_index).segment;
979 p_app_attributes(l_index).changed := l_attribute.changed;
980 p_app_attributes(l_index).process := l_attribute.process; --SHIV
981 p_app_attributes(l_index).attribute_name := g_mappings(l_mapping_index).field_name;
982 p_app_attributes(l_index).attribute_value := l_attribute.attribute9;
983 l_mapping_index := l_mapping_index +1;
984 if(l_mapping_index > l_mapping_end) then
985 l_map_complete := true;
986 end if;
987 end if;
988 end if;
989 end if;
990 --
991 -- Attribute10
992 --
993 if((NOT l_map_complete) AND (l_max_attribute_number >= 10)) then
994 if(g_mappings.exists(l_mapping_index)) then
995 if(g_mappings(l_mapping_index).segment = 'ATTRIBUTE10') then
996 l_index := l_index + 1;
997 p_app_attributes(l_index).time_attribute_id := l_attribute.time_attribute_id;
998 p_app_attributes(l_index).building_block_id := l_attribute.building_block_id;
999 p_app_attributes(l_index).category := g_mappings(l_mapping_index).category;
1000 p_app_attributes(l_index).bld_blk_info_type := l_attribute.bld_blk_info_type;
1001 p_app_attributes(l_index).attribute_index := l_attribute_index;
1002 p_app_attributes(l_index).segment := g_mappings(l_mapping_index).segment;
1003 p_app_attributes(l_index).changed := l_attribute.changed;
1004 p_app_attributes(l_index).process := l_attribute.process; --SHIV
1005 p_app_attributes(l_index).attribute_name := g_mappings(l_mapping_index).field_name;
1006 p_app_attributes(l_index).attribute_value := l_attribute.attribute10;
1007 l_mapping_index := l_mapping_index +1;
1008 if(l_mapping_index > l_mapping_end) then
1009 l_map_complete := true;
1010 end if;
1011 end if;
1012 end if;
1013 end if;
1014 --
1015 -- Attribute11
1016 --
1017 if((NOT l_map_complete) AND (l_max_attribute_number >= 11)) then
1018 if(g_mappings.exists(l_mapping_index)) then
1019 if(g_mappings(l_mapping_index).segment = 'ATTRIBUTE11') then
1020 l_index := l_index + 1;
1021 p_app_attributes(l_index).time_attribute_id := l_attribute.time_attribute_id;
1022 p_app_attributes(l_index).building_block_id := l_attribute.building_block_id;
1023 p_app_attributes(l_index).category := g_mappings(l_mapping_index).category;
1024 p_app_attributes(l_index).bld_blk_info_type := l_attribute.bld_blk_info_type;
1025 p_app_attributes(l_index).attribute_index := l_attribute_index;
1026 p_app_attributes(l_index).segment := g_mappings(l_mapping_index).segment;
1027 p_app_attributes(l_index).changed := l_attribute.changed;
1028 p_app_attributes(l_index).process := l_attribute.process; --SHIV
1029 p_app_attributes(l_index).attribute_name := g_mappings(l_mapping_index).field_name;
1030 p_app_attributes(l_index).attribute_value := l_attribute.attribute11;
1031 l_mapping_index := l_mapping_index +1;
1032 if(l_mapping_index > l_mapping_end) then
1033 l_map_complete := true;
1034 end if;
1035 end if;
1036 end if;
1037 end if;
1038 --
1039 -- Attribute12
1040 --
1041 if((NOT l_map_complete) AND (l_max_attribute_number >= 12)) then
1042 if(g_mappings.exists(l_mapping_index)) then
1043 if(g_mappings(l_mapping_index).segment = 'ATTRIBUTE12') then
1044 l_index := l_index + 1;
1045 p_app_attributes(l_index).time_attribute_id := l_attribute.time_attribute_id;
1046 p_app_attributes(l_index).building_block_id := l_attribute.building_block_id;
1047 p_app_attributes(l_index).category := g_mappings(l_mapping_index).category;
1048 p_app_attributes(l_index).bld_blk_info_type := l_attribute.bld_blk_info_type;
1049 p_app_attributes(l_index).attribute_index := l_attribute_index;
1050 p_app_attributes(l_index).segment := g_mappings(l_mapping_index).segment;
1051 p_app_attributes(l_index).changed := l_attribute.changed;
1052 p_app_attributes(l_index).process := l_attribute.process; --SHIV
1053 p_app_attributes(l_index).attribute_name := g_mappings(l_mapping_index).field_name;
1054 p_app_attributes(l_index).attribute_value := l_attribute.attribute12;
1055 l_mapping_index := l_mapping_index +1;
1056 if(l_mapping_index > l_mapping_end) then
1057 l_map_complete := true;
1058 end if;
1059 end if;
1060 end if;
1061 end if;
1062 --
1063 -- Attribute13
1064 --
1065 if((NOT l_map_complete) AND (l_max_attribute_number >= 13)) then
1066 if(g_mappings.exists(l_mapping_index)) then
1067 if(g_mappings(l_mapping_index).segment = 'ATTRIBUTE13') then
1068 l_index := l_index + 1;
1069 p_app_attributes(l_index).time_attribute_id := l_attribute.time_attribute_id;
1070 p_app_attributes(l_index).building_block_id := l_attribute.building_block_id;
1071 p_app_attributes(l_index).category := g_mappings(l_mapping_index).category;
1072 p_app_attributes(l_index).bld_blk_info_type := l_attribute.bld_blk_info_type;
1073 p_app_attributes(l_index).attribute_index := l_attribute_index;
1074 p_app_attributes(l_index).segment := g_mappings(l_mapping_index).segment;
1075 p_app_attributes(l_index).changed := l_attribute.changed;
1076 p_app_attributes(l_index).process := l_attribute.process; --SHIV
1077 p_app_attributes(l_index).attribute_name := g_mappings(l_mapping_index).field_name;
1078 p_app_attributes(l_index).attribute_value := l_attribute.attribute13;
1079 l_mapping_index := l_mapping_index +1;
1080 if(l_mapping_index > l_mapping_end) then
1081 l_map_complete := true;
1082 end if;
1083 end if;
1084 end if;
1085 end if;
1086 --
1087 -- Attribute14
1088 --
1089 if((NOT l_map_complete) AND (l_max_attribute_number >= 14)) then
1090 if(g_mappings.exists(l_mapping_index)) then
1091 if(g_mappings(l_mapping_index).segment = 'ATTRIBUTE14') then
1092 l_index := l_index + 1;
1093 p_app_attributes(l_index).time_attribute_id := l_attribute.time_attribute_id;
1094 p_app_attributes(l_index).building_block_id := l_attribute.building_block_id;
1095 p_app_attributes(l_index).category := g_mappings(l_mapping_index).category;
1096 p_app_attributes(l_index).bld_blk_info_type := l_attribute.bld_blk_info_type;
1097 p_app_attributes(l_index).attribute_index := l_attribute_index;
1098 p_app_attributes(l_index).segment := g_mappings(l_mapping_index).segment;
1099 p_app_attributes(l_index).changed := l_attribute.changed;
1100 p_app_attributes(l_index).process := l_attribute.process; --SHIV
1101 p_app_attributes(l_index).attribute_name := g_mappings(l_mapping_index).field_name;
1102 p_app_attributes(l_index).attribute_value := l_attribute.attribute14;
1103 l_mapping_index := l_mapping_index +1;
1104 if(l_mapping_index > l_mapping_end) then
1105 l_map_complete := true;
1106 end if;
1107 end if;
1108 end if;
1109 end if;
1110 --
1111 -- Attribute15
1112 --
1113 if((NOT l_map_complete) AND (l_max_attribute_number >= 15)) then
1114 if(g_mappings.exists(l_mapping_index)) then
1115 if(g_mappings(l_mapping_index).segment = 'ATTRIBUTE15') then
1116 l_index := l_index + 1;
1117 p_app_attributes(l_index).time_attribute_id := l_attribute.time_attribute_id;
1118 p_app_attributes(l_index).building_block_id := l_attribute.building_block_id;
1119 p_app_attributes(l_index).category := g_mappings(l_mapping_index).category;
1120 p_app_attributes(l_index).bld_blk_info_type := l_attribute.bld_blk_info_type;
1121 p_app_attributes(l_index).attribute_index := l_attribute_index;
1122 p_app_attributes(l_index).segment := g_mappings(l_mapping_index).segment;
1123 p_app_attributes(l_index).changed := l_attribute.changed;
1124 p_app_attributes(l_index).process := l_attribute.process; --SHIV
1125 p_app_attributes(l_index).attribute_name := g_mappings(l_mapping_index).field_name;
1126 p_app_attributes(l_index).attribute_value := l_attribute.attribute15;
1127 l_mapping_index := l_mapping_index +1;
1128 if(l_mapping_index > l_mapping_end) then
1129 l_map_complete := true;
1130 end if;
1131 end if;
1132 end if;
1133 end if;
1134 --
1135 -- Attribute16
1136 --
1137 if((NOT l_map_complete) AND (l_max_attribute_number >= 16)) then
1138 if(g_mappings.exists(l_mapping_index)) then
1139 if(g_mappings(l_mapping_index).segment = 'ATTRIBUTE16') then
1140 l_index := l_index + 1;
1141 p_app_attributes(l_index).time_attribute_id := l_attribute.time_attribute_id;
1142 p_app_attributes(l_index).building_block_id := l_attribute.building_block_id;
1143 p_app_attributes(l_index).category := g_mappings(l_mapping_index).category;
1144 p_app_attributes(l_index).bld_blk_info_type := l_attribute.bld_blk_info_type;
1145 p_app_attributes(l_index).attribute_index := l_attribute_index;
1146 p_app_attributes(l_index).segment := g_mappings(l_mapping_index).segment;
1147 p_app_attributes(l_index).changed := l_attribute.changed;
1148 p_app_attributes(l_index).process := l_attribute.process; --SHIV
1149 p_app_attributes(l_index).attribute_name := g_mappings(l_mapping_index).field_name;
1150 p_app_attributes(l_index).attribute_value := l_attribute.attribute16;
1151 l_mapping_index := l_mapping_index +1;
1152 if(l_mapping_index > l_mapping_end) then
1153 l_map_complete := true;
1154 end if;
1155 end if;
1156 end if;
1157 end if;
1158 --
1159 -- Attribute17
1160 --
1161 if((NOT l_map_complete) AND (l_max_attribute_number >= 17)) then
1162 if(g_mappings.exists(l_mapping_index)) then
1163 if(g_mappings(l_mapping_index).segment = 'ATTRIBUTE17') then
1164 l_index := l_index + 1;
1165 p_app_attributes(l_index).time_attribute_id := l_attribute.time_attribute_id;
1166 p_app_attributes(l_index).building_block_id := l_attribute.building_block_id;
1167 p_app_attributes(l_index).category := g_mappings(l_mapping_index).category;
1168 p_app_attributes(l_index).bld_blk_info_type := l_attribute.bld_blk_info_type;
1169 p_app_attributes(l_index).attribute_index := l_attribute_index;
1170 p_app_attributes(l_index).segment := g_mappings(l_mapping_index).segment;
1171 p_app_attributes(l_index).changed := l_attribute.changed;
1172 p_app_attributes(l_index).process := l_attribute.process; --SHIV
1173 p_app_attributes(l_index).attribute_name := g_mappings(l_mapping_index).field_name;
1174 p_app_attributes(l_index).attribute_value := l_attribute.attribute17;
1175 l_mapping_index := l_mapping_index +1;
1176 if(l_mapping_index > l_mapping_end) then
1177 l_map_complete := true;
1178 end if;
1179 end if;
1180 end if;
1181 end if;
1182 --
1183 -- Attribute18
1184 --
1185 if((NOT l_map_complete) AND (l_max_attribute_number >= 18)) then
1186 if(g_mappings.exists(l_mapping_index)) then
1187 if(g_mappings(l_mapping_index).segment = 'ATTRIBUTE18') then
1188 l_index := l_index + 1;
1189 p_app_attributes(l_index).time_attribute_id := l_attribute.time_attribute_id;
1190 p_app_attributes(l_index).building_block_id := l_attribute.building_block_id;
1191 p_app_attributes(l_index).category := g_mappings(l_mapping_index).category;
1192 p_app_attributes(l_index).bld_blk_info_type := l_attribute.bld_blk_info_type;
1193 p_app_attributes(l_index).attribute_index := l_attribute_index;
1194 p_app_attributes(l_index).segment := g_mappings(l_mapping_index).segment;
1195 p_app_attributes(l_index).changed := l_attribute.changed;
1196 p_app_attributes(l_index).process := l_attribute.process; --SHIV
1197 p_app_attributes(l_index).attribute_name := g_mappings(l_mapping_index).field_name;
1198 p_app_attributes(l_index).attribute_value := l_attribute.attribute18;
1199 l_mapping_index := l_mapping_index +1;
1200 if(l_mapping_index > l_mapping_end) then
1201 l_map_complete := true;
1202 end if;
1203 end if;
1204 end if;
1205 end if;
1206 --
1207 -- Attribute19
1208 --
1209 if((NOT l_map_complete) AND (l_max_attribute_number >= 19)) then
1210 if(g_mappings.exists(l_mapping_index)) then
1211 if(g_mappings(l_mapping_index).segment = 'ATTRIBUTE19') then
1212 l_index := l_index + 1;
1213 p_app_attributes(l_index).time_attribute_id := l_attribute.time_attribute_id;
1214 p_app_attributes(l_index).building_block_id := l_attribute.building_block_id;
1215 p_app_attributes(l_index).category := g_mappings(l_mapping_index).category;
1216 p_app_attributes(l_index).bld_blk_info_type := l_attribute.bld_blk_info_type;
1217 p_app_attributes(l_index).attribute_index := l_attribute_index;
1218 p_app_attributes(l_index).segment := g_mappings(l_mapping_index).segment;
1219 p_app_attributes(l_index).changed := l_attribute.changed;
1220 p_app_attributes(l_index).process := l_attribute.process; --SHIV
1221 p_app_attributes(l_index).attribute_name := g_mappings(l_mapping_index).field_name;
1222 p_app_attributes(l_index).attribute_value := l_attribute.attribute19;
1223 l_mapping_index := l_mapping_index +1;
1224 if(l_mapping_index > l_mapping_end) then
1225 l_map_complete := true;
1226 end if;
1227 end if;
1228 end if;
1229 end if;
1230 --
1231 -- Attribute20
1232 --
1233 if((NOT l_map_complete) AND (l_max_attribute_number >= 20)) then
1234 if(g_mappings.exists(l_mapping_index)) then
1235 if(g_mappings(l_mapping_index).segment = 'ATTRIBUTE20') then
1236 l_index := l_index + 1;
1237 p_app_attributes(l_index).time_attribute_id := l_attribute.time_attribute_id;
1238 p_app_attributes(l_index).building_block_id := l_attribute.building_block_id;
1239 p_app_attributes(l_index).category := g_mappings(l_mapping_index).category;
1240 p_app_attributes(l_index).bld_blk_info_type := l_attribute.bld_blk_info_type;
1241 p_app_attributes(l_index).attribute_index := l_attribute_index;
1242 p_app_attributes(l_index).segment := g_mappings(l_mapping_index).segment;
1243 p_app_attributes(l_index).changed := l_attribute.changed;
1244 p_app_attributes(l_index).process := l_attribute.process; --SHIV
1245 p_app_attributes(l_index).attribute_name := g_mappings(l_mapping_index).field_name;
1246 p_app_attributes(l_index).attribute_value := l_attribute.attribute20;
1247 l_mapping_index := l_mapping_index +1;
1248 if(l_mapping_index > l_mapping_end) then
1249 l_map_complete := true;
1250 end if;
1251 end if;
1252 end if;
1253 end if;
1254 --
1255 -- Attribute21
1256 --
1257 if((NOT l_map_complete) AND (l_max_attribute_number >= 21)) then
1258 if(g_mappings.exists(l_mapping_index)) then
1259 if(g_mappings(l_mapping_index).segment = 'ATTRIBUTE21') then
1260 l_index := l_index + 1;
1261 p_app_attributes(l_index).time_attribute_id := l_attribute.time_attribute_id;
1262 p_app_attributes(l_index).building_block_id := l_attribute.building_block_id;
1263 p_app_attributes(l_index).category := g_mappings(l_mapping_index).category;
1264 p_app_attributes(l_index).bld_blk_info_type := l_attribute.bld_blk_info_type;
1265 p_app_attributes(l_index).attribute_index := l_attribute_index;
1266 p_app_attributes(l_index).segment := g_mappings(l_mapping_index).segment;
1267 p_app_attributes(l_index).changed := l_attribute.changed;
1268 p_app_attributes(l_index).process := l_attribute.process; --SHIV
1269 p_app_attributes(l_index).attribute_name := g_mappings(l_mapping_index).field_name;
1270 p_app_attributes(l_index).attribute_value := l_attribute.attribute21;
1271 l_mapping_index := l_mapping_index +1;
1272 if(l_mapping_index > l_mapping_end) then
1273 l_map_complete := true;
1274 end if;
1275 end if;
1276 end if;
1277 end if;
1278 --
1279 -- Attribute22
1280 --
1281 if((NOT l_map_complete) AND (l_max_attribute_number >= 22)) then
1282 if(g_mappings.exists(l_mapping_index)) then
1283 if(g_mappings(l_mapping_index).segment = 'ATTRIBUTE22') then
1284 l_index := l_index + 1;
1285 p_app_attributes(l_index).time_attribute_id := l_attribute.time_attribute_id;
1286 p_app_attributes(l_index).building_block_id := l_attribute.building_block_id;
1287 p_app_attributes(l_index).category := g_mappings(l_mapping_index).category;
1288 p_app_attributes(l_index).bld_blk_info_type := l_attribute.bld_blk_info_type;
1289 p_app_attributes(l_index).attribute_index := l_attribute_index;
1290 p_app_attributes(l_index).segment := g_mappings(l_mapping_index).segment;
1291 p_app_attributes(l_index).changed := l_attribute.changed;
1292 p_app_attributes(l_index).process := l_attribute.process; --SHIV
1293 p_app_attributes(l_index).attribute_name := g_mappings(l_mapping_index).field_name;
1294 p_app_attributes(l_index).attribute_value := l_attribute.attribute22;
1295 l_mapping_index := l_mapping_index +1;
1296 if(l_mapping_index > l_mapping_end) then
1297 l_map_complete := true;
1298 end if;
1299 end if;
1300 end if;
1301 end if;
1302 --
1303 -- Attribute23
1304 --
1305 if((NOT l_map_complete) AND (l_max_attribute_number >= 23)) then
1306 if(g_mappings.exists(l_mapping_index)) then
1307 if(g_mappings(l_mapping_index).segment = 'ATTRIBUTE23') then
1308 l_index := l_index + 1;
1309 p_app_attributes(l_index).time_attribute_id := l_attribute.time_attribute_id;
1310 p_app_attributes(l_index).building_block_id := l_attribute.building_block_id;
1311 p_app_attributes(l_index).category := g_mappings(l_mapping_index).category;
1312 p_app_attributes(l_index).bld_blk_info_type := l_attribute.bld_blk_info_type;
1313 p_app_attributes(l_index).attribute_index := l_attribute_index;
1314 p_app_attributes(l_index).segment := g_mappings(l_mapping_index).segment;
1315 p_app_attributes(l_index).changed := l_attribute.changed;
1316 p_app_attributes(l_index).process := l_attribute.process; --SHIV
1317 p_app_attributes(l_index).attribute_name := g_mappings(l_mapping_index).field_name;
1318 p_app_attributes(l_index).attribute_value := l_attribute.attribute23;
1319 l_mapping_index := l_mapping_index +1;
1320 if(l_mapping_index > l_mapping_end) then
1321 l_map_complete := true;
1322 end if;
1323 end if;
1324 end if;
1325 end if;
1326 --
1327 -- Attribute24
1328 --
1329 if((NOT l_map_complete) AND (l_max_attribute_number >= 24)) then
1330 if(g_mappings.exists(l_mapping_index)) then
1331 if(g_mappings(l_mapping_index).segment = 'ATTRIBUTE24') then
1332 l_index := l_index + 1;
1333 p_app_attributes(l_index).time_attribute_id := l_attribute.time_attribute_id;
1334 p_app_attributes(l_index).building_block_id := l_attribute.building_block_id;
1335 p_app_attributes(l_index).category := g_mappings(l_mapping_index).category;
1336 p_app_attributes(l_index).bld_blk_info_type := l_attribute.bld_blk_info_type;
1337 p_app_attributes(l_index).attribute_index := l_attribute_index;
1338 p_app_attributes(l_index).segment := g_mappings(l_mapping_index).segment;
1339 p_app_attributes(l_index).changed := l_attribute.changed;
1340 p_app_attributes(l_index).process := l_attribute.process; --SHIV
1341 p_app_attributes(l_index).attribute_name := g_mappings(l_mapping_index).field_name;
1342 p_app_attributes(l_index).attribute_value := l_attribute.attribute24;
1343 l_mapping_index := l_mapping_index +1;
1344 if(l_mapping_index > l_mapping_end) then
1345 l_map_complete := true;
1346 end if;
1347 end if;
1348 end if;
1349 end if;
1350 --
1351 -- Attribute25
1352 --
1353 if((NOT l_map_complete) AND (l_max_attribute_number >= 25)) then
1354 if(g_mappings.exists(l_mapping_index)) then
1355 if(g_mappings(l_mapping_index).segment = 'ATTRIBUTE25') then
1356 l_index := l_index + 1;
1357 p_app_attributes(l_index).time_attribute_id := l_attribute.time_attribute_id;
1358 p_app_attributes(l_index).building_block_id := l_attribute.building_block_id;
1359 p_app_attributes(l_index).category := g_mappings(l_mapping_index).category;
1360 p_app_attributes(l_index).bld_blk_info_type := l_attribute.bld_blk_info_type;
1361 p_app_attributes(l_index).attribute_index := l_attribute_index;
1362 p_app_attributes(l_index).segment := g_mappings(l_mapping_index).segment;
1363 p_app_attributes(l_index).changed := l_attribute.changed;
1364 p_app_attributes(l_index).process := l_attribute.process; --SHIV
1365 p_app_attributes(l_index).attribute_name := g_mappings(l_mapping_index).field_name;
1366 p_app_attributes(l_index).attribute_value := l_attribute.attribute25;
1367 l_mapping_index := l_mapping_index +1;
1368 if(l_mapping_index > l_mapping_end) then
1369 l_map_complete := true;
1370 end if;
1371 end if;
1372 end if;
1373 end if;
1374 --
1375 -- Attribute26
1376 --
1377 if((NOT l_map_complete) AND (l_max_attribute_number >= 26)) then
1378 if(g_mappings.exists(l_mapping_index)) then
1379 if(g_mappings(l_mapping_index).segment = 'ATTRIBUTE26') then
1380 l_index := l_index + 1;
1381 p_app_attributes(l_index).time_attribute_id := l_attribute.time_attribute_id;
1382 p_app_attributes(l_index).building_block_id := l_attribute.building_block_id;
1383 p_app_attributes(l_index).category := g_mappings(l_mapping_index).category;
1384 p_app_attributes(l_index).bld_blk_info_type := l_attribute.bld_blk_info_type;
1385 p_app_attributes(l_index).attribute_index := l_attribute_index;
1386 p_app_attributes(l_index).segment := g_mappings(l_mapping_index).segment;
1387 p_app_attributes(l_index).changed := l_attribute.changed;
1388 p_app_attributes(l_index).process := l_attribute.process; --SHIV
1389 p_app_attributes(l_index).attribute_name := g_mappings(l_mapping_index).field_name;
1390 p_app_attributes(l_index).attribute_value := l_attribute.attribute26;
1391 l_mapping_index := l_mapping_index +1;
1392 if(l_mapping_index > l_mapping_end) then
1393 l_map_complete := true;
1394 end if;
1395 end if;
1396 end if;
1397 end if;
1398 --
1399 -- Attribute27
1400 --
1401 if((NOT l_map_complete) AND (l_max_attribute_number >= 27)) then
1402 if(g_mappings.exists(l_mapping_index)) then
1403 if(g_mappings(l_mapping_index).segment = 'ATTRIBUTE27') then
1404 l_index := l_index + 1;
1405 p_app_attributes(l_index).time_attribute_id := l_attribute.time_attribute_id;
1406 p_app_attributes(l_index).building_block_id := l_attribute.building_block_id;
1407 p_app_attributes(l_index).category := g_mappings(l_mapping_index).category;
1408 p_app_attributes(l_index).bld_blk_info_type := l_attribute.bld_blk_info_type;
1409 p_app_attributes(l_index).attribute_index := l_attribute_index;
1410 p_app_attributes(l_index).segment := g_mappings(l_mapping_index).segment;
1411 p_app_attributes(l_index).changed := l_attribute.changed;
1412 p_app_attributes(l_index).process := l_attribute.process; --SHIV
1413 p_app_attributes(l_index).attribute_name := g_mappings(l_mapping_index).field_name;
1414 p_app_attributes(l_index).attribute_value := l_attribute.attribute27;
1415 l_mapping_index := l_mapping_index +1;
1416 if(l_mapping_index > l_mapping_end) then
1417 l_map_complete := true;
1418 end if;
1419 end if;
1420 end if;
1421 end if;
1422 --
1423 -- Attribute28
1424 --
1425 if((NOT l_map_complete) AND (l_max_attribute_number >= 28)) then
1426 if(g_mappings.exists(l_mapping_index)) then
1427 if(g_mappings(l_mapping_index).segment = 'ATTRIBUTE28') then
1428 l_index := l_index + 1;
1429 p_app_attributes(l_index).time_attribute_id := l_attribute.time_attribute_id;
1430 p_app_attributes(l_index).building_block_id := l_attribute.building_block_id;
1431 p_app_attributes(l_index).category := g_mappings(l_mapping_index).category;
1432 p_app_attributes(l_index).bld_blk_info_type := l_attribute.bld_blk_info_type;
1433 p_app_attributes(l_index).attribute_index := l_attribute_index;
1434 p_app_attributes(l_index).segment := g_mappings(l_mapping_index).segment;
1435 p_app_attributes(l_index).changed := l_attribute.changed;
1436 p_app_attributes(l_index).process := l_attribute.process; --SHIV
1437 p_app_attributes(l_index).attribute_name := g_mappings(l_mapping_index).field_name;
1438 p_app_attributes(l_index).attribute_value := l_attribute.attribute28;
1439 l_mapping_index := l_mapping_index +1;
1440 if(l_mapping_index > l_mapping_end) then
1441 l_map_complete := true;
1442 end if;
1443 end if;
1444 end if;
1445 end if;
1446 --
1447 -- Attribute29
1448 --
1449 if((NOT l_map_complete) AND (l_max_attribute_number >= 29)) then
1450 if(g_mappings.exists(l_mapping_index)) then
1451 if(g_mappings(l_mapping_index).segment = 'ATTRIBUTE29') then
1452 l_index := l_index + 1;
1453 p_app_attributes(l_index).time_attribute_id := l_attribute.time_attribute_id;
1454 p_app_attributes(l_index).building_block_id := l_attribute.building_block_id;
1455 p_app_attributes(l_index).category := g_mappings(l_mapping_index).category;
1456 p_app_attributes(l_index).bld_blk_info_type := l_attribute.bld_blk_info_type;
1457 p_app_attributes(l_index).attribute_index := l_attribute_index;
1458 p_app_attributes(l_index).segment := g_mappings(l_mapping_index).segment;
1459 p_app_attributes(l_index).changed := l_attribute.changed;
1460 p_app_attributes(l_index).process := l_attribute.process; --SHIV
1461 p_app_attributes(l_index).attribute_name := g_mappings(l_mapping_index).field_name;
1462 p_app_attributes(l_index).attribute_value := l_attribute.attribute29;
1463 l_mapping_index := l_mapping_index +1;
1464 if(l_mapping_index > l_mapping_end) then
1465 l_map_complete := true;
1466 end if;
1467 end if;
1468 end if;
1469 end if;
1470 --
1471 -- Attribute30
1472 --
1473 if((NOT l_map_complete) AND (l_max_attribute_number = 30)) then
1474 if(g_mappings.exists(l_mapping_index)) then
1475 if(g_mappings(l_mapping_index).segment = 'ATTRIBUTE30') then
1476 l_index := l_index + 1;
1477 p_app_attributes(l_index).time_attribute_id := l_attribute.time_attribute_id;
1478 p_app_attributes(l_index).building_block_id := l_attribute.building_block_id;
1479 p_app_attributes(l_index).category := g_mappings(l_mapping_index).category;
1480 p_app_attributes(l_index).bld_blk_info_type := l_attribute.bld_blk_info_type;
1481 p_app_attributes(l_index).attribute_index := l_attribute_index;
1482 p_app_attributes(l_index).segment := g_mappings(l_mapping_index).segment;
1483 p_app_attributes(l_index).changed := l_attribute.changed;
1484 p_app_attributes(l_index).process := l_attribute.process; --SHIV
1485 p_app_attributes(l_index).attribute_name := g_mappings(l_mapping_index).field_name;
1486 p_app_attributes(l_index).attribute_value := l_attribute.attribute30;
1487 l_mapping_index := l_mapping_index +1;
1488 if(l_mapping_index > l_mapping_end) then
1489 l_map_complete := true;
1490 end if;
1491 end if;
1492 end if;
1493 end if;
1494 end if;
1495 l_attribute_index := p_attributes.next(l_attribute_index);
1496 End Loop;
1497
1498 End setMappings;
1499 --
1500 -- New more performant version.
1501 --
1502 Function create_app_attributes
1503 (p_attributes in hxc_attribute_table_type
1504 ,p_retrieval_process_id in hxc_retrieval_processes.retrieval_process_id%type
1505 ,p_deposit_process_id in hxc_deposit_processes.deposit_process_id%type
1506 ) return hxc_self_service_time_deposit.app_attributes_info is
1507
1508 l_index pls_integer;
1509 l_app_attributes hxc_self_service_time_deposit.app_attributes_info;
1510 l_map_idx pls_integer;
1511
1512 Begin
1513 --
1514 -- Make sure we have the mappings
1515 --
1516 cache_mappings;
1517 --
1518 -- Set the index basis, deposit or retrieval?
1519 --
1520 if(p_deposit_process_id is not null) then
1521 setMappings(p_deposit_process_id,c_deposit_process,p_attributes, l_app_attributes);
1522 else
1523 setMappings(p_retrieval_process_id,c_retrieval_process,p_attributes, l_app_attributes);
1524 end if;
1525
1526 return l_app_attributes;
1527
1528 End create_app_attributes;
1529
1530 Function attribute_needed
1531 (p_blocks in hxc_block_table_type
1532 ,p_time_building_block_id in number
1533 ) return boolean is
1534
1535 l_index number;
1536 l_found boolean := false;
1537
1538 Begin
1539
1540 l_index := p_blocks.first;
1541
1542 Loop
1543 Exit when ((not p_blocks.exists(l_index)) OR (l_found));
1544
1545 if(p_blocks(l_index).time_building_block_id = p_time_building_block_id) then
1546 l_found := true;
1547 end if;
1548
1549 l_index := p_blocks.next(l_index);
1550 End Loop;
1551
1552 return l_found;
1553
1554 End attribute_needed;
1555
1556 Function find_corresponding_app_set_id
1557 (p_blocks in hxc_block_table_type
1558 ,p_time_building_block_id in number
1559 ) return number is
1560
1561 l_index number;
1562 l_appset_id number := -1;
1563 l_found boolean := false;
1564
1565 Begin
1566
1567 l_index := p_blocks.first;
1568
1569 Loop
1570 Exit when ((not p_blocks.exists(l_index)) OR (l_found));
1571
1572 if(p_blocks(l_index).time_building_block_id = p_time_building_block_id) then
1573 l_appset_id := p_blocks(l_index).application_set_id;
1574 l_found := true;
1575 end if;
1576
1577 l_index := p_blocks.next(l_index);
1578 End Loop;
1579
1580 return l_appset_id;
1581
1582 End find_corresponding_app_set_id;
1583
1584 Function create_app_attributes
1585 (p_blocks in hxc_block_table_type
1586 ,p_attributes in hxc_attribute_table_type
1587 ,p_retrieval_process_id in hxc_retrieval_processes.retrieval_process_id%type
1588 ,p_deposit_process_id in hxc_deposit_processes.deposit_process_id%type
1589 ,p_recipients in hxc_timecard_validation.recipient_application_table
1590 ) return hxc_self_service_time_deposit.app_attributes_info is
1591
1592 l_attribute_index number;
1593 l_mapping_index number;
1594 l_app_attribute_index number := 0;
1595 l_app_attributes hxc_self_service_time_deposit.app_attributes_info;
1596 g_appset_recips appset_recipient_table;
1597 l_block_app_set number;
1598 l_mapping_start number;
1599 l_mapping_stop number;
1600
1601 l_proc varchar2(70) := 'create_app_attributes(block)';
1602
1603 Begin
1604 --
1605 -- Make sure we have the mappings
1606 cache_mappings;
1607 --
1608 -- Cache all the recipients and corresponding application sets
1609 --
1610 cache_appset_recipient;
1611 --
1612 -- Loop over the attributes
1613 --
1614 l_attribute_index := p_attributes.first;
1615
1616 Loop
1617 Exit When Not p_attributes.exists(l_attribute_index);
1618 l_block_app_set := find_corresponding_app_set_id(p_blocks,p_attributes(l_attribute_index).building_block_id);
1619 if(l_block_app_set <> -1) then
1620 --
1621 -- Loop over the mappings, to find those
1622 -- that correspond to this app attributes request
1623 -- We can guess this, based on the mapping info
1624 -- we built when we cached the mappings
1625
1626 if(p_retrieval_process_id is not null) then
1627 l_mapping_start := g_retrieval_map(p_retrieval_process_id).start_index;
1628 l_mapping_stop := g_retrieval_map(p_retrieval_process_id).stop_index;
1629 end if;
1630 if(p_deposit_process_id is not null) then
1631 l_mapping_start := g_deposit_map(p_deposit_process_id).start_index;
1632 l_mapping_stop := g_deposit_map(p_deposit_process_id).stop_index;
1633 end if;
1634 /*
1635 Loop
1636 Exit When Not g_mappings.exists(l_mapping_index);
1637 */
1638
1639 if (skip_attribute_entry(p_attributes(l_attribute_index)) = FALSE) Then
1640 For l_mapping_index in l_mapping_start..l_mapping_stop Loop
1641 if(mapping_applies(p_attributes(l_attribute_index),l_mapping_index,p_retrieval_process_id, p_deposit_process_id,l_block_app_set,p_recipients)) then
1642 l_app_attribute_index := l_app_attribute_index +1 ;
1643
1644 l_app_attributes(l_app_attribute_index).time_attribute_id
1645 := p_attributes(l_attribute_index).time_attribute_id;
1646 l_app_attributes(l_app_attribute_index).building_block_id
1647 := p_attributes(l_attribute_index).building_block_id;
1648 l_app_attributes(l_app_attribute_index).category
1649 := g_mappings(l_mapping_index).category;
1650 l_app_attributes(l_app_attribute_index).bld_blk_info_type
1651 := p_attributes(l_attribute_index).bld_blk_info_type;
1652 l_app_attributes(l_app_attribute_index).attribute_index
1653 := l_attribute_index;
1654 l_app_attributes(l_app_attribute_index).segment
1655 := g_mappings(l_mapping_index).segment;
1656 l_app_attributes(l_app_attribute_index).changed
1657 := p_attributes(l_attribute_index).changed;
1658 l_app_attributes(l_app_attribute_index).process
1659 := p_attributes(l_attribute_index).process; --SHIV
1660 l_app_attributes(l_app_attribute_index).attribute_name
1661 := g_mappings(l_mapping_index).field_name;
1662
1663 set_value
1664 (p_attributes
1665 ,l_attribute_index
1666 ,l_mapping_index
1667 ,l_app_attributes
1668 ,l_app_attribute_index
1669 );
1670
1671 end if;
1672
1673 -- l_mapping_index := g_mappings.next(l_mapping_index);
1674 End Loop;
1675 End if;
1676 end if; -- is this attribute needed
1677 l_attribute_index := p_attributes.next(l_attribute_index);
1678 End Loop;
1679
1680 return l_app_attributes;
1681
1682 End create_app_attributes;
1683
1684 Procedure update_value
1685 (p_attributes in out nocopy hxc_attribute_table_type
1686 ,p_index in number
1687 ,p_segment in hxc_mapping_components.segment%type
1688 ,p_value in hxc_time_attributes.attribute1%type
1689 ) is
1690
1691 Begin
1692
1693 if(p_segment = 'ATTRIBUTE1') then
1694 p_attributes(p_index).attribute1 := p_value;
1695 elsif(p_segment='ATTRIBUTE2') then
1696 p_attributes(p_index).ATTRIBUTE2 := p_value;
1697 elsif(p_segment='ATTRIBUTE3') then
1698 p_attributes(p_index).ATTRIBUTE3 := p_value;
1699 elsif(p_segment='ATTRIBUTE4') then
1700 p_attributes(p_index).ATTRIBUTE4 := p_value;
1701 elsif(p_segment='ATTRIBUTE5') then
1702 p_attributes(p_index).ATTRIBUTE5 := p_value;
1703 elsif(p_segment='ATTRIBUTE6') then
1704 p_attributes(p_index).ATTRIBUTE6 := p_value;
1705 elsif(p_segment='ATTRIBUTE7') then
1706 p_attributes(p_index).ATTRIBUTE7 := p_value;
1707 elsif(p_segment='ATTRIBUTE8') then
1708 p_attributes(p_index).ATTRIBUTE8 := p_value;
1709 elsif(p_segment='ATTRIBUTE9') then
1710 p_attributes(p_index).ATTRIBUTE9 := p_value;
1711 elsif(p_segment='ATTRIBUTE10') then
1712 p_attributes(p_index).ATTRIBUTE10 := p_value;
1713 elsif(p_segment='ATTRIBUTE11') then
1714 p_attributes(p_index).ATTRIBUTE11 := p_value;
1715 elsif(p_segment='ATTRIBUTE12') then
1716 p_attributes(p_index).ATTRIBUTE12 := p_value;
1717 elsif(p_segment='ATTRIBUTE13') then
1718 p_attributes(p_index).ATTRIBUTE13 := p_value;
1719 elsif(p_segment='ATTRIBUTE14') then
1720 p_attributes(p_index).ATTRIBUTE14 := p_value;
1721 elsif(p_segment='ATTRIBUTE15') then
1722 p_attributes(p_index).ATTRIBUTE15 := p_value;
1723 elsif(p_segment='ATTRIBUTE16') then
1724 p_attributes(p_index).ATTRIBUTE16 := p_value;
1725 elsif(p_segment='ATTRIBUTE17') then
1726 p_attributes(p_index).ATTRIBUTE17 := p_value;
1727 elsif(p_segment='ATTRIBUTE18') then
1728 p_attributes(p_index).ATTRIBUTE18 := p_value;
1729 elsif(p_segment='ATTRIBUTE19') then
1730 p_attributes(p_index).ATTRIBUTE19 := p_value;
1731 elsif(p_segment='ATTRIBUTE20') then
1732 p_attributes(p_index).ATTRIBUTE20 := p_value;
1733 elsif(p_segment='ATTRIBUTE21') then
1734 p_attributes(p_index).ATTRIBUTE21 := p_value;
1735 elsif(p_segment='ATTRIBUTE22') then
1736 p_attributes(p_index).ATTRIBUTE22 := p_value;
1737 elsif(p_segment='ATTRIBUTE23') then
1738 p_attributes(p_index).ATTRIBUTE23 := p_value;
1739 elsif(p_segment='ATTRIBUTE24') then
1740 p_attributes(p_index).ATTRIBUTE24 := p_value;
1741 elsif(p_segment='ATTRIBUTE25') then
1742 p_attributes(p_index).ATTRIBUTE25 := p_value;
1743 elsif(p_segment='ATTRIBUTE26') then
1744 p_attributes(p_index).ATTRIBUTE26 := p_value;
1745 elsif(p_segment='ATTRIBUTE27') then
1746 p_attributes(p_index).ATTRIBUTE27 := p_value;
1747 elsif(p_segment='ATTRIBUTE28') then
1748 p_attributes(p_index).ATTRIBUTE28 := p_value;
1749 elsif(p_segment='ATTRIBUTE29') then
1750 p_attributes(p_index).ATTRIBUTE29 := p_value;
1751 elsif(p_segment='ATTRIBUTE30') then
1752 p_attributes(p_index).ATTRIBUTE30 := p_value;
1753 elsif(p_segment='ATTRIBUTE_CATEGORY') then
1754 p_attributes(p_index).attribute_category :=
1755 hxc_deposit_wrapper_utilities.get_dupdff_code(p_value);
1756 --p_attributes(p_index).ATTRIBUTE_CATEGORY := p_value;
1757 end if;
1758
1759 End update_value;
1760
1761 Procedure set_new_attribute_value
1762 (p_attribute in out nocopy hxc_attribute_type
1763 ,p_segment in hxc_mapping_components.segment%type
1764 ,p_value in hxc_time_attributes.attribute1%type
1765 ) is
1766
1767 Begin
1768
1769 if(p_segment = 'ATTRIBUTE1') then
1770 p_attribute.attribute1 := p_value;
1771 elsif(p_segment='ATTRIBUTE2') then
1772 p_attribute.ATTRIBUTE2 := p_value;
1773 elsif(p_segment='ATTRIBUTE3') then
1774 p_attribute.ATTRIBUTE3 := p_value;
1775 elsif(p_segment='ATTRIBUTE4') then
1776 p_attribute.ATTRIBUTE4 := p_value;
1777 elsif(p_segment='ATTRIBUTE5') then
1778 p_attribute.ATTRIBUTE5 := p_value;
1779 elsif(p_segment='ATTRIBUTE6') then
1780 p_attribute.ATTRIBUTE6 := p_value;
1781 elsif(p_segment='ATTRIBUTE7') then
1782 p_attribute.ATTRIBUTE7 := p_value;
1783 elsif(p_segment='ATTRIBUTE8') then
1784 p_attribute.ATTRIBUTE8 := p_value;
1785 elsif(p_segment='ATTRIBUTE9') then
1786 p_attribute.ATTRIBUTE9 := p_value;
1787 elsif(p_segment='ATTRIBUTE10') then
1788 p_attribute.ATTRIBUTE10 := p_value;
1789 elsif(p_segment='ATTRIBUTE11') then
1790 p_attribute.ATTRIBUTE11 := p_value;
1791 elsif(p_segment='ATTRIBUTE12') then
1792 p_attribute.ATTRIBUTE12 := p_value;
1793 elsif(p_segment='ATTRIBUTE13') then
1794 p_attribute.ATTRIBUTE13 := p_value;
1795 elsif(p_segment='ATTRIBUTE14') then
1796 p_attribute.ATTRIBUTE14 := p_value;
1797 elsif(p_segment='ATTRIBUTE15') then
1798 p_attribute.ATTRIBUTE15 := p_value;
1799 elsif(p_segment='ATTRIBUTE16') then
1800 p_attribute.ATTRIBUTE16 := p_value;
1801 elsif(p_segment='ATTRIBUTE17') then
1802 p_attribute.ATTRIBUTE17 := p_value;
1803 elsif(p_segment='ATTRIBUTE18') then
1804 p_attribute.ATTRIBUTE18 := p_value;
1805 elsif(p_segment='ATTRIBUTE19') then
1806 p_attribute.ATTRIBUTE19 := p_value;
1807 elsif(p_segment='ATTRIBUTE20') then
1808 p_attribute.ATTRIBUTE20 := p_value;
1809 elsif(p_segment='ATTRIBUTE21') then
1810 p_attribute.ATTRIBUTE21 := p_value;
1811 elsif(p_segment='ATTRIBUTE22') then
1812 p_attribute.ATTRIBUTE22 := p_value;
1813 elsif(p_segment='ATTRIBUTE23') then
1814 p_attribute.ATTRIBUTE23 := p_value;
1815 elsif(p_segment='ATTRIBUTE24') then
1816 p_attribute.ATTRIBUTE24 := p_value;
1817 elsif(p_segment='ATTRIBUTE25') then
1818 p_attribute.ATTRIBUTE25 := p_value;
1819 elsif(p_segment='ATTRIBUTE26') then
1820 p_attribute.ATTRIBUTE26 := p_value;
1821 elsif(p_segment='ATTRIBUTE27') then
1822 p_attribute.ATTRIBUTE27 := p_value;
1823 elsif(p_segment='ATTRIBUTE28') then
1824 p_attribute.ATTRIBUTE28 := p_value;
1825 elsif(p_segment='ATTRIBUTE29') then
1826 p_attribute.ATTRIBUTE29 := p_value;
1827 elsif(p_segment='ATTRIBUTE30') then
1828 p_attribute.ATTRIBUTE30 := p_value;
1829 elsif(p_segment='ATTRIBUTE_CATEGORY') then
1830 p_attribute.attribute_category :=
1831 hxc_deposit_wrapper_utilities.get_dupdff_code(p_value);
1832 -- p_attribute.ATTRIBUTE_CATEGORY := p_value;
1833 end if;
1834
1835 End set_new_attribute_value;
1836
1837 Procedure create_new_attribute
1838 (p_attributes in out nocopy hxc_attribute_table_type
1839 ,p_app_attributes in out nocopy hxc_self_service_time_deposit.app_attributes_info
1840 ,p_app_index in number
1841 ) is
1842
1843 l_new_time_attribute_id number;
1844 l_new_attribute hxc_attribute_type;
1845 l_index number;
1846 l_attribute_category hxc_bld_blk_info_types.bld_blk_info_type%type;
1847
1848 Begin
1849
1850 if(instr(p_app_attributes(p_app_index).bld_blk_info_type,'Dummy')<1) then
1851 l_attribute_category := substr(p_app_attributes(p_app_index).bld_blk_info_type,1,30);
1852 else
1853 l_attribute_category := null;
1854 end if;
1855
1856 l_new_time_attribute_id := hxc_timecard_attribute_utils.next_time_attribute_id(p_attributes);
1857
1858 l_new_attribute := hxc_attribute_type
1859 (l_new_time_attribute_id
1860 ,p_app_attributes(p_app_index).building_block_id
1861 ,l_attribute_category
1862 ,null
1863 ,null
1864 ,null
1865 ,null
1866 ,null
1867 ,null
1868 ,null
1869 ,null
1870 ,null
1871 ,null
1872 ,null
1873 ,null
1874 ,null
1875 ,null
1876 ,null
1877 ,null
1878 ,null
1879 ,null
1880 ,null
1881 ,null
1882 ,null
1883 ,null
1884 ,null
1885 ,null
1886 ,null
1887 ,null
1888 ,null
1889 ,null
1890 ,null
1891 ,null
1892 ,hxc_timecard_attribute_utils.get_bld_blk_info_type_id
1893 (p_app_attributes(p_app_index).bld_blk_info_type)
1894 ,1
1895 ,'Y'
1896 ,'N'
1897 ,p_app_attributes(p_app_index).bld_blk_info_type
1898 ,'Y'
1899 ,null
1900 );
1901
1902 l_index := p_app_attributes.first;
1903 Loop
1904 Exit when not p_app_attributes.exists(l_index);
1905 if(
1906 (p_app_attributes(l_index).bld_blk_info_type = p_app_attributes(p_app_index).bld_blk_info_type)
1907 AND
1908 (p_app_attributes(l_index).time_attribute_id = p_app_attributes(p_app_index).time_attribute_id)
1909 ) then
1910 set_new_attribute_value
1911 (l_new_attribute
1912 ,p_app_attributes(l_index).segment
1913 ,p_app_attributes(l_index).attribute_value
1914 );
1915 p_app_attributes(l_index).updated := 'Y';
1916 p_app_attributes(l_index).process := 'Y'; --SHIV
1917 end if;
1918 l_index := p_app_attributes.next(l_index);
1919 End Loop;
1920
1921 p_attributes.extend();
1922
1923 p_attributes(p_attributes.last) := l_new_attribute;
1924
1925 End create_new_attribute;
1926
1927 Procedure update_attributes
1928 (p_attributes in out nocopy hxc_attribute_table_type
1929 ,p_app_attributes in out nocopy hxc_self_service_time_deposit.app_attributes_info
1930 ) is
1931
1932 l_index number;
1933
1934 Begin
1935
1936 l_index := p_app_attributes.first;
1937 Loop
1938 Exit when not p_app_attributes.exists(l_index);
1939 if (NVL(p_app_attributes(l_index).updated,'N') = 'N') then
1940 if (p_app_attributes(l_index).attribute_index is not null) then
1941 update_value
1942 (p_attributes => p_attributes
1943 ,p_index => p_app_attributes(l_index).attribute_index
1944 ,p_segment => p_app_attributes(l_index).segment
1945 ,p_value => p_app_attributes(l_index).attribute_value
1946 );
1947 else
1948 create_new_attribute
1949 (p_attributes => p_attributes
1950 ,p_app_attributes => p_app_attributes
1951 ,p_app_index => l_index
1952 );
1953 end if;
1954 p_app_attributes(l_index).updated := 'Y';
1955 p_app_attributes(l_index).process := 'Y'; --SHIV
1956 end if;
1957 l_index := p_app_attributes.next(l_index);
1958 End Loop;
1959
1960 End update_attributes;
1961
1962 end hxc_app_attribute_utils;