public abstract class ExternalLinkRef extends Object
Creating a reference instance does not execute anything on the DOORS client, it is just a way to get a pointer to an element on which commands are executed. The reference is only resolved to the actual element by the time the command is executed and may result in an element not being found.
Referencing an external link is notably required to delete it with a DeleteExternalLinkFragment
fragment.
There is no unique identifier associated to an external link. Therefore the external link is referenced here using a combination of link direction and link path, whose pair can be reasonably expected to be unique.
Below is a snippet illustrating how to use an external link reference (see CommandRunner
for a full snippet):
ObjectRef object = ObjectRef.absoluteNumber(4); ExternalLinkDirectionKind direction = ExternalLinkDirectionKind.OUTWARD_LITERAL; String linkPath = "http://www.sodius.com"; ExternalLinkRef link = ExternalLinkRef.linkPath(object, "direction, linkPath); ModuleRef module = ModuleRef.qualifiedName("/MyFolder/MyModule"); EditModuleCommand command = new EditModuleCommand(module, TerminationMode.SAVE_AND_CLOSE); command.add(new DeleteExternalLinkFragment(link)); myCommandRunner.run(command);
CommandRunner
,
DeleteExternalLinkFragment
,
UpdateExternalLinkFragment
Constructor and Description |
---|
ExternalLinkRef() |
Modifier and Type | Method and Description |
---|---|
static ExternalLinkRef |
linkPath(ObjectRef object,
ExternalLinkDirectionKind direction,
String linkPath)
Returns a reference to an external link based on its owner, link direction and link path.
|
public static ExternalLinkRef linkPath(ObjectRef object, ExternalLinkDirectionKind direction, String linkPath)
object
- a reference to the owner of the external link.direction
- the link direction.linkPath
- the link path.