Finally remove the requirement for an InventoryItem/FolderBase object to

be passed into inventory queries.
This makes the API more homogenous and also will more clearly show
coding
errors related to HG inventory where the .Owner field has a meaning
for a query but wasn't always set.
LSLKeyTest
Melanie Thielker 2016-07-04 03:35:48 +01:00
parent 6deced0193
commit ea8f3c83bf
33 changed files with 147 additions and 228 deletions

View File

@ -445,8 +445,7 @@ namespace OpenSim.Groups
UUID itemID = binBucketMap["item_id"].AsUUID();
UUID ownerID = binBucketMap["owner_id"].AsUUID();
item = new InventoryItemBase(itemID, ownerID);
item = m_sceneList[0].InventoryService.GetItem(item);
item = m_sceneList[0].InventoryService.GetItem(ownerID, itemID);
}
else
m_log.DebugFormat("[Groups]: Received OSD with unexpected type: {0}", binBucketOSD.GetType());

View File

@ -2836,8 +2836,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
if (wearable[0].ItemID != UUID.Zero)
{
// Get inventory item and copy it
InventoryItemBase item = new InventoryItemBase(wearable[0].ItemID, source);
item = inventoryService.GetItem(item);
InventoryItemBase item = inventoryService.GetItem(source, wearable[0].ItemID);
if (item != null)
{
@ -2890,8 +2889,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
if (itemID != UUID.Zero)
{
// Get inventory item and copy it
InventoryItemBase item = new InventoryItemBase(itemID, source);
item = inventoryService.GetItem(item);
InventoryItemBase item = inventoryService.GetItem(source, itemID);
if (item != null)
{

View File

@ -403,10 +403,7 @@ namespace OpenSim.Capabilities.Handlers
return contents;
}
contents = fetchedContents;
InventoryFolderBase containingFolder = new InventoryFolderBase();
containingFolder.ID = folderID;
containingFolder.Owner = agentID;
containingFolder = m_InventoryService.GetFolder(containingFolder);
InventoryFolderBase containingFolder = m_InventoryService.GetFolder(agentID, folderID);
if (containingFolder != null)
{
@ -429,7 +426,7 @@ namespace OpenSim.Capabilities.Handlers
{
if (item.AssetType == (int)AssetType.Link)
{
InventoryItemBase linkedItem = m_InventoryService.GetItem(new InventoryItemBase(item.AssetID));
InventoryItemBase linkedItem = m_InventoryService.GetItem(agentID, item.AssetID);
// Take care of genuinely broken links where the target doesn't exist
// HACK: Also, don't follow up links that just point to other links. In theory this is legitimate,
@ -659,10 +656,7 @@ from docs seems this was never a spec
// Must fetch it individually
else if (contents.FolderID == UUID.Zero)
{
InventoryFolderBase containingFolder = new InventoryFolderBase();
containingFolder.ID = freq.folder_id;
containingFolder.Owner = freq.owner_id;
containingFolder = m_InventoryService.GetFolder(containingFolder);
InventoryFolderBase containingFolder = m_InventoryService.GetFolder(freq.owner_id, freq.folder_id);
if (containingFolder != null)
{
@ -759,12 +753,9 @@ from docs seems this was never a spec
m_log.WarnFormat("[WEB FETCH INV DESC HANDLER]: GetMultipleItems failed. Falling back to fetching inventory items one by one.");
linked = new InventoryItemBase[itemIDs.Count];
int i = 0;
InventoryItemBase item = new InventoryItemBase();
item.Owner = freq.owner_id;
foreach (UUID id in itemIDs)
{
item.ID = id;
linked[i++] = m_InventoryService.GetItem(item);
linked[i++] = m_InventoryService.GetItem(freq.owner_id, id);
}
}
@ -850,4 +841,4 @@ from docs seems this was never a spec
public InventoryCollection Collection;
public int Descendents;
}
}
}

View File

@ -81,24 +81,15 @@ namespace OpenSim.Capabilities.Handlers
// OMG!!! One by one!!! This is fallback code, in case the backend isn't updated
m_log.WarnFormat("[FETCH INVENTORY HANDLER]: GetMultipleItems failed. Falling back to fetching inventory items one by one.");
items = new InventoryItemBase[itemsRequested.Count];
InventoryItemBase item = new InventoryItemBase();
item.Owner = m_agentID;
foreach (UUID id in itemIDs)
{
item.ID = id;
items[i++] = m_inventoryService.GetItem(item);
}
items[i++] = m_inventoryService.GetItem(m_agentID, id);
}
}
else
{
items = new InventoryItemBase[itemsRequested.Count];
InventoryItemBase item = new InventoryItemBase();
foreach (UUID id in itemIDs)
{
item.ID = id;
items[i++] = m_inventoryService.GetItem(item);
}
items[i++] = m_inventoryService.GetItem(UUID.Zero, id);
}
foreach (InventoryItemBase item in items)
@ -152,4 +143,4 @@ namespace OpenSim.Capabilities.Handlers
return llsdItem;
}
}
}
}

View File

@ -1386,7 +1386,7 @@ namespace OpenSim.Region.ClientStack.Linden
IClientAPI client = null;
m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client);
item = m_Scene.InventoryService.GetItem(new InventoryItemBase(itemID));
item = m_Scene.InventoryService.GetItem(m_HostCapsObj.AgentID, itemID);
if (item != null)
{
string message;

View File

@ -898,8 +898,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp, scriptedState);
InventoryItemBase item = new InventoryItemBase(grp.FromItemID, sp.UUID);
item = m_scene.InventoryService.GetItem(item);
InventoryItemBase item = m_scene.InventoryService.GetItem(sp.UUID, grp.FromItemID);
if (item != null)
{
@ -1223,8 +1222,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
return;
}
InventoryItemBase item = new InventoryItemBase(itemID, sp.UUID);
item = m_scene.InventoryService.GetItem(item);
InventoryItemBase item = m_scene.InventoryService.GetItem(sp.UUID, itemID);
if (item == null)
return;

View File

