Mercurial > hg > openmind
comparison src/main/java/org/mpi/openmind/repository/bo/Relation.java @ 70:b5a22b9ab9c6
Relation constructor takes objectClass instead of ownValue.
author | casties |
---|---|
date | Thu, 02 Feb 2017 11:58:23 +0100 |
parents | 467843399e70 |
children |
comparison
equal
deleted
inserted
replaced
69:bde6212babfd | 70:b5a22b9ab9c6 |
---|---|
69 rel.setSource(src); | 69 rel.setSource(src); |
70 rel.setTarget(tar); | 70 rel.setTarget(tar); |
71 return rel; | 71 return rel; |
72 } | 72 } |
73 | 73 |
74 /** | |
75 * Creates a Relation with the given source and target Entities. | |
76 * | |
77 * Adds the Relation to the Entities. Requires Entities to be non-lightweight. | |
78 * | |
79 * Make sure to set objectClass later. | |
80 * | |
81 * @param source | |
82 * @param target | |
83 */ | |
74 public Relation(Entity source, Entity target){ | 84 public Relation(Entity source, Entity target){ |
75 this.setSource(source); | 85 this.setSource(source); |
76 this.setTarget(target); | 86 this.setTarget(target); |
77 source.addSourceRelation(this); | 87 source.addSourceRelation(this); |
78 target.addTargetRelation(this); | 88 target.addTargetRelation(this); |
79 this.setSystemStatus(Node.SYS_STATUS_CURRENT_VERSION); | 89 this.setSystemStatus(Node.SYS_STATUS_CURRENT_VERSION); |
80 } | 90 } |
81 | 91 |
82 public Relation(Entity srcNonLW, Entity tarNonLW, String ownValue){ | 92 /** |
93 * Creates a Relation with the given source and target Entities and objectClass. | |
94 * | |
95 * Adds the Relation to the Entities. Requires Entities to be non-lightweight. | |
96 * | |
97 * @param srcNonLW | |
98 * @param tarNonLW | |
99 * @param objectClass | |
100 */ | |
101 public Relation(Entity srcNonLW, Entity tarNonLW, String objectClass){ | |
83 this.setSource(srcNonLW); | 102 this.setSource(srcNonLW); |
84 this.setTarget(tarNonLW); | 103 this.setTarget(tarNonLW); |
85 srcNonLW.addSourceRelation(this); | 104 srcNonLW.addSourceRelation(this); |
86 tarNonLW.addTargetRelation(this); | 105 tarNonLW.addTargetRelation(this); |
87 this.setOwnValue(ownValue); | 106 this.setObjectClass(objectClass); |
107 this.setOwnValue(objectClass); | |
88 this.setSystemStatus(Node.SYS_STATUS_CURRENT_VERSION); | 108 this.setSystemStatus(Node.SYS_STATUS_CURRENT_VERSION); |
89 } | 109 } |
90 | 110 |
91 @Column(name="source_id") | 111 @Column(name="source_id") |
92 private Long sourceId; | 112 private Long sourceId; |