Previous Topic

Book Contents

Book Index

Next Topic

Instances Are Relation Dependent

The 'Instances are relation dependent' check box has an important function and some consequences which need to be clearly understood. If used incorrectly, it may result in unexpected behavior of actions such as DeepCopy or objects deletion and export.

Example:

The example of relation 'Contract – ContractItem' relation will serve us as a case study.

The Relation browser displays the following information:

  • The Contract item is the source object type (on the left side) and Contract is the target object type (on the right side) and the relation means that a Contractitem references exactly 1 Contract (minimum target cardinality = maximum target cardinality = 1). A Contract has at least 1 Contract item but can have more of them (minimum source cardinality = 1, maximum source cardinality. = N).

    Thus, a Contractitem has an attribute 'contract' which references exactly one Contract, and a Contract has an attribute “contractitems” which is a non-empty collection of Contractitems.

  • The check box in the Dependent column corresponds to the 'Instances are relation dependent' check box found in the Relation tab of the actual Relation Customizer.
    • If the check box is selected, it has the following meaning:

      A Contract item is dependent on the Contract to which it refers. In other words, the relation from a Contract item to a Contract is unchangeable. This means that once the relation between a Contract item and a Contract is saved to the database, it is not possible to change the relation. Also, once a contract item has been created and assigned to a contract, then the relation between contract and contract item cannot be changed. A Contract item can only exist when it belongs to a particular Contract and it cannot be assigned to a different one. If an error is made, then the contract item must be deleted and created again within the correct contract.

      Sometimes the term "aggregation" is used to describe this type of relation (as opposed to an association if the flag is not set).

Consequences:

  • Relation actions

    As it is not possible (for example) to assign a different Person (existing or new) to an existing ID or remove it, the relation actions Remove or Link Existing are not available in the reference view for Person when you open it within ID.

    These actions are not offered anywhere the 'Instances are relation dependent' flag has been checked.

    It is not possible to re-assign an existing ID to another Person. When you open the view for Person, you will not see the action Link Existing. It is because you would have to choose from an existing ID but such an ID already belongs to a different Person and cannot be assigned to the Person you are editing – the relation from ID to Person is not changeable.

    However, you will see the relation action Link New: It is possible to create a new ID and assign it to the edited Person.

  • Business objects deletion
    • Delete Cascade

      If the 'Instances are relation dependent' flag is set, then when you attempt to delete a Person (using standard Delete business object action), all ID’s of the deleted Person will be deleted as well. This is because an ID always needs to belong to at least one Person. Sometimes the term Delete Cascade is used to describe this rule.

    • Delete Restrict

      If the instances are not relation dependent, then the Delete action would not allow you to delete the Object until the related objects have been deleted or re-assigned to another object This rule is called Delete Restrict.

  • Deep Copy

    The deep copy algorithm also uses this flag to decide whether a related object has to be copied as well or it can only be referenced from the copy. If the related object is dependent, then it must be copied as well.

    Also, the Standard filter used in standard deepCopy does not copy 1..N collections if certain conditions are met – one of them also being the Relation Dependent flag.

  • Export

    Similarly, export uses the flag in the Auto filter to decide whether a related object will be exported or not. If it is dependent, it will automatically be exported.

In This Chapter

More Examples

See Also

Relation Tab

User Period Covering

Setting Defaults