@ -219,7 +219,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
// sp.Appearance.GetAttachpoint(attSo.FromItemID),
// Is.EqualTo((int)AttachmentPoint.Chest));
InventoryItemBase attachmentItem = scene.InventoryService.GetItem(new InventoryItemBase(attSo.FromItemID));
InventoryItemBase attachmentItem = scene.InventoryService.GetItem(sp.UUID, attSo.FromItemID);
Assert.That(attachmentItem, Is.Not.Null);
Assert.That(attachmentItem.Name, Is.EqualTo(attName));
@ -266,7 +266,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
// sp.Appearance.GetAttachpoint(attSo.FromItemID),
// Is.EqualTo((int)AttachmentPoint.LeftHand));
InventoryItemBase attachmentItem = scene.InventoryService.GetItem(new InventoryItemBase(attSo.FromItemID));
InventoryItemBase attachmentItem = scene.InventoryService.GetItem(sp.UUID, attSo.FromItemID);
Assert.That(attachmentItem, Is.Not.Null);
Assert.That(attachmentItem.Name, Is.EqualTo(so.Name));
@ -299,7 +299,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
// sp.Appearance.GetAttachpoint(attSo.FromItemID),
// Is.EqualTo((int)AttachmentPoint.LeftHand));
InventoryItemBase attachmentItem = scene.InventoryService.GetItem(new InventoryItemBase(attSo.FromItemID));
InventoryItemBase attachmentItem = scene.InventoryService.GetItem(sp.UUID, attSo.FromItemID);
Assert.That(attachmentItem, Is.Not.Null);
Assert.That(attachmentItem.Name, Is.EqualTo(so2.Name));
@ -332,7 +332,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
// sp.Appearance.GetAttachpoint(attSo.FromItemID),
// Is.EqualTo((int)AttachmentPoint.LeftHand));
InventoryItemBase attachmentItem = scene.InventoryService.GetItem(new InventoryItemBase(attSo.FromItemID));
InventoryItemBase attachmentItem = scene.InventoryService.GetItem(sp.UUID, attSo.FromItemID);
Assert.That(attachmentItem, Is.Not.Null);
Assert.That(attachmentItem.Name, Is.EqualTo(so2.Name));
@ -600,7 +600,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
// Assert.That(sp.Appearance.GetAttachments().Count, Is.EqualTo(0));
// Check item status
Assert.That(scene.InventoryService.GetItem(new InventoryItemBase(attItem.ID)), Is.Null);
Assert.That(scene.InventoryService.GetItem(sp.UUID, attItem.ID), Is.Null);
// Check object in scene
SceneObjectGroup soInScene = scene.GetSceneObjectGroup("att");
@ -679,7 +679,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
scene.AttachmentsModule.DetachSingleAttachmentToInv(sp, rezzedSo);
InventoryItemBase userItemUpdated = scene.InventoryService.GetItem(userItem);
InventoryItemBase userItemUpdated = scene.InventoryService.GetItem(userItem.Owner, userItem.ID);
AssetBase asset = scene.AssetService.Get(userItemUpdated.AssetID.ToString());
// TODO: It would probably be better here to check script state via the saving and retrieval of state

View File

