it.sistematica.isharedoc.opencmis.indatabase.storedobj.impl
Class StoredObjectImpl

java.lang.Object
  extended by it.sistematica.isharedoc.opencmis.indatabase.storedobj.impl.StoredObjectImpl
All Implemented Interfaces:
StoredObject
Direct Known Subclasses:
AbstractMultiFilingImpl, AbstractSingleFilingImpl, DocumentVersionImpl, PolicyImpl, RelationshipImpl

public class StoredObjectImpl
extends java.lang.Object
implements StoredObject

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

Author:
Fabio Spica

Field Summary
protected  File fNativeObject
           
protected  ObjectStoreImpl fObjStore
           
protected  java.util.Map<java.lang.String,org.apache.chemistry.opencmis.commons.data.PropertyData<?>> fProperties
           
protected  java.lang.String fRepositoryId
           
protected  java.lang.String fTypeId
           
static int ICON_SIZE
           
protected  java.util.List<java.lang.String> policyIds
           
static java.lang.String RENDITION_MIME_TYPE_JPEG
           
static java.lang.String RENDITION_MIME_TYPE_PNG
           
static java.lang.String RENDITION_SUFFIX
           
protected  java.util.List<java.lang.String> secondaryTypeIds
           
 
Constructor Summary
StoredObjectImpl(ObjectStoreImpl objStore)
           
