Allow IInventoryService.GetFolder(folderId, userId) as well as GetFolder(InventoryFolderBase folder)

This involves no wire changes since the methods often just construct an InventoryFolderBase under the hood.
This is in line with other methods that alraedy allow requests via uuid
soprefactor
Justin Clark-Casey (justincc) 2010-06-11 21:52:43 +01:00
parent 8531da37d4
commit 3525195bc9
14 changed files with 84 additions and 22 deletions

View File

@ -575,9 +575,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID), itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
new Dictionary<string, InventoryFolderBase>(), new List<InventoryNodeBase>()); new Dictionary<string, InventoryFolderBase>(), new List<InventoryNodeBase>());
InventoryFolderBase folder1Post InventoryFolderBase folder1Post = scene.InventoryService.GetFolder(folder1.ID, ua1.PrincipalID);
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
Assert.That(folder1Post.ID, Is.EqualTo(folder1.ID)); Assert.That(folder1Post.ID, Is.EqualTo(folder1.ID));
/* /*
InventoryFolderBase folder2 InventoryFolderBase folder2
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1Post, "b"); = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1Post, "b");

View File

@ -1,4 +1,4 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
@ -229,12 +229,14 @@ namespace OpenSim.Region.CoreModules.Framework.Library
/// <returns></returns> /// <returns></returns>
public InventoryItemBase GetItem(InventoryItemBase item) { return null; } public InventoryItemBase GetItem(InventoryItemBase item) { return null; }
public InventoryFolderBase GetFolder(UUID folderId, UUID userId) { return null; }
/// <summary> /// <summary>
/// Get a folder, given by its UUID /// Get a folder, given by its UUID
/// </summary> /// </summary>
/// <param name="folder"></param> /// <param name="folder"></param>
/// <returns></returns> /// <returns></returns>
public InventoryFolderBase GetFolder(InventoryFolderBase folder) { return null; } public InventoryFolderBase GetFolder(InventoryFolderBase folder) { return null; }
/// <summary> /// <summary>
/// Does the given user have an inventory structure? /// Does the given user have an inventory structure?

View File

@ -205,6 +205,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
public abstract InventoryItemBase GetItem(InventoryItemBase item); public abstract InventoryItemBase GetItem(InventoryItemBase item);
public abstract InventoryFolderBase GetFolder(UUID folderId, UUID userId);
public abstract InventoryFolderBase GetFolder(InventoryFolderBase folder); public abstract InventoryFolderBase GetFolder(InventoryFolderBase folder);
/// <summary> /// <summary>

View File

@ -1,4 +1,4 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
@ -470,7 +470,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return connector.DeleteItems(ownerID, itemIDs); return connector.DeleteItems(ownerID, itemIDs);
} }
public InventoryItemBase GetItem(InventoryItemBase item) public InventoryItemBase GetItem(InventoryItemBase item)
{ {
if (item == null) if (item == null)
return null; return null;
@ -486,7 +486,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return connector.GetItem(item); return connector.GetItem(item);
} }
public InventoryFolderBase GetFolder(InventoryFolderBase folder) public InventoryFolderBase GetFolder(UUID folderId, UUID userId)
{
return GetFolder(new InventoryFolderBase(folderId, userId));
}
public InventoryFolderBase GetFolder(InventoryFolderBase folder)
{ {
if (folder == null) if (folder == null)
return null; return null;
@ -503,12 +508,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return connector.GetFolder(folder); return connector.GetFolder(folder);
} }
public bool HasInventoryForUser(UUID userID) public bool HasInventoryForUser(UUID userID)
{ {
return false; return false;
} }
public List<InventoryItemBase> GetActiveGestures(UUID userId) public List<InventoryItemBase> GetActiveGestures(UUID userId)
{ {
return new List<InventoryItemBase>(); return new List<InventoryItemBase>();
} }

View File

@ -267,6 +267,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return item; return item;
} }
public InventoryFolderBase GetFolder(UUID folderId, UUID userId)
{
return GetFolder(new InventoryFolderBase(folderId, userId));
}
public InventoryFolderBase GetFolder(InventoryFolderBase folder) public InventoryFolderBase GetFolder(InventoryFolderBase folder)
{ {
return m_InventoryService.GetFolder(folder); return m_InventoryService.GetFolder(folder);

View File

@ -307,6 +307,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_RemoteConnector.QueryItem(item.Owner.ToString(), item, sessionID); return m_RemoteConnector.QueryItem(item.Owner.ToString(), item, sessionID);
} }
public override InventoryFolderBase GetFolder(UUID folderId, UUID userId)
{
return GetFolder(new InventoryFolderBase(folderId, userId));
}
public override InventoryFolderBase GetFolder(InventoryFolderBase folder) public override InventoryFolderBase GetFolder(InventoryFolderBase folder)
{ {
if (folder == null) if (folder == null)

View File

@ -250,7 +250,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
} }
public bool DeleteItems(UUID ownerID, List<UUID> itemIDs) public bool DeleteItems(UUID ownerID, List<UUID> itemIDs)
{ {
if (itemIDs == null) if (itemIDs == null)
return false; return false;
@ -260,7 +260,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_RemoteConnector.DeleteItems(ownerID, itemIDs); return m_RemoteConnector.DeleteItems(ownerID, itemIDs);
} }
public InventoryItemBase GetItem(InventoryItemBase item) public InventoryItemBase GetItem(InventoryItemBase item)
{ {
m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetItem {0}", item.ID); m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetItem {0}", item.ID);
if (item == null) if (item == null)
@ -271,7 +271,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_RemoteConnector.GetItem(item); return m_RemoteConnector.GetItem(item);
} }
public InventoryFolderBase GetFolder(InventoryFolderBase folder) public InventoryFolderBase GetFolder(UUID folderId, UUID userId)
{
return GetFolder(new InventoryFolderBase(folderId, userId));
}
public InventoryFolderBase GetFolder(InventoryFolderBase folder)
{ {
m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetFolder {0}", folder.ID); m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetFolder {0}", folder.ID);
if (folder == null) if (folder == null)
@ -280,17 +285,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_RemoteConnector.GetFolder(folder); return m_RemoteConnector.GetFolder(folder);
} }
public bool HasInventoryForUser(UUID userID) public bool HasInventoryForUser(UUID userID)
{ {
return false; return false;
} }
public List<InventoryItemBase> GetActiveGestures(UUID userId) public List<InventoryItemBase> GetActiveGestures(UUID userId)
{ {
return new List<InventoryItemBase>(); return new List<InventoryItemBase>();
} }
public int GetAssetPermissions(UUID userID, UUID assetID) public int GetAssetPermissions(UUID userID, UUID assetID)
{ {
return m_RemoteConnector.GetAssetPermissions(userID, assetID); return m_RemoteConnector.GetAssetPermissions(userID, assetID);
} }

View File

@ -171,6 +171,11 @@ namespace OpenSim.Services.Connectors
{ {
return null; return null;
} }
public InventoryFolderBase GetFolder(UUID folderId, UUID userId)
{
return null;
}
public InventoryFolderBase GetFolder(InventoryFolderBase folder) public InventoryFolderBase GetFolder(InventoryFolderBase folder)
{ {

View File

@ -431,6 +431,11 @@ namespace OpenSim.Services.Connectors
return null; return null;
} }
public InventoryFolderBase GetFolder(UUID folderId, UUID userId)
{
return GetFolder(new InventoryFolderBase(folderId, userId));
}
public InventoryFolderBase GetFolder(InventoryFolderBase folder) public InventoryFolderBase GetFolder(InventoryFolderBase folder)
{ {
try try

View File

@ -1,4 +1,4 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
@ -314,6 +314,11 @@ namespace OpenSim.Services.Connectors.SimianGrid
m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Item " + item.ID + " owned by " + item.Owner + " not found"); m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Item " + item.ID + " owned by " + item.Owner + " not found");
return null; return null;
} }
public InventoryFolderBase GetFolder(UUID folderId, UUID userId)
{
return GetFolder(new InventoryFolderBase(folderId, userId));
}
/// <summary> /// <summary>
/// Get a folder, given by its UUID /// Get a folder, given by its UUID

View File

@ -169,6 +169,14 @@ namespace OpenSim.Services.Interfaces
/// <returns></returns> /// <returns></returns>
InventoryItemBase GetItem(InventoryItemBase item); InventoryItemBase GetItem(InventoryItemBase item);
/// <summary>
/// Get a folder.
/// </summary>
/// <param name="folderId"></param>
/// <param name="userId"></param>
/// <returns></returns>
InventoryFolderBase GetFolder(UUID folderId, UUID userId);
/// <summary> /// <summary>
/// Get a folder, given by its UUID /// Get a folder, given by its UUID
/// </summary> /// </summary>

View File

@ -439,15 +439,20 @@ namespace OpenSim.Services.InventoryService
m_log.DebugFormat("[INVENTORY SERVICE]: GetItem failed to find item {0}", item.ID); m_log.DebugFormat("[INVENTORY SERVICE]: GetItem failed to find item {0}", item.ID);
return null; return null;
} }
public virtual InventoryFolderBase GetFolder(InventoryFolderBase folder) public virtual InventoryFolderBase GetFolder(UUID folderId, UUID userId)
{ {
InventoryFolderBase result = m_Database.getInventoryFolder(folder.ID); InventoryFolderBase result = m_Database.getInventoryFolder(folderId);
if (result != null) if (result != null)
return result; return result;
m_log.DebugFormat("[INVENTORY SERVICE]: GetFolder failed to find folder {0}", folder.ID); m_log.DebugFormat("[INVENTORY SERVICE]: GetFolder failed to find folder {0}", folderId);
return null; return null;
}
public virtual InventoryFolderBase GetFolder(InventoryFolderBase folder)
{
return GetFolder(folder.ID, folder.Owner);
} }
public virtual bool DeleteFolders(UUID ownerID, List<UUID> folderIDs) public virtual bool DeleteFolders(UUID ownerID, List<UUID> folderIDs)

View File

@ -368,6 +368,11 @@ namespace OpenSim.Services.InventoryService
return ConvertToOpenSim(items[0]); return ConvertToOpenSim(items[0]);
} }
public virtual InventoryFolderBase GetFolder(UUID folderId, UUID userId)
{
return GetFolder(new InventoryFolderBase(folderId, userId));
}
public virtual InventoryFolderBase GetFolder(InventoryFolderBase folder) public virtual InventoryFolderBase GetFolder(InventoryFolderBase folder)
{ {

View File

@ -162,6 +162,11 @@ namespace OpenSim.Tests.Common.Mock
{ {
return null; return null;
} }
public InventoryFolderBase GetFolder(UUID folderId, UUID userId)
{
return null;
}
public InventoryFolderBase GetFolder(InventoryFolderBase folder) public InventoryFolderBase GetFolder(InventoryFolderBase folder)
{ {