関係するアセットのアセットへの追加

以下を参照してください。

アセット間の関係を追加するには、RAMAsset.addRelatedAsset(Asset, RelationshipType) を使用します。

                //Fetch Existing asset
                RAMAsset existingAsset = session.getAsset("{5FAC1496-4860-B417-340D-ABE9A58B3C7D}");

                // Create a 3nd asset
                RAMAsset thirdAsset = session.createAsset("1.0");
                thirdAsset.setName("Third Related Asset");
                thirdAsset.setCommunity(session.getCommunity("Rational Asset Manager Development"));
                thirdAsset.setAssetType(session.getAssetType("Documentation"));
                thirdAsset.setShortDescription("Third asset is a relationship test");

                //Relate the 1st asset to the second asset
                existingAsset.addRelatedAsset(newAsset,  session.getRelationshipType("Tutorial"));
                
                // Relate the 2nd asset to the first asset
                newAsset.addRelatedAsset(existingAsset, session.getRelationshipType("Implementation"));

                // Relate the 2nd asset to the 3rd asset
                newAsset.addRelatedAsset(thirdAsset, session.getRelationshipType("Dependency"));
                
                session.queueAssetForPut(thirdAsset);
                session.queueAssetForPut(newAsset);
                session.queueAssetForPut(existingAsset);
                
                session.putAssets(new NullProgressMonitor());

フィードバック