Generalisation (from a specific class) in a pattern

Hi,

We’re using Visual Paradigm with java language.
In our model, every object has a base class and implements interfaces (which also have base interface as well).

So the model looks like this:

BaseInterface —> InterfaceA ----> ClassA (realisation)

BaseClass ----> ClassA (generalisation) (class ClassA extends BaseClass implements InterfaceA)

1. Problem and Question
Right now I can only implement this model this way: BaseClass is part of the diagram, and every new Class in the model has a generalisation connection to the BaseClass. This gives a graphically ugly diagram, where every model object has a connection line to the Base class.

If I remove the BaseClass from the diagram, the connection lines dissapear, and the generalisation can be seen in the relation table correctly.

Questin: is it possible, to add Classes to the model, where a Class has generalisation to a base class, but that base class is NOT part of the specific diagram?

2. Problem and Question
With the model described above, I would like to define new pattern.
If I define a pattern where a class extends a base class I have two options:

  1. Including the base class in the pattern definition:
    This way when I create new classes based on this pattern, the pattern creates new base class every time.
    (for examle BaseClass becomes BaseClass, BaseClass1, BaseClass2 etc.)

  2. Excluding the base class from the pattern definition:
    This way when I create new classes based on this pattern, the new classes doesn’t have generalisation relations at all.

Question: How can I define such a pattern, telling that every new class has to extend a (specific well defined) base class, and implement an interface which extends a (specific well defined) base interface?

Thank you in advance:
Gejzir

Dear Gejzir,

Thank you for your message. I’m very sorry that our design pattern feature is not designed to use in this way. The design pattern feature is allow you to define a mold for creating a diagram. Where the diagram created by the “pattern” are always new model elements.

In VP the only way to create relationships between 2 elements are create it in diagram. Once you created it, you can then remove it from your diagram. This is same to what you described in your forum post.

The best approach to deal with this is you keep create the sub-class from the base class, i.e. using the resource centric icons. After that you cut and paste it to your target diagram. This will move the newly created class to the target diagram and keep the generalization relationship in model.

Feel free to contact me for any queries.

Best regards,
Rain Wong