Salome HOME
41c06abb6dc58967f4fb076fb03566344ddf2cc2
[tools/siman.git] / Workspace / Siman-Common / src / org / splat / dal / bo / som / UsesRelation.java
1 package org.splat.dal.bo.som;
2 /**
3  * 
4  * @author    Daniel Brunier-Coulin
5  * @copyright OPEN CASCADE 2012-2014
6  */
7
8 import org.splat.dal.bo.kernel.Persistent;
9 import org.splat.dal.bo.kernel.Relation;
10
11
12 public class UsesRelation extends Relation {
13
14     private Document  refer;
15
16 //  ==============================================================================================================================
17 //  Constructors
18 //  ==============================================================================================================================
19
20 //  Database fetch constructor
21     protected UsesRelation () {
22     }
23 //  Initialization constructors
24     public UsesRelation (final Document from, final Document to) {
25 //  ---------------------------------------------------
26       super(from);
27       this.refer   = to;
28       this.reverse = new UsedByRelation(this, to, from);
29     }
30 //  Internal constructor
31     protected UsesRelation (final Relation back, final Document from, final Document to) {
32 //  ------------------------------------------------------------------
33       super(from);
34       this.refer   = to;
35       this.reverse = back;
36     }
37
38 //  ==============================================================================================================================
39 //  Public member functions
40 //  ==============================================================================================================================
41
42     @Override
43         public Class<? extends Relation> getReverseClass () {
44 //  ---------------------------------------------------
45       return UsedByRelation.class;
46     }
47
48     @Override
49         public Document getTo () {
50 //  -------------------------
51       return refer;
52     }
53     @Override
54         public boolean isBidirectional () {
55 //  ---------------------------------
56       return true;
57     }
58     @Override
59         public void setTo (final Persistent to) {
60 //  ------------------------------------
61       refer = (Document)to;
62     }
63 }