org.apache.chemistry.opencmis.inmemory.storedobj.impl
Class StoredObjectImpl

java.lang.Object
  extended by org.apache.chemistry.opencmis.inmemory.storedobj.impl.StoredObjectImpl
All Implemented Interfaces:
StoredObject
Direct Known Subclasses:
AbstractMultiFilingImpl, AbstractSingleFilingImpl, DocumentVersionImpl

public class StoredObjectImpl
extends Object
implements StoredObject

StoredObject is the common superclass of all objects hold in the repository Documents, Folders, Relationships and Policies

Author:
Jens

Field Summary
protected  GregorianCalendar fCreatedAt
           
protected  String fCreatedBy
           
protected  String fId
           
protected  GregorianCalendar fModifiedAt
           
protected  String fModifiedBy
           
protected  String fName
           
protected  ObjectStoreImpl fObjStore
           
protected  Map<String,PropertyData<?>> fProperties
           
protected  String fRepositoryId
           
protected  String fTypeId
           
 
Method Summary
 void createSystemBasePropertiesWhenCreated(Map<String,PropertyData<?>> properties, String user)
          Create all system base properties that need to be stored with every object in the repository This method is called when a new object is created to record all of the capturing data like the creation time, creator etc.
 void fillProperties(Map<String,PropertyData<?>> properties, BindingsObjectFactory objFactory, List<String> requestedIds)
           
 String getChangeToken()
          Retrieve a change token uniquely identifying the state of the object when it was persisted (used for optimistic locking)
 GregorianCalendar getCreatedAt()
           
 String getCreatedBy()
          Retrieve the user who created the document
 String getId()
          Retrieve the id of this object.
 GregorianCalendar getModifiedAt()
          Retrieve date and time when the object was last modified.
 String getModifiedBy()
          Retrieve the user who last modified the document
 String getName()
          Retrieve the name of this object
 Map<String,PropertyData<?>> getProperties()
          Retrieve the list of properties
 String getRepositoryId()
          Get the repository id of this object where the object is stored.
 String getTypeId()
          Retrieve the type of this document.
 void persist()
          Persist the object so that it can be later retrieved by its id.
 void rename(String newName)
          Rename an object
 void setCreatedAt(GregorianCalendar createdAt)
          Assign date and time when the object was created.
 void setCreatedBy(String createdBy)
          Set the user who last modified the object.
 void setCustomProperties(Map<String,PropertyData<?>> properties)
          Set all properties which are not system properties.
 void setModifiedAtNow()
          Assign current date and time when the object was last modified.
 void setModifiedBy(String modifiedBy)
          Set the user who last modified the object.
 void setName(String name)
          Set the name of this document.
 void setProperties(Map<String,PropertyData<?>> props)
          Assign the properties to an object.
 void setRepositoryId(String repositoryId)
          Assign a repository where this object will be stored.
protected  void setSystemBasePropertiesWhenCreatedDirect(String name, String typeId, String user)
          Add CMIS_CREATED_BY, CMIS_CREATION_DATE, CMIS_LAST_MODIFIED_BY, CMIS_LAST_MODIFICATION_DATE, CMIS_CHANGE_TOKEN system properties to the list of properties with current values
 void setTypeId(String type)
          Set the type of this document.
 void updateSystemBasePropertiesWhenModified(Map<String,PropertyData<?>> properties, String user)
          Update all system base properties that need to be stored with every object in the repository This method is called when an object is is updated to record all of the capturing data like the modification time, updating user etc.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fId

protected String fId

fName

protected String fName

fTypeId

protected String fTypeId

fCreatedBy

protected String fCreatedBy

fModifiedBy

protected String fModifiedBy

fCreatedAt

protected GregorianCalendar fCreatedAt

fModifiedAt

protected GregorianCalendar fModifiedAt

fRepositoryId

protected String fRepositoryId

fProperties

protected Map<String,PropertyData<?>> fProperties

fObjStore

protected final ObjectStoreImpl fObjStore
Method Detail

getId

public String getId()
Description copied from interface: StoredObject
Retrieve the id of this object.

Specified by:
getId in interface StoredObject
Returns:
id of this object

getName

public String getName()
Description copied from interface: StoredObject
Retrieve the name of this object

Specified by:
getName in interface StoredObject
Returns:
name of this object

setName

public void setName(String name)
Description copied from interface: StoredObject
Set the name of this document. This method does not persist the object.

Specified by:
setName in interface StoredObject
Parameters:
name - name that is assigned to this object

getTypeId

public String getTypeId()
Description copied from interface: StoredObject
Retrieve the type of this document.

Specified by:
getTypeId in interface StoredObject
Returns:
Id of the type identifying the type of this object

setTypeId

public void setTypeId(String type)
Description copied from interface: StoredObject
Set the type of this document. This method does not persist the object.

Specified by:
setTypeId in interface StoredObject
Parameters:
type - id of the type this object gets assigned.

getCreatedBy

public String getCreatedBy()
Description copied from interface: StoredObject
Retrieve the user who created the document

Specified by:
getCreatedBy in interface StoredObject
Returns:
user who created the document.

