private void RebuildIndices(IVertexType myVertexType, Int64 myTransaction, SecurityToken mySecurity, bool myOnlyNonPersistent) { Dictionary <IList <IPropertyDefinition>, IEnumerable <ISonesIndex> > toRebuild = new Dictionary <IList <IPropertyDefinition>, IEnumerable <ISonesIndex> >(); foreach (var indexDef in myVertexType.GetIndexDefinitions(false)) { var indices = GetIndices(myVertexType, indexDef.IndexedProperties, mySecurity, myTransaction).Where(_ => !myOnlyNonPersistent || !GetIsPersistentIndex(_)); toRebuild.Add(indexDef.IndexedProperties, indices); } if (toRebuild.Count > 0) { foreach (var aIdxCollection in toRebuild.Values) { foreach (var aIdx in aIdxCollection) { aIdx.Clear(); } } var vertices = _vertexStore.GetVerticesByTypeID(mySecurity, myTransaction, myVertexType.ID); foreach (var vertex in vertices) { foreach (var indexGroup in toRebuild) { foreach (var index in indexGroup.Value) { index.Add(CreateIndexKey(indexGroup.Key, vertex), vertex.VertexID); } } } } }
public void AddUserDefinedDataTypes(IVertexStore myStore, AComponentPluginManager myPluginManager) { myStore.CheckNull("myStore"); var creationDate = DateTime.UtcNow.ToBinary(); List <AUserdefinedDataType> userdefinedDataTypePlugins = new List <AUserdefinedDataType>(); foreach (var plugin in myPluginManager.GetPluginsForType <AUserdefinedDataType>()) { userdefinedDataTypePlugins.Add((AUserdefinedDataType)plugin); } List <String> userdefinedTypes = new List <String>(); var maxValue = long.MinValue; foreach (var vertex in myStore.GetVerticesByTypeID(_security, _transaction, (long)BaseTypes.BaseType)) { if (vertex.GetProperty <Boolean>((long)AttributeDefinitions.BaseTypeDotIsUserDefined)) { if (!userdefinedDataTypePlugins.Any(item => item.TypeName == vertex.GetProperty <String>((long)AttributeDefinitions.BaseTypeDotName))) { throw new Exception(); } else { userdefinedTypes.Add(vertex.GetProperty <String>((long)AttributeDefinitions.BaseTypeDotName)); } } if (vertex.VertexID > maxValue) { maxValue = vertex.VertexID; } } maxValue++; foreach (var type in userdefinedDataTypePlugins.Select(item => item.TypeName).Except(userdefinedTypes)) { _storageManager.StoreBasicType(myStore, new VertexInformation((long)BaseTypes.BaseType, maxValue++), type, true, "UserdefinedType" + type, creationDate, _security, _transaction); } }
public IEnumerable <IVertex> GetVerticesByTypeID(SecurityToken mySecurityToken, Int64 myTransactionToken, long myTypeID, IEnumerable <long> myInterestingVertexIDs, IEnumerable <string> myInterestingEditionNames, IEnumerable <Int64> myInterestingRevisionIDs) { return(_vertexStore.GetVerticesByTypeID(mySecurityToken, myTransactionToken, myTypeID, myInterestingVertexIDs, myInterestingEditionNames, myInterestingRevisionIDs)); }
public void AddUserDefinedDataTypes(IVertexStore myStore, AComponentPluginManager myPluginManager) { myStore.CheckNull("myStore"); var creationDate = DateTime.UtcNow.ToBinary(); List<AUserdefinedDataType> userdefinedDataTypePlugins = new List<AUserdefinedDataType>(); foreach (var plugin in myPluginManager.GetPluginsForType<AUserdefinedDataType>()) { userdefinedDataTypePlugins.Add((AUserdefinedDataType)plugin); } List<String> userdefinedTypes = new List<String>(); var maxValue = long.MinValue; foreach (var vertex in myStore.GetVerticesByTypeID(_security, _transaction, (long)BaseTypes.BaseType)) { if(vertex.GetProperty<Boolean>((long)AttributeDefinitions.BaseTypeDotIsUserDefined)) { if (!userdefinedDataTypePlugins.Any(item => item.TypeName == vertex.GetProperty<String>((long)AttributeDefinitions.BaseTypeDotName))) { throw new Exception(); } else { userdefinedTypes.Add(vertex.GetProperty<String>((long)AttributeDefinitions.BaseTypeDotName)); } } if (vertex.VertexID > maxValue) { maxValue = vertex.VertexID; } } maxValue++; foreach (var type in userdefinedDataTypePlugins.Select(item => item.TypeName).Except(userdefinedTypes)) { _storageManager.StoreBasicType(myStore, new VertexInformation((long)BaseTypes.BaseType, maxValue++), type, true, "UserdefinedType" + type, creationDate, _security, _transaction); } }