org.apache.chemistry.opencmis.client.runtime
Class AbstractCmisObject

java.lang.Object
  extended by org.apache.chemistry.opencmis.client.runtime.AbstractCmisObject
All Implemented Interfaces:
Serializable, CmisObject, CmisObjectProperties, ObjectId
Direct Known Subclasses:
AbstractFilableCmisObject, RelationshipImpl

public abstract class AbstractCmisObject
extends Object
implements CmisObject, Serializable

Base class for all persistent session object impl classes.

See Also:
Serialized Form

Constructor Summary
AbstractCmisObject()
           
 
Method Summary
 Acl addAcl(List<Ace> addAces, AclPropagation aclPropagation)
          Adds ACEs to the object.
 Acl applyAcl(List<Ace> addAces, List<Ace> removeAces, AclPropagation aclPropagation)
          Adds and removes ACEs to the object.
 void applyPolicy(ObjectId... policyIds)
          Applies policies to this object.
protected  TransientCmisObject createTransientCmisObject()
           
 void delete(boolean allVersions)
          Deletes this object.
 Acl getAcl()
          Returns the ACL if it has been fetched for this object.
 Acl getAcl(boolean onlyBasicPermissions)
           
<T> T
getAdapter(Class<T> adapterInterface)
          Returns an adapter based on the given interface.
 AllowableActions getAllowableActions()
          Returns the allowable actions if they have been fetched for this object.
 ObjectType getBaseType()
          Returns the base type of this CMIS object (object type identified by cmis:baseTypeId).
 BaseTypeId getBaseTypeId()
          Returns the id of the base type of this CMIS object (CMIS property cmis:baseTypeId).
protected  CmisBinding getBinding()
          Returns the binding object.
 String getChangeToken()
          Returns the change token (CMIS property cmis:changeToken).
 String getCreatedBy()
          Returns the user who created this CMIS object (CMIS property cmis:createdBy).
protected  OperationContext getCreationContext()
          Returns the OperationContext that was used to create this object.
 GregorianCalendar getCreationDate()
          Returns the timestamp when this CMIS object has been created (CMIS property cmis:creationDate).
 List<CmisExtensionElement> getExtensions(ExtensionLevel level)
          Returns the extensions for the given level.
 String getId()
          Returns the id.
 GregorianCalendar getLastModificationDate()
          Returns the timestamp when this CMIS object has been modified (CMIS property cmis:lastModificationDate).
 String getLastModifiedBy()
          Returns the user who modified this CMIS object (CMIS property cmis:lastModifiedBy).
 String getName()
          Returns the name of this CMIS object (CMIS property cmis:name).
protected  ObjectFactory getObjectFactory()
          Returns the object factory.
protected  String getObjectId()
          Returns the id of this object or throws an exception if the id is unknown.
protected  ObjectType getObjectType()
          Returns the object type.
 List<Policy> getPolicies()
          Returns the applied policies if they have been fetched for this object.
 List<Property<?>> getProperties()
          Returns a list of all available CMIS properties.
<T> Property<T>
getProperty(String id)
          Returns the requested property.
protected  String getPropertyQueryName(String propertyId)
          Returns the query name of a property.
<T> T
getPropertyValue(String id)
          Returns the value of the requested property.
 long getRefreshTimestamp()
          Returns the timestamp (in milliseconds) of the last refresh.
 List<Relationship> getRelationships()
          Returns the relationships if they have been fetched for this object.
 List<Rendition> getRenditions()
          Returns the renditions if they have been fetched for this object.
protected  String getRepositoryId()
          Returns the repository id.
protected  SessionImpl getSession()
          Returns the session object.
 TransientCmisObject getTransientObject()
          Returns a transient object adapter.
 ObjectType getType()
          Returns the type of this CMIS object (object type identified by cmis:objectTypeId).
protected  void initialize(SessionImpl session, ObjectType objectType, ObjectData objectData, OperationContext context)
          Initializes the object.
protected  void readLock()
          Acquires a read lock.
protected  void readUnlock()
          Releases a read lock.
 void refresh()
          Reloads the data from the repository.
 void refreshIfOld(long durationInMillis)
          Reloads the data from the repository if the last refresh did not occur within durationInMillis.
 Acl removeAcl(List<Ace> removeAces, AclPropagation aclPropagation)
          Removes ACEs to the object.
 void removePolicy(ObjectId... policyIds)
          Remove policies from this object.
 CmisObject updateProperties(Map<String,?> properties)
          Updates the properties that are provided.
 ObjectId updateProperties(Map<String,?> properties, boolean refresh)
          Updates the properties that are provided.