@ -904,8 +904,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
continue;
}
InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i][j].ItemID, userID);
baseItem = invService.GetItem(baseItem);
InventoryItemBase baseItem = invService.GetItem(userID, appearance.Wearables[i][j].ItemID);
if (baseItem != null)
{

View File

@ -239,8 +239,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
InventoryFolderBase trashFolder =
invService.GetFolderForType(client.AgentId, FolderType.Trash);
InventoryItemBase item = new InventoryItemBase(transactionID, client.AgentId);
item = invService.GetItem(item);
InventoryItemBase item = invService.GetItem(client.AgentId, transactionID);
if (item != null && trashFolder != null)
{

View File

@ -86,8 +86,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gestures
{
IInventoryService invService = m_scene.InventoryService;
InventoryItemBase item = new InventoryItemBase(gestureId, client.AgentId);
item = invService.GetItem(item);
InventoryItemBase item = invService.GetItem(client.AgentId, gestureId);
if (item != null)
{
item.Flags |= 1;
@ -102,8 +101,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gestures
{
IInventoryService invService = m_scene.InventoryService;
InventoryItemBase item = new InventoryItemBase(gestureId, client.AgentId);
item = invService.GetItem(item);
InventoryItemBase item = invService.GetItem(client.AgentId, gestureId);
if (item != null)
{
item.Flags &= ~(uint)1;

View File

@ -270,8 +270,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
// RLV uses this
if (im.dialog == (byte) InstantMessageDialog.TaskInventoryAccepted)
{
InventoryFolderBase folder = new InventoryFolderBase(inventoryID, client.AgentId);
folder = invService.GetFolder(folder);
InventoryFolderBase folder = invService.GetFolder(client.AgentId, inventoryID);
if (folder != null)
{
@ -280,8 +279,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
UUID destFolderID = new UUID(im.binaryBucket, 0);
if (destFolderID != UUID.Zero)
{
InventoryFolderBase destFolder = new InventoryFolderBase(destFolderID, client.AgentId);
destFolder = invService.GetFolder(destFolder);
InventoryFolderBase destFolder = invService.GetFolder(client.AgentId, destFolderID);
if (destFolder != null)
{
if (folder.ParentID != destFolder.ID)
@ -339,8 +337,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip
InventoryItemBase item = new InventoryItemBase(inventoryID, client.AgentId);
item = invService.GetItem(item);
InventoryItemBase item = invService.GetItem(client.AgentId, inventoryID);
InventoryFolderBase folder = null;
UUID? previousParentFolderID = null;
@ -354,8 +351,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
}
else
{
folder = new InventoryFolderBase(inventoryID, client.AgentId);
folder = invService.GetFolder(folder);
folder = invService.GetFolder(client.AgentId, inventoryID);
if (folder != null) // It's a folder
{
@ -368,9 +364,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
// Tell client about updates to original parent and new parent (this should probably be factored with existing move item/folder code).
if (previousParentFolderID != null)
{
InventoryFolderBase previousParentFolder
= new InventoryFolderBase((UUID)previousParentFolderID, client.AgentId);
previousParentFolder = invService.GetFolder(previousParentFolder);
InventoryFolderBase previousParentFolder = invService.GetFolder(client.AgentId, (UUID)previousParentFolderID);
scene.SendInventoryUpdate(client, previousParentFolder, true, true);
scene.SendInventoryUpdate(client, destinationFolder, true, true);
@ -392,8 +386,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip
InventoryItemBase item = new InventoryItemBase(inventoryID, client.AgentId);
item = invService.GetItem(item);
InventoryItemBase item = invService.GetItem(client.AgentId, inventoryID);
InventoryFolderBase folder = null;
UUID? previousParentFolderID = null;
@ -410,8 +403,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
}
else
{
folder = new InventoryFolderBase(inventoryID, client.AgentId);
folder = invService.GetFolder(folder);
folder = invService.GetFolder(client.AgentId, inventoryID);
if (folder != null & trashFolder != null)
{
@ -439,9 +431,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
// Tell client about updates to original parent and new parent (this should probably be factored with existing move item/folder code).
else if (previousParentFolderID != null)
{
InventoryFolderBase previousParentFolder
= new InventoryFolderBase((UUID)previousParentFolderID, client.AgentId);
previousParentFolder = invService.GetFolder(previousParentFolder);
InventoryFolderBase previousParentFolder = invService.GetFolder(client.AgentId, (UUID)previousParentFolderID);
scene.SendInventoryUpdate(client, previousParentFolder, true, true);
scene.SendInventoryUpdate(client, trashFolder, true, true);
@ -500,10 +490,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
{
UUID folderID = new UUID(im.binaryBucket, 1);
InventoryFolderBase given =
new InventoryFolderBase(folderID, recipientID);
InventoryFolderBase folder =
scene.InventoryService.GetFolder(given);
scene.InventoryService.GetFolder(recipientID, folderID);
if (folder != null)
user.ControllingClient.SendBulkUpdateInventory(folder);
@ -512,10 +500,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
{
UUID itemID = new UUID(im.binaryBucket, 1);
InventoryItemBase given =
new InventoryItemBase(itemID, recipientID);
InventoryItemBase item =
scene.InventoryService.GetItem(given);
scene.InventoryService.GetItem(recipientID, itemID);
if (item != null)
{
@ -538,10 +524,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
{
UUID folderID = new UUID(im.imSessionID);
InventoryFolderBase given =
new InventoryFolderBase(folderID, recipientID);
InventoryFolderBase folder =
scene.InventoryService.GetFolder(given);
scene.InventoryService.GetFolder(recipientID, folderID);
if (folder != null)
user.ControllingClient.SendBulkUpdateInventory(folder);
@ -550,10 +534,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
{
UUID itemID = new UUID(im.imSessionID);
InventoryItemBase given =
new InventoryItemBase(itemID, recipientID);
InventoryItemBase item =
scene.InventoryService.GetItem(given);
scene.InventoryService.GetItem(recipientID, itemID);
if (item != null)
{

View File

@ -95,8 +95,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
foreach (AvatarAttachment att in a.GetAttachments())
{
InventoryItemBase item = new InventoryItemBase(att.ItemID, account.PrincipalID);
item = Scene.InventoryService.GetItem(item);
InventoryItemBase item = Scene.InventoryService.GetItem(account.PrincipalID, att.ItemID);
if (item != null)
a.SetAttachment(att.AttachPoint, att.ItemID, item.AssetID);
else

View File

@ -314,9 +314,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
//if (fromTaskID.Equals(UUID.Zero))
//{
InventoryItemBase item = new InventoryItemBase(itemID);
item.Owner = remoteClient.AgentId;
item = m_Scene.InventoryService.GetItem(item);
InventoryItemBase item = m_Scene.InventoryService.GetItem(remoteClient.AgentId, itemID);
//if (item == null)
//{ // Fetch the item
// item = new InventoryItemBase();

View File

@ -184,8 +184,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
if (!m_Scene.Permissions.CanCreateUserInventory(invType, remoteClient.AgentId))
return;
InventoryFolderBase f = new InventoryFolderBase(folderID, remoteClient.AgentId);
InventoryFolderBase folder = m_Scene.InventoryService.GetFolder(f);
InventoryFolderBase folder = m_Scene.InventoryService.GetFolder(remoteClient.AgentId, folderID);
if (folder == null && Enum.IsDefined(typeof(FolderType), (sbyte)invType))
{
@ -260,8 +259,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
/// <returns></returns>
public virtual UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data)
{
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
item = m_Scene.InventoryService.GetItem(item);
InventoryItemBase item = m_Scene.InventoryService.GetItem(remoteClient.AgentId, itemID);
if (item.Owner != remoteClient.AgentId)
return UUID.Zero;
@ -719,8 +717,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
if (DeRezAction.SaveToExistingUserInventoryItem == action)
{
item = new InventoryItemBase(so.RootPart.FromUserInventoryItemID, userID);
item = m_Scene.InventoryService.GetItem(item);
item = m_Scene.InventoryService.GetItem(userID, so.RootPart.FromUserInventoryItemID);
//item = userInfo.RootFolder.FindItem(
// objectGroup.RootPart.FromUserInventoryItemID);
@ -792,9 +789,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
{
if (so.FromFolderID != UUID.Zero && so.RootPart.OwnerID == remoteClient.AgentId)
{
InventoryFolderBase f = new InventoryFolderBase(so.FromFolderID, userID);
if (f != null)
folder = m_Scene.InventoryService.GetFolder(f);
folder = m_Scene.InventoryService.GetFolder(userID, so.FromFolderID);
if(folder.Type == 14 || folder.Type == 16)
{
@ -830,8 +825,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment)
{
// m_log.DebugFormat("[INVENTORY ACCESS MODULE]: RezObject for {0}, item {1}", remoteClient.Name, itemID);
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
item = m_Scene.InventoryService.GetItem(item);
InventoryItemBase item = m_Scene.InventoryService.GetItem(remoteClient.AgentId, itemID);
if (item == null)
{
@ -1289,8 +1283,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
protected virtual InventoryItemBase GetItem(UUID agentID, UUID itemID)
{
IInventoryService invService = m_Scene.RequestModuleInterface<IInventoryService>();
InventoryItemBase item = new InventoryItemBase(itemID, agentID);
item = invService.GetItem(item);
InventoryItemBase item = invService.GetItem(agentID, itemID);
if (item != null && item.CreatorData != null && item.CreatorData != string.Empty)
UserManagementModule.AddUser(item.CreatorIdAsUuid, item.CreatorData);

View File

@ -103,13 +103,8 @@ namespace OpenSim.Region.CoreModules.Framework.Library
{
InventoryItemBase[] itemColl = new InventoryItemBase[itemIDs.Length];
int i = 0;
InventoryItemBase item = new InventoryItemBase();
item.Owner = principalID;
foreach (UUID fid in itemIDs)
{
item.ID = fid;
itemColl[i++] = GetItem(item);
}
itemColl[i++] = GetItem(principalID, fid);
return itemColl;
}
@ -239,14 +234,14 @@ namespace OpenSim.Region.CoreModules.Framework.Library
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
public InventoryItemBase GetItem(InventoryItemBase item) { return null; }
public InventoryItemBase GetItem(UUID principalID, UUID itemID) { return null; }
/// <summary>
/// Get a folder, given by its UUID
/// </summary>
/// <param name="folder"></param>
/// <returns></returns>
public InventoryFolderBase GetFolder(InventoryFolderBase folder) { return null; }
public InventoryFolderBase GetFolder(UUID principalID, UUID folderID) { return null; }
/// <summary>
/// Does the given user have an inventory structure?

View File

@ -598,21 +598,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return connector.DeleteItems(ownerID, itemIDs);
}
public InventoryItemBase GetItem(InventoryItemBase item)
public InventoryItemBase GetItem(UUID principalID, UUID itemID)
{
if (item == null)
return null;
//m_log.Debug("[HG INVENTORY CONNECTOR]: GetItem " + item.ID);
string invURL = GetInventoryServiceURL(item.Owner);
string invURL = GetInventoryServiceURL(principalID);
if (invURL == null) // not there, forward to local inventory connector to resolve
lock (m_Lock)
return m_LocalGridInventoryService.GetItem(item);
return m_LocalGridInventoryService.GetItem(principalID, itemID);
IInventoryService connector = GetConnector(invURL);
return connector.GetItem(item);
return connector.GetItem(principalID, itemID);
}
public InventoryItemBase[] GetMultipleItems(UUID userID, UUID[] itemIDs)
@ -632,22 +630,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return connector.GetMultipleItems(userID, itemIDs);
}
public InventoryFolderBase GetFolder(InventoryFolderBase folder)
public InventoryFolderBase GetFolder(UUID principalID, UUID folderID)
{
if (folder == null)
return null;
//m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolder " + folder.ID);
string invURL = GetInventoryServiceURL(folder.Owner);
string invURL = GetInventoryServiceURL(principalID);
if (invURL == null) // not there, forward to local inventory connector to resolve
lock (m_Lock)
return m_LocalGridInventoryService.GetFolder(folder);
return m_LocalGridInventoryService.GetFolder(principalID, folderID);
IInventoryService connector = GetConnector(invURL);
return connector.GetFolder(folder);
return connector.GetFolder(principalID, folderID);
}
public bool HasInventoryForUser(UUID userID)
@ -710,4 +705,4 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return connector;
}
}
}
}

View File

@ -292,13 +292,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_InventoryService.DeleteItems(ownerID, itemIDs);
}
public InventoryItemBase GetItem(InventoryItemBase item)
public InventoryItemBase GetItem(UUID principalID, UUID itemID)
{
// m_log.DebugFormat("[LOCAL INVENTORY SERVICES CONNECTOR]: Requesting inventory item {0}", item.ID);
// UUID requestedItemId = item.ID;
item = m_InventoryService.GetItem(item);
InventoryItemBase item = m_InventoryService.GetItem(principalID, itemID);
// if (null == item)
// m_log.ErrorFormat(
@ -312,9 +312,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_InventoryService.GetMultipleItems(userID, itemIDs);
}
public InventoryFolderBase GetFolder(InventoryFolderBase folder)
public InventoryFolderBase GetFolder(UUID principalID, UUID folderID)
{
return m_InventoryService.GetFolder(folder);
return m_InventoryService.GetFolder(principalID, folderID);
}
/// <summary>

View File

@ -292,15 +292,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_RemoteConnector.DeleteItems(ownerID, itemIDs);
}
public InventoryItemBase GetItem(InventoryItemBase item)
public InventoryItemBase GetItem(UUID userID, UUID itemID)
{
//m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetItem {0}", item.ID);
if (item == null)
return null;
if (m_RemoteConnector == null)
m_log.DebugFormat("[XINVENTORY CONNECTOR]: connector stub is null!!!");
return m_RemoteConnector.GetItem(item);
return m_RemoteConnector.GetItem(userID, itemID);
}
public InventoryItemBase[] GetMultipleItems(UUID userID, UUID[] itemIDs)
@ -311,13 +309,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_RemoteConnector.GetMultipleItems(userID, itemIDs);
}
public InventoryFolderBase GetFolder(InventoryFolderBase folder)
public InventoryFolderBase GetFolder(UUID userID, UUID folderID)
{
//m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetFolder {0}", folder.ID);
if (folder == null)
return null;
return m_RemoteConnector.GetFolder(folder);
return m_RemoteConnector.GetFolder(userID, folderID);
}
public bool HasInventoryForUser(UUID userID)
@ -337,4 +333,4 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
#endregion
}
}
}

View File

@ -1100,8 +1100,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (objectID == UUID.Zero) // User inventory
{
IInventoryService invService = m_scene.InventoryService;
InventoryItemBase assetRequestItem = new InventoryItemBase(notecard, user);
assetRequestItem = invService.GetItem(assetRequestItem);
InventoryItemBase assetRequestItem = invService.GetItem(user, notecard);
if (assetRequestItem == null && LibraryRootFolder != null) // Library item
{
assetRequestItem = LibraryRootFolder.FindItem(notecard);
@ -1625,8 +1624,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (objectID == UUID.Zero) // User inventory
{
IInventoryService invService = m_scene.InventoryService;
InventoryItemBase assetRequestItem = new InventoryItemBase(script, user);
assetRequestItem = invService.GetItem(assetRequestItem);
InventoryItemBase assetRequestItem = invService.GetItem(user, script);
if (assetRequestItem == null && LibraryRootFolder != null) // Library item
{
assetRequestItem = LibraryRootFolder.FindItem(script);
@ -1722,8 +1720,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (objectID == UUID.Zero) // User inventory
{
IInventoryService invService = m_scene.InventoryService;
InventoryItemBase assetRequestItem = new InventoryItemBase(notecard, user);
assetRequestItem = invService.GetItem(assetRequestItem);
InventoryItemBase assetRequestItem = invService.GetItem(user, notecard);
if (assetRequestItem == null && LibraryRootFolder != null) // Library item
{
assetRequestItem = LibraryRootFolder.FindItem(notecard);

View File

@ -143,8 +143,7 @@ namespace OpenSim.Region.Framework.Scenes
// m_log.DebugFormat(
// "[ASYNC INVENTORY SENDER]: Handling request from {0} for {1} on queue", fh.Client.Name, fh.ItemID);
InventoryItemBase item = new InventoryItemBase(fh.ItemID, fh.Client.AgentId);
item = m_scene.InventoryService.GetItem(item);
InventoryItemBase item = m_scene.InventoryService.GetItem(fh.Client.AgentId, fh.ItemID);
if (item != null)
fh.Client.SendInventoryItemDetails(item.Owner, item);
@ -153,4 +152,4 @@ namespace OpenSim.Region.Framework.Scenes
}
}
}
}
}

View File

@ -223,8 +223,7 @@ namespace OpenSim.Region.Framework.Scenes
if (core.TryGet<IClientInventory>(out inv))
{
InventoryFolderBase parent = new InventoryFolderBase(f.ParentID, f.Owner);
parent = InventoryService.GetFolder(parent);
InventoryFolderBase parent = InventoryService.GetFolder(f.Owner, f.ParentID);
inv.SendRemoveInventoryItems(new UUID[] { item.ID });
inv.SendBulkUpdateInventory(new InventoryFolderBase[0], new InventoryItemBase[] { item });
string message = "The item was placed in folder " + f.Name;
@ -407,8 +406,7 @@ namespace OpenSim.Region.Framework.Scenes
// inventory. Rut-Roh. Whatever. Make this secure. Yeah.
//
// Passing something to another avatar or a an object will already
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
item = InventoryService.GetItem(item);
InventoryItemBase item = InventoryService.GetItem(remoteClient.AgentId, itemID);
if (item != null)
{
@ -585,8 +583,7 @@ namespace OpenSim.Region.Framework.Scenes
return null;
}
InventoryItemBase item = new InventoryItemBase(itemId, senderId);
item = InventoryService.GetItem(item);
InventoryItemBase item = InventoryService.GetItem(senderId, itemId);
if (item == null)
{
@ -807,7 +804,7 @@ namespace OpenSim.Region.Framework.Scenes
UUID recipientId, UUID senderId, UUID folderId, UUID recipientParentFolderId)
{
//// Retrieve the folder from the sender
InventoryFolderBase folder = InventoryService.GetFolder(new InventoryFolderBase(folderId, senderId));
InventoryFolderBase folder = InventoryService.GetFolder(senderId, folderId);
if (null == folder)
{
m_log.ErrorFormat(
@ -868,8 +865,7 @@ namespace OpenSim.Region.Framework.Scenes
if (item == null)
{
item = new InventoryItemBase(oldItemID, remoteClient.AgentId);
item = InventoryService.GetItem(item);
item = InventoryService.GetItem(remoteClient.AgentId, oldItemID);
if (item == null)
{
@ -953,7 +949,7 @@ namespace OpenSim.Region.Framework.Scenes
foreach (InventoryItemBase b in items)
{
CopyInventoryItem(remoteClient, 0, remoteClient.AgentId, b.ID, b.Folder, null);
InventoryItemBase n = InventoryService.GetItem(b);
InventoryItemBase n = InventoryService.GetItem(b.Owner, b.ID);
n.Folder = destfolder;
moveitems.Add(n);
remoteClient.SendInventoryItemCreateUpdate(n, 0);
@ -1605,8 +1601,7 @@ namespace OpenSim.Region.Framework.Scenes
InventoryCollection contents = InventoryService.GetFolderContent(client.AgentId, folder.ID);
// Fetch the folder itself to get its current version
InventoryFolderBase containingFolder = new InventoryFolderBase(folder.ID, client.AgentId);
containingFolder = InventoryService.GetFolder(containingFolder);
InventoryFolderBase containingFolder = InventoryService.GetFolder(client.AgentId, folder.ID);
// m_log.DebugFormat("[AGENT INVENTORY]: Sending inventory folder contents ({0} nodes) for \"{1}\" to {2} {3}",
// contents.Folders.Count + contents.Items.Count, containingFolder.Name, client.FirstName, client.LastName);
@ -1620,7 +1615,7 @@ namespace OpenSim.Region.Framework.Scenes
{
if (item.AssetType == (int)AssetType.Link)
{
InventoryItemBase linkedItem = InventoryService.GetItem(new InventoryItemBase(item.AssetID));
InventoryItemBase linkedItem = InventoryService.GetItem(client.AgentId, item.AssetID);
// Take care of genuinely broken links where the target doesn't exist
// HACK: Also, don't follow up links that just point to other links. In theory this is legitimate,
@ -1680,8 +1675,7 @@ namespace OpenSim.Region.Framework.Scenes
UUID copyID = UUID.Random();
if (itemID != UUID.Zero)
{
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
item = InventoryService.GetItem(item);
InventoryItemBase item = InventoryService.GetItem(remoteClient.AgentId, itemID);
// Try library
if (null == item && LibraryService != null && LibraryService.LibraryRootFolder != null)
@ -1836,8 +1830,7 @@ namespace OpenSim.Region.Framework.Scenes
public SceneObjectPart RezScriptFromAgentInventory(UUID agentID, UUID fromItemID, uint localID)
{
UUID copyID = UUID.Random();
InventoryItemBase item = new InventoryItemBase(fromItemID, agentID);
item = InventoryService.GetItem(item);
InventoryItemBase item = InventoryService.GetItem(agentID, fromItemID);
// Try library
// XXX clumsy, possibly should be one call

View File

@ -627,8 +627,7 @@ namespace OpenSim.Region.Framework.Scenes
// m_log.DebugFormat(
// "[AGENT INVENTORY]: Updating inventory folder {0} {1} for {2} {3}", folderID, name, remoteClient.Name, remoteClient.AgentId);
InventoryFolderBase folder = new InventoryFolderBase(folderID, remoteClient.AgentId);
folder = InventoryService.GetFolder(folder);
InventoryFolderBase folder = InventoryService.GetFolder(remoteClient.AgentId, folderID);
if (folder != null)
{
folder.Name = name;
@ -645,8 +644,7 @@ namespace OpenSim.Region.Framework.Scenes
public void HandleMoveInventoryFolder(IClientAPI remoteClient, UUID folderID, UUID parentID)
{
InventoryFolderBase folder = new InventoryFolderBase(folderID, remoteClient.AgentId);
folder = InventoryService.GetFolder(folder);
InventoryFolderBase folder = InventoryService.GetFolder(remoteClient.AgentId, folderID);
if (folder != null)
{
folder.ParentID = parentID;

View File

@ -505,8 +505,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
//variable will be set to null and attachment will
//not be included with the group notice.
Scene scene = (Scene)remoteClient.Scene;
item = new InventoryItemBase(itemID, ownerID);
item = scene.InventoryService.GetItem(item);
item = scene.InventoryService.GetItem(ownerID, itemID);
if (item != null)
{

View File

@ -114,12 +114,12 @@ namespace OpenSim.Server.Handlers.Inventory
"POST", "/DeleteItem/", DeleteItems, CheckAuthSession));
m_httpServer.AddStreamHandler(
new RestDeserialiseSecureHandler<InventoryItemBase, InventoryItemBase>(
"POST", "/QueryItem/", m_InventoryService.GetItem, CheckAuthSession));
new RestDeserialiseSecureHandler<Guid, InventoryItemBase>(
"POST", "/QueryItem/", GetItem, CheckAuthSession));
m_httpServer.AddStreamHandler(
new RestDeserialiseSecureHandler<InventoryFolderBase, InventoryFolderBase>(
"POST", "/QueryFolder/", m_InventoryService.GetFolder, CheckAuthSession));
new RestDeserialiseSecureHandler<Guid, InventoryFolderBase>(
"POST", "/QueryFolder/", GetFolder, CheckAuthSession));
m_httpServer.AddStreamHandler(
new RestDeserialiseTrustedHandler<Guid, bool>(
@ -205,6 +205,16 @@ namespace OpenSim.Server.Handlers.Inventory
return new Dictionary<AssetType, InventoryFolderBase>();
}
public InventoryItemBase GetItem(Guid guid)
{
return m_InventoryService.GetItem(UUID.Zero, new UUID(guid));
}
public InventoryFolderBase GetFolder(Guid guid)
{
return m_InventoryService.GetFolder(UUID.Zero, new UUID(guid));
}
public InventoryCollection GetFolderContent(Guid guid)
{
return m_InventoryService.GetFolderContent(UUID.Zero, new UUID(guid));

View File

@ -566,9 +566,11 @@ namespace OpenSim.Server.Handlers.Inventory
Dictionary<string,object> result = new Dictionary<string,object>();
UUID id = UUID.Zero;
UUID.TryParse(request["ID"].ToString(), out id);
UUID user = UUID.Zero;
if (request.ContainsKey("PRINCIPAL"))
UUID.TryParse(request["PRINCIPAL"].ToString(), out user);
InventoryItemBase item = new InventoryItemBase(id);
item = m_InventoryService.GetItem(item);
InventoryItemBase item = m_InventoryService.GetItem(user, id);
if (item != null)
result["item"] = EncodeItem(item);
@ -617,9 +619,11 @@ namespace OpenSim.Server.Handlers.Inventory
Dictionary<string, object> result = new Dictionary<string, object>();
UUID id = UUID.Zero;
UUID.TryParse(request["ID"].ToString(), out id);
UUID user = UUID.Zero;
if (request.ContainsKey("PRINCIPAL"))
UUID.TryParse(request["PRINCIPAL"].ToString(), out user);
InventoryFolderBase folder = new InventoryFolderBase(id);
folder = m_InventoryService.GetFolder(folder);
InventoryFolderBase folder = m_InventoryService.GetFolder(user, id);
if (folder != null)
result["folder"] = EncodeFolder(folder);

View File

@ -520,10 +520,10 @@ namespace OpenSim.Services.Connectors
return CheckReturn(ret);
}
public InventoryItemBase GetItem(InventoryItemBase item)
public InventoryItemBase GetItem(UUID principalID, UUID itemID)
{
InventoryItemBase retrieved = null;
if (m_ItemCache.TryGetValue(item.ID, out retrieved))
if (m_ItemCache.TryGetValue(itemID, out retrieved))
{
return retrieved;
}
@ -532,7 +532,8 @@ namespace OpenSim.Services.Connectors
{
Dictionary<string, object> ret = MakeRequest("GETITEM",
new Dictionary<string, object> {
{ "ID", item.ID.ToString() }
{ "ID", itemID.ToString() },
{ "PRINCIPAL", principalID.ToString() }
});
if (!CheckReturn(ret))
@ -545,7 +546,7 @@ namespace OpenSim.Services.Connectors
m_log.Error("[XINVENTORY SERVICES CONNECTOR]: Exception in GetItem: ", e);
}
m_ItemCache.AddOrUpdate(item.ID, retrieved, CACHE_EXPIRATION_SECONDS);
m_ItemCache.AddOrUpdate(itemID, retrieved, CACHE_EXPIRATION_SECONDS);
return retrieved;
}
@ -613,13 +614,14 @@ namespace OpenSim.Services.Connectors
return itemArr;
}
public InventoryFolderBase GetFolder(InventoryFolderBase folder)
public InventoryFolderBase GetFolder(UUID principalID, UUID folderID)
{
try
{
Dictionary<string, object> ret = MakeRequest("GETFOLDER",
new Dictionary<string, object> {
{ "ID", folder.ID.ToString() }
{ "ID", folderID.ToString() },
{ "PRINCIPAL", principalID.ToString() }
});
if (!CheckReturn(ret))

View File

@ -277,17 +277,17 @@ namespace OpenSim.Services.Connectors.SimianGrid
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
public InventoryItemBase GetItem(InventoryItemBase item)
public InventoryItemBase GetItem(UUID principalID, UUID itemID)
{
InventoryItemBase retrieved = null;
if (m_ItemCache.TryGetValue(item.ID, out retrieved))
if (m_ItemCache.TryGetValue(itemID, out retrieved))
return retrieved;
NameValueCollection requestArgs = new NameValueCollection
{
{ "RequestMethod", "GetInventoryNode" },
{ "ItemID", item.ID.ToString() },
{ "OwnerID", item.Owner.ToString() },
{ "ItemID", itemID.ToString() },
{ "OwnerID", principalID.ToString() },
{ "IncludeFolders", "1" },
{ "IncludeItems", "1" },
{ "ChildrenOnly", "1" }
@ -303,17 +303,17 @@ namespace OpenSim.Services.Connectors.SimianGrid
// and sanity check just in case
for (int i = 0; i < items.Count; i++)
{
if (items[i].ID == item.ID)
if (items[i].ID == itemID)
{
retrieved = items[i];
m_ItemCache.AddOrUpdate(item.ID, retrieved, CACHE_EXPIRATION_SECONDS);
m_ItemCache.AddOrUpdate(itemID, retrieved, CACHE_EXPIRATION_SECONDS);
return retrieved;
}
}
}
}
m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Item " + item.ID + " owned by " + item.Owner + " not found");
m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Item " + itemID + " owned by " + principalID + " not found");
return null;
}
@ -321,13 +321,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
{
InventoryItemBase[] result = new InventoryItemBase[itemIDs.Length];
int i = 0;
InventoryItemBase item = new InventoryItemBase();
item.Owner = principalID;
foreach (UUID id in itemIDs)
{
item.ID = id;
result[i++] = GetItem(item);
}
result[i++] = GetItem(principalID, id);
return result;
}
@ -337,13 +332,13 @@ namespace OpenSim.Services.Connectors.SimianGrid
/// </summary>
/// <param name="folder"></param>
/// <returns></returns>
public InventoryFolderBase GetFolder(InventoryFolderBase folder)
public InventoryFolderBase GetFolder(UUID principalID, UUID folderID)
{
NameValueCollection requestArgs = new NameValueCollection
{
{ "RequestMethod", "GetInventoryNode" },
{ "ItemID", folder.ID.ToString() },
{ "OwnerID", folder.Owner.ToString() },
{ "ItemID", folderID.ToString() },
{ "OwnerID", principalID.ToString() },
{ "IncludeFolders", "1" },
{ "IncludeItems", "0" },
{ "ChildrenOnly", "1" }
@ -353,7 +348,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
if (response["Success"].AsBoolean() && response["Items"] is OSDArray)
{
OSDArray items = (OSDArray)response["Items"];
List<InventoryFolderBase> folders = GetFoldersFromResponse(items, folder.ID, true);
List<InventoryFolderBase> folders = GetFoldersFromResponse(items, folderID, true);
if (folders.Count > 0)
return folders[0];

View File

@ -291,9 +291,9 @@ namespace OpenSim.Services.HypergridService
//{
//}
public override InventoryItemBase GetItem(InventoryItemBase item)
public override InventoryItemBase GetItem(UUID principalID, UUID itemID)
{
InventoryItemBase it = base.GetItem(item);
InventoryItemBase it = base.GetItem(principalID, itemID);
if (it != null)
{
UserAccount user = m_Cache.GetUser(it.CreatorId);

View File

@ -383,7 +383,7 @@ namespace OpenSim.Services.HypergridService
// Check the items' current folders
foreach (InventoryItemBase item in items)
{
InventoryItemBase originalItem = base.GetItem(item);
InventoryItemBase originalItem = base.GetItem(item.Owner, item.ID);
if (!IsWithinSuitcaseTree(originalItem.Owner, originalItem.Folder))
{
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveItems: folder {0} (user {1}) is not within Suitcase tree", item.Folder, item.Owner);
@ -401,7 +401,7 @@ namespace OpenSim.Services.HypergridService
public new InventoryItemBase GetItem(InventoryItemBase item)
{
InventoryItemBase it = base.GetItem(item);
InventoryItemBase it = base.GetItem(item.Owner, item.ID);
if (it == null)
{
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to retrieve item {0} ({1}) in folder {2}",
@ -426,9 +426,9 @@ namespace OpenSim.Services.HypergridService
return it;
}
public new InventoryFolderBase GetFolder(InventoryFolderBase folder)
public new InventoryFolderBase GetFolder(UUID principalID, UUID folderID)
{
InventoryFolderBase f = base.GetFolder(folder);
InventoryFolderBase f = base.GetFolder(principalID, folderID);
if (f != null)
{

View File

@ -161,7 +161,7 @@ namespace OpenSim.Services.Interfaces
/// </summary>
/// <param name="item"></param>
/// <returns>null if no item was found, otherwise the found item</returns>
InventoryItemBase GetItem(InventoryItemBase item);
InventoryItemBase GetItem(UUID userID, UUID itemID);
/// <summary>
/// Get multiple items, given by their UUIDs
@ -175,7 +175,7 @@ namespace OpenSim.Services.Interfaces
/// </summary>
/// <param name="folder"></param>
/// <returns></returns>
InventoryFolderBase GetFolder(InventoryFolderBase folder);
InventoryFolderBase GetFolder(UUID userID, UUID folderID);
/// <summary>
/// Does the given user have an inventory structure?

View File

@ -90,8 +90,7 @@ namespace OpenSim.Services.InventoryService.Tests
Assert.That(xis.AddItem(itemToStore), Is.True);
InventoryItemBase itemRetrieved = new InventoryItemBase(itemId);
itemRetrieved = xis.GetItem(itemRetrieved);
InventoryItemBase itemRetrieved = xis.GetItem(UUID.Zero, itemId);
Assert.That(itemRetrieved, Is.Not.Null);
Assert.That(itemRetrieved.CreatorId, Is.EqualTo(creatorId));
@ -139,8 +138,7 @@ namespace OpenSim.Services.InventoryService.Tests
Assert.That(xis.UpdateItem(itemToStore), Is.True);
InventoryItemBase itemRetrieved = new InventoryItemBase(itemId);
itemRetrieved = xis.GetItem(itemRetrieved);
InventoryItemBase itemRetrieved = xis.GetItem(UUID.Zero, itemId);
Assert.That(itemRetrieved, Is.Not.Null);
Assert.That(itemRetrieved.Name, Is.EqualTo(itemName2));
@ -162,7 +160,7 @@ namespace OpenSim.Services.InventoryService.Tests
Assert.That(xis.UpdateItem(itemToStore), Is.True);
itemRetrieved = xis.GetItem(itemRetrieved);
itemRetrieved = xis.GetItem(itemRetrieved.Owner, itemRetrieved.ID);
Assert.That(itemRetrieved, Is.Not.Null);
Assert.That(itemRetrieved.CreatorId, Is.EqualTo(creatorId));
@ -174,4 +172,4 @@ namespace OpenSim.Services.InventoryService.Tests
Assert.That(itemRetrieved.Name, Is.EqualTo(itemName3));
}
}
}
}

View File

@ -315,8 +315,7 @@ namespace OpenSim.Services.InventoryService
inventory.Items.Add(ConvertToOpenSim(i));
}
InventoryFolderBase f = new InventoryFolderBase(folderID, principalID);
f = GetFolder(f);
InventoryFolderBase f = GetFolder(principalID, folderID);
if (f != null)
{
inventory.Version = f.Version;
@ -359,7 +358,7 @@ namespace OpenSim.Services.InventoryService
{
// m_log.DebugFormat("[XINVENTORY]: Add folder {0} type {1} in parent {2}", folder.Name, folder.Type, folder.ParentID);
InventoryFolderBase check = GetFolder(folder);
InventoryFolderBase check = GetFolder(folder.Owner, folder.ID);
if (check != null)
return false;
@ -402,7 +401,7 @@ namespace OpenSim.Services.InventoryService
// m_log.DebugFormat("[XINVENTORY]: Update folder {0} {1} ({2})", folder.Name, folder.Type, folder.ID);
XInventoryFolder xFolder = ConvertFromOpenSim(folder);
InventoryFolderBase check = GetFolder(folder);
InventoryFolderBase check = GetFolder(folder.Owner, folder.ID);
if (check == null)
return AddFolder(folder);
@ -512,7 +511,7 @@ namespace OpenSim.Services.InventoryService
// m_log.InfoFormat(
// "[XINVENTORY SERVICE]: Updating item {0} {1} in folder {2}", item.Name, item.ID, item.Folder);
InventoryItemBase retrievedItem = GetItem(item);
InventoryItemBase retrievedItem = GetItem(item.Owner, item.ID);
if (retrievedItem == null)
{
@ -598,11 +597,11 @@ namespace OpenSim.Services.InventoryService
return true;
}
public virtual InventoryItemBase GetItem(InventoryItemBase item)
public virtual InventoryItemBase GetItem(UUID principalID, UUID itemID)
{
XInventoryItem[] items = m_Database.GetItems(
new string[] { "inventoryID" },
new string[] { item.ID.ToString() });
new string[] { itemID.ToString() });
if (items.Length == 0)
return null;
@ -614,22 +613,17 @@ namespace OpenSim.Services.InventoryService
{
InventoryItemBase[] items = new InventoryItemBase[ids.Length];
int i = 0;
InventoryItemBase item = new InventoryItemBase();
item.Owner = userID;
foreach (UUID id in ids)
{
item.ID = id;
items[i++] = GetItem(item);
}
items[i++] = GetItem(userID, id);
return items;
}
public virtual InventoryFolderBase GetFolder(InventoryFolderBase folder)
public virtual InventoryFolderBase GetFolder(UUID principalID, UUID folderID)
{
XInventoryFolder[] folders = m_Database.GetFolders(
new string[] { "folderID"},
new string[] { folder.ID.ToString() });
new string[] { folderID.ToString() });
if (folders.Length == 0)
return null;

View File

@ -159,8 +159,7 @@ namespace Robust.Tests
XInventoryServicesConnector m_Connector = new XInventoryServicesConnector(DemonServer.Address);
// Prefetch Notecard 1, will be cached from here on
InventoryItemBase item = new InventoryItemBase(new UUID("10000000-0000-0000-0000-000000000001"), m_userID);
item = m_Connector.GetItem(item);
InventoryItemBase item = m_Connector.GetItem(m_userID, new UUID("10000000-0000-0000-0000-000000000001"));
Assert.NotNull(item, "Failed to get Notecard 1");
Assert.AreEqual("Test Notecard 1", item.Name, "Wrong name for Notecard 1");