
Previously, I documented two new functions related to the new Copy Design app in Vault 2015 R2. Now I would like to explore some uses for those functions. The most obvious usage is to build your own Copy Design algorithm that meets your specific needs.
Technically, a custom Copy Design as always possible in Vault, but these new functions make things easier. Most significantly, your app does not have to engage in any CAD-specific APIs. Assuming, of course, the CAD file is one of the types that Vault recognizes.
I said that the new functions make a custom Copy Design easier, but it’s still not something I would describe as simple. You still have to manage things like file relationships, and file naming.
For each file you want to copy, you basically have to do three steps:
Step 1: Get a download ticket.
DocumentService.GetDownloadTicketsByFileIds(…)
You are not actually downloading anything, but let’s not worry about that for the moment. The important thing is that we are swapping the File Id for ticket, and the ticket is required in step 2.
Step 2: Copy the binary file contents.
FilestoreService.CopyFile(…)
This step will do a server-side copy of the file bits. Nothing is actually download or uploaded from your computer. The operation just does a copy of the binary data. The meta data still has not been copied yet, so it doesn’t really exist in Vault. It has no file name, no folder location, no create time, and so on. It’s basically a set of data floating in limbo.
Step 3: Add the file to Vault
DocumentService.AddUploadedFile(…)
This step is where you tell the Vault database about the file. It’s here that you set the new name, new location, and new relationships for the copied file. Again, the function name isn’t technically correct. We didn’t upload the file, but this function doesn’t care. It just needs an uploadTicket so that it can cement the binary data to the meta data.
Another key aspect of the copy is that the internal file relationships have not yet been modified. Step 2 is a perfect copy, so it still has pointers to old file names. Vault is designed so that file relationships are updated when the file is downloaded. This is another reason you want to use AcquireFiles when downloading. It fixes up the references for your local files.
The new copy design app works the same way. It relies on download to fix up and broken references. Those references will technically stay broken until an engineer checks out the files, makes changes and checks the files back in.

Leave a Reply