This project has retired. For details please refer to its
Attic page.
RelationshipImpl xref
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.chemistry.opencmis.client.runtime;
20
21 import org.apache.chemistry.opencmis.client.api.CmisObject;
22 import org.apache.chemistry.opencmis.client.api.ObjectId;
23 import org.apache.chemistry.opencmis.client.api.ObjectType;
24 import org.apache.chemistry.opencmis.client.api.OperationContext;
25 import org.apache.chemistry.opencmis.client.api.Relationship;
26 import org.apache.chemistry.opencmis.client.api.TransientCmisObject;
27 import org.apache.chemistry.opencmis.client.api.TransientRelationship;
28 import org.apache.chemistry.opencmis.commons.PropertyIds;
29 import org.apache.chemistry.opencmis.commons.data.ObjectData;
30
31 public class RelationshipImpl extends AbstractCmisObject implements Relationship {
32
33 private static final long serialVersionUID = 1L;
34
35
36
37
38 public RelationshipImpl(SessionImpl session, ObjectType objectType, ObjectData objectData, OperationContext context) {
39 initialize(session, objectType, objectData, context);
40 }
41
42 @Override
43 protected TransientCmisObject createTransientCmisObject() {
44 TransientRelationshipImpl tr = new TransientRelationshipImpl();
45 tr.initialize(getSession(), this);
46
47 return tr;
48 }
49
50 public TransientRelationship getTransientRelationship() {
51 return (TransientRelationship) getTransientObject();
52 }
53
54 public CmisObject getSource() {
55 return getSource(getSession().getDefaultContext());
56 }
57
58 public CmisObject getSource(OperationContext context) {
59 readLock();
60 try {
61 ObjectId sourceId = getSourceId();
62 if (sourceId == null) {
63 return null;
64 }
65
66 return getSession().getObject(sourceId, context);
67 } finally {
68 readUnlock();
69 }
70 }
71
72 public ObjectId getSourceId() {
73 String sourceId = getPropertyValue(PropertyIds.SOURCE_ID);
74 if ((sourceId == null) || (sourceId.length() == 0)) {
75 return null;
76 }
77
78 return getSession().createObjectId(sourceId);
79 }
80
81 public CmisObject getTarget() {
82 return getTarget(getSession().getDefaultContext());
83 }
84
85 public CmisObject getTarget(OperationContext context) {
86 readLock();
87 try {
88 ObjectId targetId = getTargetId();
89 if (targetId == null) {
90 return null;
91 }
92
93 return getSession().getObject(targetId, context);
94 } finally {
95 readUnlock();
96 }
97 }
98
99 public ObjectId getTargetId() {
100 String targetId = getPropertyValue(PropertyIds.TARGET_ID);
101 if ((targetId == null) || (targetId.length() == 0)) {
102 return null;
103 }
104
105 return getSession().createObjectId(targetId);
106 }
107 }