setCreatedBy

public void setCreatedBy(String createdBy)
Description copied from interface: StoredObject
Set the user who last modified the object. This method does not persist the object.

Specified by:
setCreatedBy in interface StoredObject
Parameters:
createdBy - user who last modified the document

getModifiedBy

public String getModifiedBy()
Description copied from interface: StoredObject
Retrieve the user who last modified the document

Specified by:
getModifiedBy in interface StoredObject
Returns:
user who last modified the document.

setModifiedBy

public void setModifiedBy(String modifiedBy)
Description copied from interface: StoredObject
Set the user who last modified the object. This method does not persist the object.

Specified by:
setModifiedBy in interface StoredObject
Parameters:
modifiedBy - user who last modified the document

getCreatedAt

public GregorianCalendar getCreatedAt()
Specified by:
getCreatedAt in interface StoredObject

setCreatedAt

public void setCreatedAt(GregorianCalendar createdAt)
Description copied from interface: StoredObject
Assign date and time when the object was created. Usually you should not call this method externally. This method does not persist the object.

Specified by:
setCreatedAt in interface StoredObject
Parameters:
createdAt - date the object was created

getModifiedAt

public GregorianCalendar getModifiedAt()
Description copied from interface: StoredObject
Retrieve date and time when the object was last modified.

Specified by:
getModifiedAt in interface StoredObject
Returns:
date the object was last modified

setModifiedAtNow

public void setModifiedAtNow()
Description copied from interface: StoredObject
Assign current date and time when the object was last modified. Usually you should not call this method externally. This method does not persist the object.

Specified by:
setModifiedAtNow in interface StoredObject

setRepositoryId

public void setRepositoryId(String repositoryId)
Description copied from interface: StoredObject
Assign a repository where this object will be stored. This method does not persist the object.

Specified by:
setRepositoryId in interface StoredObject
Parameters:
repositoryId - id of the repository

getRepositoryId

public String getRepositoryId()
Description copied from interface: StoredObject
Get the repository id of this object where the object is stored.

Specified by:
getRepositoryId in interface StoredObject
Returns:

setProperties

public void setProperties(Map<String,PropertyData<?>> props)
Description copied from interface: StoredObject
Assign the properties to an object. This method does not persist the object.

Specified by:
setProperties in interface StoredObject
Parameters:
props - properties to be assigned

getProperties

public Map<String,PropertyData<?>> getProperties()
Description copied from interface: StoredObject
Retrieve the list of properties

Specified by:
getProperties in interface StoredObject
Returns:

getChangeToken

public String getChangeToken()
Description copied from interface: StoredObject
Retrieve a change token uniquely identifying the state of the object when it was persisted (used for optimistic locking)

Specified by:
getChangeToken in interface StoredObject
Returns:
String identifying the change token

rename

public void rename(String newName)
Description copied from interface: StoredObject
Rename an object

Specified by:
rename in interface StoredObject
Parameters:
newName - the new name of the object

createSystemBasePropertiesWhenCreated

public void createSystemBasePropertiesWhenCreated(Map<String,PropertyData<?>> properties,
                                                  String user)
Description copied from interface: StoredObject
Create all system base properties that need to be stored with every object in the repository This method is called when a new object is created to record all of the capturing data like the creation time, creator etc.

Specified by:
createSystemBasePropertiesWhenCreated in interface StoredObject
Parameters:
properties - The properties passed by the client, containing, name, type, etc
user - The user creating the document

updateSystemBasePropertiesWhenModified

public void updateSystemBasePropertiesWhenModified(Map<String,PropertyData<?>> properties,
                                                   String user)
Description copied from interface: StoredObject
Update all system base properties that need to be stored with every object in the repository This method is called when an object is is updated to record all of the capturing data like the modification time, updating user etc.

Specified by:
updateSystemBasePropertiesWhenModified in interface StoredObject
Parameters:
properties - The properties passed by the client, containing, name, type, etc
user - The user creating the document

fillProperties

public void fillProperties(Map<String,PropertyData<?>> properties,
                           BindingsObjectFactory objFactory,
                           List<String> requestedIds)
Specified by:
fillProperties in interface StoredObject

setCustomProperties

public void setCustomProperties(Map<String,PropertyData<?>> properties)
Description copied from interface: StoredObject
Set all properties which are not system properties. These are the properties as defined in Type system definition. This method is called when an object is created or updated. The implementation must ignore the system properties.

Specified by:
setCustomProperties in interface StoredObject
Parameters:
properties - Set of properties as set by the client, including system parameters

setSystemBasePropertiesWhenCreatedDirect

protected void setSystemBasePropertiesWhenCreatedDirect(String name,
                                                        String typeId,
                                                        String user)
Add CMIS_CREATED_BY, CMIS_CREATION_DATE, CMIS_LAST_MODIFIED_BY, CMIS_LAST_MODIFICATION_DATE, CMIS_CHANGE_TOKEN system properties to the list of properties with current values


persist

public void persist()
Description copied from interface: StoredObject
Persist the object so that it can be later retrieved by its id. Assign an id to the object

Specified by:
persist in interface StoredObject


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