early remove calls
parent
6ca23c1123
commit
9aa0302e5b
|
@ -119,22 +119,46 @@ namespace OpenSim.Data.NHibernate
|
||||||
/// <param name="obj">the object</param>
|
/// <param name="obj">the object</param>
|
||||||
/// <param name="regionUUID">the region UUID</param>
|
/// <param name="regionUUID">the region UUID</param>
|
||||||
public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID)
|
public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID)
|
||||||
{
|
|
||||||
foreach (SceneObjectPart part in obj.Children.Values)
|
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
foreach (SceneObjectPart part in obj.Children.Values)
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("Storing part {0}", part.UUID);
|
m_log.InfoFormat("Storing part {0}", part.UUID);
|
||||||
session.SaveOrUpdate(part);
|
session.SaveOrUpdate(part);
|
||||||
|
}
|
||||||
session.Flush();
|
session.Flush();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Error("Can't save: ", e);
|
m_log.Error("Can't save: ", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private SceneObjectGroup LoadObject(LLUUID uuid, LLUUID region)
|
||||||
|
{
|
||||||
|
SceneObjectGroup group = new SceneObjectGroup();
|
||||||
|
|
||||||
|
ICriteria criteria = session.CreateCriteria(typeof(SceneObjectPart));
|
||||||
|
criteria.Add(Expression.Eq("RegionID", region));
|
||||||
|
criteria.Add(Expression.Eq("ParentUUID", uuid));
|
||||||
|
criteria.AddOrder( Order.Asc("ParentID") );
|
||||||
|
|
||||||
|
foreach (SceneObjectPart p in criteria.List())
|
||||||
|
{
|
||||||
|
// root part
|
||||||
|
if (p.UUID == uuid)
|
||||||
|
{
|
||||||
|
group.AddPart(p);
|
||||||
|
group.RootPart = p;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
group.AddPart(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -144,6 +168,13 @@ namespace OpenSim.Data.NHibernate
|
||||||
/// <param name="regionUUID">the region UUID</param>
|
/// <param name="regionUUID">the region UUID</param>
|
||||||
public void RemoveObject(LLUUID obj, LLUUID regionUUID)
|
public void RemoveObject(LLUUID obj, LLUUID regionUUID)
|
||||||
{
|
{
|
||||||
|
SceneObjectGroup g = LoadObject(obj, regionUUID);
|
||||||
|
foreach (SceneObjectPart p in g.Children.Values)
|
||||||
|
{
|
||||||
|
session.Delete(p);
|
||||||
|
}
|
||||||
|
session.Flush();
|
||||||
|
|
||||||
m_log.InfoFormat("[REGION DB]: Removing obj: {0} from region: {1}", obj.UUID, regionUUID);
|
m_log.InfoFormat("[REGION DB]: Removing obj: {0} from region: {1}", obj.UUID, regionUUID);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue