> GetListOfUpdateTriggersFor(string className) { NeoDatis.Tool.Wrappers.List.IOdbList <NeoDatis.Odb.Core.Trigger.Trigger> l1 = listOfUpdateTriggers [className]; NeoDatis.Tool.Wrappers.List.IOdbList <NeoDatis.Odb.Core.Trigger.Trigger> l2 = listOfUpdateTriggers [AllClassTrigger]; if (l2 != null) { int size = l2.Count; if (l1 != null) { size = size + l1.Count; } NeoDatis.Tool.Wrappers.List.IOdbList <NeoDatis.Odb.Core.Trigger.Trigger> r = new NeoDatis.Tool.Wrappers.List.OdbArrayList <NeoDatis.Odb.Core.Trigger.Trigger>(size); if (l1 != null) { r.AddAll(l1); } r.AddAll(l2); return(r); } return(l1); }
private NeoDatis.Odb.Core.Server.Layers.Layer3.Engine.Message ManageAddClassInfoListCommand (NeoDatis.Odb.Core.Server.Message.NewClassInfoListMessage message) { // Gets the base identifier string baseIdentifier = message.GetBaseIdentifier(); NeoDatis.Odb.Core.Server.Connection.ConnectionManager connectionManager = null; NeoDatis.Odb.Core.Server.Connection.IConnection connection = null; NeoDatis.Tool.Mutex.Mutex mutex = null; try { mutex = NeoDatis.Tool.Mutex.MutexFactory.Get(baseIdentifier).Acquire("addClassInfoList" ); // Gets the connection manager for this base identifier connectionManager = GetConnectionManager(baseIdentifier); if (connectionManager == null) { System.Text.StringBuilder buffer = new System.Text.StringBuilder(); buffer.Append("ODBServer.ConnectionThread:Base ").Append(baseIdentifier).Append(" is not registered on this server!" ); return new NeoDatis.Odb.Core.Server.Message.StoreMessageResponse(baseIdentifier, message.GetConnectionId(), buffer.ToString()); } connection = connectionManager.GetConnection(message.GetConnectionId()); NeoDatis.Odb.Impl.Core.Server.Transaction.ServerSession session = (NeoDatis.Odb.Impl.Core.Server.Transaction.ServerSession )sessionManager.GetSession(baseIdentifier, true); NeoDatis.Odb.Core.Layers.Layer3.IStorageEngine engine = connection.GetStorageEngine (); NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfoList ciList = message.GetClassInfoList (); ciList = engine.GetObjectWriter().AddClasses(ciList); // here we must create a new list with all class info because // Serialization hold object references // In this case, it holds the reference of the previous class info // list. Serialization thinks object did not change so it will send the reference // instead of the new object. Creating the new list force the // serialization // mechanism to send object NeoDatis.Tool.Wrappers.List.IOdbList<NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo > allClassInfos = new NeoDatis.Tool.Wrappers.List.OdbArrayList<NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo >(); allClassInfos.AddAll(session.GetMetaModel().GetAllClasses()); NeoDatis.Odb.Core.Server.Message.NewClassInfoListMessageResponse r = new NeoDatis.Odb.Core.Server.Message.NewClassInfoListMessageResponse (baseIdentifier, message.GetConnectionId(), allClassInfos); session.ResetClassInfoIds(); return r; } catch (System.Exception e) { string se = NeoDatis.Tool.Wrappers.OdbString.ExceptionToString(e, false); string msg = baseIdentifier + ":Error while adding new Class Info List" + message .GetClassInfoList(); NeoDatis.Tool.DLogger.Error(msg, e); return new NeoDatis.Odb.Core.Server.Message.NewClassInfoListMessageResponse(baseIdentifier , message.GetConnectionId(), msg + ":\n" + se); } finally { if (mutex != null) { mutex.Release("addClassInfoList"); } } }
> GetListOfUpdateTriggersFor(string className) { NeoDatis.Tool.Wrappers.List.IOdbList<NeoDatis.Odb.Core.Trigger.Trigger> l1 = listOfUpdateTriggers [className]; NeoDatis.Tool.Wrappers.List.IOdbList<NeoDatis.Odb.Core.Trigger.Trigger> l2 = listOfUpdateTriggers [AllClassTrigger]; if (l2 != null) { int size = l2.Count; if (l1 != null) { size = size + l1.Count; } NeoDatis.Tool.Wrappers.List.IOdbList<NeoDatis.Odb.Core.Trigger.Trigger> r = new NeoDatis.Tool.Wrappers.List.OdbArrayList <NeoDatis.Odb.Core.Trigger.Trigger>(size); if (l1 != null) { r.AddAll(l1); } r.AddAll(l2); return r; } return l1; }
/// <summary>Returns the list of involved fields for this query.</summary> /// <remarks> /// Returns the list of involved fields for this query. List of String /// <pre> /// If query must return sum("value") and field("name"), involvedField will contain "value","name" /// </pre> /// </remarks> public override NeoDatis.Tool.Wrappers.List.IOdbList<string> GetAllInvolvedFields () { NeoDatis.Tool.Wrappers.List.IOdbList<string> l = new NeoDatis.Tool.Wrappers.List.OdbArrayList <string>(); // To check field duplicity System.Collections.Generic.IDictionary<string, string> map = new NeoDatis.Tool.Wrappers.Map.OdbHashMap <string, string>(); l.AddAll(base.GetAllInvolvedFields()); if (!l.IsEmpty()) { for (int i = 0; i < l.Count; i++) { map.Add(l[i], l[i]); } } System.Collections.Generic.IEnumerator<NeoDatis.Odb.Core.Query.Execution.IQueryFieldAction > iterator = objectActions.GetEnumerator(); NeoDatis.Odb.Core.Query.Execution.IQueryFieldAction oa = null; string name = null; while (iterator.MoveNext()) { oa = iterator.Current; if (oa.GetType() != typeof(NeoDatis.Odb.Impl.Core.Query.Values.CountAction)) { name = oa.GetAttributeName(); if (!map.ContainsKey(name)) { l.Add(name); map.Add(name, name); } } } if (hasGroupBy) { for (int i = 0; i < groupByFieldList.Length; i++) { name = groupByFieldList[i]; if (!map.ContainsKey(name)) { l.Add(name); map.Add(name, name); } } } if (HasOrderBy()) { for (int i = 0; i < orderByFields.Length; i++) { name = orderByFields[i]; if (!map.ContainsKey(name)) { l.Add(name); map.Add(name, name); } } } map.Clear(); map = null; return l; }
/// <summary>Returns the list of involved fields for this query.</summary> /// <remarks> /// Returns the list of involved fields for this query. List of String /// <pre> /// If query must return sum("value") and field("name"), involvedField will contain "value","name" /// </pre> /// </remarks> public override NeoDatis.Tool.Wrappers.List.IOdbList <string> GetAllInvolvedFields () { NeoDatis.Tool.Wrappers.List.IOdbList <string> l = new NeoDatis.Tool.Wrappers.List.OdbArrayList <string>(); // To check field duplicity System.Collections.Generic.IDictionary <string, string> map = new NeoDatis.Tool.Wrappers.Map.OdbHashMap <string, string>(); l.AddAll(base.GetAllInvolvedFields()); if (!l.IsEmpty()) { for (int i = 0; i < l.Count; i++) { map.Add(l[i], l[i]); } } System.Collections.Generic.IEnumerator <NeoDatis.Odb.Core.Query.Execution.IQueryFieldAction > iterator = objectActions.GetEnumerator(); NeoDatis.Odb.Core.Query.Execution.IQueryFieldAction oa = null; string name = null; while (iterator.MoveNext()) { oa = iterator.Current; if (oa.GetType() != typeof(NeoDatis.Odb.Impl.Core.Query.Values.CountAction)) { name = oa.GetAttributeName(); if (!map.ContainsKey(name)) { l.Add(name); map.Add(name, name); } } } if (hasGroupBy) { for (int i = 0; i < groupByFieldList.Length; i++) { name = groupByFieldList[i]; if (!map.ContainsKey(name)) { l.Add(name); map.Add(name, name); } } } if (HasOrderBy()) { for (int i = 0; i < orderByFields.Length; i++) { name = orderByFields[i]; if (!map.ContainsKey(name)) { l.Add(name); map.Add(name, name); } } } map.Clear(); map = null; return(l); }