<RELATION> : Relation field

Java class : leon.info.LyRelationFieldInfo

ROLE

This element describes a field that refers to one or several objects of the application. The object references stored inside the value of this field may be ordered or not. Information about that kind of field could be completed by the list of target classes of the application, a default value, a field that specify the target class and a field that creates a context.

ATTRIBUTES

<!ATTLIST RELATION
	  id ID #REQUIRED
	  template IDREF #IMPLIED
	  extends IDREF #IMPLIED
	  abstract ( true | false) "false"
	  javaName NMTOKEN #IMPLIED
	  multiple ( true | false) "false"
	  ordered ( true | false) "false"
	  calculated ( true | false) "false"
	  direction ( NONE | FORWARD | BACKWARD | BOTH) "BOTH"
	  type ( ASSOCIATION | COMPOSITION | PARENT | DEPENDENCY) "ASSOCIATION"
	  userData CDATA #IMPLIED
	  reverse IDREF #IMPLIED
	  behavior NMTOKEN #IMPLIED>
Attribute Mand. Description Default
id yes This is the identifier of this field.  
template no Reference to the relation field used as pattern.  
extends no Reference of the field from which this field inherits. A relation may only extends another relation from a parent class. In the case of an extension it is possible to restrict the list of authorized classes with the CLASSES element.  
abstract no Indicates whether the relation is abstract or not. An abstract relation may not be valued. It must be extended in order to be used. false
javaName no Name of the Java attribute that corresponds to the current field when automatic code generation is used. The default value is the name of the current field.  
multiple no This attributes indicates if the field may accept one or several reference to objects of the application. false
ordered no This attribute indicates if the list of reference to objects of the application is stored with a defined order. This attribute is useless for relation fields that are not multiple. false
calculated no Indicates whether the relation is calculated or not. Attribute reserved for an applicative use. false
direction no This attribute defines the direction followed when this field is used inside the computing of a cross-reference. Inside the application, cross-references are computed and used many times to manage contexts between views of the graphical user interface. This attribute tells how references to objects defined on this field should be taken into account:
- NONE: all existing references to objects stored inside this field are ignored during computation of cross-references.
- FORWARD: during the computation of a cross-reference, this field may be only used in the direct way to collect objects. The object that has this field defined in its class can give the reference to objects stored inside the associated value. On the other hand, objects stored inside the value of this field are not allowed to give the reference to the object that holds this value.
- BACKWARD: during the computation of a cross-reference, this field may be only used in the reverse way to collect objects. The rule applied is the opposite
BOTH
type no Gives the type of the relation. 3 types of relations are supported :
- ASSOCIATION: association relation without any dependency between the object and related objects,
-COMPOSITION: composition relation between the object and related objects. The deletion of the object involves the deletion of related objects.
ASSOCIATION
userData no User data. Attribute reserved for an applicative use.  
reverse no RELATION.reverse  
behavior no Name of the Java class representing the behavior of this field. Reserved for a future use.  

ELEMENTS

<!ELEMENT RELATION 
	  (%FIELD_BEGIN;,
	   CLASSES*,
	   MIN?,
	   MAX?,
	   DEFAULT?,
	   CONTEXT_FIELD?,
	   CLASS_FIELD?,
	   %FIELD_END;)>
Element Mand. Mult. Description
FIELD_BEGIN
yes no Begin of a field description.
CLASSES no yes This is the list of target classes. It defines the classes the referred objects should belong. 'For example, if we set the default value for the field (), inside the application, this variable should be defined during the session (session.addValue("$PROJECT", object)).
MIN no no Gives for a multiple relation the minimum number of values that are expected on input for this field.
MAX no no Gives for a multiple relation the maximum number of values that are accepted on input for this field.
DEFAULT no no This is the default value. The value should be a string that is the identifier of an existing object of the application. The value could also be an application variable provided it is defined during the user session.
CONTEXT_FIELD no no This attribute adds a context over the current field that limit the list of objects available for the selection.
CLASS_FIELD no no This attribute defines the field that specifies the target classes.
FIELD_END
yes no End of a field description.

SAMPLE 1

<RELATION id="alr_net">
	<ROUTES>
		<ROUTE target='netClass'>
			<STEP idrefs='alr_obj' target='muxClass'/>
		</ROUTE>
		<ROUTE target='netClass'>
			<STEP idrefs='alr_obj' target='cardClass'/>
			<STEP idrefs='card_eqt' target='muxClass'/>
		</ROUTE>
		<ROUTE>
			<STEP idrefs='alr_obj' target='portClass'/>
			<STEP idrefs='port_card' target='cardClass'/>
			<STEP idrefs='card_eqt' target='muxClass'/>
		</ROUTE>
	</ROUTES>
	<NAME value="ALR_NETWORK"/>
	<F_MARKS sort='true' filter='true' find='true' table='true' 			local='true'/>
	<CLASSES idrefs="netClass"/>
</RELATION>

SAMPLE 2

<RELATION id="br_eme" direction='FORWARD'>
	<F_BIND value="EMETTEUR"/>
	<NAME value="BR_EMETTEUR"/>
	<TAB value="TAB_EMISSION"/>
	<F_MARKS create='true' set='true' sort='true' filter='true' find='true' table='true'>
		<MARK name='EMISSION'/>
	</F_MARKS>
	<CLASSES idrefs="custClass usrClass"/>
	<DEFAULT value="$USER"/>
</RELATION>