file Creating requirements and dictionaries

4 years 10 months ago #3296 by ua138
How can I create requirements and dictionaries? It seems that they are not created in the same way as the rest of uml elements. Is there any documentation related to that?

I have tried to create dictionaries in this way:
List<Dictionary> rootDictionary = session.getRequirementModel().getRootDictionary();
Dictionary createdElement = session.getRequirementModel()
						.createDictionary("Dictionary", (Dictionary)element);
				createdElement.addStereotype(IRCasePeerModule.MODULE_NAME, "DictionaryStereotype");
for(Dictionary d : rootDictionary){
	createdElement.setOwnerDictionary(d);
}

And the requirement as:
	Requirement createdElement = session.getRequirementModel().createRequirement();
    	RequirementContainer reqContainer = session.getRequirementModel().createRequirementContainer();
    	//session.getRequirementModel().create
    	try {
    		createdElement.addStereotype(IRCasePeerModule.MODULE_NAME, "RequirementStereotype");
    		createdElement.setName("Requirement");
    		createdElement.setOwnerContainer(reqContainer);
    		createdElement.setAnalystProperties(session.getRequirementModel().createPropertyTable());
		} catch (ExtensionNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

I attach the project files. (They inherit from an abstract class I have created).

File Attachment:

File Name: Files.zip
File Size:5 KB
Attachments:

Please Log in or Create an account to join the conversation.

4 years 10 months ago #3297 by pan
Do you have an error message?

Please Log in or Create an account to join the conversation.

4 years 10 months ago #3298 by ua138
Yes, when I create the requirement it gives me two errors:






And for the Dictionary only this information is available:




Thank you very much for your response. If any further information is needed please let me know.
Attachments:

Please Log in or Create an account to join the conversation.

4 years 10 months ago #3299 by pan
I see.
From your method RequirementTool::createOwnElement(...), you try to create a Requirement createdElement on a RequirementContainer that you create with the same command but the RequirementContainer has no owner.
On reqContainer, you have to set its owner: an existing RequirementContainer (use void setOwnerContainer(RequirementContainer value) ) or the AnalystProject (use void setOwnerProject(AnalystProject value)).

Each time that you will create a Requirement, you will also create a RequirementContainer. Is it really what you want? I suggest you to create the Requirement on the AnalystProject or try to find the closest RequirementContainer from the diagram (if the diagram is owned by a Requirement element).

Does it help?
The following user(s) said Thank You: ua138

Please Log in or Create an account to join the conversation.

4 years 10 months ago #3300 by ua138
Honestly, I do not understand how it works. My intentions are to create my own diagram that includes requirements from the IAnalystModel and other elements from IUmlModel. Is that possible?

Why there is a need to create and analyst project? Where do I get it from? How do I create one? Where do I create it? Is it possible to set the owner as the elements from the list List<MObject> selectedElements?

Is there any place where I can get documentation about this?

Thank you very much for your quick responses!

Regards

Please Log in or Create an account to join the conversation.

4 years 10 months ago #3301 by pan
Actually, requirements elements can only be created on an Analyst model. On this page: RequirementContainer metamodel we can see that a RequirementContainer can have a RequirementContainer or an AnalystProject as parent.

A project always contains an AnalystProject. By default, this element is hidden. To show it, click on the "Show analyst model" (see the first image of this page showing the analyst model ).

On the Javadoc documentation of the API , search for RequirementContainer from the bottom left element list. This will give the needed methods to get necessary information for the Requirement elements.

Hope this helps.

Please Log in or Create an account to join the conversation.

Moderators: tmachmaab
Time to create page: 0.407 seconds
^ Back to Top