diff options
author | Justin Clarke Casey | 2008-01-06 01:56:29 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-01-06 01:56:29 +0000 |
commit | 679923ec871d98e5aa514734b2e23f9a00c58433 (patch) | |
tree | c2591d0a336339dd7ce5ca26d39abde68d0b81be /OpenSim | |
parent | Prim inventory phase 4. Properly recover the prim folder ID from storage. S... (diff) | |
download | opensim-SC_OLD-679923ec871d98e5aa514734b2e23f9a00c58433.zip opensim-SC_OLD-679923ec871d98e5aa514734b2e23f9a00c58433.tar.gz opensim-SC_OLD-679923ec871d98e5aa514734b2e23f9a00c58433.tar.bz2 opensim-SC_OLD-679923ec871d98e5aa514734b2e23f9a00c58433.tar.xz |
Factor out TaskInventoryItem
Diffstat (limited to '')
4 files changed, 116 insertions, 83 deletions
diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs new file mode 100644 index 0000000..e1eac79 --- /dev/null +++ b/OpenSim/Framework/TaskInventoryItem.cs | |||
@@ -0,0 +1,101 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | |||
29 | using libsecondlife; | ||
30 | |||
31 | namespace OpenSim.Framework | ||
32 | { | ||
33 | public class TaskInventoryItem | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// XXX This should really be factored out into some constants class. | ||
37 | /// </summary> | ||
38 | private const uint FULL_MASK_PERMISSIONS_GENERAL = 2147483647; | ||
39 | |||
40 | /// <summary> | ||
41 | /// Inventory types | ||
42 | /// </summary> | ||
43 | public static string[] InvTypes = new string[] | ||
44 | { | ||
45 | "texture", | ||
46 | "sound", | ||
47 | "", | ||
48 | "", | ||
49 | "", | ||
50 | "", | ||
51 | "", | ||
52 | "", | ||
53 | "", | ||
54 | "", | ||
55 | "lsl_text", | ||
56 | "" | ||
57 | }; | ||
58 | |||
59 | /// <summary> | ||
60 | /// Asset types | ||
61 | /// </summary> | ||
62 | public static string[] Types = new string[] | ||
63 | { | ||
64 | "texture", | ||
65 | "sound", | ||
66 | "", | ||
67 | "", | ||
68 | "", | ||
69 | "", | ||
70 | "", | ||
71 | "", | ||
72 | "", | ||
73 | "", | ||
74 | "lsltext", | ||
75 | "" | ||
76 | }; | ||
77 | |||
78 | public LLUUID item_id = LLUUID.Zero; | ||
79 | public LLUUID parent_id = LLUUID.Zero; //parent folder id | ||
80 | |||
81 | public uint base_mask = FULL_MASK_PERMISSIONS_GENERAL; | ||
82 | public uint owner_mask = FULL_MASK_PERMISSIONS_GENERAL; | ||
83 | public uint group_mask = FULL_MASK_PERMISSIONS_GENERAL; | ||
84 | public uint everyone_mask = FULL_MASK_PERMISSIONS_GENERAL; | ||
85 | public uint next_owner_mask = FULL_MASK_PERMISSIONS_GENERAL; | ||
86 | public LLUUID creator_id = LLUUID.Zero; | ||
87 | public LLUUID owner_id = LLUUID.Zero; | ||
88 | public LLUUID last_owner_id = LLUUID.Zero; | ||
89 | public LLUUID group_id = LLUUID.Zero; | ||
90 | |||
91 | public LLUUID asset_id = LLUUID.Zero; | ||
92 | public string type = ""; | ||
93 | public string inv_type = ""; | ||
94 | public uint flags = 0; | ||
95 | public string name = ""; | ||
96 | public string desc = ""; | ||
97 | public uint creation_date = 0; | ||
98 | |||
99 | public LLUUID ParentPartID = LLUUID.Zero; | ||
100 | } | ||
101 | } | ||
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 4bbc2ed..a9b3fe9 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -1178,15 +1178,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
1178 | SceneObjectPart part = GetChildPart(localID); | 1178 | SceneObjectPart part = GetChildPart(localID); |
1179 | if (part != null) | 1179 | if (part != null) |
1180 | { | 1180 | { |
1181 | SceneObjectPart.TaskInventoryItem taskItem = new SceneObjectPart.TaskInventoryItem(); | 1181 | TaskInventoryItem taskItem = new TaskInventoryItem(); |
1182 | taskItem.item_id = item.inventoryID; | 1182 | taskItem.item_id = item.inventoryID; |
1183 | taskItem.asset_id = item.assetID; | 1183 | taskItem.asset_id = item.assetID; |
1184 | taskItem.name = item.inventoryName; | 1184 | taskItem.name = item.inventoryName; |
1185 | taskItem.desc = item.inventoryDescription; | 1185 | taskItem.desc = item.inventoryDescription; |
1186 | taskItem.owner_id = item.avatarID; | 1186 | taskItem.owner_id = item.avatarID; |
1187 | taskItem.creator_id = item.creatorsID; | 1187 | taskItem.creator_id = item.creatorsID; |
1188 | taskItem.type = SceneObjectPart.TaskInventoryItem.Types[item.assetType]; | 1188 | taskItem.type = TaskInventoryItem.Types[item.assetType]; |
1189 | taskItem.inv_type = SceneObjectPart.TaskInventoryItem.Types[item.invType]; | 1189 | taskItem.inv_type = TaskInventoryItem.Types[item.invType]; |
1190 | part.AddInventoryItem(taskItem); | 1190 | part.AddInventoryItem(taskItem); |
1191 | return true; | 1191 | return true; |
1192 | } | 1192 | } |
@@ -1200,15 +1200,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
1200 | SceneObjectPart part = GetChildPart(localID); | 1200 | SceneObjectPart part = GetChildPart(localID); |
1201 | if (part != null) | 1201 | if (part != null) |
1202 | { | 1202 | { |
1203 | SceneObjectPart.TaskInventoryItem taskItem = new SceneObjectPart.TaskInventoryItem(); | 1203 | TaskInventoryItem taskItem = new TaskInventoryItem(); |
1204 | taskItem.item_id = copyItemID; | 1204 | taskItem.item_id = copyItemID; |
1205 | taskItem.asset_id = item.assetID; | 1205 | taskItem.asset_id = item.assetID; |
1206 | taskItem.name = item.inventoryName; | 1206 | taskItem.name = item.inventoryName; |
1207 | taskItem.desc = item.inventoryDescription; | 1207 | taskItem.desc = item.inventoryDescription; |
1208 | taskItem.owner_id = new LLUUID(item.avatarID.ToString()); | 1208 | taskItem.owner_id = new LLUUID(item.avatarID.ToString()); |
1209 | taskItem.creator_id = new LLUUID(item.creatorsID.ToString()); | 1209 | taskItem.creator_id = new LLUUID(item.creatorsID.ToString()); |
1210 | taskItem.type = SceneObjectPart.TaskInventoryItem.Types[item.assetType]; | 1210 | taskItem.type = TaskInventoryItem.Types[item.assetType]; |
1211 | taskItem.inv_type = SceneObjectPart.TaskInventoryItem.InvTypes[item.invType]; | 1211 | taskItem.inv_type = TaskInventoryItem.InvTypes[item.invType]; |
1212 | part.AddInventoryItem(taskItem); | 1212 | part.AddInventoryItem(taskItem); |
1213 | return true; | 1213 | return true; |
1214 | } | 1214 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 2ddcf7b..b07b43c 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -1736,73 +1736,5 @@ namespace OpenSim.Region.Environment.Scenes | |||
1736 | { | 1736 | { |
1737 | } | 1737 | } |
1738 | } | 1738 | } |
1739 | |||
1740 | public class TaskInventoryItem | ||
1741 | { | ||
1742 | /// <summary> | ||
1743 | /// Inventory types | ||
1744 | /// </summary> | ||
1745 | public static string[] InvTypes = new string[] | ||
1746 | { | ||
1747 | "texture", | ||
1748 | "sound", | ||
1749 | "", | ||
1750 | "", | ||
1751 | "", | ||
1752 | "", | ||
1753 | "", | ||
1754 | "", | ||
1755 | "", | ||
1756 | "", | ||
1757 | "lsl_text", | ||
1758 | "" | ||
1759 | }; | ||
1760 | |||
1761 | /// <summary> | ||
1762 | /// Asset types | ||
1763 | /// </summary> | ||
1764 | public static string[] Types = new string[] | ||
1765 | { | ||
1766 | "texture", | ||
1767 | "sound", | ||
1768 | "", | ||
1769 | "", | ||
1770 | "", | ||
1771 | "", | ||
1772 | "", | ||
1773 | "", | ||
1774 | "", | ||
1775 | "", | ||
1776 | "lsltext", | ||
1777 | "" | ||
1778 | }; | ||
1779 | |||
1780 | public LLUUID item_id = LLUUID.Zero; | ||
1781 | public LLUUID parent_id = LLUUID.Zero; //parent folder id | ||
1782 | |||
1783 | public uint base_mask = FULL_MASK_PERMISSIONS_GENERAL; | ||
1784 | public uint owner_mask = FULL_MASK_PERMISSIONS_GENERAL; | ||
1785 | public uint group_mask = FULL_MASK_PERMISSIONS_GENERAL; | ||
1786 | public uint everyone_mask = FULL_MASK_PERMISSIONS_GENERAL; | ||
1787 | public uint next_owner_mask = FULL_MASK_PERMISSIONS_GENERAL; | ||
1788 | public LLUUID creator_id = LLUUID.Zero; | ||
1789 | public LLUUID owner_id = LLUUID.Zero; | ||
1790 | public LLUUID last_owner_id = LLUUID.Zero; | ||
1791 | public LLUUID group_id = LLUUID.Zero; | ||
1792 | |||
1793 | public LLUUID asset_id = LLUUID.Zero; | ||
1794 | public string type = ""; | ||
1795 | public string inv_type = ""; | ||
1796 | public uint flags = 0; | ||
1797 | public string name = ""; | ||
1798 | public string desc = ""; | ||
1799 | public uint creation_date = 0; | ||
1800 | |||
1801 | public LLUUID ParentPartID = LLUUID.Zero; | ||
1802 | |||
1803 | public TaskInventoryItem() | ||
1804 | { | ||
1805 | } | ||
1806 | } | ||
1807 | } | 1739 | } |
1808 | } | 1740 | } |
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs index 8bad730..b99b819 100644 --- a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs +++ b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs | |||
@@ -340,11 +340,11 @@ namespace OpenSim.DataStore.MonoSqlite | |||
340 | String sql = String.Format("primID = '{0}'", prim.UUID.ToString()); | 340 | String sql = String.Format("primID = '{0}'", prim.UUID.ToString()); |
341 | DataRow[] dbItemRows = dbItems.Select(sql); | 341 | DataRow[] dbItemRows = dbItems.Select(sql); |
342 | 342 | ||
343 | IList<SceneObjectPart.TaskInventoryItem> inventory = new List<SceneObjectPart.TaskInventoryItem>(); | 343 | IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>(); |
344 | 344 | ||
345 | foreach (DataRow row in dbItemRows) | 345 | foreach (DataRow row in dbItemRows) |
346 | { | 346 | { |
347 | SceneObjectPart.TaskInventoryItem item = buildItem(row); | 347 | TaskInventoryItem item = buildItem(row); |
348 | inventory.Add(item); | 348 | inventory.Add(item); |
349 | 349 | ||
350 | MainLog.Instance.Verbose("DATASTORE", "Restored item {0}, {1}", item.name, item.item_id); | 350 | MainLog.Instance.Verbose("DATASTORE", "Restored item {0}, {1}", item.name, item.item_id); |
@@ -897,9 +897,9 @@ namespace OpenSim.DataStore.MonoSqlite | |||
897 | /// </summary> | 897 | /// </summary> |
898 | /// <param name="row"></param> | 898 | /// <param name="row"></param> |
899 | /// <returns></returns> | 899 | /// <returns></returns> |
900 | private SceneObjectPart.TaskInventoryItem buildItem(DataRow row) | 900 | private TaskInventoryItem buildItem(DataRow row) |
901 | { | 901 | { |
902 | SceneObjectPart.TaskInventoryItem taskItem = new SceneObjectPart.TaskInventoryItem(); | 902 | TaskInventoryItem taskItem = new TaskInventoryItem(); |
903 | 903 | ||
904 | taskItem.item_id = new LLUUID((String)row["itemID"]); | 904 | taskItem.item_id = new LLUUID((String)row["itemID"]); |
905 | taskItem.ParentPartID = new LLUUID((String)row["primID"]); | 905 | taskItem.ParentPartID = new LLUUID((String)row["primID"]); |
@@ -1069,7 +1069,7 @@ namespace OpenSim.DataStore.MonoSqlite | |||
1069 | row["SitTargetOrientZ"] = sitTargetOrient.Z; | 1069 | row["SitTargetOrientZ"] = sitTargetOrient.Z; |
1070 | } | 1070 | } |
1071 | 1071 | ||
1072 | private void fillItemRow(DataRow row, SceneObjectPart.TaskInventoryItem taskItem) | 1072 | private void fillItemRow(DataRow row, TaskInventoryItem taskItem) |
1073 | { | 1073 | { |
1074 | row["itemID"] = taskItem.item_id; | 1074 | row["itemID"] = taskItem.item_id; |
1075 | row["primID"] = taskItem.ParentPartID; | 1075 | row["primID"] = taskItem.ParentPartID; |
@@ -1271,7 +1271,7 @@ namespace OpenSim.DataStore.MonoSqlite | |||
1271 | /// <param name="primID"></param> | 1271 | /// <param name="primID"></param> |
1272 | /// <param name="items"></param> | 1272 | /// <param name="items"></param> |
1273 | /// <returns></returns> | 1273 | /// <returns></returns> |
1274 | private void addPrimInventory(LLUUID primID, IDictionary<LLUUID, SceneObjectPart.TaskInventoryItem> items) | 1274 | private void addPrimInventory(LLUUID primID, IDictionary<LLUUID, TaskInventoryItem> items) |
1275 | { | 1275 | { |
1276 | MainLog.Instance.Verbose("DATASTORE", "Entered addPrimInventory with prim ID {0}", primID); | 1276 | MainLog.Instance.Verbose("DATASTORE", "Entered addPrimInventory with prim ID {0}", primID); |
1277 | 1277 | ||
@@ -1283,8 +1283,8 @@ namespace OpenSim.DataStore.MonoSqlite | |||
1283 | 1283 | ||
1284 | // Build structures for manipulation purposes | 1284 | // Build structures for manipulation purposes |
1285 | IDictionary<String, DataRow> dbItemsToRemove = new Dictionary<String, DataRow>(); | 1285 | IDictionary<String, DataRow> dbItemsToRemove = new Dictionary<String, DataRow>(); |
1286 | ICollection<SceneObjectPart.TaskInventoryItem> itemsToAdd | 1286 | ICollection<TaskInventoryItem> itemsToAdd |
1287 | = new List<SceneObjectPart.TaskInventoryItem>(); | 1287 | = new List<TaskInventoryItem>(); |
1288 | 1288 | ||
1289 | foreach (DataRow row in dbItemRows) | 1289 | foreach (DataRow row in dbItemRows) |
1290 | { | 1290 | { |
@@ -1319,7 +1319,7 @@ namespace OpenSim.DataStore.MonoSqlite | |||
1319 | } | 1319 | } |
1320 | 1320 | ||
1321 | // Insert items not already present | 1321 | // Insert items not already present |
1322 | foreach (SceneObjectPart.TaskInventoryItem newItem in itemsToAdd) | 1322 | foreach (TaskInventoryItem newItem in itemsToAdd) |
1323 | { | 1323 | { |
1324 | MainLog.Instance.Verbose( | 1324 | MainLog.Instance.Verbose( |
1325 | "DATASTORE", | 1325 | "DATASTORE", |