1: package body WF_ENTITY_MGR as
2: /* $Header: WFEMGRB.pls 120.4 2010/03/09 21:02:56 alsosa ship $ */
3: ------------------------------------------------------------------------------
4: /*
5: ** InitCache -
49:
50: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
51:
52: WF_LOG_PKG.String(WF_LOG_PKG.LEVEL_PROCEDURE,
53: 'wf.plsql.WF_ENTITY_MGR.put',
54: 'Begin put('||p_entity_type||', '||
55: p_entity_key_value||', '||p_att||', '||
56: p_value||', '||p_change_number||')');
57: end if;
69: and entity_key_value = upper(p_entity_key_value)
70: and attribute_name = 'CACHE_CHANGED';
71:
72: if sql%notfound then
73: WF_ENTITY_MGR.InitCache(put.p_entity_type,
74: put.p_entity_key_value);
75: else
76: --We locked the cache so we can exit the loop.
77: l_cacheLocked := TRUE;
110:
111: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
112:
113: WF_LOG_PKG.String(WF_LOG_PKG.LEVEL_PROCEDURE,
114: 'wf.plsql.WF_ENTITY_MGR.put',
115: 'End put('||p_entity_type||', '||
116: p_entity_key_value||', '||p_att||', '||
117: p_value||', '||p_change_number||')');
118: end if;
136:
137: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
138:
139: WF_LOG_PKG.String(WF_LOG_PKG.LEVEL_PROCEDURE,
140: 'wf.plsql.WF_ENTITY_MGR.process_changes',
141: 'Begin process_changes('||p_entity_type||', '||
142: p_entity_key_value||', '||p_change_source||', '||
143: p_change_type||', '||p_event_name||')');
144: end if;
142: p_entity_key_value||', '||p_change_source||', '||
143: p_change_type||', '||p_event_name||')');
144: end if;
145:
146: if (wf_entity_mgr.get_attribute_value(my_ent_type, p_entity_key_value,
147: 'CACHE_CHANGED') = 'YES') then
148: --
149: -- Tell everybody about the change by raising the appropriate event
150: --
150: --
151: -- First, mark this entity in the cache as unchanged so we can pick up
152: -- any actual subsequent changes
153: --
154: wf_entity_mgr.put_attribute_value(my_ent_type, p_entity_key_value,
155: 'CACHE_CHANGED', 'NO');
156: wf_event.AddParameterToList('CHANGE_SOURCE', p_change_source, my_parms);
157: wf_event.AddParameterToList('CHANGE_TYPE', p_change_type, my_parms);
158:
166:
167: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
168:
169: WF_LOG_PKG.String(WF_LOG_PKG.LEVEL_PROCEDURE,
170: 'wf.plsql.WF_ENTITY_MGR.process_changes',
171: 'End process_changes('||p_entity_type||', '||
172: p_entity_key_value||', '||p_change_source||', '||
173: p_change_type||', '||p_event_name||')');
174: end if;
187:
188: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
189:
190: WF_LOG_PKG.String(WF_LOG_PKG.LEVEL_PROCEDURE,
191: 'wf.plsql.WF_ENTITY_MGR. get_attribute_value',
192: 'Begin get_attribute_value('||p_entity_type||', '||
193: p_entity_key_value||', '||
194: p_attribute||')');
195: end if;
202:
203: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
204:
205: WF_LOG_PKG.String(WF_LOG_PKG.LEVEL_PROCEDURE,
206: 'wf.plsql.WF_ENTITY_MGR. get_attribute_value',
207: 'End get_attribute_value('||p_entity_type||', '||
208: p_entity_key_value||', '||
209: p_attribute||')');
210: end if;
212: return my_att_val;
213: exception when no_data_found then
214: if (wf_log_pkg.level_unexpected >= fnd_log.g_current_runtime_level) then
215: WF_LOG_PKG.String(WF_LOG_PKG.LEVEL_UNEXPECTED,
216: 'wf.plsql.WF_ENTITY_MGR. get_attribute_value',
217: 'Exception: '||sqlerrm);
218: end if;
219:
220: return '*UNKNOWN*';
234:
235: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
236:
237: WF_LOG_PKG.String(WF_LOG_PKG.LEVEL_PROCEDURE,
238: 'wf.plsql.WF_ENTITY_MGR. put_attribute_value',
239: 'Begin put_attribute_value('||p_entity_type||', '||
240: p_entity_key_value||', '||
241: p_attribute||', '||p_attribute_value||')');
242: end if;
241: p_attribute||', '||p_attribute_value||')');
242: end if;
243:
244: if (p_attribute = 'CACHE_CHANGED') then
245: wf_entity_mgr.put(my_ent_type,
246: p_entity_key_value,
247: 'CACHE_CHANGED',
248: p_attribute_value,
249: NULL);
254: elsif (p_attribute_value is null) then
255: null; -- means "do not update" like for fndload --
256: -- if you want to null out a value, use *NULL* --
257: else
258: old_att_val := wf_entity_mgr.get_attribute_value(my_ent_type,
259: p_entity_key_value,
260: p_attribute);
261: if (p_attribute_value <> old_att_val) then
262: wf_entity_mgr.put(my_ent_type,
258: old_att_val := wf_entity_mgr.get_attribute_value(my_ent_type,
259: p_entity_key_value,
260: p_attribute);
261: if (p_attribute_value <> old_att_val) then
262: wf_entity_mgr.put(my_ent_type,
263: p_entity_key_value,
264: p_attribute,
265: p_attribute_value,
266: NULL);
268: end if;
269: if (wf_log_pkg.level_procedure >= fnd_log.g_current_runtime_level) then
270:
271: WF_LOG_PKG.String(WF_LOG_PKG.LEVEL_PROCEDURE,
272: 'wf.plsql.WF_ENTITY_MGR. put_attribute_value',
273: 'End put_attribute_value('||p_entity_type||', '||
274: p_entity_key_value||', '||
275: p_attribute||', '||p_attribute_value||')');
276:
301:
302: commit;
303: exception
304: when others then
305: wf_core.context('WF_ENTITY_MGR', 'flush_cache', p_entity_type);
306: raise;
307: end;
308: ------------------------------------------------------------------------------
309: /*
322: FUNCTION gen_xml_payload(p_event_name in varchar2,
323: p_event_key in varchar2) return clob
324: is
325: my_clob clob;
326: my_ent_type varchar2(50) := wf_entity_mgr.get_entity_type(p_event_name);
327: found boolean := FALSE;
328:
329: l_doc xmldom.DOMDocument;
330: l_root xmldom.DOMNode;
389: wf_core.context('WF_ENTITY_MANAGER', 'purge_cache_attributes', p_enddate);
390: raise;
391: end;
392: ------------------------------------------------------------------------------
393: end WF_ENTITY_MGR;