From 286d681673a9c3211601a675429ca76bbc2ddf60 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Fri, 2 May 2008 19:16:54 +0000 Subject: in theory this gives me a back end that will do persistance to actually have something to test plumbing in appearance saving. --- OpenSim/Data/NHibernate/NHibernateUserData.cs | 31 ++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Data/NHibernate/NHibernateUserData.cs b/OpenSim/Data/NHibernate/NHibernateUserData.cs index 6a830f6..87594db 100644 --- a/OpenSim/Data/NHibernate/NHibernateUserData.cs +++ b/OpenSim/Data/NHibernate/NHibernateUserData.cs @@ -244,16 +244,41 @@ namespace OpenSim.Data.NHibernate public override bool MoneyTransferRequest(LLUUID from, LLUUID to, uint amount) {return true;} public override bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID inventory) {return true;} - /// Appearance + /// Appearance /// TODO: stubs for now to get us to a compiling state gently override public UserAppearance GetUserAppearance(LLUUID user) { - return new UserAppearance(); + UserAppearance appearance; + // TODO: I'm sure I'll have to do something silly here + using(ISession session = factory.OpenSession()) { + appearance = session.Load(typeof(UserAppearance), user) as UserAppearance; + } + return appearance; + } + + private bool ExistsAppearance(LLUUID uuid) + { + UserAppearance appearance; + using(ISession session = factory.OpenSession()) { + appearance = session.Load(typeof(UserAppearance), uuid) as UserAppearance; + } + return (appearance == null) ? false : true; } + override public void UpdateUserAppearance(LLUUID user, UserAppearance appearance) { - return; + bool exists = ExistsAppearance(user); + using(ISession session = factory.OpenSession()) { + using(ITransaction transaction = session.BeginTransaction()) { + if (exists) { + session.Update(appearance); + } else { + session.Save(appearance); + } + transaction.Commit(); + } + } } override public void AddAttachment(LLUUID user, LLUUID item) -- cgit v1.1