处理关系范围

当提供了新版本的资产时,可自动调整资产关系。可以将 RelationshipRange 放置到“资产至资产”关系上。该范围指定可接受的相关资产的最低和最高版本。还存在一个标志,用来指示此关系是否应该指向此范围中的所有资产或仅指向该范围中已核准的最高版本资产。

                //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);

反馈