« Back to Secure Tropos Project

Is it possible to embed objects into relation classes?

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Is it possible to embed objects into relation classes?
community relation documentation
Answer
3/27/14 12:34 PM
Would it be possible to define a relationship class, which would have another object embedded inside of it? For example, relationship would have a round badge with integer value on it, which moves around as relationship moves. This embedded concept could be virtualized by changing GraphRep attribute of the relationship class and adding an ellipse and text on the relationship, but it is not a "real" embedded concept, i.e. it cannot be clicked solely and have its own notebook and attributes from those of the relationship class.

RE: Is it possible to embed objects into relation classes?
Answer
3/8/13 12:33 PM as a reply to Anonymous.
Relations can only have attributes of the type: [Date, Datetime, Enumeration, Enumerationlist, Expression, Floating number, Integer, Longstring, Programcall, String, Time], which can be displayed in the Graphrep as attribute dependent graphical representation. Hence, relations can not include other objects but may have any attribute from aforementioned types, which can be displayed next to the relation.
See a small sample for an ellipse and an integer as mentioned in the text.


MIDDLE
ATTR "a" x:0.00cm y:-1.00cm w:c h:c
ELLIPSE x:0.00cm y:-1.00cm rx:0.5cm ry:0.25cm


Extension
Objects can be referenced using following possibilities:
Include object references in one of the classes that are connected by the relation. Make new – hidden – attributes in the notebook storing the “referenced objects” which can be and populated and received with AdoScripts.
Resolve the relation that connects two classes, into two relations and an additional class in between. This new class can have the required inclusion of other objects. Adding this class can be performed either manually or by implementing an ADOscript

Writing an Adoscript for one of aformentioned possibilities will listen for the event: BeforeCreateRelationInstance

ON_EVENT "BeforeCreateRelationInstance" { CC "Core" GET_OBJ_NAME objid: (frominstid)
SET objname1: (objname)
CC "Core" GET_OBJ_NAME objid: (toinstid)
SET objname2: (objname)
IF (objname1 = objname2) {
EXIT -1
}
}