file Creating requirements and dictionaries

4 years 9 months ago - 4 years 9 months ago #3302 by ua138
Ok, now I understand it a bit better. With which method can I obtain the AnalystProject opened in my session?

Would it be possible to create my own requirement for an uml (IUmlModel) project? How could I do it?

Is it possible to modify for example a "Class" with an stereotype to add a text field, or my own customized fields? I attach an image to illustrate what I am writing about.





I want my own definition to look like the image. Is that possible?
Attachments:

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

4 years 9 months ago #3303 by ua138
I will also be very grateful if someone could share the complete code for creating a requirement/dictionary

Thank you.

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

4 years 9 months ago - 4 years 9 months ago #3304 by pan
To obtain the AnalystProject:
IModelingSession session = Modelio.getInstance().getModelingSession();
AnalystProject anproject = null;
for (MObject root: session.getModel().getModelRoots()) {
	if (root instanceof AnalystProject) {
		anproject = (AnalystProject)root;
	}
}

To create a Requirement:
IModelingSession session = Modelio.getInstance().getModelingSession();
AnalystProject anproject = null;						
try (ITransaction tr = session.createTransaction("Create Requirement")) {
	List<MObject> roots = session.getModel().getModelRoots();
	for (MObject root: roots) {
		if (root instanceof AnalystProject) {
			anproject = (AnalystProject)root;
			RequirementContainer reqContainer = session.getRequirementModel().createRequirementContainer();
			Requirement req = session.getRequirementModel().createRequirement("", reqContainer);
			session.getModel().getDefaultNameService().setDefaultName(reqContainer);						reqContainer.setOwnerProject(anproject);													session.getModel().getDefaultNameService().setDefaultName(req);						tr.commit();						
		}
	}
} catch (InvalidTransactionException e) {
	System.out.println(e.getMessage());
}
In this example, I created a RequirementContainer but the RequirementContainer should be retrieved in other way. To create a Dictionary, it's the same principle.

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

4 years 9 months ago - 4 years 9 months ago #3305 by ua138
Thank you, this helped me a lot. Now I understand better how it works.
But still, i cannot manage to make appear the requirements in the diagram. When I drag and drop them from the tool palette to the diagram, it only creates them in the analyst project.

Is there any way of visualizing them in a diagram?

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

4 years 9 months ago #3306 by pan
You can drag & drop them from the explorer to the diagram and they will be unmasked.

You cannot modify the existing requirement fields but you can add TagTypes on your own Stereotypes if you want to have specific attributes (see the image as example).



Please note that if you use the requirements on the open source version several requirements features will be missing (spreadsheet editors, document generation, ...). These features are only available on the Enterprise edition of Modelio.
Attachments:

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

4 years 9 months ago - 4 years 9 months ago #3307 by ua138
Thank you very much! I will use the stereotypes with tags.

I still have problems unmasking the requirements in my own diagram. Do I need to change the scope somewhere? Do I need to change the accept method?

I have this code for the stereotype:
<Stereotype name="RequirementStereotype" metaclass="Requirement" is-hidden="false" label="%RequirementStereotype.label" uid="ab289f43-9605-4853-a2f9-03e665e2754a">
                <Icon path="%RequirementTool.image"/>
                <Image path="%RequirementTool.image"/>
                <TagTypes/>
            </Stereotype>
            <Stereotype name="RequirementContainerStereotype" metaclass="RequirementContainer" is-hidden="false" label="%RequirementStereotype.label" uid="cb19ff30-98c8-43f1-b098-e5d8ceba2782">
                <Icon path="%RequirementTool.image"/>
                <Image path="%RequirementTool.image"/>
                <TagTypes/>
            </Stereotype>

And this code for the tool:
<Tool id="RequirementTool" label="%RequirementTool.label" tooltip="%RequirementTool.tooltip" image="%RequirementTool.image">
                <Handler class="org.casesuite.rcase.command.tool.nodes.RequirementTool">
                    <HParameter name="metaclass" value="Requirement"/>
                    <HParameter name="stereotype" value="RequirementStereotype"/>
                </Handler>
            </Tool>
            <Tool id="RequirementContainerTool" label="%RequirementContainerTool.label" tooltip="%RequirementTool.tooltip" image="%RequirementTool.image">
                <Handler class="org.casesuite.rcase.command.tool.nodes.RequirementContainerTool">
                    <HParameter name="metaclass" value="RequirementContainer"/>
                    <HParameter name="stereotype" value="RequirementContainerStereotype"/>
                </Handler>
            </Tool>

For creating the diagram:
<Command id="ContextDependencyDiagram" label="%ContextDependencyDiagram.label" tooltip="%ContextDependencyDiagram.tooltip" image="%ContextDependencyDiagram.image" group="%ContextDependencyDiagram.group" modify-model="true" group-image="%ContextDependencyDiagram.groupimage">
                <Handler class="org.casesuite.rcase.command.create.diagram.CreateContextDependencyDiagram"/>
            </Command>

For the diagram itself:
<DiagramType base-diagram="StaticDiagram" stereotype="DiagramStereotype">
                <Handler class="org.casesuite.rcase.customizer.ContextDependencyDiagramCustomizer"/>
            </DiagramType>

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

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