01: package org.osbl.orga.model;
02:
03: import org.conform.Property;
04:
05: public class Relationship implements Comparable {
06: Long id;
07: @Property(mandatory="true")
08: Member member;
09: @Property(mandatory="true")
10: Member peer;
11: @Property(mandatory="true")
12: String relation;
13:
14: public Relationship() {
15: }
16:
17: public Relationship(Member member, Member peer, String relation) {
18: this .member = member;
19: this .peer = peer;
20: this .relation = relation;
21: }
22:
23: public Long getId() {
24: return id;
25: }
26:
27: public void setId(Long id) {
28: this .id = id;
29: }
30:
31: public Member getMember() {
32: return member;
33: }
34:
35: public void setMember(Member member) {
36: this .member = member;
37: }
38:
39: public Member getPeer() {
40: return peer;
41: }
42:
43: public void setPeer(Member peer) {
44: this .peer = peer;
45: }
46:
47: public String getRelation() {
48: return relation;
49: }
50:
51: public void setRelation(String relation) {
52: this .relation = relation;
53: }
54:
55: public int compareTo(Object o) {
56: Relationship r = (Relationship) o;
57: if (id == null && r.id != null)
58: return 1;
59: else if (id != null && r.id == null)
60: return -1;
61: else if (id == null && r.id == null)
62: return 0;
63: else
64: return id.compareTo(r.id);
65: }
66: }
|