CMDBuild Forum

Inherited Attributes from Domain Relationships

Hello,

I would like a class to inherit an attribute from another class to which a domain provides a relationship.

Let me demonstrate:

I have two classes,

'VLAN'

'vlIPRange'

Each created VLAN has it's own subnet with access to a gateway allowing it to speak to other networks. 

I have a DOMAIN between 'VLAN' and 'vlIPRange'. I would like the class 'vlIPRange' to have some attributes which currently belong to 'VLAN' and automatically inherit the data within those attributes.

The attributes in question would be netmask, ipRangeStart, ipRangeEnd, gateway. 

So when a user creates a card within the vIPRange and a relationship between vIPRange and VLAN using the created domain, I want them to be able to relate directly to a card within that range. 

Therefore, IF vIPRange Card 1 has a relationship with VLAN Card 3 then Card 1 must inherit Card 3's data for 'netmask', 'ipRangeStart', 'ipRangeEnd' and 'gateway'.

Currently, when I create a reference attribute, I only get the Description attribute no matter what I call the reference attribute in the vlIPRange class.

Can anyone suggest how I could implement this?

Thanks,

Jamie

Hellp,

the inheritance in CMDBuild does not work in this way.

As in the object-oriented programming, you can use the inheritance to "specialize" a class by creating a child class that includes parents attributes and domains beyond other specific attributes and domains.

Let's suppose, for example, that "AssetIT" includes the attributes "Assignee", "SerialNumber", "Supplier", "PurchaseDate", "Room", etc, and the domains "AssetITSupplier", "AssetITEmployee", "AssetITLocation".

In this case e.g. "Printer" can inherits from "AssetIT" by adding the new attributes "Type" (inkjet, laser, etc), "Color" (Y / N), "PaperSize" (A3, A4), etc.

Otherwise, "Client" ("Videocard", "SoundCard") can inherits from "Computer" ("CPUNumber", "CPUSpeed", "RAM", "HDSize"), which in turn inherits from "AssetIT".

 

In your case you have the classes "VLAN" and "vlIPRange" with similar attributes and a relation, and you want that, when choosing a value for the "VLAN" reference attribute on a "vlIPRange" card, the attributes "netmask", "ipRangeStart", etc automatically gain the value on the related VLAN.

In order to do that, you have two possibilities:

-

to make the attributes "netmask", "ipRangeStart" on "vlIPRange" not editable and update their value with a database trigger during the card saving (examples: http://www.cmdbuild.org/forum/forum-in-english/452549010 , http://www.cmdbuild.org/forum/forum-in-english/908224516 )

- to write a little workflow for the guided insertion (wizard) of cards in "vlIPRange" (in a workflow you can use some API's to set the value of "vlIPRange" attributes which depend on the "VLAN" reference value)

 

Fabio

 

1 Like