Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Possible Error in Papyrus(Code java generator doubt)
Possible Error in Papyrus [message #1778596] Mon, 18 December 2017 11:54 Go to next message
Eduardo Gutierrez is currently offline Eduardo GutierrezFriend
Messages: 28
Registered: December 2017
Junior Member
Hello, im trying to use Papyrus, but when i draw a simple class diagram like:

1 employee works in one company, and one company has one employee ( 1 to 1 relation).

When i generate the code in Java it appears the company and employee class, but it doesnt appear any reference to employee or company....

What i get ( two files employee.java and company.java):

class employee {
char idemp;
//other attributes
}

class company {
char idcompany;
//other attributes
}

what i expected ( and think should be)
class employee
{
char idemp;
//other attributes
Company cmp;
}

class company {
char idcompany;
//other attributes
Employee emp;
}

Because in one to one relation, you have to assign zero or one value to the other class.
I dont know if its some properties or settings problem

I think that relations with many ( one to many, many to many) its ok, as appears an Array of elements of the class.
ex: one company has many employees
class company {
char idcompany;
//other attributes
Employee[] emp;
}
i think this is ok.


Im using latest Eclipse version with Papyrus form Eclipse Market.

Thanks

Re: Possible Error in Papyrus [message #1778652 is a reply to message #1778596] Tue, 19 December 2017 10:30 Go to previous messageGo to next message
Shuai Li is currently offline Shuai LiFriend
Messages: 19
Registered: March 2016
Location: Paris Saclay, France
Junior Member
Hi,

The generated code is conform to navigability in the UML specification, i.e. if C1 cannot navigate to class C2, then a reference of C2 should not be generated in C1.

When you created the association, are you sure both member ends of the association are navigable? Navigability of member ends can be specified by clicking on the association, and checking its properties in the Properties view. Note that you can directly create navigable associations with the palette of the class diagram, by using the Directed Association tool (or one of the other similar tools in the palette). If the members ends are navigable, they should then be contained in the classes themselves (instead of the association) as UML::Property of the classes. In the diagram, a "dot" should appear on any association member end that is navigable.

Hope this helps.
Re: Possible Error in Papyrus [message #1778724 is a reply to message #1778652] Wed, 20 December 2017 13:06 Go to previous messageGo to next message
Eduardo Gutierrez is currently offline Eduardo GutierrezFriend
Messages: 28
Registered: December 2017
Junior Member
I solved it changing the owner of the relation, instead of Association to Classifier. I dont understand which is the difference, but setting Navigable to True in both, if the owner is Association it doesnt work and if i put the Classifier as a owner it works.

Also how can i put attributes and operations ? It appears properties and stereotypes, and some are shown in the model explorer and others not.....I just want to set ex: name String salary int in Employee class ( just show them in the rectangle below the class name in attributes). Private visibility

Also write some operations void calculateSalary and getName for example as operations. It would be nice to be shown in the model explorer ( in a rectangle below attributes). Public visibility.

Thanks



Thanks in advance
Re: Possible Error in Papyrus [message #1778752 is a reply to message #1778724] Wed, 20 December 2017 20:45 Go to previous message
Charles Rivet is currently offline Charles RivetFriend
Messages: 181
Registered: May 2014
Location: Canada
Senior Member

Hello Eduardo,

If you create a property (or operation) in the model explorer, it may not show up in the element compartment on a diagram.

Have you tried to right-click on the diagram element and selecting "Filters > Show/Hide Contents" in order to show what you need to see?

Alternately, you if you always want to see all the content, you could turn on "Filters > Synchronized with model."



/Charles Rivet
Previous Topic:Export details from Papyrus to XMI
Next Topic:Elements loose their position on diagrams
Goto Forum:
  


Current Time: Fri Apr 20 11:05:48 GMT 2018

Powered by FUDForum. Page generated in 0.02057 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software