Asset relationships can automatically be adjusted as new versions of assets become available. A RelationshipRange can be placed on an asset to asset relationship. The range specifies the lowest and highest versions of the related asset that are acceptable. There is also a flag to indicate if this relationship should point to all assets in this range, or only to the asset with the highest approved version in the range.
//Create a relationship range
RelationshipRange relationshipRange = new RelationshipRange();
relationshipRange.setHighestVersion("2.0");
relationshipRange.setHighestVersionType(RelationshipRange.LESS_THAN);
relationshipRange.setLowestVersion("1.5");
relationshipRange.setLowestVersionType(RelationshipRange.GREATER_THAN_OR_EQUAL_TO);
//Only relate to the highest version asset in the range
relationshipRange.setType(RelationshipRange.HIGHEST_VERSION);
//Creating/updating an asset relationship that has a range
RAMRelationship[] relationships = asset.setRelationshipRange(existingAsset, newRelationshipType, relationshipRange);
//Fetch relationship range
relationshipRange = relationships[0].getRelationshipRange();
//Remove relationship range
asset.removeRelationshipRange(existingAsset, newRelationshipType);