Post your questions regarding using the Vault and Fortress API in your programs.
Moderator: SourceGear
-
TeamWiSE
- Posts: 31
- Joined: Thu Aug 10, 2006 2:40 am
- Location: Mönchengladbach, Germany
-
Contact:
Post
by TeamWiSE » Wed Nov 02, 2022 7:54 am
Am I correct in assuming that the
Properties Member of the
VaultDeletedObject class has the following meaning:
- 1 = folder
- 2 = file
- 5 = branch
- 6 = share
Is this the complete list? Or are other values possible/known?
To put this question in context: I am building a small utility that is going to obliterate deleted branches overnight. Such an operation takes too long to execute during work-hours (the DB is fully locked during the obliterate transaction) and the admin console needs an interactive confirm after a long waiting period (but requires the OK to obliterate within a short time after listing the items to obliterate), making this way to obliterate not a viable option either. So my utility would collect all deleted items and issue a
VaultRequestObliterate for all
VaultDeletedObject-instances that have a
Properties Member with the value 5.
-
jclausius
- Posts: 3702
- Joined: Tue Dec 16, 2003 1:17 pm
- Location: SourceGear
-
Contact:
Post
by jclausius » Thu Nov 03, 2022 8:11 am
No. The properties are a bitmap of various properties, but the main 2 properties are for file or folder. So, determine this, you can do a bitwise AND using VaultLib.VaultFSObjectDefine entries :
VaultDeletedObject delObject = ...;
if ( (((ushort)delObject.Properties) & VaultLib.VaultFSObjectDefine.TypeFolder) == VaultLib.VaultFSObjectDefine.TypeFolder)
{
// this is a folder
}
if ( (((ushort)delObject.Properties) & VaultLib.VaultFSObjectDefine.TypeFile) == VaultLib.VaultFSObjectDefine.TypeFile)
{
// this is a file
}
----
Since VaultDeletedObject's properties is from the database, there are other bitmap masks (branch [4], snapshot [8], and virtual [16]), but I don't believe those would be of any value.
Jeff Clausius
SourceGear
-
TeamWiSE
- Posts: 31
- Joined: Thu Aug 10, 2006 2:40 am
- Location: Mönchengladbach, Germany
-
Contact:
Post
by TeamWiSE » Thu Nov 03, 2022 8:56 am
The branch bit (0x04) is exactly the one, that is of importance to me, since we want to automate the obliteration of old branches. Are these bitmasks (branch [4], snapshot [8], and virtual [16]) symbolically defined in VaultLib, e.g. like VaultLib.VaultFSObjectDefine.TypeFolder? Or should I just use the corresponding values?
-
jclausius
- Posts: 3702
- Joined: Tue Dec 16, 2003 1:17 pm
- Location: SourceGear
-
Contact:
Post
by jclausius » Fri Nov 04, 2022 12:42 pm
They are defined in server code (as the server works directly with the database), but not in the ClientAPI.
Normally one would look at the properties of a file/folder (VaultClientFolder f = ...; if (f.Branched) { ... };) or go through ClientInstance.TreeCache to check on Share information. However, your situation is unique in that the item is already deleted and represented by the VaultDeletedObject class, and the API doesn't expose any literals / enums for those properties since they're not used in any of the clients.
You can create your own int constants for that value if you would like. Since this is stored as a database property it will never change.
Jeff Clausius
SourceGear
-
TeamWiSE
- Posts: 31
- Joined: Thu Aug 10, 2006 2:40 am
- Location: Mönchengladbach, Germany
-
Contact:
Post
by TeamWiSE » Sat Nov 05, 2022 7:16 am
Thanks for the support, I will do just that.