You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2010/09/21 12:43:46 UTC
svn commit: r999305 - in
/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client:
chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/
chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/cli...
Author: fmui
Date: Tue Sep 21 10:43:46 2010
New Revision: 999305
URL: http://svn.apache.org/viewvc?rev=999305&view=rev
Log:
- added getSourceId() and getTargetId() to the Relationship interface (that allows access to the ids even if they are not reference valid objects)
Modified:
incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Relationship.java
incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PersistentRelationshipImpl.java
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Relationship.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Relationship.java?rev=999305&r1=999304&r2=999305&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Relationship.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Relationship.java Tue Sep 21 10:43:46 2010
@@ -28,22 +28,36 @@ public interface Relationship extends Cm
// relationship specific properties
/**
- * Gets the source object.
+ * Gets the source object. If the source object id is invalid,
+ * <code>null</code> will be returned.
*/
- CmisObject getSource(); // cmis:sourceId
+ CmisObject getSource();
/**
- * Gets the source object using the given {@link OperationContext}.
+ * Gets the source object using the given {@link OperationContext}. If the
+ * source object id is invalid, <code>null</code> will be returned.
*/
CmisObject getSource(OperationContext context);
/**
- * Gets the target object.
+ * Gets the source object id.
*/
- CmisObject getTarget(); // cmis:targetId
+ ObjectId getSourceId(); // cmis:sourceId
/**
- * Gets the target object using the given {@link OperationContext}.
+ * Gets the target object. If the target object id is invalid,
+ * <code>null</code> will be returned.
+ */
+ CmisObject getTarget();
+
+ /**
+ * Gets the target object using the given {@link OperationContext}. If the
+ * target object id is invalid, <code>null</code> will be returned.
*/
CmisObject getTarget(OperationContext context);
+
+ /**
+ * Gets the target object id.
+ */
+ ObjectId getTargetId(); // cmis:targetId
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PersistentRelationshipImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PersistentRelationshipImpl.java?rev=999305&r1=999304&r2=999305&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PersistentRelationshipImpl.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PersistentRelationshipImpl.java Tue Sep 21 10:43:46 2010
@@ -19,6 +19,7 @@
package org.apache.chemistry.opencmis.client.runtime;
import org.apache.chemistry.opencmis.client.api.CmisObject;
+import org.apache.chemistry.opencmis.client.api.ObjectId;
import org.apache.chemistry.opencmis.client.api.ObjectType;
import org.apache.chemistry.opencmis.client.api.OperationContext;
import org.apache.chemistry.opencmis.client.api.Relationship;
@@ -35,60 +36,57 @@ public class PersistentRelationshipImpl
initialize(session, objectType, objectData, context);
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.opencmis.client.api.Relationship#getSource()
- */
public CmisObject getSource() {
return getSource(getSession().getDefaultContext());
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.opencmis.client.api.Relationship#getSource()
- */
public CmisObject getSource(OperationContext context) {
readLock();
try {
- String sourceId = getPropertyValue(PropertyIds.SOURCE_ID);
+ ObjectId sourceId = getSourceId();
if (sourceId == null) {
return null;
}
- return getSession().getObject(getSession().createObjectId(sourceId), context);
+ return getSession().getObject(sourceId, context);
} finally {
readUnlock();
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.opencmis.client.api.Relationship#getTarget()
- */
+ public ObjectId getSourceId() {
+ String sourceId = getPropertyValue(PropertyIds.SOURCE_ID);
+ if ((sourceId == null) || (sourceId.length() == 0)) {
+ return null;
+ }
+
+ return getSession().createObjectId(sourceId);
+ }
+
public CmisObject getTarget() {
return getTarget(getSession().getDefaultContext());
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.opencmis.client.api.Relationship#getTarget()
- */
public CmisObject getTarget(OperationContext context) {
readLock();
try {
- String targetId = getPropertyValue(PropertyIds.TARGET_ID);
+ ObjectId targetId = getTargetId();
if (targetId == null) {
return null;
}
- return getSession().getObject(getSession().createObjectId(targetId), context);
+ return getSession().getObject(targetId, context);
} finally {
readUnlock();
}
}
+ public ObjectId getTargetId() {
+ String targetId = getPropertyValue(PropertyIds.TARGET_ID);
+ if ((targetId == null) || (targetId.length() == 0)) {
+ return null;
+ }
+
+ return getSession().createObjectId(targetId);
+ }
}