Return-Path: Delivered-To: apmail-incubator-chemistry-dev-archive@minotaur.apache.org Received: (qmail 14019 invoked from network); 23 Apr 2010 09:42:24 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 23 Apr 2010 09:42:24 -0000 Received: (qmail 92800 invoked by uid 500); 23 Apr 2010 09:42:24 -0000 Delivered-To: apmail-incubator-chemistry-dev-archive@incubator.apache.org Received: (qmail 92709 invoked by uid 500); 23 Apr 2010 09:42:22 -0000 Mailing-List: contact chemistry-dev-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-dev@incubator.apache.org Received: (qmail 92701 invoked by uid 99); 23 Apr 2010 09:42:22 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Apr 2010 09:42:22 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of fguillaume@nuxeo.com designates 209.85.219.213 as permitted sender) Received: from [209.85.219.213] (HELO mail-ew0-f213.google.com) (209.85.219.213) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Apr 2010 09:42:13 +0000 Received: by ewy5 with SMTP id 5so2790079ewy.0 for ; Fri, 23 Apr 2010 02:41:53 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.106.142 with HTTP; Fri, 23 Apr 2010 02:41:52 -0700 (PDT) Date: Fri, 23 Apr 2010 11:41:52 +0200 Received: by 10.102.182.28 with SMTP id e28mr3170570muf.78.1272015712142; Fri, 23 Apr 2010 02:41:52 -0700 (PDT) Message-ID: Subject: Re: svn commit: r937209 [1/3] - in /incubator/chemistry/opencmis/trunk: chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/ chemistry-opencmis-commons/chemistry-opencmis-commons-impl/sr From: Florent Guillaume To: Stephan Klevenz Cc: List-Chemistry Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Hi, You seem to be using 8-space indentation, which is different from the rest of the code, and produces (as you can see) huge diffs which completely hide the actual code changes. We're using 4-space indentation now, could you please update your code formatter? Thanks, Florent On Fri, Apr 23, 2010 at 11:28 AM, sklevenz wrote: > Author: sklevenz > Date: Fri Apr 23 09:28:57 2010 > New Revision: 937209 > > URL: http://svn.apache.org/viewvc?rev=3D937209&view=3Drev > Log: > Implementation of PagingIterable Interface > JUnit Test implementations > Bugfixes of PagingIterable implementation > > Added: > =A0 =A0incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemist= ry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtim= e/WriteObjectRelationIT.java =A0 (with props) > =A0 =A0incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemist= ry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtim= e/WriteObjectVersionIT.java =A0 (with props) > Modified: > =A0 =A0incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemi= stry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/clien= t/runtime/AbstractPersistentCmisObject.java > =A0 =A0incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemi= stry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/clien= t/runtime/PersistentFolderImpl.java > =A0 =A0incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemi= stry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/clien= t/runtime/PersistentSessionImpl.java > =A0 =A0incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chem= istry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/com= mons/impl/dataobjects/DocumentTypeDefinitionImpl.java > =A0 =A0incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemist= ry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtim= e/WriteObjectIT.java > > Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/ch= emistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/cl= ient/runtime/AbstractPersistentCmisObject.java > URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chem= istry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apac= he/chemistry/opencmis/client/runtime/AbstractPersistentCmisObject.java?rev= =3D937209&r1=3D937208&r2=3D937209&view=3Ddiff > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistr= y-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/r= untime/AbstractPersistentCmisObject.java (original) > +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistr= y-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/r= untime/AbstractPersistentCmisObject.java Fri Apr 23 09:28:57 2010 > @@ -39,6 +39,8 @@ import org.apache.chemistry.opencmis.cli > =A0import org.apache.chemistry.opencmis.client.api.Property; > =A0import org.apache.chemistry.opencmis.client.api.Relationship; > =A0import org.apache.chemistry.opencmis.client.api.Rendition; > +import org.apache.chemistry.opencmis.client.runtime.util.AbstractPageFet= ch; > +import org.apache.chemistry.opencmis.client.runtime.util.DefaultPagingIt= erable; > =A0import org.apache.chemistry.opencmis.commons.PropertyIds; > =A0import org.apache.chemistry.opencmis.commons.api.Ace; > =A0import org.apache.chemistry.opencmis.commons.api.Acl; > @@ -46,7 +48,9 @@ import org.apache.chemistry.opencmis.com > =A0import org.apache.chemistry.opencmis.commons.api.CmisBinding; > =A0import org.apache.chemistry.opencmis.commons.api.Holder; > =A0import org.apache.chemistry.opencmis.commons.api.ObjectData; > +import org.apache.chemistry.opencmis.commons.api.ObjectList; > =A0import org.apache.chemistry.opencmis.commons.api.PropertyDefinition; > +import org.apache.chemistry.opencmis.commons.api.RelationshipService; > =A0import org.apache.chemistry.opencmis.commons.api.RenditionData; > =A0import org.apache.chemistry.opencmis.commons.enums.AclPropagation; > =A0import org.apache.chemistry.opencmis.commons.enums.BaseTypeId; > @@ -59,882 +63,868 @@ import org.apache.chemistry.opencmis.com > =A0*/ > =A0public abstract class AbstractPersistentCmisObject implements CmisObje= ct { > > - =A0 =A0private PersistentSessionImpl session; > - =A0 =A0private ObjectType objectType; > - =A0 =A0private Map> properties; > - =A0 =A0private AllowableActions allowableActions; > - =A0 =A0private List renditions; > - =A0 =A0private Acl acl; > - =A0 =A0private List policies; > - =A0 =A0private List relationships; > - =A0 =A0private OperationContext creationContext; > - =A0 =A0private boolean isChanged =3D false; > - =A0 =A0private long refreshTimestamp; > - > - =A0 =A0private final ReentrantReadWriteLock fLock =3D new ReentrantRead= WriteLock(); > - > - =A0 =A0/** > - =A0 =A0 * Initializes the object. > - =A0 =A0 */ > - =A0 =A0protected void initialize(PersistentSessionImpl session, ObjectT= ype objectType, ObjectData objectData, > - =A0 =A0 =A0 =A0 =A0 =A0OperationContext context) { > - =A0 =A0 =A0 =A0if (session =3D=3D null) { > - =A0 =A0 =A0 =A0 =A0 =A0throw new IllegalArgumentException("Session must= be set!"); > - =A0 =A0 =A0 =A0} > - > - =A0 =A0 =A0 =A0if (objectType =3D=3D null) { > - =A0 =A0 =A0 =A0 =A0 =A0throw new IllegalArgumentException("Object type = must be set!"); > - =A0 =A0 =A0 =A0} > - > - =A0 =A0 =A0 =A0if (objectType.getPropertyDefinitions().size() < 9) { > - =A0 =A0 =A0 =A0 =A0 =A0// there must be at least the 9 standard propert= ies that all objects > - =A0 =A0 =A0 =A0 =A0 =A0// have > - =A0 =A0 =A0 =A0 =A0 =A0throw new IllegalArgumentException("Object type = must have property defintions!"); > - =A0 =A0 =A0 =A0} > - > - =A0 =A0 =A0 =A0this.session =3D session; > - =A0 =A0 =A0 =A0this.objectType =3D objectType; > - =A0 =A0 =A0 =A0this.creationContext =3D new OperationContextImpl(contex= t); > - =A0 =A0 =A0 =A0this.refreshTimestamp =3D System.currentTimeMillis(); > - > - =A0 =A0 =A0 =A0ObjectFactory of =3D getObjectFactory(); > - > - =A0 =A0 =A0 =A0if (objectData !=3D null) { > - =A0 =A0 =A0 =A0 =A0 =A0// handle properties > - =A0 =A0 =A0 =A0 =A0 =A0if (objectData.getProperties() !=3D null) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0this.properties =3D of.convertProperties= (objectType, objectData.getProperties()); > - =A0 =A0 =A0 =A0 =A0 =A0} > - > - =A0 =A0 =A0 =A0 =A0 =A0// handle allowable actions > - =A0 =A0 =A0 =A0 =A0 =A0if (objectData.getAllowableActions() !=3D null) = { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0this.allowableActions =3D objectData.get= AllowableActions(); > - =A0 =A0 =A0 =A0 =A0 =A0} > - > - =A0 =A0 =A0 =A0 =A0 =A0// handle renditions > - =A0 =A0 =A0 =A0 =A0 =A0if (objectData.getRenditions() !=3D null) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0this.renditions =3D new ArrayList(); > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0for (RenditionData rd : objectData.getRe= nditions()) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0this.renditions.add(of.convertRe= ndition(getId(), rd)); > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} > - =A0 =A0 =A0 =A0 =A0 =A0} > - > - =A0 =A0 =A0 =A0 =A0 =A0// handle ACL > - =A0 =A0 =A0 =A0 =A0 =A0if (objectData.getAcl() !=3D null) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0acl =3D objectData.getAcl(); > - =A0 =A0 =A0 =A0 =A0 =A0} > - > - =A0 =A0 =A0 =A0 =A0 =A0// handle policies > - =A0 =A0 =A0 =A0 =A0 =A0if ((objectData.getPolicyIds() !=3D null) && (ob= jectData.getPolicyIds().getPolicyIds() !=3D null)) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0policies =3D new ArrayList(); > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0for (String pid : objectData.getPolicyId= s().getPolicyIds()) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0CmisObject policy =3D session.ge= tObject(getSession().createObjectId(pid)); > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (policy instanceof Policy) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0policies.add((Policy) po= licy); > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} > - =A0 =A0 =A0 =A0 =A0 =A0} > - > - =A0 =A0 =A0 =A0 =A0 =A0// handle relationships > - =A0 =A0 =A0 =A0 =A0 =A0if (objectData.getRelationships() !=3D null) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0relationships =3D new ArrayList(); > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0for (ObjectData rod : objectData.getRela= tionships()) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0CmisObject relationship =3D of.c= onvertObject(rod, this.creationContext); > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (relationship instanceof Rela= tionship) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0relationships.add((Relat= ionship) relationship); > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} > - =A0 =A0 =A0 =A0 =A0 =A0} > - =A0 =A0 =A0 =A0} > - > - =A0 =A0 =A0 =A0isChanged =3D false; > - =A0 =A0} > - > - =A0 =A0/** > - =A0 =A0 * Acquires a write lock. > - =A0 =A0 */ > - =A0 =A0protected void writeLock() { > - =A0 =A0 =A0 =A0fLock.writeLock().lock(); > - =A0 =A0} > - > - =A0 =A0/** > - =A0 =A0 * Releases a write lock. > - =A0 =A0 */ > - =A0 =A0protected void writeUnlock() { > - =A0 =A0 =A0 =A0fLock.writeLock().unlock(); > - =A0 =A0} > - > - =A0 =A0/** > - =A0 =A0 * Acquires a read lock. > - =A0 =A0 */ > - =A0 =A0protected void readLock() { > - =A0 =A0 =A0 =A0fLock.readLock().lock(); > - =A0 =A0} > - > - =A0 =A0/** > - =A0 =A0 * Releases a read lock. > - =A0 =A0 */ > - =A0 =A0protected void readUnlock() { > - =A0 =A0 =A0 =A0fLock.readLock().unlock(); > - =A0 =A0} > - > - =A0 =A0/** > - =A0 =A0 * Returns the session object. > - =A0 =A0 */ > - =A0 =A0protected PersistentSessionImpl getSession() { > - =A0 =A0 =A0 =A0return this.session; > - =A0 =A0} > - > - =A0 =A0/** > - =A0 =A0 * Returns the repository id. > - =A0 =A0 */ > - =A0 =A0protected String getRepositoryId() { > - =A0 =A0 =A0 =A0return getSession().getRepositoryId(); > - =A0 =A0} > - > - =A0 =A0/** > - =A0 =A0 * Returns the object type. > - =A0 =A0 */ > - =A0 =A0protected ObjectType getObjectType() { > - =A0 =A0 =A0 =A0readLock(); > - =A0 =A0 =A0 =A0try { > - =A0 =A0 =A0 =A0 =A0 =A0return this.objectType; > - =A0 =A0 =A0 =A0} finally { > - =A0 =A0 =A0 =A0 =A0 =A0readUnlock(); > - =A0 =A0 =A0 =A0} > - =A0 =A0} > - > - =A0 =A0/** > - =A0 =A0 * Returns the binding object. > - =A0 =A0 */ > - =A0 =A0protected CmisBinding getBinding() { > - =A0 =A0 =A0 =A0return getSession().getBinding(); > - =A0 =A0} > - > - =A0 =A0/** > - =A0 =A0 * Returns the object factory. > - =A0 =A0 */ > - =A0 =A0protected ObjectFactory getObjectFactory() { > - =A0 =A0 =A0 =A0return getSession().getObjectFactory(); > - =A0 =A0} > - > - =A0 =A0/** > - =A0 =A0 * Returns the id of this object or throws an exception if the i= d is > - =A0 =A0 * unknown. > - =A0 =A0 */ > - =A0 =A0protected String getObjectId() { > - =A0 =A0 =A0 =A0String objectId =3D getId(); > - =A0 =A0 =A0 =A0if (objectId =3D=3D null) { > - =A0 =A0 =A0 =A0 =A0 =A0throw new IllegalStateException("Object Id is un= known!"); > - =A0 =A0 =A0 =A0} > - > - =A0 =A0 =A0 =A0return objectId; > - =A0 =A0} > - > - =A0 =A0// --- operations --- > - > - =A0 =A0/* > - =A0 =A0 * (non-Javadoc) > - =A0 =A0 * > - =A0 =A0 * @see org.apache.opencmis.client.api.CmisObject#delete(boolean= ) > - =A0 =A0 */ > - =A0 =A0public void delete(boolean allVersions) { > - =A0 =A0 =A0 =A0String objectId =3D getObjectId(); > - =A0 =A0 =A0 =A0getBinding().getObjectService().deleteObject(getReposito= ryId(), objectId, allVersions, null); > - =A0 =A0} > - > - =A0 =A0/* > - =A0 =A0 * (non-Javadoc) > - =A0 =A0 * > - =A0 =A0 * @see org.apache.opencmis.client.api.CmisObject#updateProperti= es() > - =A0 =A0 */ > - =A0 =A0public ObjectId updateProperties() { > - =A0 =A0 =A0 =A0readLock(); > - =A0 =A0 =A0 =A0try { > - =A0 =A0 =A0 =A0 =A0 =A0String objectId =3D getObjectId(); > - =A0 =A0 =A0 =A0 =A0 =A0Holder objectIdHolder =3D new Holder(objectId); > - > - =A0 =A0 =A0 =A0 =A0 =A0String changeToken =3D getChangeToken(); > - =A0 =A0 =A0 =A0 =A0 =A0Holder changeTokenHolder =3D new Holder<= String>(changeToken); > - > - =A0 =A0 =A0 =A0 =A0 =A0Set updatebility =3D new HashSet(); > - =A0 =A0 =A0 =A0 =A0 =A0updatebility.add(Updatability.READWRITE); > - > - =A0 =A0 =A0 =A0 =A0 =A0// check if checked out > - =A0 =A0 =A0 =A0 =A0 =A0Boolean isCheckedOut =3D getPropertyValue(Proper= tyIds.IS_VERSION_SERIES_CHECKED_OUT); > - =A0 =A0 =A0 =A0 =A0 =A0if ((isCheckedOut !=3D null) && isCheckedOut.boo= leanValue()) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0updatebility.add(Updatability.WHENCHECKE= DOUT); > - =A0 =A0 =A0 =A0 =A0 =A0} > - > - =A0 =A0 =A0 =A0 =A0 =A0// it's time to update > - =A0 =A0 =A0 =A0 =A0 =A0getBinding().getObjectService().updateProperties= (getRepositoryId(), objectIdHolder, changeTokenHolder, > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0getObjectFactory().convertProper= ties(this.properties, this.objectType, updatebility), null); > - > - =A0 =A0 =A0 =A0 =A0 =A0if (objectIdHolder.getValue() =3D=3D null) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return null; > - =A0 =A0 =A0 =A0 =A0 =A0} > - > - =A0 =A0 =A0 =A0 =A0 =A0return getSession().createObjectId(objectIdHolde= r.getValue()); > - =A0 =A0 =A0 =A0} finally { > - =A0 =A0 =A0 =A0 =A0 =A0readUnlock(); > - =A0 =A0 =A0 =A0} > - =A0 =A0} > - > - =A0 =A0/* > - =A0 =A0 * (non-Javadoc) > - =A0 =A0 * > - =A0 =A0 * @see > - =A0 =A0 * org.apache.opencmis.client.api.CmisObject#updateProperties(ja= va.util.Map) > - =A0 =A0 */ > - =A0 =A0public ObjectId updateProperties(Map properties) { > - =A0 =A0 =A0 =A0if ((properties =3D=3D null) || (properties.isEmpty())) = { > - =A0 =A0 =A0 =A0 =A0 =A0throw new IllegalArgumentException("Properties m= ust not be empty!"); > - =A0 =A0 =A0 =A0} > - > - =A0 =A0 =A0 =A0readLock(); > - =A0 =A0 =A0 =A0try { > - =A0 =A0 =A0 =A0 =A0 =A0String objectId =3D getObjectId(); > - =A0 =A0 =A0 =A0 =A0 =A0Holder objectIdHolder =3D new Holder(objectId); > - > - =A0 =A0 =A0 =A0 =A0 =A0String changeToken =3D getChangeToken(); > - =A0 =A0 =A0 =A0 =A0 =A0Holder changeTokenHolder =3D new Holder<= String>(changeToken); > - > - =A0 =A0 =A0 =A0 =A0 =A0Set updatebility =3D new HashSet(); > - =A0 =A0 =A0 =A0 =A0 =A0updatebility.add(Updatability.READWRITE); > - > - =A0 =A0 =A0 =A0 =A0 =A0// check if checked out > - =A0 =A0 =A0 =A0 =A0 =A0Boolean isCheckedOut =3D getPropertyValue(Proper= tyIds.IS_VERSION_SERIES_CHECKED_OUT); > - =A0 =A0 =A0 =A0 =A0 =A0if ((isCheckedOut !=3D null) && isCheckedOut.boo= leanValue()) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0updatebility.add(Updatability.WHENCHECKE= DOUT); > - =A0 =A0 =A0 =A0 =A0 =A0} > - > - =A0 =A0 =A0 =A0 =A0 =A0// it's time to update > - =A0 =A0 =A0 =A0 =A0 =A0getBinding().getObjectService().updateProperties= (getRepositoryId(), objectIdHolder, changeTokenHolder, > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0getObjectFactory().convertProper= ties(properties, this.objectType, updatebility), null); > - > - =A0 =A0 =A0 =A0 =A0 =A0if (objectIdHolder.getValue() =3D=3D null) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return null; > - =A0 =A0 =A0 =A0 =A0 =A0} > - > - =A0 =A0 =A0 =A0 =A0 =A0return getSession().createObjectId(objectIdHolde= r.getValue()); > - =A0 =A0 =A0 =A0} finally { > - =A0 =A0 =A0 =A0 =A0 =A0readUnlock(); > - =A0 =A0 =A0 =A0} > - =A0 =A0} > - > - =A0 =A0// --- properties --- > - > - =A0 =A0/* > - =A0 =A0 * (non-Javadoc) > - =A0 =A0 * > - =A0 =A0 * @see org.apache.opencmis.client.api.CmisObject#getBaseType() > - =A0 =A0 */ > - =A0 =A0public ObjectType getBaseType() { > - =A0 =A0 =A0 =A0BaseTypeId baseTypeId =3D getBaseTypeId(); > - =A0 =A0 =A0 =A0if (baseTypeId =3D=3D null) { > - =A0 =A0 =A0 =A0 =A0 =A0return null; > - =A0 =A0 =A0 =A0} > - > - =A0 =A0 =A0 =A0return getSession().getTypeDefinition(baseTypeId.value()= ); > - =A0 =A0} > - > - =A0 =A0/* > - =A0 =A0 * (non-Javadoc) > - =A0 =A0 * > - =A0 =A0 * @see org.apache.opencmis.client.api.CmisObject#getBaseTypeId(= ) > - =A0 =A0 */ > - =A0 =A0public BaseTypeId getBaseTypeId() { > - =A0 =A0 =A0 =A0String baseType =3D getPropertyValue(PropertyIds.BASE_TY= PE_ID); > - =A0 =A0 =A0 =A0if (baseType =3D=3D null) { > - =A0 =A0 =A0 =A0 =A0 =A0return null; > - =A0 =A0 =A0 =A0} > - > - =A0 =A0 =A0 =A0return BaseTypeId.fromValue(baseType); > - =A0 =A0} > - > - =A0 =A0/* > - =A0 =A0 * (non-Javadoc) > - =A0 =A0 * > - =A0 =A0 * @see org.apache.opencmis.client.api.CmisObject#getChangeToken= () > - =A0 =A0 */ > - =A0 =A0public String getChangeToken() { > - =A0 =A0 =A0 =A0return getPropertyValue(PropertyIds.CHANGE_TOKEN); > - =A0 =A0} > - > - =A0 =A0/* > - =A0 =A0 * (non-Javadoc) > - =A0 =A0 * > - =A0 =A0 * @see org.apache.opencmis.client.api.CmisObject#getCreatedBy() > - =A0 =A0 */ > - =A0 =A0public String getCreatedBy() { > - =A0 =A0 =A0 =A0return getPropertyValue(PropertyIds.CREATED_BY); > - =A0 =A0} > - > - =A0 =A0/* > - =A0 =A0 * (non-Javadoc) > - =A0 =A0 * > - =A0 =A0 * @see org.apache.opencmis.client.api.CmisObject#getCreationDat= e() > - =A0 =A0 */ > - =A0 =A0public GregorianCalendar getCreationDate() { > - =A0 =A0 =A0 =A0return getPropertyValue(PropertyIds.CREATION_DATE); > - =A0 =A0} > - > - =A0 =A0/* > - =A0 =A0 * (non-Javadoc) > - =A0 =A0 * > - =A0 =A0 * @see org.apache.opencmis.client.api.CmisObject#getId() > - =A0 =A0 */ > - =A0 =A0public String getId() { > - =A0 =A0 =A0 =A0return getPropertyValue(PropertyIds.OBJECT_ID); > - =A0 =A0} > - > - =A0 =A0/* > - =A0 =A0 * (non-Javadoc) > - =A0 =A0 * > - =A0 =A0 * @see org.apache.opencmis.client.api.CmisObject#getLastModific= ationDate() > - =A0 =A0 */ > - =A0 =A0public GregorianCalendar getLastModificationDate() { > - =A0 =A0 =A0 =A0return getPropertyValue(PropertyIds.LAST_MODIFICATION_DA= TE); > - =A0 =A0} > - > - =A0 =A0/* > - =A0 =A0 * (non-Javadoc) > - =A0 =A0 * > - =A0 =A0 * @see org.apache.opencmis.client.api.CmisObject#getLastModifie= dBy() > - =A0 =A0 */ > - =A0 =A0public String getLastModifiedBy() { > - =A0 =A0 =A0 =A0return getPropertyValue(PropertyIds.LAST_MODIFIED_BY); > - =A0 =A0} > - > - =A0 =A0/* > - =A0 =A0 * (non-Javadoc) > - =A0 =A0 * > - =A0 =A0 * @see org.apache.opencmis.client.api.CmisObject#getName() > - =A0 =A0 */ > - =A0 =A0public String getName() { > - =A0 =A0 =A0 =A0return getPropertyValue(PropertyIds.NAME); > - =A0 =A0} > - > - =A0 =A0/* > - =A0 =A0 * (non-Javadoc) > - =A0 =A0 * > - =A0 =A0 * @see org.apache.opencmis.client.api.CmisObject#getProperties(= ) > - =A0 =A0 */ > - =A0 =A0public List> getProperties() { > - =A0 =A0 =A0 =A0readLock(); > - =A0 =A0 =A0 =A0try { > - =A0 =A0 =A0 =A0 =A0 =A0return new ArrayList>(this.propertie= s.values()); > - =A0 =A0 =A0 =A0} finally { > - =A0 =A0 =A0 =A0 =A0 =A0readUnlock(); > - =A0 =A0 =A0 =A0} > - =A0 =A0} > - > - =A0 =A0/* > - =A0 =A0 * (non-Javadoc) > - =A0 =A0 * > - =A0 =A0 * @see > - =A0 =A0 * org.apache.opencmis.client.api.CmisObject#getProperty(java.la= ng.String) > - =A0 =A0 */ > - =A0 =A0@SuppressWarnings("unchecked") > - =A0 =A0public Property getProperty(String id) { > - =A0 =A0 =A0 =A0readLock(); > - =A0 =A0 =A0 =A0try { > - =A0 =A0 =A0 =A0 =A0 =A0return (Property) this.properties.get(id); > - =A0 =A0 =A0 =A0} finally { > - =A0 =A0 =A0 =A0 =A0 =A0readUnlock(); > - =A0 =A0 =A0 =A0} > - =A0 =A0} > - > - =A0 =A0/* > - =A0 =A0 * (non-Javadoc) > - =A0 =A0 * > - =A0 =A0 * @see > - =A0 =A0 * org.apache.opencmis.client.api.CmisObject#getPropertyMultival= ue(java. > - =A0 =A0 * lang.String) > - =A0 =A0 */ > - =A0 =A0public List getPropertyMultivalue(String id) { > - =A0 =A0 =A0 =A0Property property =3D getProperty(id); > - =A0 =A0 =A0 =A0if (property =3D=3D null) { > - =A0 =A0 =A0 =A0 =A0 =A0return null; > - =A0 =A0 =A0 =A0} > - > - =A0 =A0 =A0 =A0return property.getValues(); > - =A0 =A0} > - > - =A0 =A0/* > - =A0 =A0 * (non-Javadoc) > - =A0 =A0 * > - =A0 =A0 * @see > - =A0 =A0 * org.apache.opencmis.client.api.CmisObject#getPropertyValue(ja= va.lang. > - =A0 =A0 * String) > - =A0 =A0 */ > - =A0 =A0public T getPropertyValue(String id) { > - =A0 =A0 =A0 =A0Property property =3D getProperty(id); > - =A0 =A0 =A0 =A0if (property =3D=3D null) { > - =A0 =A0 =A0 =A0 =A0 =A0return null; > - =A0 =A0 =A0 =A0} > - > - =A0 =A0 =A0 =A0return property.getFirstValue(); > - =A0 =A0} > - > - =A0 =A0/* > - =A0 =A0 * (non-Javadoc) > - =A0 =A0 * > - =A0 =A0 * @see org.apache.opencmis.client.api.CmisObject#setName(java.l= ang.String) > - =A0 =A0 */ > - =A0 =A0public void setName(String name) { > - =A0 =A0 =A0 =A0setProperty(PropertyIds.NAME, name); > - =A0 =A0} > - > - =A0 =A0/* > - =A0 =A0 * (non-Javadoc) > - =A0 =A0 * > - =A0 =A0 * @see > - =A0 =A0 * org.apache.opencmis.client.api.CmisObject#setProperty(java.la= ng.String, > - =A0 =A0 * java.lang.Object) > - =A0 =A0 */ > - =A0 =A0@SuppressWarnings("unchecked") > - =A0 =A0public void setProperty(String id, T value) { > - =A0 =A0 =A0 =A0PropertyDefinition propertyDefinition =3D checkProper= ty(id, value); > - > - =A0 =A0 =A0 =A0// check updatability > - =A0 =A0 =A0 =A0if (propertyDefinition.getUpdatability() =3D=3D Updatabi= lity.READONLY) { > - =A0 =A0 =A0 =A0 =A0 =A0throw new IllegalArgumentException("Property is = read-only!"); > - =A0 =A0 =A0 =A0} > - > - =A0 =A0 =A0 =A0// create property > - =A0 =A0 =A0 =A0Property newProperty =3D (Property) getObjectFacto= ry().createProperty( > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(PropertyDefinition) propertyDefiniti= on, value); > - > - =A0 =A0 =A0 =A0writeLock(); > - =A0 =A0 =A0 =A0try { > - =A0 =A0 =A0 =A0 =A0 =A0setChanged(); > - =A0 =A0 =A0 =A0 =A0 =A0this.properties.put(id, newProperty); > - =A0 =A0 =A0 =A0} finally { > - =A0 =A0 =A0 =A0 =A0 =A0writeUnlock(); > - =A0 =A0 =A0 =A0} > - =A0 =A0} > - > - =A0 =A0/* > - =A0 =A0 * (non-Javadoc) > - =A0 =A0 * > - =A0 =A0 * @see > - =A0 =A0 * org.apache.opencmis.client.api.CmisObject#setPropertyMultival= ue(java. > - =A0 =A0 * lang.String, java.util.List) > - =A0 =A0 */ > - =A0 =A0@SuppressWarnings("unchecked") > - =A0 =A0public void setPropertyMultivalue(String id, List value) = { > - =A0 =A0 =A0 =A0PropertyDefinition propertyDefinition =3D checkProper= ty(id, value); > - > - =A0 =A0 =A0 =A0// check updatability > - =A0 =A0 =A0 =A0if (propertyDefinition.getUpdatability() =3D=3D Updatabi= lity.READONLY) { > - =A0 =A0 =A0 =A0 =A0 =A0throw new IllegalArgumentException("Property is = read-only!"); > - =A0 =A0 =A0 =A0} > - > - =A0 =A0 =A0 =A0// create property > - =A0 =A0 =A0 =A0Property newProperty =3D (Property) getObjectFacto= ry().createPropertyMultivalue( > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(PropertyDefinition) propertyDefiniti= on, value); > - > - =A0 =A0 =A0 =A0writeLock(); > - =A0 =A0 =A0 =A0try { > - =A0 =A0 =A0 =A0 =A0 =A0setChanged(); > - =A0 =A0 =A0 =A0 =A0 =A0this.properties.put(id, newProperty); > - =A0 =A0 =A0 =A0} finally { > - =A0 =A0 =A0 =A0 =A0 =A0writeUnlock(); > - =A0 =A0 =A0 =A0} > - =A0 =A0} > - > - =A0 =A0/* > - =A0 =A0 * (non-Javadoc) > - =A0 =A0 * > - =A0 =A0 * @see org.apache.opencmis.client.api.CmisObject#getType() > - =A0 =A0 */ > - =A0 =A0public ObjectType getType() { > - =A0 =A0 =A0 =A0readLock(); > - =A0 =A0 =A0 =A0try { > - =A0 =A0 =A0 =A0 =A0 =A0return this.objectType; > - =A0 =A0 =A0 =A0} finally { > - =A0 =A0 =A0 =A0 =A0 =A0readUnlock(); > - =A0 =A0 =A0 =A0} > - =A0 =A0} > - > - =A0 =A0// --- allowable actions --- > - > - =A0 =A0/* > - =A0 =A0 * (non-Javadoc) > - =A0 =A0 * > - =A0 =A0 * @see org.apache.opencmis.client.api.CmisObject#getAllowableAc= tions() > - =A0 =A0 */ > - =A0 =A0public AllowableActions getAllowableActions() { > - =A0 =A0 =A0 =A0readLock(); > - =A0 =A0 =A0 =A0try { > - =A0 =A0 =A0 =A0 =A0 =A0return this.allowableActions; > - =A0 =A0 =A0 =A0} finally { > - =A0 =A0 =A0 =A0 =A0 =A0readUnlock(); > - =A0 =A0 =A0 =A0} > - =A0 =A0} > - > - =A0 =A0// --- renditions --- > - > - =A0 =A0/* > - =A0 =A0 * (non-Javadoc) > - =A0 =A0 * > - =A0 =A0 * @see org.apache.opencmis.client.api.CmisObject#getRenditions(= ) > - =A0 =A0 */ > - =A0 =A0public List getRenditions() { > - =A0 =A0 =A0 =A0readLock(); > - =A0 =A0 =A0 =A0try { > - =A0 =A0 =A0 =A0 =A0 =A0return this.renditions; > - =A0 =A0 =A0 =A0} finally { > - =A0 =A0 =A0 =A0 =A0 =A0readUnlock(); > - =A0 =A0 =A0 =A0} > - =A0 =A0} > - > - =A0 =A0// --- ACL --- > - > - =A0 =A0/* > - =A0 =A0 * (non-Javadoc) > - =A0 =A0 * > - =A0 =A0 * @see org.apache.opencmis.client.api.CmisObject#getAcl(boolean= ) > - =A0 =A0 */ > - =A0 =A0public Acl getAcl(boolean onlyBasicPermissions) { > - =A0 =A0 =A0 =A0String objectId =3D getObjectId(); > - =A0 =A0 =A0 =A0return getBinding().getAclService().getAcl(getRepository= Id(), objectId, onlyBasicPermissions, null); > - =A0 =A0} > - > - =A0 =A0/* > - =A0 =A0 * (non-Javadoc) > - =A0 =A0 * > - =A0 =A0 * @see org.apache.opencmis.client.api.CmisObject#applyAcl(java.= util.List, > - =A0 =A0 * java.util.List, org.apache.opencmis.commons.enums.AclPropagat= ion) > - =A0 =A0 */ > - =A0 =A0public Acl applyAcl(List addAces, List removeAces, Acl= Propagation aclPropagation) { > - =A0 =A0 =A0 =A0String objectId =3D getObjectId(); > - > - =A0 =A0 =A0 =A0ObjectFactory of =3D getObjectFactory(); > - > - =A0 =A0 =A0 =A0return getBinding().getAclService().applyAcl(getReposito= ryId(), objectId, of.convertAces(addAces), > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0of.convertAces(removeAces), aclPropagati= on, null); > - =A0 =A0} > - > - =A0 =A0/* > - =A0 =A0 * (non-Javadoc) > - =A0 =A0 * > - =A0 =A0 * @see org.apache.opencmis.client.api.CmisObject#addAcl(java.ut= il.List, > - =A0 =A0 * org.apache.opencmis.commons.enums.AclPropagation) > - =A0 =A0 */ > - =A0 =A0public void addAcl(List addAces, AclPropagation aclPropagat= ion) { > - =A0 =A0 =A0 =A0applyAcl(addAces, null, aclPropagation); > - =A0 =A0} > - > - =A0 =A0/* > - =A0 =A0 * (non-Javadoc) > - =A0 =A0 * > - =A0 =A0 * @see org.apache.opencmis.client.api.CmisObject#removeAcl(java= .util.List, > - =A0 =A0 * org.apache.opencmis.commons.enums.AclPropagation) > - =A0 =A0 */ > - =A0 =A0public void removeAcl(List removeAces, AclPropagation aclPr= opagation) { > - =A0 =A0 =A0 =A0applyAcl(null, removeAces, aclPropagation); > - =A0 =A0} > - > - =A0 =A0/* > - =A0 =A0 * (non-Javadoc) > - =A0 =A0 * > - =A0 =A0 * @see org.apache.opencmis.client.api.CmisObject#getAcl() > - =A0 =A0 */ > - =A0 =A0public Acl getAcl() { > - =A0 =A0 =A0 =A0readLock(); > - =A0 =A0 =A0 =A0try { > - =A0 =A0 =A0 =A0 =A0 =A0return this.acl; > - =A0 =A0 =A0 =A0} finally { > - =A0 =A0 =A0 =A0 =A0 =A0readUnlock(); > - =A0 =A0 =A0 =A0} > - =A0 =A0} > - > - =A0 =A0// --- policies --- > - > - =A0 =A0/* > - =A0 =A0 * (non-Javadoc) > - =A0 =A0 * > - =A0 =A0 * @see > - =A0 =A0 * org.apache.opencmis.client.api.CmisObject#applyPolicy(org.apa= che.opencmis > - =A0 =A0 * .client.api.ObjectId) > - =A0 =A0 */ > - =A0 =A0public void applyPolicy(ObjectId policyId) { > - =A0 =A0 =A0 =A0if ((policyId =3D=3D null) || (policyId.getId() =3D=3D n= ull)) { > - =A0 =A0 =A0 =A0 =A0 =A0throw new IllegalArgumentException("Policy Id is= not set!"); > - =A0 =A0 =A0 =A0} > - > - =A0 =A0 =A0 =A0String objectId =3D getObjectId(); > - =A0 =A0 =A0 =A0getBinding().getPolicyService().applyPolicy(getRepositor= yId(), policyId.getId(), objectId, null); > - =A0 =A0} > - > - =A0 =A0/* > - =A0 =A0 * (non-Javadoc) > - =A0 =A0 * > - =A0 =A0 * @see > - =A0 =A0 * org.apache.opencmis.client.api.CmisObject#removePolicy(org.ap= ache.opencmis > - =A0 =A0 * .client.api.ObjectId) > - =A0 =A0 */ > - =A0 =A0public void removePolicy(ObjectId policyId) { > - =A0 =A0 =A0 =A0if ((policyId =3D=3D null) || (policyId.getId() =3D=3D n= ull)) { > - =A0 =A0 =A0 =A0 =A0 =A0throw new IllegalArgumentException("Policy Id is= not set!"); > - =A0 =A0 =A0 =A0} > - > - =A0 =A0 =A0 =A0String objectId =3D getObjectId(); > - =A0 =A0 =A0 =A0getBinding().getPolicyService().removePolicy(getReposito= ryId(), policyId.getId(), objectId, null); > - =A0 =A0} > - > - =A0 =A0/* > - =A0 =A0 * (non-Javadoc) > - =A0 =A0 * > - =A0 =A0 * @see org.apache.opencmis.client.api.CmisObject#getPolicies() > - =A0 =A0 */ > - =A0 =A0public List getPolicies() { > - =A0 =A0 =A0 =A0readLock(); > - =A0 =A0 =A0 =A0try { > - =A0 =A0 =A0 =A0 =A0 =A0return this.policies; > - =A0 =A0 =A0 =A0} finally { > - =A0 =A0 =A0 =A0 =A0 =A0readUnlock(); > - =A0 =A0 =A0 =A0} > - =A0 =A0} > - > - =A0 =A0// --- relationships --- > - > - =A0 =A0/* > - =A0 =A0 * (non-Javadoc) > - =A0 =A0 * > - =A0 =A0 * @see org.apache.opencmis.client.api.CmisObject#getRelationshi= ps() > - =A0 =A0 */ > - =A0 =A0public List getRelationships() { > - =A0 =A0 =A0 =A0readLock(); > - =A0 =A0 =A0 =A0try { > - =A0 =A0 =A0 =A0 =A0 =A0return this.relationships; > - =A0 =A0 =A0 =A0} finally { > - =A0 =A0 =A0 =A0 =A0 =A0readUnlock(); > - =A0 =A0 =A0 =A0} > - =A0 =A0} > - > - =A0 =A0/* > - =A0 =A0 * (non-Javadoc) > - =A0 =A0 * > - =A0 =A0 * @see org.apache.opencmis.client.api.CmisObject#getRelationshi= ps(boolean, > - =A0 =A0 * org.apache.opencmis.commons.enums.RelationshipDirection, > - =A0 =A0 * org.apache.opencmis.client.api.objecttype.ObjectType, > - =A0 =A0 * org.apache.opencmis.client.api.OperationContext, int) > - =A0 =A0 */ > - =A0 =A0public PagingIterable getRelationships(final boole= an includeSubRelationshipTypes, > - =A0 =A0 =A0 =A0 =A0 =A0final RelationshipDirection relationshipDirectio= n, ObjectType type, OperationContext context, > - =A0 =A0 =A0 =A0 =A0 =A0final int itemsPerPage) { > - =A0 =A0 =A0 =A0// if (itemsPerPage < 1) { > - =A0 =A0 =A0 =A0// throw new IllegalArgumentException("itemsPerPage must= be > 0!"); > - =A0 =A0 =A0 =A0// } > - =A0 =A0 =A0 =A0// > - =A0 =A0 =A0 =A0// final String objectId =3D getObjectId(); > - =A0 =A0 =A0 =A0// final String typeId =3D (type =3D=3D null ? null : ty= pe.getId()); > - =A0 =A0 =A0 =A0// final RelationshipService relationshipService =3D > - =A0 =A0 =A0 =A0// getBinding().getRelationshipService(); > - =A0 =A0 =A0 =A0// final OperationContext ctxt =3D (context !=3D null ? = context : new > - =A0 =A0 =A0 =A0// OperationContextImpl(getSession() > - =A0 =A0 =A0 =A0// .getDefaultContext())); > - =A0 =A0 =A0 =A0// > - =A0 =A0 =A0 =A0// return new AbstractPagingList() { > - =A0 =A0 =A0 =A0// > - =A0 =A0 =A0 =A0// @Override > - =A0 =A0 =A0 =A0// protected FetchResult fetchPage(int pageNumber) { > - =A0 =A0 =A0 =A0// int skipCount =3D pageNumber * getMaxItemsPerPage(); > - =A0 =A0 =A0 =A0// > - =A0 =A0 =A0 =A0// // fetch the relationships > - =A0 =A0 =A0 =A0// ObjectList relList =3D > - =A0 =A0 =A0 =A0// relationshipService.getObjectRelationships(getReposit= oryId(), > - =A0 =A0 =A0 =A0// objectId, > - =A0 =A0 =A0 =A0// includeSubRelationshipTypes, relationshipDirection, t= ypeId, > - =A0 =A0 =A0 =A0// ctxt.getFilterString(), ctxt > - =A0 =A0 =A0 =A0// .isIncludeAllowableActions(), > - =A0 =A0 =A0 =A0// BigInteger.valueOf(getMaxItemsPerPage()), BigInteger > - =A0 =A0 =A0 =A0// .valueOf(skipCount), null); > - =A0 =A0 =A0 =A0// > - =A0 =A0 =A0 =A0// // convert relationship objects > - =A0 =A0 =A0 =A0// List page =3D new ArrayList(); > - =A0 =A0 =A0 =A0// if (relList.getObjects() !=3D null) { > - =A0 =A0 =A0 =A0// for (ObjectData rod : relList.getObjects()) { > - =A0 =A0 =A0 =A0// Relationship relationship =3D new > - =A0 =A0 =A0 =A0// PersistentRelationshipImpl(getSession(), getObjectFac= tory() > - =A0 =A0 =A0 =A0// .getTypeFromObjectData(rod), rod, ctxt); > - =A0 =A0 =A0 =A0// > - =A0 =A0 =A0 =A0// page.add(relationship); > - =A0 =A0 =A0 =A0// } > - =A0 =A0 =A0 =A0// } > - =A0 =A0 =A0 =A0// > - =A0 =A0 =A0 =A0// return new FetchResult(page, relList.getNumItems(), > - =A0 =A0 =A0 =A0// relList.hasMoreItems()); > - =A0 =A0 =A0 =A0// } > - =A0 =A0 =A0 =A0// > - =A0 =A0 =A0 =A0// @Override > - =A0 =A0 =A0 =A0// public int getMaxItemsPerPage() { > - =A0 =A0 =A0 =A0// return itemsPerPage; > - =A0 =A0 =A0 =A0// } > - =A0 =A0 =A0 =A0// }; > - =A0 =A0 =A0 =A0return null; > - =A0 =A0} > - > - =A0 =A0// --- other --- > - > - =A0 =A0/* > - =A0 =A0 * (non-Javadoc) > - =A0 =A0 * > - =A0 =A0 * @see org.apache.opencmis.client.api.CmisObject#isChanged() > - =A0 =A0 */ > - =A0 =A0public boolean isChanged() { > - =A0 =A0 =A0 =A0readLock(); > - =A0 =A0 =A0 =A0try { > - =A0 =A0 =A0 =A0 =A0 =A0return isChanged; > - =A0 =A0 =A0 =A0} finally { > - =A0 =A0 =A0 =A0 =A0 =A0readUnlock(); > - =A0 =A0 =A0 =A0} > - =A0 =A0} > - > - =A0 =A0/** > - =A0 =A0 * Sets the isChanged flag to true > - =A0 =A0 */ > - =A0 =A0protected void setChanged() { > - =A0 =A0 =A0 =A0writeLock(); > - =A0 =A0 =A0 =A0try { > - =A0 =A0 =A0 =A0 =A0 =A0isChanged =3D true; > - =A0 =A0 =A0 =A0} finally { > - =A0 =A0 =A0 =A0 =A0 =A0writeUnlock(); > - =A0 =A0 =A0 =A0} > - =A0 =A0} > - > - =A0 =A0/* > - =A0 =A0 * (non-Javadoc) > - =A0 =A0 * > - =A0 =A0 * @see org.apache.opencmis.client.api.CmisObject#getRefreshTime= stamp() > - =A0 =A0 */ > - =A0 =A0public long getRefreshTimestamp() { > - =A0 =A0 =A0 =A0readLock(); > - =A0 =A0 =A0 =A0try { > - =A0 =A0 =A0 =A0 =A0 =A0return this.refreshTimestamp; > - =A0 =A0 =A0 =A0} finally { > - =A0 =A0 =A0 =A0 =A0 =A0readUnlock(); > - =A0 =A0 =A0 =A0} > - =A0 =A0} > - > - =A0 =A0/* > - =A0 =A0 * (non-Javadoc) > - =A0 =A0 * > - =A0 =A0 * @see > - =A0 =A0 * org.apache.opencmis.client.api.CmisObject#refresh(org.apache.= opencmis > - =A0 =A0 * .client.api.OperationContext ) > - =A0 =A0 */ > - =A0 =A0public void refresh() { > - =A0 =A0 =A0 =A0writeLock(); > - =A0 =A0 =A0 =A0try { > - =A0 =A0 =A0 =A0 =A0 =A0String objectId =3D getObjectId(); > - > - =A0 =A0 =A0 =A0 =A0 =A0// get the latest data from the repository > - =A0 =A0 =A0 =A0 =A0 =A0ObjectData objectData =3D getSession().getBindin= g().getObjectService().getObject(getRepositoryId(), objectId, > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0creationContext.getFilterString(= ), creationContext.isIncludeAllowableActions(), > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0creationContext.getIncludeRelati= onships(), creationContext.getRenditionFilterString(), > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0creationContext.isIncludePolicie= s(), creationContext.isIncludeAcls(), null); > - > - =A0 =A0 =A0 =A0 =A0 =A0// reset this object > - =A0 =A0 =A0 =A0 =A0 =A0initialize(getSession(), getObjectType(), object= Data, this.creationContext); > - =A0 =A0 =A0 =A0} finally { > - =A0 =A0 =A0 =A0 =A0 =A0writeUnlock(); > - =A0 =A0 =A0 =A0} > - =A0 =A0} > - > - =A0 =A0/* > - =A0 =A0 * (non-Javadoc) > - =A0 =A0 * > - =A0 =A0 * @see org.apache.opencmis.client.api.CmisObject#refreshIfOld(l= ong) > - =A0 =A0 */ > - =A0 =A0public void refreshIfOld(long durationInMillis) { > - =A0 =A0 =A0 =A0writeLock(); > - =A0 =A0 =A0 =A0try { > - =A0 =A0 =A0 =A0 =A0 =A0if (this.refreshTimestamp < System.currentTimeMi= llis() - durationInMillis) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0refresh(); > - =A0 =A0 =A0 =A0 =A0 =A0} > - =A0 =A0 =A0 =A0} finally { > - =A0 =A0 =A0 =A0 =A0 =A0writeUnlock(); > - =A0 =A0 =A0 =A0} > - =A0 =A0} > - > - =A0 =A0// --- internal --- > - > - =A0 =A0/** > - =A0 =A0 * Checks if a value matches a property definition. > - =A0 =A0 */ > - =A0 =A0private PropertyDefinition checkProperty(String id, Object va= lue) { > - =A0 =A0 =A0 =A0PropertyDefinition propertyDefinition =3D getObjectTy= pe().getPropertyDefinitions().get(id); > - =A0 =A0 =A0 =A0if (propertyDefinition =3D=3D null) { > - =A0 =A0 =A0 =A0 =A0 =A0throw new IllegalArgumentException("Unknown prop= erty '" + id + "'!"); > - =A0 =A0 =A0 =A0} > - > - =A0 =A0 =A0 =A0// null values are ok for updates > - =A0 =A0 =A0 =A0if (value =3D=3D null) { > - =A0 =A0 =A0 =A0 =A0 =A0return propertyDefinition; > - =A0 =A0 =A0 =A0} > - > - =A0 =A0 =A0 =A0// single and multi value check > - =A0 =A0 =A0 =A0List values =3D null; > - =A0 =A0 =A0 =A0if (value instanceof List) { > - =A0 =A0 =A0 =A0 =A0 =A0if (propertyDefinition.getCardinality() !=3D Car= dinality.MULTI) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0throw new IllegalArgumentException("Prop= erty '" + propertyDefinition.getId() > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0+ "' is not a multi valu= e property!"); > - =A0 =A0 =A0 =A0 =A0 =A0} > - > - =A0 =A0 =A0 =A0 =A0 =A0values =3D (List) value; > - =A0 =A0 =A0 =A0 =A0 =A0if (values.isEmpty()) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return propertyDefinition; > - =A0 =A0 =A0 =A0 =A0 =A0} > - =A0 =A0 =A0 =A0} else { > - =A0 =A0 =A0 =A0 =A0 =A0if (propertyDefinition.getCardinality() !=3D Car= dinality.SINGLE) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0throw new IllegalArgumentException("Prop= erty '" + propertyDefinition.getId() > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0+ "' is not a single val= ue property!"); > - =A0 =A0 =A0 =A0 =A0 =A0} > - > - =A0 =A0 =A0 =A0 =A0 =A0values =3D Collections.singletonList(value); > - =A0 =A0 =A0 =A0} > - > - =A0 =A0 =A0 =A0// check if list contains null values > - =A0 =A0 =A0 =A0for (Object o : values) { > - =A0 =A0 =A0 =A0 =A0 =A0if (o =3D=3D null) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0throw new IllegalArgumentException("Prop= erty '" + propertyDefinition.getId() > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0+ "' contains null value= s!"); > - =A0 =A0 =A0 =A0 =A0 =A0} > - =A0 =A0 =A0 =A0} > - > - =A0 =A0 =A0 =A0// take a sample and test the data type > - =A0 =A0 =A0 =A0boolean typeMatch =3D false; > - =A0 =A0 =A0 =A0Object firstValue =3D values.get(0); > - > - =A0 =A0 =A0 =A0switch (propertyDefinition.getPropertyType()) { > - =A0 =A0 =A0 =A0case STRING: > - =A0 =A0 =A0 =A0case ID: > - =A0 =A0 =A0 =A0case URI: > - =A0 =A0 =A0 =A0case HTML: > - =A0 =A0 =A0 =A0 =A0 =A0typeMatch =3D (firstValue instanceof String); > - =A0 =A0 =A0 =A0 =A0 =A0break; > - =A0 =A0 =A0 =A0case INTEGER: > - =A0 =A0 =A0 =A0 =A0 =A0typeMatch =3D (firstValue instanceof BigInteger)= ; > - =A0 =A0 =A0 =A0 =A0 =A0break; > - =A0 =A0 =A0 =A0case DECIMAL: > - =A0 =A0 =A0 =A0 =A0 =A0typeMatch =3D (firstValue instanceof BigDecimal)= ; > - =A0 =A0 =A0 =A0 =A0 =A0break; > - =A0 =A0 =A0 =A0case BOOLEAN: > - =A0 =A0 =A0 =A0 =A0 =A0typeMatch =3D (firstValue instanceof Boolean); > - =A0 =A0 =A0 =A0 =A0 =A0break; > - =A0 =A0 =A0 =A0case DATETIME: > - =A0 =A0 =A0 =A0 =A0 =A0typeMatch =3D (firstValue instanceof GregorianCa= lendar); > - =A0 =A0 =A0 =A0 =A0 =A0break; > - =A0 =A0 =A0 =A0} > - > - =A0 =A0 =A0 =A0if (!typeMatch) { > - =A0 =A0 =A0 =A0 =A0 =A0throw new IllegalArgumentException("Value of pro= perty '" + propertyDefinition.getId() > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0+ "' does not match property typ= e!"); > - =A0 =A0 =A0 =A0} > + =A0 =A0 =A0 private PersistentSessionImpl session; > + =A0 =A0 =A0 private ObjectType objectType; > + =A0 =A0 =A0 private Map> properties; > + =A0 =A0 =A0 private AllowableActions allowableActions; > + =A0 =A0 =A0 private List renditions; > + =A0 =A0 =A0 private Acl acl; > + =A0 =A0 =A0 private List policies; > + =A0 =A0 =A0 private List relationships; > + =A0 =A0 =A0 private OperationContext creationContext; > + =A0 =A0 =A0 private boolean isChanged =3D false; > + =A0 =A0 =A0 private long refreshTimestamp; > + > + =A0 =A0 =A0 private final ReentrantReadWriteLock fLock =3D new Reentran= tReadWriteLock(); > + > + =A0 =A0 =A0 /** > + =A0 =A0 =A0 =A0* Initializes the object. > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 protected void initialize(PersistentSessionImpl session, Ob= jectType objectType, ObjectData objectData, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 OperationContext context) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (session =3D=3D null) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 throw new IllegalArgumentEx= ception("Session must be set!"); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (objectType =3D=3D null) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 throw new IllegalArgumentEx= ception("Object type must be set!"); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (objectType.getPropertyDefinitions().siz= e() < 9) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 // there must be at least t= he 9 standard properties that all objects > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 // have > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 throw new IllegalArgumentEx= ception("Object type must have property defintions!"); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 this.session =3D session; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 this.objectType =3D objectType; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 this.creationContext =3D new OperationConte= xtImpl(context); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 this.refreshTimestamp =3D System.currentTim= eMillis(); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ObjectFactory of =3D getObjectFactory(); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (objectData !=3D null) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 // handle properties > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (objectData.getPropertie= s() !=3D null) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 this.proper= ties =3D of.convertProperties(objectType, objectData.getProperties()); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 // handle allowable actions > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (objectData.getAllowable= Actions() !=3D null) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 this.allowa= bleActions =3D objectData.getAllowableActions(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 // handle renditions > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (objectData.getRendition= s() !=3D null) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 this.rendit= ions =3D new ArrayList(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 for (Rendit= ionData rd : objectData.getRenditions()) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 this.renditions.add(of.convertRendition(getId(), rd)); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 // handle ACL > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (objectData.getAcl() != =3D null) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 acl =3D obj= ectData.getAcl(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 // handle policies > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((objectData.getPolicyId= s() !=3D null) && (objectData.getPolicyIds().getPolicyIds() !=3D null)) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 policies = =3D new ArrayList(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 for (String= pid : objectData.getPolicyIds().getPolicyIds()) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 CmisObject policy =3D session.getObject(getSession().createObjectId(pi= d)); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 if (policy instanceof Policy) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 policies.add((Policy) policy); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 } > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 // handle relationships > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (objectData.getRelations= hips() !=3D null) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 relationshi= ps =3D new ArrayList(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 for (Object= Data rod : objectData.getRelationships()) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 CmisObject relationship =3D of.convertObject(rod, this.creationContext= ); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 if (relationship instanceof Relationship) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 relationships.add((Relationship) relationship); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 } > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 isChanged =3D false; > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /** > + =A0 =A0 =A0 =A0* Acquires a write lock. > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 protected void writeLock() { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 fLock.writeLock().lock(); > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /** > + =A0 =A0 =A0 =A0* Releases a write lock. > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 protected void writeUnlock() { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 fLock.writeLock().unlock(); > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /** > + =A0 =A0 =A0 =A0* Acquires a read lock. > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 protected void readLock() { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 fLock.readLock().lock(); > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /** > + =A0 =A0 =A0 =A0* Releases a read lock. > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 protected void readUnlock() { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 fLock.readLock().unlock(); > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /** > + =A0 =A0 =A0 =A0* Returns the session object. > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 protected PersistentSessionImpl getSession() { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return this.session; > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /** > + =A0 =A0 =A0 =A0* Returns the repository id. > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 protected String getRepositoryId() { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return getSession().getRepositoryId(); > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /** > + =A0 =A0 =A0 =A0* Returns the object type. > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 protected ObjectType getObjectType() { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 readLock(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 try { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return this.objectType; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } finally { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 readUnlock(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /** > + =A0 =A0 =A0 =A0* Returns the binding object. > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 protected CmisBinding getBinding() { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return getSession().getBinding(); > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /** > + =A0 =A0 =A0 =A0* Returns the object factory. > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 protected ObjectFactory getObjectFactory() { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return getSession().getObjectFactory(); > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /** > + =A0 =A0 =A0 =A0* Returns the id of this object or throws an exception i= f the id is > + =A0 =A0 =A0 =A0* unknown. > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 protected String getObjectId() { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 String objectId =3D getId(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (objectId =3D=3D null) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 throw new IllegalStateExcep= tion("Object Id is unknown!"); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return objectId; > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 // --- operations --- > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* (non-Javadoc) > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* @see org.apache.opencmis.client.api.CmisObject#delete(= boolean) > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 public void delete(boolean allVersions) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 String objectId =3D getObjectId(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 getBinding().getObjectService().deleteObjec= t(getRepositoryId(), objectId, allVersions, null); > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* (non-Javadoc) > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* @see org.apache.opencmis.client.api.CmisObject#updateP= roperties() > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 public ObjectId updateProperties() { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 readLock(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 try { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 String objectId =3D getObje= ctId(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Holder objectIdHold= er =3D new Holder(objectId); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 String changeToken =3D getC= hangeToken(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Holder changeTokenH= older =3D new Holder(changeToken); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Set updatebil= ity =3D new HashSet(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 updatebility.add(Updatabili= ty.READWRITE); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 // check if checked out > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Boolean isCheckedOut =3D ge= tPropertyValue(PropertyIds.IS_VERSION_SERIES_CHECKED_OUT); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((isCheckedOut !=3D null= ) && isCheckedOut.booleanValue()) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 updatebilit= y.add(Updatability.WHENCHECKEDOUT); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 // it's time to update > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 getBinding().getObjectServi= ce().updateProperties(getRepositoryId(), objectIdHolder, changeTokenHolder, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 getObjectFactory().convertProperties(this.properties, this.objectType,= updatebility), null); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (objectIdHolder.getValue= () =3D=3D null) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return null= ; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return getSession().createO= bjectId(objectIdHolder.getValue()); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } finally { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 readUnlock(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* (non-Javadoc) > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* @see > + =A0 =A0 =A0 =A0* org.apache.opencmis.client.api.CmisObject#updateProper= ties(java.util.Map) > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 public ObjectId updateProperties(Map properties)= { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((properties =3D=3D null) || (properties= .isEmpty())) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 throw new IllegalArgumentEx= ception("Properties must not be empty!"); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 readLock(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 try { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 String objectId =3D getObje= ctId(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Holder objectIdHold= er =3D new Holder(objectId); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 String changeToken =3D getC= hangeToken(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Holder changeTokenH= older =3D new Holder(changeToken); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Set updatebil= ity =3D new HashSet(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 updatebility.add(Updatabili= ty.READWRITE); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 // check if checked out > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Boolean isCheckedOut =3D ge= tPropertyValue(PropertyIds.IS_VERSION_SERIES_CHECKED_OUT); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((isCheckedOut !=3D null= ) && isCheckedOut.booleanValue()) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 updatebilit= y.add(Updatability.WHENCHECKEDOUT); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 // it's time to update > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 getBinding().getObjectServi= ce().updateProperties(getRepositoryId(), objectIdHolder, changeTokenHolder, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 getObjectFactory().convertProperties(properties, this.objectType, upda= tebility), null); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (objectIdHolder.getValue= () =3D=3D null) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return null= ; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return getSession().createO= bjectId(objectIdHolder.getValue()); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } finally { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 readUnlock(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 // --- properties --- > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* (non-Javadoc) > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* @see org.apache.opencmis.client.api.CmisObject#getBase= Type() > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 public ObjectType getBaseType() { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 BaseTypeId baseTypeId =3D getBaseTypeId(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (baseTypeId =3D=3D null) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return null; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return getSession().getTypeDefinition(baseT= ypeId.value()); > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* (non-Javadoc) > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* @see org.apache.opencmis.client.api.CmisObject#getBase= TypeId() > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 public BaseTypeId getBaseTypeId() { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 String baseType =3D getPropertyValue(Proper= tyIds.BASE_TYPE_ID); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (baseType =3D=3D null) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return null; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return BaseTypeId.fromValue(baseType); > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* (non-Javadoc) > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* @see org.apache.opencmis.client.api.CmisObject#getChan= geToken() > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 public String getChangeToken() { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return getPropertyValue(PropertyIds.CHANGE_= TOKEN); > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* (non-Javadoc) > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* @see org.apache.opencmis.client.api.CmisObject#getCrea= tedBy() > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 public String getCreatedBy() { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return getPropertyValue(PropertyIds.CREATED= _BY); > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* (non-Javadoc) > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* @see org.apache.opencmis.client.api.CmisObject#getCrea= tionDate() > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 public GregorianCalendar getCreationDate() { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return getPropertyValue(PropertyIds.CREATIO= N_DATE); > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* (non-Javadoc) > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* @see org.apache.opencmis.client.api.CmisObject#getId() > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 public String getId() { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return getPropertyValue(PropertyIds.OBJECT_= ID); > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* (non-Javadoc) > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* @see org.apache.opencmis.client.api.CmisObject#getLast= ModificationDate() > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 public GregorianCalendar getLastModificationDate() { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return getPropertyValue(PropertyIds.LAST_MO= DIFICATION_DATE); > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* (non-Javadoc) > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* @see org.apache.opencmis.client.api.CmisObject#getLast= ModifiedBy() > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 public String getLastModifiedBy() { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return getPropertyValue(PropertyIds.LAST_MO= DIFIED_BY); > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* (non-Javadoc) > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* @see org.apache.opencmis.client.api.CmisObject#getName= () > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 public String getName() { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return getPropertyValue(PropertyIds.NAME); > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* (non-Javadoc) > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* @see org.apache.opencmis.client.api.CmisObject#getProp= erties() > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 public List> getProperties() { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 readLock(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 try { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return new ArrayList>(this.properties.values()); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } finally { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 readUnlock(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* (non-Javadoc) > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* @see > + =A0 =A0 =A0 =A0* org.apache.opencmis.client.api.CmisObject#getProperty(= java.lang.String) > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 @SuppressWarnings("unchecked") > + =A0 =A0 =A0 public Property getProperty(String id) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 readLock(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 try { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (Property) this.p= roperties.get(id); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } finally { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 readUnlock(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* (non-Javadoc) > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* @see > + =A0 =A0 =A0 =A0* org.apache.opencmis.client.api.CmisObject#getPropertyM= ultivalue(java. > + =A0 =A0 =A0 =A0* lang.String) > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 public List getPropertyMultivalue(String id) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 Property property =3D getProperty(id); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (property =3D=3D null) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return null; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return property.getValues(); > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* (non-Javadoc) > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* @see > + =A0 =A0 =A0 =A0* org.apache.opencmis.client.api.CmisObject#getPropertyV= alue(java.lang. > + =A0 =A0 =A0 =A0* String) > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 public T getPropertyValue(String id) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 Property property =3D getProperty(id); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (property =3D=3D null) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return null; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return property.getFirstValue(); > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* (non-Javadoc) > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* @see org.apache.opencmis.client.api.CmisObject#setName= (java.lang.String) > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 public void setName(String name) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 setProperty(PropertyIds.NAME, name); > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* (non-Javadoc) > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* @see > + =A0 =A0 =A0 =A0* org.apache.opencmis.client.api.CmisObject#setProperty(= java.lang.String, > + =A0 =A0 =A0 =A0* java.lang.Object) > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 @SuppressWarnings("unchecked") > + =A0 =A0 =A0 public void setProperty(String id, T value) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 PropertyDefinition propertyDefinition = =3D checkProperty(id, value); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 // check updatability > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (propertyDefinition.getUpdatability() = =3D=3D Updatability.READONLY) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 throw new IllegalArgumentEx= ception("Property is read-only!"); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 // create property > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 Property newProperty =3D (Property) g= etObjectFactory().createProperty( > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (PropertyDe= finition) propertyDefinition, value); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 writeLock(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 try { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 setChanged(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 this.properties.put(id, new= Property); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } finally { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 writeUnlock(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* (non-Javadoc) > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* @see > + =A0 =A0 =A0 =A0* org.apache.opencmis.client.api.CmisObject#setPropertyM= ultivalue(java. > + =A0 =A0 =A0 =A0* lang.String, java.util.List) > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 @SuppressWarnings("unchecked") > + =A0 =A0 =A0 public void setPropertyMultivalue(String id, List va= lue) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 PropertyDefinition propertyDefinition = =3D checkProperty(id, value); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 // check updatability > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (propertyDefinition.getUpdatability() = =3D=3D Updatability.READONLY) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 throw new IllegalArgumentEx= ception("Property is read-only!"); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 // create property > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 Property newProperty =3D (Property) g= etObjectFactory().createPropertyMultivalue( > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (PropertyDe= finition) propertyDefinition, value); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 writeLock(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 try { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 setChanged(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 this.properties.put(id, new= Property); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } finally { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 writeUnlock(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* (non-Javadoc) > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* @see org.apache.opencmis.client.api.CmisObject#getType= () > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 public ObjectType getType() { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 readLock(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 try { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return this.objectType; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } finally { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 readUnlock(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 // --- allowable actions --- > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* (non-Javadoc) > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* @see org.apache.opencmis.client.api.CmisObject#getAllo= wableActions() > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 public AllowableActions getAllowableActions() { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 readLock(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 try { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return this.allowableAction= s; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } finally { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 readUnlock(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 // --- renditions --- > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* (non-Javadoc) > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* @see org.apache.opencmis.client.api.CmisObject#getRend= itions() > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 public List getRenditions() { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 readLock(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 try { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return this.renditions; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } finally { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 readUnlock(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 // --- ACL --- > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* (non-Javadoc) > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* @see org.apache.opencmis.client.api.CmisObject#getAcl(= boolean) > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 public Acl getAcl(boolean onlyBasicPermissions) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 String objectId =3D getObjectId(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return getBinding().getAclService().getAcl(= getRepositoryId(), objectId, onlyBasicPermissions, null); > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* (non-Javadoc) > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* @see org.apache.opencmis.client.api.CmisObject#applyAc= l(java.util.List, > + =A0 =A0 =A0 =A0* java.util.List, org.apache.opencmis.commons.enums.AclP= ropagation) > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 public Acl applyAcl(List addAces, List removeAces= , AclPropagation aclPropagation) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 String objectId =3D getObjectId(); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ObjectFactory of =3D getObjectFactory(); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return getBinding().getAclService().applyAc= l(getRepositoryId(), objectId, of.convertAces(addAces), > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 of.convertA= ces(removeAces), aclPropagation, null); > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* (non-Javadoc) > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* @see org.apache.opencmis.client.api.CmisObject#addAcl(= java.util.List, > + =A0 =A0 =A0 =A0* org.apache.opencmis.commons.enums.AclPropagation) > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 public void addAcl(List addAces, AclPropagation aclPro= pagation) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 applyAcl(addAces, null, aclPropagation); > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* (non-Javadoc) > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* @see org.apache.opencmis.client.api.CmisObject#removeA= cl(java.util.List, > + =A0 =A0 =A0 =A0* org.apache.opencmis.commons.enums.AclPropagation) > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 public void removeAcl(List removeAces, AclPropagation = aclPropagation) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 applyAcl(null, removeAces, aclPropagation); > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* (non-Javadoc) > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* @see org.apache.opencmis.client.api.CmisObject#getAcl(= ) > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 public Acl getAcl() { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 readLock(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 try { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return this.acl; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } finally { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 readUnlock(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 // --- policies --- > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* (non-Javadoc) > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* @see > + =A0 =A0 =A0 =A0* org.apache.opencmis.client.api.CmisObject#applyPolicy(= org.apache.opencmis > + =A0 =A0 =A0 =A0* .client.api.ObjectId) > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 public void applyPolicy(ObjectId policyId) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((policyId =3D=3D null) || (policyId.get= Id() =3D=3D null)) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 throw new IllegalArgumentEx= ception("Policy Id is not set!"); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 String objectId =3D getObjectId(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 getBinding().getPolicyService().applyPolicy= (getRepositoryId(), policyId.getId(), objectId, null); > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* (non-Javadoc) > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* @see > + =A0 =A0 =A0 =A0* org.apache.opencmis.client.api.CmisObject#removePolicy= (org.apache.opencmis > + =A0 =A0 =A0 =A0* .client.api.ObjectId) > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 public void removePolicy(ObjectId policyId) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((policyId =3D=3D null) || (policyId.get= Id() =3D=3D null)) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 throw new IllegalArgumentEx= ception("Policy Id is not set!"); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 String objectId =3D getObjectId(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 getBinding().getPolicyService().removePolic= y(getRepositoryId(), policyId.getId(), objectId, null); > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* (non-Javadoc) > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* @see org.apache.opencmis.client.api.CmisObject#getPoli= cies() > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 public List getPolicies() { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 readLock(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 try { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return this.policies; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } finally { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 readUnlock(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 // --- relationships --- > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* (non-Javadoc) > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* @see org.apache.opencmis.client.api.CmisObject#getRela= tionships() > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 public List getRelationships() { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 readLock(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 try { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return this.relationships; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } finally { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 readUnlock(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* (non-Javadoc) > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* @see org.apache.opencmis.client.api.CmisObject#getRela= tionships(boolean, > + =A0 =A0 =A0 =A0* org.apache.opencmis.commons.enums.RelationshipDirectio= n, > + =A0 =A0 =A0 =A0* org.apache.opencmis.client.api.objecttype.ObjectType, > + =A0 =A0 =A0 =A0* org.apache.opencmis.client.api.OperationContext, int) > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 public PagingIterable getRelationships(final = boolean includeSubRelationshipTypes, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 final RelationshipDirection= relationshipDirection, ObjectType type, OperationContext context, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 final int itemsPerPage) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (itemsPerPage < 1) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 throw new IllegalArgumentEx= ception("itemsPerPage must be > 0!"); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 final String objectId =3D getObjectId(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 final String typeId =3D (type =3D=3D null ?= null : type.getId()); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 final RelationshipService relationshipServi= ce =3D getBinding().getRelationshipService(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 final OperationContext ctxt =3D new Operati= onContextImpl(context); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return new DefaultPagingIterable(new AbstractPageFetch() { > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 @Override > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 protected AbstractPageFetch= .PageFetchResult fetchPage(long skipCount) { > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 // fetch th= e relationships > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ObjectList = relList =3D relationshipService.getObjectRelationships(getRepositoryId(), o= bjectId, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 includeSubRelationshipTypes, relationshipDirection, ty= peId, ctxt.getFilterString(), ctxt > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 .isIncludeAllowableAct= ions(), BigInteger.valueOf(itemsPerPage), BigInteger > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 .valueOf(skipCount), n= ull); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 // convert = relationship objects > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 List page =3D new ArrayList(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (relList= .getObjects() !=3D null) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 for (ObjectData rod : relList.getObjects()) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 Relationship relationship =3D new PersistentRelationsh= ipImpl(getSession(), getObjectFactory() > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 .getTypeFromObjectData= (rod), rod, ctxt); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 page.add(relationship); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 } > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return new = AbstractPageFetch.PageFetchResult(page, relList.getNumItems()= , relList > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 .hasMoreItems()) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 }; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 }); > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 // --- other --- > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* (non-Javadoc) > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* @see org.apache.opencmis.client.api.CmisObject#isChang= ed() > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 public boolean isChanged() { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 readLock(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 try { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return isChanged; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } finally { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 readUnlock(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /** > + =A0 =A0 =A0 =A0* Sets the isChanged flag to true > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 protected void setChanged() { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 writeLock(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 try { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 isChanged =3D true; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } finally { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 writeUnlock(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* (non-Javadoc) > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* @see org.apache.opencmis.client.api.CmisObject#getRefr= eshTimestamp() > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 public long getRefreshTimestamp() { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 readLock(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 try { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return this.refreshTimestam= p; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } finally { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 readUnlock(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* (non-Javadoc) > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* @see > + =A0 =A0 =A0 =A0* org.apache.opencmis.client.api.CmisObject#refresh(org.= apache.opencmis > + =A0 =A0 =A0 =A0* .client.api.OperationContext ) > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 public void refresh() { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 writeLock(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 try { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 String objectId =3D getObje= ctId(); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 // get the latest data from= the repository > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ObjectData objectData =3D g= etSession().getBinding().getObjectService().getObject(getRepositoryId(), ob= jectId, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 creationContext.getFilterString(), creationContext.isIncludeAllowableA= ctions(), > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 creationContext.getIncludeRelationships(), creationContext.getRenditio= nFilterString(), > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 creationContext.isIncludePolicies(), creationContext.isIncludeAcls(), = null); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 // reset this object > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 initialize(getSession(), ge= tObjectType(), objectData, this.creationContext); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } finally { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 writeUnlock(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* (non-Javadoc) > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* @see org.apache.opencmis.client.api.CmisObject#refresh= IfOld(long) > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 public void refreshIfOld(long durationInMillis) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 writeLock(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 try { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (this.refreshTimestamp <= System.currentTimeMillis() - durationInMillis) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 refresh(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } finally { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 writeUnlock(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 // --- internal --- > + > + =A0 =A0 =A0 /** > + =A0 =A0 =A0 =A0* Checks if a value matches a property definition. > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 private PropertyDefinition checkProperty(String id, Obje= ct value) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 PropertyDefinition propertyDefinition = =3D getObjectType().getPropertyDefinitions().get(id); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (propertyDefinition =3D=3D null) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 throw new IllegalArgumentEx= ception("Unknown property '" + id + "'!"); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 // null values are ok for updates > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (value =3D=3D null) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return propertyDefinition; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 // single and multi value check > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 List values =3D null; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (value instanceof List) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (propertyDefinition.getC= ardinality() !=3D Cardinality.MULTI) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 throw new I= llegalArgumentException("Property '" + propertyDefinition.getId() > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 + "' is not a multi value property!"); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 values =3D (List) value; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (values.isEmpty()) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return prop= ertyDefinition; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } else { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (propertyDefinition.getC= ardinality() !=3D Cardinality.SINGLE) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 throw new I= llegalArgumentException("Property '" + propertyDefinition.getId() > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 + "' is not a single value property!"); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 values =3D Collections.sing= letonList(value); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 // check if list contains null values > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 for (Object o : values) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (o =3D=3D null) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 throw new I= llegalArgumentException("Property '" + propertyDefinition.getId() > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 + "' contains null values!"); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 // take a sample and test the data type > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 boolean typeMatch =3D false; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 Object firstValue =3D values.get(0); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 switch (propertyDefinition.getPropertyType(= )) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 case STRING: > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 case ID: > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 case URI: > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 case HTML: > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 typeMatch =3D (firstValue i= nstanceof String); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 case INTEGER: > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 typeMatch =3D (firstValue i= nstanceof BigInteger); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 case DECIMAL: > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 typeMatch =3D (firstValue i= nstanceof BigDecimal); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 case BOOLEAN: > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 typeMatch =3D (firstValue i= nstanceof Boolean); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 case DATETIME: > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 typeMatch =3D (firstValue i= nstanceof GregorianCalendar); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (!typeMatch) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 throw new IllegalArgumentEx= ception("Value of property '" + propertyDefinition.getId() > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 + "' does not match property type!"); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > > - =A0 =A0 =A0 =A0return propertyDefinition; > - =A0 =A0} > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return propertyDefinition; > + =A0 =A0 =A0 } > =A0} > > > --=20 Florent Guillaume, Director of R&D, Nuxeo Open Source, Java EE based, Enterprise Content Management (ECM) http://www.nuxeo.com http://www.nuxeo.org +33 1 40 33 79 87