protected  void writeLock()
          Acquires a write lock.
protected  void writeUnlock()
          Releases a write lock.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractCmisObject

public AbstractCmisObject()
Method Detail

initialize

protected void initialize(SessionImpl session,
                          ObjectType objectType,
                          ObjectData objectData,
                          OperationContext context)
Initializes the object.


writeLock

protected void writeLock()
Acquires a write lock.


writeUnlock

protected void writeUnlock()
Releases a write lock.


readLock

protected void readLock()
Acquires a read lock.


readUnlock

protected void readUnlock()
Releases a read lock.


getSession

protected SessionImpl getSession()
Returns the session object.


getRepositoryId

protected String getRepositoryId()
Returns the repository id.


getObjectType

protected ObjectType getObjectType()
Returns the object type.


getBinding

protected CmisBinding getBinding()
Returns the binding object.


getObjectFactory

protected ObjectFactory getObjectFactory()
Returns the object factory.


getObjectId

protected String getObjectId()
Returns the id of this object or throws an exception if the id is unknown.


getCreationContext

protected OperationContext getCreationContext()
Returns the OperationContext that was used to create this object.


getPropertyQueryName

protected String getPropertyQueryName(String propertyId)
Returns the query name of a property.


delete

public void delete(boolean allVersions)
Description copied from interface: CmisObject
Deletes this object.

Specified by:
delete in interface CmisObject
Parameters:
allVersions - if this object is a document this parameter defines if just this version or all versions should be deleted

updateProperties

public CmisObject updateProperties(Map<String,?> properties)
Description copied from interface: CmisObject
Updates the properties that are provided.

Specified by:
updateProperties in interface CmisObject
Parameters:
properties - the properties to update
Returns:
the updated object (a repository might have created a new object)

updateProperties

public ObjectId updateProperties(Map<String,?> properties,
                                 boolean refresh)
Description copied from interface: CmisObject
Updates the properties that are provided.

Specified by:
updateProperties in interface CmisObject
Parameters:
properties - the properties to update
refresh - indicates if the object should be refresh after the update
Returns:
the object id of the updated object (a repository might have created a new object)

getBaseType

public ObjectType getBaseType()
Description copied from interface: CmisObjectProperties
Returns the base type of this CMIS object (object type identified by cmis:baseTypeId).

Specified by:
getBaseType in interface CmisObjectProperties

getBaseTypeId

public BaseTypeId getBaseTypeId()
Description copied from interface: CmisObjectProperties
Returns the id of the base type of this CMIS object (CMIS property cmis:baseTypeId).

Specified by:
getBaseTypeId in interface CmisObjectProperties

getChangeToken

public String getChangeToken()
Description copied from interface: CmisObjectProperties
Returns the change token (CMIS property cmis:changeToken).

Specified by:
getChangeToken in interface CmisObjectProperties

getCreatedBy

public String getCreatedBy()
Description copied from interface: CmisObjectProperties
Returns the user who created this CMIS object (CMIS property cmis:createdBy).

Specified by:
getCreatedBy in interface CmisObjectProperties

getCreationDate

public GregorianCalendar getCreationDate()
Description copied from interface: CmisObjectProperties
Returns the timestamp when this CMIS object has been created (CMIS property cmis:creationDate).

Specified by:
getCreationDate in interface CmisObjectProperties

getId

public String getId()
Description copied from interface: ObjectId
Returns the id.

Specified by:
getId in interface ObjectId

getLastModificationDate

public GregorianCalendar getLastModificationDate()
Description copied from interface: CmisObjectProperties
Returns the timestamp when this CMIS object has been modified (CMIS property cmis:lastModificationDate).

Specified by:
getLastModificationDate in interface CmisObjectProperties

getLastModifiedBy

public String getLastModifiedBy()
Description copied from interface: CmisObjectProperties
Returns the user who modified this CMIS object (CMIS property cmis:lastModifiedBy).

Specified by:
getLastModifiedBy in interface CmisObjectProperties

getName

public String getName()
Description copied from interface: CmisObjectProperties
Returns the name of this CMIS object (CMIS property cmis:name).