StoredObjectImpl(ObjectStoreImpl objStore, File file)
           
 
Method Summary
 org.apache.chemistry.opencmis.commons.data.Acl addAcl(org.apache.chemistry.opencmis.commons.data.Acl acl)
          Add the Acl to the stored object
 void addAppliedPolicy(java.lang.String policyId)
          add an id of a policy to an object
 void createSystemBasePropertiesWhenCreated(java.util.Map<java.lang.String,org.apache.chemistry.opencmis.commons.data.PropertyData<?>> properties, java.lang.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(java.util.Map<java.lang.String,org.apache.chemistry.opencmis.commons.data.PropertyData<?>> properties, org.apache.chemistry.opencmis.commons.spi.BindingsObjectFactory objFactory, java.util.List<java.lang.String> requestedIds)
           
 org.apache.chemistry.opencmis.commons.data.Acl getAcl()
          get the Acl of the stored object
 org.apache.chemistry.opencmis.commons.data.AllowableActions getAllowableActions(java.lang.String user)
           
 java.util.List<java.lang.String> getAppliedPolicies()
          get applied policies of this object
 java.lang.String getChangeToken()
          Retrieve a change token uniquely identifying the state of the object when it was persisted (used for optimistic locking)
 ConfidentialityLevel getConfidentialityLevel()
           
 java.util.GregorianCalendar getCreatedAt()
           
 java.lang.String getCreatedBy()
          Retrieve the user who created the document
 boolean getDeleted()
           
 java.lang.String getDescription()
          CMIS 1.1: get description of an object
 boolean getHidden()
           
protected  org.apache.chemistry.opencmis.commons.data.ContentStream getIconFromResourceDir(java.lang.String name)
           
 java.lang.String getId()
          Retrieve the id of this object.
 java.util.GregorianCalendar getModifiedAt()
          Retrieve date and time when the object was last modified.
 java.lang.String getModifiedBy()
          Retrieve the user who last modified the document
 java.lang.String getName()
          Retrieve the name of this object
 File getNativeObject()
          Retrieve the native object.
 java.util.List<StoredObject> getObjectRelationships(org.apache.chemistry.opencmis.commons.enums.RelationshipDirection relationshipDirection, java.lang.String user)
          get the relationships of the object
 ObjectTemplate getObjectTemplate()
           
 Organization getOrganization()
           
 File getOriginalNativeObject()
           
 java.util.Map<java.lang.String,org.apache.chemistry.opencmis.commons.data.PropertyData<?>> getProperties()
          Retrieve the list of properties
 org.apache.chemistry.opencmis.commons.data.ContentStream getRenditionContent(java.lang.String streamId, long offset, long length)
          get the rendition of this object
 java.util.List<org.apache.chemistry.opencmis.commons.data.RenditionData> getRenditions(java.lang.String renditionFilter, long maxItems, long skipCount)
          get the rendition this objects supports
 java.lang.String getRepositoryId()
          Get the repository id of this object where the object is stored.
 java.util.List<java.lang.String> getSecondaryTypeIds()
          CMIS 1.1 get ids of all secondary types
 java.util.GregorianCalendar getSignatureExpireDate()
           
 java.lang.String getSignatureStatus()
           
 java.util.GregorianCalendar getSignatureValidationDate()
           
 java.lang.String getSignatureValidationNote()
           
 java.lang.String getSignatureValidationStatus()
           
 boolean getSigned()
           
 java.lang.String getType()
           
 java.lang.String getTypeId()
          Retrieve the type of this document.
 boolean hasRendition(java.lang.String user)
          check if the document can generate a renditions and rendition is visible for user
 void persist()
          Persist the object so that it can be later retrieved by its id.
 void removeAcl(org.apache.chemistry.opencmis.commons.data.Acl acl)
          Remove the Acl from the stored object
 void removePolicy(java.lang.String policyId)
          remove an id of a policy from an object
 void rename(java.lang.String newName)
          Rename an object
 void setAppliedPolicies(java.util.List<java.lang.String> newPolicies)
           
 void setConfidentialityLevel(ConfidentialityLevel confidentialityLevel)
           
 void setConfidentialityLevelId(java.math.BigInteger confidentialityLevelId)
           
 void setCreatedAt(java.util.GregorianCalendar createdAt)
          Assign date and time when the object was created.
 void setCreatedBy(java.lang.String createdBy)
          Set the user who last modified the object.
 void setCustomProperties(java.util.Map<java.lang.String,org.apache.chemistry.opencmis.commons.data.PropertyData<?>> properties)
          Set all properties which are not system properties.
 void setDeleted(boolean hidden)
           
 void setDescription(java.lang.String descr)
          CMIS 1.1: set description of an object
 void setHidden(boolean hidden)
           
 void setId(java.lang.String id)
           
 void setModifiedAtNow()
          Assign current date and time when the object was last modified.
 void setModifiedBy(java.lang.String modifiedBy)
          Set the user who last modified the object.
 void setName(java.lang.String name)
          Set the name of this document.
 void setNativeObject(File file)
          Set the native object.
 void setNote(java.lang.String note)
           
 void setObjectTemplate(ObjectTemplate objectTemplate)
           
 void setObjectTemplateId(java.math.BigInteger objectTemplateId)
           
 void setOrganization(Organization organization)
           
 void setOrganizationId(java.math.BigInteger organizationId)
           
 void setOriginalFileId(java.math.BigInteger originalFileId)
           
 void setProperties(java.util.Map<java.lang.String,org.apache.chemistry.opencmis.commons.data.PropertyData<?>> props)
          Assign the properties to an object.
 void setRemoteURL(java.lang.String url)
           
 void setRepositoryId(java.lang.String repositoryId)
          Assign a repository where this object will be stored.
 void setSecondaryTypeIds(java.util.List<java.lang.String> secondaryTypeIds)
           
 void setSignatureValidationNote(java.lang.String note)
           
 void setSignatureValidationStatus(java.lang.String status)
           
 void setStatus(java.lang.String statusCode)
           
protected  void setSystemBasePropertiesWhenCreatedDirect(java.lang.String name, java.lang.String typeId, java.lang.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(java.lang.String type)
          Set the type of this document.
protected  boolean testRenditionFilterForImage(java.lang.String[] formats)
           
 void updateSystemBasePropertiesWhenModified(java.util.Map<java.lang.String,org.apache.chemistry.opencmis.commons.data.PropertyData<?>> properties, java.lang.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

RENDITION_MIME_TYPE_JPEG

public static final java.lang.String RENDITION_MIME_TYPE_JPEG
See Also:
Constant Field Values

RENDITION_MIME_TYPE_PNG

public static final java.lang.String RENDITION_MIME_TYPE_PNG
See Also:
Constant Field Values

RENDITION_SUFFIX

public static final java.lang.String RENDITION_SUFFIX
See Also:
Constant Field Values

ICON_SIZE

public static final int ICON_SIZE
See Also:
Constant Field Values

fTypeId

protected java.lang.String fTypeId

fRepositoryId

protected java.lang.String fRepositoryId

fProperties

protected java.util.Map<java.lang.String,org.apache.chemistry.opencmis.commons.data.PropertyData<?>> fProperties

fObjStore

protected final ObjectStoreImpl fObjStore

secondaryTypeIds

protected java.util.List<java.lang.String> secondaryTypeIds

policyIds

protected java.util.List<java.lang.String> policyIds

fNativeObject

protected File fNativeObject
Constructor Detail

StoredObjectImpl

StoredObjectImpl(ObjectStoreImpl objStore)

StoredObjectImpl

StoredObjectImpl(ObjectStoreImpl objStore,
                 File file)
Method Detail

getNativeObject

public File getNativeObject()
Description copied from interface: StoredObject
Retrieve the native object.

Specified by:
getNativeObject in interface StoredObject
Returns:
native object

getOriginalNativeObject

public File getOriginalNativeObject()

setNativeObject

public void setNativeObject(File file)
Description copied from interface: StoredObject
Set the native object.

Specified by:
setNativeObject in interface StoredObject

getId

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

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

setId

public void setId(java.lang.String id)

getName

public java.lang.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(java.lang.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 java.lang.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(java.lang.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 java.lang.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(java.lang.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 java.lang.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(java.lang.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 java.util.GregorianCalendar getCreatedAt()
Specified by:
getCreatedAt in interface StoredObject

setCreatedAt

public void setCreatedAt(java.util.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 java.util.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(java.lang.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 java.lang.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:

getAppliedPolicies

public java.util.List<java.lang.String> getAppliedPolicies()
Description copied from interface: StoredObject
get applied policies of this object

Specified by:
getAppliedPolicies in interface StoredObject
Returns:
list of ids of policies applied to this object

setAppliedPolicies

public void setAppliedPolicies(java.util.List<java.lang.String> newPolicies)

addAppliedPolicy

public void addAppliedPolicy(java.lang.String policyId)
Description copied from interface: StoredObject
add an id of a policy to an object

Specified by:
addAppliedPolicy in interface StoredObject
Parameters:
policyId - id of policy to add

removePolicy

public void removePolicy(java.lang.String policyId)
Description copied from interface: StoredObject
remove an id of a policy from an object

Specified by:
removePolicy in interface StoredObject
Parameters:
policyId - id of policy to remove

setDescription

public void setDescription(java.lang.String descr)
Description copied from interface: StoredObject
CMIS 1.1: set description of an object

Specified by:
setDescription in interface StoredObject
Parameters:
descr - description of this object

getDescription

public java.lang.String getDescription()
Description copied from interface: StoredObject
CMIS 1.1: get description of an object

Specified by:
getDescription in interface StoredObject
Returns:
description of this object

getType

public java.lang.String getType()

getHidden

public boolean getHidden()

setHidden

public void setHidden(boolean hidden)

getDeleted

public boolean getDeleted()

setDeleted

public void setDeleted(boolean hidden)

getOrganization

public Organization getOrganization()

setOrganization

public void setOrganization(Organization organization)

setOrganizationId

public void setOrganizationId(java.math.BigInteger organizationId)

getConfidentialityLevel

public ConfidentialityLevel getConfidentialityLevel()

setConfidentialityLevel

public void setConfidentialityLevel(ConfidentialityLevel confidentialityLevel)

setConfidentialityLevelId

public void setConfidentialityLevelId(java.math.BigInteger confidentialityLevelId)

setStatus

public void setStatus(java.lang.String statusCode)

setNote

public void setNote(java.lang.String note)

getObjectTemplate

public ObjectTemplate getObjectTemplate()

setObjectTemplate

public void setObjectTemplate(ObjectTemplate objectTemplate)

setObjectTemplateId

public void setObjectTemplateId(java.math.BigInteger objectTemplateId)

setOriginalFileId

public void setOriginalFileId(java.math.BigInteger originalFileId)

setRemoteURL

public void setRemoteURL(java.lang.String url)

getSigned

public boolean getSigned()

getSignatureExpireDate

public java.util.GregorianCalendar getSignatureExpireDate()

getSignatureStatus

public java.lang.String getSignatureStatus()

getSignatureValidationDate

public java.util.GregorianCalendar getSignatureValidationDate()

getSignatureValidationStatus

public java.lang.String getSignatureValidationStatus()

setSignatureValidationStatus

public void setSignatureValidationStatus(java.lang.String status)

getSignatureValidationNote

public java.lang.String getSignatureValidationNote()

setSignatureValidationNote

public void setSignatureValidationNote(java.lang.String note)

getSecondaryTypeIds

public java.util.List<java.lang.String> getSecondaryTypeIds()
Description copied from interface: StoredObject
CMIS 1.1 get ids of all secondary types

Specified by:
getSecondaryTypeIds in interface StoredObject
Returns:
list of type ids

setSecondaryTypeIds

public void setSecondaryTypeIds(java.util.List<java.lang.String> secondaryTypeIds)

setProperties

public void setProperties(java.util.Map<java.lang.String,org.apache.chemistry.opencmis.commons.data.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 java.util.Map<java.lang.String,org.apache.chemistry.opencmis.commons.data.PropertyData<?>> getProperties()
Description copied from interface: StoredObject
Retrieve the list of properties

Specified by:
getProperties in interface StoredObject
Returns:

getChangeToken

public java.lang.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(java.lang.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(java.util.Map<java.lang.String,org.apache.chemistry.opencmis.commons.data.PropertyData<?>> properties,
                                                  java.lang.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(java.util.Map<java.lang.String,org.apache.chemistry.opencmis.commons.data.PropertyData<?>> properties,
                                                   java.lang.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(java.util.Map<java.lang.String,org.apache.chemistry.opencmis.commons.data.PropertyData<?>> properties,
                           org.apache.chemistry.opencmis.commons.spi.BindingsObjectFactory objFactory,
                           java.util.List<java.lang.String> requestedIds)
Specified by:
fillProperties in interface StoredObject

setCustomProperties

public void setCustomProperties(java.util.Map<java.lang.String,org.apache.chemistry.opencmis.commons.data.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(java.lang.String name,
                                                        java.lang.String typeId,
                                                        java.lang.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

getAcl

public org.apache.chemistry.opencmis.commons.data.Acl getAcl()
Description copied from interface: StoredObject
get the Acl of the stored object

Specified by:
getAcl in interface StoredObject

addAcl

public org.apache.chemistry.opencmis.commons.data.Acl addAcl(org.apache.chemistry.opencmis.commons.data.Acl acl)
Description copied from interface: StoredObject
Add the Acl to the stored object

Specified by:
addAcl in interface StoredObject

removeAcl

public void removeAcl(org.apache.chemistry.opencmis.commons.data.Acl acl)
Description copied from interface: StoredObject
Remove the Acl from the stored object

Specified by:
removeAcl in interface StoredObject

getObjectRelationships

public java.util.List<StoredObject> getObjectRelationships(org.apache.chemistry.opencmis.commons.enums.RelationshipDirection relationshipDirection,
                                                           java.lang.String user)
Description copied from interface: StoredObject
get the relationships of the object

Specified by:
getObjectRelationships in interface StoredObject
Parameters:
relationshipDirection - whether relationships where the object is the source, or the target or all are returned
user - the id of the user calling the method

getAllowableActions

public org.apache.chemistry.opencmis.commons.data.AllowableActions getAllowableActions(java.lang.String user)
Specified by:
getAllowableActions in interface StoredObject

getRenditions

public java.util.List<org.apache.chemistry.opencmis.commons.data.RenditionData> getRenditions(java.lang.String renditionFilter,
                                                                                              long maxItems,
                                                                                              long skipCount)
Description copied from interface: StoredObject
get the rendition this objects supports

Specified by:
getRenditions in interface StoredObject
Returns:
List of renditions or null if no renditions are available for this object

getRenditionContent

public org.apache.chemistry.opencmis.commons.data.ContentStream getRenditionContent(java.lang.String streamId,
                                                                                    long offset,
                                                                                    long length)
Description copied from interface: StoredObject
get the rendition of this object

Specified by:
getRenditionContent in interface StoredObject
Parameters:
streamId - stream if of rendition
offset - offset in rendition content
length - length of rendition content
Returns:
ContentStream containing the rendition

hasRendition

public boolean hasRendition(java.lang.String user)
Description copied from interface: StoredObject
check if the document can generate a renditions and rendition is visible for user

Specified by:
hasRendition in interface StoredObject
Returns:
true if rendition exists, false if not.

getIconFromResourceDir

protected org.apache.chemistry.opencmis.commons.data.ContentStream getIconFromResourceDir(java.lang.String name)
                                                                                   throws java.io.IOException
Throws:
java.io.IOException

testRenditionFilterForImage

protected boolean testRenditionFilterForImage(java.lang.String[] formats)