public abstract class DiscussionRef extends Object
DOORS compatibility: Discussions are available starting with DOORS 9.0.
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 a discussion is notably required when a comment needs to be added with a CreateCommentFragment
fragment.
There is no unique identifier associated to a discussion. Therefore the discussion is referenced here using a combination of creator and summary, whose pair can be reasonably expected to be unique.
Below is a snippet illustrating how to use a discussion reference (see CommandRunner
for a full snippet):
DiscussionRef discussion = DiscussionRef.summaryAndCreator("My Existing Discussion", "myUser"); String text = "A new comment added to an existing discussion"; ModuleRef module = ModuleRef.qualifiedName("/MyFolder/MyModule"); EditDiscussionCommand command = new EditDiscussionCommand(module); command.add(new CreateCommentFragment(discussion, text)); myCommandRunner.run(command);
CommandRunner
,
CreateCommentFragment
,
CloseDiscussionFragment
,
ReopenDiscussionFragment
,
DeleteDiscussionFragment
Constructor and Description |
---|
DiscussionRef() |
Modifier and Type | Method and Description |
---|---|
static DiscussionRef |
created(CreateDiscussionFragment fragment)
Returns a reference to a discussion that is going to be created
by the execution of the specified fragment.
|
static DiscussionRef |
summary(ObjectRef object,
String summary)
Returns a reference to an object discussion based on its summary.
|
static DiscussionRef |
summary(String summary)
Returns a reference to a formal module discussion based on its summary.
|
static DiscussionRef |
summaryAndCreator(ObjectRef object,
String summary,
String creator)
Returns a reference to an object discussion based on its summary and creator.
|
static DiscussionRef |
summaryAndCreator(String summary,
String creator)
Returns a reference to a formal module discussion based on its summary and creator.
|
public static DiscussionRef summary(String summary)
summaryAndCreator
method,
to minimize the risk of not identifying the right discussion.summary
- the summary that identifies the formal module discussion.summaryAndCreator(String, String)
public static DiscussionRef summaryAndCreator(String summary, String creator)
summary
- the summary that identifies the formal module discussion.creator
- the name of the creator of the discussion.public static DiscussionRef summary(ObjectRef object, String summary)
summaryAndCreator
method,
to minimize the risk of not identifying the right discussion.object
- the object owning the discussionsummary
- the summary that identifies the object discussion.summaryAndCreator(ObjectRef, String, String)
public static DiscussionRef summaryAndCreator(ObjectRef object, String summary, String creator)
object
- the object owning the discussionsummary
- the summary that identifies the object discussion.creator
- the name of the creator of the discussion.public static DiscussionRef created(CreateDiscussionFragment fragment)
DiscussionRef
instance
returned by this method are executed in the same command
as the one in which the specified fragment belongs to.fragment
- the fragment that creates a discussion.