public class GetAttributeValueFragment extends com.sodius.mdw.internal.metamodel.doors.io.commands.GetAttributeFragmentImpl implements ShareModuleFragment
This fragment is intended to be combined into an EditModuleCommand
instance.
Though "URL"
is not an object attribute (in the sense there is no corresponding attribute definition in DOORS), an object URL can be
retrieved using the fragment, as this is a frequent need. Below is a snippet illustrating how to use this fragment (see CommandRunner
for a full snippet):
ModuleRef module = ModuleRef.qualifiedName("/MyFolder/MyModule"); EditModuleCommand command = new EditModuleCommand(module, TerminationMode.SAVE_AND_CLOSE); CreateObjectFragment creationFragment = new CreateObjectFragment(); command.add(creationFragment); ObjectRef object = ObjectRef.created(creationFragment); GetAttributeValueFragment fragment = new GetAttributeValueFragment(object, "URL"); command.add(fragment); myCommandRunner.run(command); String url = fragment.getResult(); // gets the URL of the object created in the same command
This class is not intended to be subclassed by clients but may be instantiated.
CommandRunner
,
EditModuleCommand
Constructor and Description |
---|
GetAttributeValueFragment(LinkRef link,
String attributeName)
Instantiates fragment to retrieve the attribute value of the specified link.
|
GetAttributeValueFragment(ObjectRef object,
String attributeName)
Instantiates fragment to retrieve the attribute value of the specified object.
|
GetAttributeValueFragment(String attributeName)
Instantiates fragment to retrieve the attribute value of the edited module.
|
Modifier and Type | Method and Description |
---|---|
String |
getResult()
Returns the attribute value, once the fragment has been executed.
|
public GetAttributeValueFragment(String attributeName)
attributeName
- the name of the module attribute for which the value must be retrieved.public GetAttributeValueFragment(ObjectRef object, String attributeName)
object
- a reference to the object.attributeName
- the name of the object attribute for which the value must be retrieved.public GetAttributeValueFragment(LinkRef link, String attributeName)
link
- a reference to the link.attributeName
- the name of the link attribute for which the value must be retrieved.public final String getResult()
getResult
in class com.sodius.mdw.internal.metamodel.doors.io.commands.GetAttributeFragmentImpl
null
if the fragment hasn't been executed.