Unknown macro: {next_previous_links}
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »



Creating a relationship between two resources

A relationship (for example, dependency) can be created between two resources using the following line of code:

registry.addAssociation("c1/c2/r3", "c1/c2/r4", "depends on"); // in this case r3 depends on r4

Removing a relationship between two resources

A relationship can be removed between two resources using the following line of code:

registry.removeAssociation("c1/c2/r3", "c1/c2/r4", "depends on"); // in this case r3 depends on r4

Retrieving relationships from a resource

Relationships of a resource between two resources can be retrieved using the following line of code:

registry.addAssociation("c1/c2/r3", "c1/c2/r4", "depends on"); // in this case r3 depends on r4
 
Association all[] = registry.getAllAssociations("c1/c2/r3"); // all associations of r3
String sourcePath1 = all[0].getSourcePath(); // equals to "c1/c2/r3"

Association dependsAll[] = registry.getAssociations("c1/c2/r3", "depends on"); // "depends on" associations of r3
String sourcePath2 = dependsAll[0].getSourcePath(); // equals to "c1/c2/r3"
 
Association r4Assoc[] = registry.getAssociations("c1/c2/r4", "depends on"); // "depends on" associations of r3
boolean hasAssociations = (r4Assoc.length == 0); // this returns true 

  • No labels