tutorial

make connections between objects

Objects can be connected to create logical structures depending on the application purpose. A linktype is specified when making a connection between two Oberon objects.
One object represents the To-side and one the From-side. Oberon will use the To and From labels to determine the link's direction. The direction you define makes a difference when you navigate through the connections: in particular you can specify whether or not you want to see objects that lead to or away from the chosen object. You can connect two objects if and only if the selected linktype allows the object class (or one derived from it) on the to and the from side respectively.

Adding a new Link instance

Users can add a new link instance between two objects by the "Domain Object Manipulation" client. Simply search the two objects to connect, select one of them and push the "Add Link" button.

In the "Add Link" form you can choose one or more objects to connect with the selected one and, you can also define the connection direction and set the linktype, choosing from those allowed for the object class. To create a new link, a user should have the addlinkfrom privilege activated in the current lifecycle stage of the from side object and the addlinkto privilege granted in the to side object's current stage.

An equivalent OOQL command might be:

object addlink
  'Horror' 'Saw II' '-''
   or
'Horror' 'Saw II' '-' in 'Movies'
   or
#00002-69EB8421
to  
  'Customer' '09238912' '-'
   or
'Customer' '09238912' '-' in 'Customers'
   or
#00001-D27083FA
linktype 'Rental' ;


The Navigate function let you to view connected objects for the selected one.


Modifying a Link

A linktype may or may not have fields associated with it. If it does, you may assign a specific value to them. For example, if you were to examine the definition for the linktype “Rental” you might find it has the "RentDate" field associated with it. To set a link's field value in the "Domain Object Manipulation" client, you can select the connection from the navigation window and push the "Edit Link" button.

When links are created, they are given an internal ID. As an alternative to the From/To connected object names, you can use this ID to direct access the link. For example, you can use the following OOQL command :

link edit #00002-FD60DBE6
  field['RentDate'] '2010-03-28' ;

in place of the more complex command:

link edit object
    'Horror' 'Saw II' '-''
   or
'Horror' 'Saw II' '-' in 'Movies'
   or
#00002-69EB8421
to  
  'Customer' '09238912' '-'
   or
'Customer' '09238912' '-' in 'Customers'
   or
#00001-D27083FA
linktype 'Rental'
field['RentDate'] '2010-03-28' ;

If you do not assign values to fields, they remain blank or their default is used if there is one. Not assigned field values are marked with "X" symbol in the default column.
When you are specifying a value, be sure it is in agreement with the field definition. In other words, only integer values are assigned to integer fields, character string values are assigned to character string fields, and so on. Also, if the field has a range of valid values, the value you give must be within that range. In this case, you can select a valid value from the proposed selection list. To modify link field values, a user should have the addlinkfrom/addlinkto privileges activated in the connected objects current lifecycle stages .

Note: you can use the field clause to set the values also in the addlink OOQL commands.


Copying/Cloning a Link

After a link was added and its values defined, you can copy (or clone) the link if you have the addlink privileges on the connected objects. During the clone operation you can modify all basic parameters included the linktype. You can also modify the values you want to change: if you do not make any changes, the values remain the same as the original link.

link clone #00002-FD60DBE6
  newtype 'Rental_Archived'
field['RentDate'] '2010-04-20' ;

link clone object
    'Horror' 'Saw II' '-''
   or
'Horror' 'Saw II' '-' in 'Movies'
   or
#00002-69EB8421
to  
  'Customer' '09238912' '-'
   or
'Customer' '09238912' '-' in 'Customers'
   or
#00001-D27083FA
  newtype 'Rental_Archived'
field['RentDate'] '2010-04-20' ;

 

<< create and manage object instances  
© 2008-2012 Mirko Solazzi | Website Templates by IceTemplates.com
Please Read: Privacy Policy and Terms of Use