File Associations – Part 2


Welcome to part 2 in my 2 part series on File Associations.  In
part 1, I went over the concepts in base Vault.  In this part,
I will go over concepts added by Vault Workgroup.

New concepts:
Again we have 2 concepts that are simple on their own, but become
complex when added to everything else.

First we have Revisions, which is a way to give meaning to a
set of versions.  For purposes of this posting, I’ll be using
alpha characters for revisions and numeric characters for versions.

The next concept is Release States, which is a way of saying
that a file is completed if it is in a certain lifecycle state. 
At the API level, there is a boolean property on LfCycState which tells
if the state is a release state or not.  A lifecycle definition
usually has only one release state, but it is possible to have 0 or
multiple release states. For the purposes of this posting, release
states will have a darker color than the other states.

One final note:  The Vault clients are set up to update files
associations only with the physical file changes.  If it’s just a
change to the Vault data (for example, changing lifecycle state) then
the new file version points to the same files that the old version did.

Example:
Let’s go over an example.  Here we have 2 files, a parent and a
child.  Both files have gone through revision and lifecycle
changes.  The arrows represent direct associations between the
file versions.

The Vault API provides 5 ways to traverse this data.  In all these
cases, we are starting at the Parent and asking for the entire
dependency tree.

  1. Get Latest – no release bias

    This is useful for CAD engineers who want the latest version of all the
    files so that they can work on them.
    At the API level, you call GetLatestFileAssociationsByMasterIds in
    the Document Service and pass in ‘false’ for the releasedBiased parameter.

  2. Get Latest – release bias

    This is useful for people outside the CAD department who are not
    interested in the ‘work in progress’ data.  They just want to see
    the latest completed product.
    At the API level, you call GetLatestFileAssociationsByMasterIds in
    the Document Service and pass in ‘true’ for the releasedBiased parameter.

  3. Snapshot in Time by Version

    This is useful in cases where you don’t care about revisions.  The
    result is what you would get in base Vault, you only get the direct
    relationships between file versions.
    At the API level, you call GetFileAssociationsByIds in the
    Document Service.

  4. Snapshot in Time by Revision – no release bias

    This gives you the latest version within a revision, regardless of the
    lifecycle state.
    At the API level, you call GetRevisionFileAssociationsByIds in
    the Document Service and pass in ‘false’ for the releasedBiased parameter.

  5. Snapshot in Time by Revision – release bias

    This gives you the latest release version within a revision.  If
    no release version exists, the latest one in the revision is returned.
    At the API level, you call GetRevisionFileAssociationsByIds in
    the Document Service and pass in ‘true’ for the releasedBiased parameter.

Putting it All Together:
You should be properly confused by now.  However there are a rule that will simplify things. 

Rule:  When dealing
with revisions, think in terms of revisions.  Don’t think in terms
of versions.

Behind the scenes, revisions only care about 2 versions:  the
latest version in the revision and the latest release version in the
revision.  Many times these 2 are the same thing.  When
thinking in terms of revisions, you need to forget about all other
versions. 

So let’s redo the dependency tree for 4 and 5, this time viewing
things in terms of revisions.

  1. Snapshot in Time by Revision – no release bias

  2. Snapshot in Time by Revision – release bias

There, much better.


Comments

11 responses to “File Associations – Part 2”

  1. Steve Walton Avatar
    Steve Walton

    Thanks for the review of this part of vault.
    We are just starting to plan our move into release states and revision control with Vault 2010 Collaboration. How do we apply this information to the 40 GB of existing vault data?

  2. This is one of those questions that can have hundreds of answers depending on your requirements. My advice is to talk to your re-seller.

  3. Steve Walton Avatar
    Steve Walton

    I guess what I was looking for was some way to apply various lifecycle states to the 1000s of existing files in my database. For example, we last produced an assembly at version 68, rev M. It is now at version 103. How do I apply the released state to version 68? It seems that these lifecycle states were designed assuming I had an empty vault and was starting from scratch. Is that true?

  4. The real issue here is that you can’t edit historical Vault data. That’s kind of the point of Vault. Version 68 is ‘vaulted’, locked down, nobody can change it.
    You do have options however. For example, you can download version 68, check it in as version 104 and set the lifecycle and revision that way.
    Again, your reseller should be able to help you out here.

  5. Steve Walton Avatar
    Steve Walton

    Quoting
    “You do have options however. For example, you can download version 68, check it in as version 104 and set the lifecycle and revision that way.”
    That is not exactly true.
    I can get version 68 of an ipt from the vault. I can’t get version 68 of an iam with all of its children at their respective versions.
    I can do this is baseline Vault 2010.
    I am trying to find the recommended procedure get my information back out of vault. I am working with my reseller to resolve this issue.

  6. As I mentioned in the article, there are many dependency trees for a given file. Vault Collaboration has a revision-based view of things (examples 4 and 5). Base Vault has a version-based view of things (example 3).
    It looks like you want a version-based tree. Those links are still there, but you may need to write a custom program to get that information. As I described in example 3, you can pass version 68 of your file into GetFileAssociationsByIds and get all the child versions.

  7. Steve Walton Avatar
    Steve Walton

    I was hoping to avoid learning how to program ;)
    Thanks for the help understanding the as-designed limitations of Vault 2010 and existing data.

  8. I’m trying to get a list of parent associations using GetFileAssociationsByIds but my code is erroring out. Can you please share some code of how to do this?

  9. I think that the VaultFileBrowser sample in the SDK has an example of GetFileAssociationsByIds to get the children. Getting the parents works the same way but you fill out different parameters in the function.
    What error code are you getting?

  10. Thanks Doug, that helped. I did figure out yesterday that a nulls are the cause of my error (no associations for a particular file). The code below (from VaultFileBrowser) appears to be complete error trapping but I have a few questions which will help me (& others) understand the structure better. How can associationArrays.Length have a value of 0? How can associationArrays(0).FileAssocs.Length have a value of 0?
    If (Not associationArrays Is Nothing AndAlso associationArrays.Length > 0 AndAlso Not associationArrays(0).FileAssocs Is Nothing AndAlso associationArrays(0).FileAssocs.Length > 0) Then

  11. .NET languages allow a 0 length array. So I check for that case in the sample code. It might be that the Vault Server never returns a 0 length array. I check for that case anyway just to be safe.

Leave a Reply to Doug RedmondCancel reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading