Return-Path: Delivered-To: apmail-incubator-chemistry-commits-archive@minotaur.apache.org Received: (qmail 37362 invoked from network); 21 Sep 2010 10:44:27 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 21 Sep 2010 10:44:27 -0000 Received: (qmail 29501 invoked by uid 500); 21 Sep 2010 10:44:27 -0000 Delivered-To: apmail-incubator-chemistry-commits-archive@incubator.apache.org Received: (qmail 29451 invoked by uid 500); 21 Sep 2010 10:44:26 -0000 Mailing-List: contact chemistry-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: chemistry-dev@incubator.apache.org Delivered-To: mailing list chemistry-commits@incubator.apache.org Received: (qmail 29443 invoked by uid 99); 21 Sep 2010 10:44:25 -0000 Received: from Unknown (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Sep 2010 10:44:25 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Sep 2010 10:44:07 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 9FDE423889DA; Tue, 21 Sep 2010 10:43:46 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: 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... Date: Tue, 21 Sep 2010 10:43:46 -0000 To: chemistry-commits@incubator.apache.org From: fmui@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100921104346.9FDE423889DA@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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, + * null 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, null 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, + * null will be returned. + */ + CmisObject getTarget(); + + /** + * Gets the target object using the given {@link OperationContext}. If the + * target object id is invalid, null 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); + } }