NHibernate Inventory support. Lightly tested, but seems to work
well enough on my test environment. Will need to add some exception catching down the road. On to User Store.0.6.0-stable
parent
4cc3aad2f9
commit
ce5e51240f
|
@ -298,7 +298,7 @@ namespace OpenSim.Data.NHibernate
|
||||||
public List<InventoryItemBase> getInventoryInFolder(LLUUID folderID)
|
public List<InventoryItemBase> getInventoryInFolder(LLUUID folderID)
|
||||||
{
|
{
|
||||||
using(ISession session = factory.OpenSession()) {
|
using(ISession session = factory.OpenSession()) {
|
||||||
try {
|
// try {
|
||||||
ICriteria criteria = session.CreateCriteria(typeof(InventoryItemBase));
|
ICriteria criteria = session.CreateCriteria(typeof(InventoryItemBase));
|
||||||
criteria.Add(Expression.Eq("Folder", folderID) );
|
criteria.Add(Expression.Eq("Folder", folderID) );
|
||||||
List<InventoryItemBase> list = new List<InventoryItemBase>();
|
List<InventoryItemBase> list = new List<InventoryItemBase>();
|
||||||
|
@ -307,9 +307,9 @@ namespace OpenSim.Data.NHibernate
|
||||||
list.Add(item);
|
list.Add(item);
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
} catch {
|
// } catch {
|
||||||
return new List<InventoryItemBase>();
|
// return new List<InventoryItemBase>();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,7 +322,7 @@ namespace OpenSim.Data.NHibernate
|
||||||
public InventoryFolderBase getUserRootFolder(LLUUID user)
|
public InventoryFolderBase getUserRootFolder(LLUUID user)
|
||||||
{
|
{
|
||||||
using(ISession session = factory.OpenSession()) {
|
using(ISession session = factory.OpenSession()) {
|
||||||
try {
|
// try {
|
||||||
ICriteria criteria = session.CreateCriteria(typeof(InventoryFolderBase));
|
ICriteria criteria = session.CreateCriteria(typeof(InventoryFolderBase));
|
||||||
criteria.Add(Expression.Eq("ParentID", LLUUID.Zero) );
|
criteria.Add(Expression.Eq("ParentID", LLUUID.Zero) );
|
||||||
criteria.Add(Expression.Eq("Owner", user) );
|
criteria.Add(Expression.Eq("Owner", user) );
|
||||||
|
@ -332,9 +332,9 @@ namespace OpenSim.Data.NHibernate
|
||||||
}
|
}
|
||||||
m_log.ErrorFormat("No Inventory Root Folder Found for: {0}", user);
|
m_log.ErrorFormat("No Inventory Root Folder Found for: {0}", user);
|
||||||
return new InventoryFolderBase();
|
return new InventoryFolderBase();
|
||||||
} catch {
|
// } catch {
|
||||||
return new InventoryFolderBase();
|
// return new InventoryFolderBase();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,9 +347,9 @@ namespace OpenSim.Data.NHibernate
|
||||||
{
|
{
|
||||||
using(ISession session = factory.OpenSession()) {
|
using(ISession session = factory.OpenSession()) {
|
||||||
// try {
|
// try {
|
||||||
IQuery query = session.CreateQuery("from InventoryFolders i where i.ParentID = :parent");
|
ICriteria criteria = session.CreateCriteria(typeof(InventoryFolderBase));
|
||||||
query.SetParameter("parent", parentID, NHibernateUtil.Custom(typeof(LLUUIDUserType)));
|
criteria.Add(Expression.Eq("ParentID", parentID) );
|
||||||
foreach (InventoryFolderBase item in query.List())
|
foreach (InventoryFolderBase item in criteria.List())
|
||||||
{
|
{
|
||||||
folders.Add(item);
|
folders.Add(item);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<generator class="assigned" />
|
<generator class="assigned" />
|
||||||
</id>
|
</id>
|
||||||
<property name="Type" type="short" />
|
<property name="Type" type="short" />
|
||||||
<property name="Version" type="short" />
|
<property name="Version" type="UInt16" />
|
||||||
<property name="ParentID" index="folder_parent_id" type="OpenSim.Data.NHibernate.LLUUIDUserType, OpenSim.Data.NHibernate" />
|
<property name="ParentID" index="folder_parent_id" type="OpenSim.Data.NHibernate.LLUUIDUserType, OpenSim.Data.NHibernate" />
|
||||||
<property name="Owner" index="folder_owner_id" type="OpenSim.Data.NHibernate.LLUUIDUserType, OpenSim.Data.NHibernate" />
|
<property name="Owner" index="folder_owner_id" type="OpenSim.Data.NHibernate.LLUUIDUserType, OpenSim.Data.NHibernate" />
|
||||||
<property name="Name" type="String" length="64" />
|
<property name="Name" type="String" length="64" />
|
||||||
|
|
Loading…
Reference in New Issue