Object Diagram arrow between objects in different packages

0 votes
asked Jul 4 in Bug by ilya_mart (120 points)
Hello! I have objects in different packages and try to link them:

package Provider {
object Role2 {
scope = reseller
priv = all
}
}

package Reseller {
object Role6 {
scope = reseller
priv = all
}  
object Staff1
object Staff2
Staff1 --> Role6
Staff2 --> Provider.Role2
}

This arrow drawn correctly: Staff1 --> Role6
This arrow incorrect: Staff2 --> Provider.Role2. Actually PlantUML draws an arrow to a new Class named "Role2". I don't have this class.

Rendered diagram: https://1drv.ms/u/s!AhtL_TwTtbMKh8dwYc5y5zBAT_Ua_w

2 Answers

0 votes
answered Jul 4 by The-Lu (48,920 points)

Hello I.,

If you want to use `Provider.Role2`, you must to use `namespace` without `object` (object seems to not work with namespace...), then change :

  • `object` to `class`
  • `package` to `namespace`

with that, see your expected result:

@startuml
hide circle
hide empty members

namespace Provider {
class Role2 {
scope = reseller
priv = all
}
}

namespace Reseller {
class Role6 {
scope = reseller
priv = all
}  
class Staff1
class Staff2

Staff1 --> Role6
Staff2 --> Provider.Role2
}
@enduml

If that can help,
Regards.

0 votes
answered Jul 4 by The-Lu (48,920 points)

Hello I.,

Another solution is, instead, to use unique aliases, as:

@startuml
package Provider {
object "Role2" as R2 {
scope = reseller
priv = all
}
}

package Reseller {
object Role6 {
scope = reseller
priv = all
}  
object Staff1
object Staff2
Staff1 --> Role6
Staff2 --> R2
}
@enduml

If that can help,
Regards.

...