Specified by:
getName in interface CmisObjectProperties

getProperties

public List<Property<?>> getProperties()
Description copied from interface: CmisObjectProperties
Returns a list of all available CMIS properties.

Specified by:
getProperties in interface CmisObjectProperties

getProperty

public <T> Property<T> getProperty(String id)
Description copied from interface: CmisObjectProperties
Returns the requested property. If the property is not available, null is returned.

Specified by:
getProperty in interface CmisObjectProperties

getPropertyValue

public <T> T getPropertyValue(String id)
Description copied from interface: CmisObjectProperties
Returns the value of the requested property. If the property is not available, null is returned.

Specified by:
getPropertyValue in interface CmisObjectProperties

getType

public ObjectType getType()
Description copied from interface: CmisObjectProperties
Returns the type of this CMIS object (object type identified by cmis:objectTypeId).

Specified by:
getType in interface CmisObjectProperties

getAllowableActions

public AllowableActions getAllowableActions()
Description copied from interface: CmisObject
Returns the allowable actions if they have been fetched for this object.

Specified by:
getAllowableActions in interface CmisObject

getRenditions

public List<Rendition> getRenditions()
Description copied from interface: CmisObject
Returns the renditions if they have been fetched for this object.

Specified by:
getRenditions in interface CmisObject

getAcl

public Acl getAcl(boolean onlyBasicPermissions)

applyAcl

public Acl applyAcl(List<Ace> addAces,
                    List<Ace> removeAces,
                    AclPropagation aclPropagation)
Description copied from interface: CmisObject
Adds and removes ACEs to the object.

Specified by:
applyAcl in interface CmisObject
Returns:
the new ACL of this object

addAcl

public Acl addAcl(List<Ace> addAces,
                  AclPropagation aclPropagation)
Description copied from interface: CmisObject
Adds ACEs to the object.

Specified by:
addAcl in interface CmisObject

removeAcl

public Acl removeAcl(List<Ace> removeAces,
                     AclPropagation aclPropagation)
Description copied from interface: CmisObject
Removes ACEs to the object.

Specified by:
removeAcl in interface CmisObject

getAcl

public Acl getAcl()
Description copied from interface: CmisObject
Returns the ACL if it has been fetched for this object.

Specified by:
getAcl in interface CmisObject

applyPolicy

public void applyPolicy(ObjectId... policyIds)
Description copied from interface: CmisObject
Applies policies to this object.

Specified by:
applyPolicy in interface CmisObject

removePolicy

public void removePolicy(ObjectId... policyIds)
Description copied from interface: CmisObject
Remove policies from this object.

Specified by:
removePolicy in interface CmisObject

getPolicies

public List<Policy> getPolicies()
Description copied from interface: CmisObject
Returns the applied policies if they have been fetched for this object.

Specified by:
getPolicies in interface CmisObject

getRelationships

public List<Relationship> getRelationships()
Description copied from interface: CmisObject
Returns the relationships if they have been fetched for this object.

Specified by:
getRelationships in interface CmisObject

getExtensions

public List<CmisExtensionElement> getExtensions(ExtensionLevel level)
Description copied from interface: CmisObject
Returns the extensions for the given level.

Specified by:
getExtensions in interface CmisObject

getAdapter

public <T> T getAdapter(Class<T> adapterInterface)
Description copied from interface: CmisObject
Returns an adapter based on the given interface.

Specified by:
getAdapter in interface CmisObject

getTransientObject

public TransientCmisObject getTransientObject()
Description copied from interface: CmisObject
Returns a transient object adapter.

Specified by:
getTransientObject in interface CmisObject
See Also:
TransientCmisObject

createTransientCmisObject

protected TransientCmisObject createTransientCmisObject()

getRefreshTimestamp

public long getRefreshTimestamp()
Description copied from interface: CmisObject
Returns the timestamp (in milliseconds) of the last refresh.

Specified by:
getRefreshTimestamp in interface CmisObject

refresh

public void refresh()
Description copied from interface: CmisObject
Reloads the data from the repository.

Specified by:
refresh in interface CmisObject

refreshIfOld

public void refreshIfOld(long durationInMillis)
Description copied from interface: CmisObject
Reloads the data from the repository if the last refresh did not occur within durationInMillis.

Specified by:
refreshIfOld in interface CmisObject


Copyright © 2009-2011 The Apache Software Foundation. All Rights Reserved.