This project has retired. For details please refer to its
Attic page.
TransientRelationshipImpl 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.OperationContext;
24 import org.apache.chemistry.opencmis.client.api.TransientRelationship;
25 import org.apache.chemistry.opencmis.commons.PropertyIds;
26
27 public class TransientRelationshipImpl extends AbstractTransientCmisObject implements TransientRelationship {
28
29 public CmisObject getSource() {
30 return getSource(getSession().getDefaultContext());
31 }
32
33 public CmisObject getSource(OperationContext context) {
34 return getSession().getObject(getSourceId(), context);
35 }
36
37 public ObjectId getSourceId() {
38 String sourceId = getPropertyValue(PropertyIds.SOURCE_ID);
39 if ((sourceId == null) || (sourceId.length() == 0)) {
40 return null;
41 }
42
43 return getSession().createObjectId(sourceId);
44 }
45
46 public void setSourceId(ObjectId id) {
47 if ((id == null) || (id.getId() == null) || (id.getId().length() == 0)) {
48 throw new IllegalArgumentException("Id is invalid!");
49 }
50
51 setPropertyValue(PropertyIds.SOURCE_ID, id.getId());
52 }
53
54 public CmisObject getTarget() {
55 return getTarget(getSession().getDefaultContext());
56 }
57
58 public CmisObject getTarget(OperationContext context) {
59 return getSession().getObject(getTargetId(), context);
60 }
61
62 public ObjectId getTargetId() {
63 String targetId = getPropertyValue(PropertyIds.TARGET_ID);
64 if ((targetId == null) || (targetId.length() == 0)) {
65 return null;
66 }
67
68 return getSession().createObjectId(targetId);
69 }
70
71 public void setTargetId(ObjectId id) {
72 if ((id == null) || (id.getId() == null) || (id.getId().length() == 0)) {
73 throw new IllegalArgumentException("Id is invalid!");
74 }
75
76 setPropertyValue(PropertyIds.TARGET_ID, id.getId());
77 }
78 }