protected void PostProcess(IPostProcessWriter writer) { ILinkedMap <String, IXmlPostProcessor> xmlPostProcessors = XmlPostProcessorRegistry.GetXmlPostProcessors(); ILinkedMap <String, Object> ppResults = new LinkedHashMap <String, Object>((int)(xmlPostProcessors.Count / 0.75 + 1)); foreach (Entry <String, IXmlPostProcessor> entry in xmlPostProcessors) { String tagName = entry.Key; IXmlPostProcessor xmlPostProcessor = entry.Value; Object result = xmlPostProcessor.ProcessWrite(writer); if (result != null) { ppResults.Put(tagName, result); } } if (ppResults.Count == 0) { return; } String postProcessElement = XmlDictionary.PostProcessElement; writer.WriteStartElement(postProcessElement); foreach (Entry <String, Object> entry in ppResults) { String tagName = entry.Key; Object result = entry.Value; writer.WriteOpenElement(tagName); writer.WriteObject(result); writer.WriteCloseElement(tagName); } writer.WriteCloseElement(postProcessElement); }
public Object ProcessWrite(IPostProcessWriter writer) { ISet <Object> substitutedEntities = writer.SubstitutedEntities; if (substitutedEntities.Count == 0) { return(null); } IDisposableCache childCache = CacheFactory.Create(CacheFactoryDirective.NoDCE, "XmlMerge"); IServiceContext mergeContext = BeanContext.CreateService(delegate(IBeanContextFactory childContextFactory) { childContextFactory.RegisterBean(typeof(MergeHandle)).Autowireable <MergeHandle>().PropertyValue("Cache", childCache); }); try { IDictionary <Object, Int32> mutableToIdMap = writer.MutableToIdMap; IObjRefHelper objRefHelper = ObjRefHelper; MergeHandle mergeHandle = mergeContext.GetService <MergeHandle>(); IList <Object> toMerge = new List <Object>(substitutedEntities.Count); foreach (Object entity in substitutedEntities) { toMerge.Add(entity); IObjRef ori = objRefHelper.EntityToObjRef(entity); mergeHandle.objToOriDict.Add(entity, ori); Int32 id = mutableToIdMap[entity]; mutableToIdMap.Add(ori, id); } ICUDResult cudResult = MergeController.MergeDeep(toMerge, mergeHandle); if (cudResult.AllChanges.Count != 0) { return(cudResult); } else { return(null); } } finally { mergeContext.Dispose(); } }
public Object processWrite(IPostProcessWriter writer) { return(""); }