protected override Doc DoPopulateDoc(MySqlCrudQueryExecutionContext context, Type tDoc, Schema schema, Schema.FieldDef[] toLoad, MySqlDataReader reader) { var verState = VersionInfo.MapCanonicalState(reader.AsStringField("VERSION_STATE")); var gop = context.GetState <GdidOrPath>(); var result = new TreeNodeInfo(); result.Forest = gop.Id.System; result.Tree = gop.Id.Type; result.Gdid = reader.AsGdidField("GDID"); result.G_Parent = reader.AsGdidField("G_PARENT"); result.PathSegment = reader.AsStringField("PATH_SEGMENT"); result.FullPath = "[n/a for version specific node]"; result.StartUtc = reader.AsDateTimeField("START_UTC").Value; result.Properties = Constraints.MapToConfigRoot(reader.AsStringField("PROPERTIES")); result.LevelConfig = Constraints.MapToConfigRoot(reader.AsStringField("CONFIG")); result.DataVersion = new VersionInfo { G_Version = reader.AsGdidField("G_VERSION"), State = verState, Actor = reader.AsEntityIdField("VERSION_ACTOR").Value, Origin = reader.AsAtomField("VERSION_ORIGIN").Value, Utc = reader.AsDateTimeField("VERSION_UTC").Value }; return(result); }
protected override Doc DoPopulateDoc(MySqlCrudQueryExecutionContext context, Type tDoc, Schema schema, Schema.FieldDef[] toLoad, MySqlDataReader reader) { var verState = VersionInfo.MapCanonicalState(reader.AsStringField("VERSION_STATE")); if (!VersionInfo.IsExistingStateOf(verState)) { return(null); //deleted, skip this doc } var tree = context.GetState <TreePtr>(); var result = new TreeNodeInfo(); result.Forest = tree.IdForest; result.Tree = tree.IdTree; result.Gdid = reader.AsGdidField("GDID"); result.G_Parent = reader.AsGdidField("G_PARENT"); result.PathSegment = reader.AsStringField("PATH_SEGMENT"); result.FullPath = null;//calculated by logic result.StartUtc = reader.AsDateTimeField("START_UTC").Value; result.Properties = Constraints.MapToConfigRoot(reader.AsStringField("PROPERTIES")); result.LevelConfig = Constraints.MapToConfigRoot(reader.AsStringField("CONFIG")); result.DataVersion = new VersionInfo { G_Version = reader.AsGdidField("G_VERSION"), State = verState, Actor = reader.AsEntityIdField("VERSION_ACTOR").Value, Origin = reader.AsAtomField("VERSION_ORIGIN").Value, Utc = reader.AsDateTimeField("VERSION_UTC").Value }; return(result); }
protected override Doc DoPopulateDoc(MySqlCrudQueryExecutionContext context, Type tDoc, Schema schema, Schema.FieldDef[] toLoad, MySqlDataReader reader) { return(new VersionInfo() { G_Version = reader.AsGdidField("GDID"), State = VersionInfo.MapCanonicalState(reader.AsStringField("VERSION_STATE")), Actor = reader.AsEntityIdField("VERSION_ACTOR").Value, Origin = reader.AsAtomField("VERSION_ORIGIN").Value, Utc = reader.AsDateTimeField("VERSION_UTC").Value }); }
protected override Doc DoPopulateDoc(MySqlCrudQueryExecutionContext context, Type tDoc, Schema schema, Schema.FieldDef[] toLoad, MySqlDataReader reader) { var verState = VersionInfo.MapCanonicalState(reader.AsStringField("VERSION_STATE")); if (!VersionInfo.IsExistingStateOf(verState)) { return(null); //deleted, skip this doc } var id = context.GetState <EntityId>(); var realm = reader.AsAtomField("REALM").Value; var gUser = reader.AsGdidField("GDID"); var sysToken = m_Logic.MakeSystemTokenData(realm, gUser); var name = reader.AsStringField("NAME"); var level = Constraints.MapUserStatus(reader.AsString("LEVEL")) ?? Security.UserStatus.Invalid; var levelDown = Constraints.MapUserStatus(reader.AsString("LEVEL_DOWN")); if (levelDown.HasValue && levelDown.Value < level) { level = levelDown.Value; } var result = new MinIdpUserData { SysId = gUser.ToHexString(), Realm = realm, SysTokenData = sysToken, Status = level, CreateUtc = reader.AsDateTimeField("CREATE_UTC", DateTime.MinValue).Value, StartUtc = reader.AsDateTimeField("START_UTC", DateTime.MinValue).Value, EndUtc = reader.AsDateTimeField("END_UTC", DateTime.MaxValue).Value, LoginId = id, LoginPassword = reader.AsStringField("PWD"), LoginStartUtc = reader.AsDateTimeField("LOGIN_START_UTC"), LoginEndUtc = reader.AsDateTimeField("LOGIN_START_UTC"), ScreenName = name, Name = name, Description = reader.AsStringField("DESCRIPTION"), Note = reader.AsStringField("NOTE"), Role = null, // TODO: extract role from PROPS column data Rights = reader.AsStringField("RIGHTS"), Props = null }; return(result); }