org.alfresco.repo.domain.node
Class AuditablePropertiesEntity

java.lang.Object
  extended by org.alfresco.repo.domain.node.AuditablePropertiesEntity

public class AuditablePropertiesEntity
extends java.lang.Object

Class holding properties associated with the cm:auditable aspect. This aspect is common enough to warrant direct inclusion on the Node entity.

Since:
3.4

Constructor Summary
AuditablePropertiesEntity()
          Default constructor with all null values.
AuditablePropertiesEntity(AuditablePropertiesEntity that)
          Copy constructor to create an unlocked instance
 
Method Summary
 java.util.Map getAuditableProperties()
           
 java.io.Serializable getAuditableProperty(org.alfresco.service.namespace.QName qname)
           
static java.util.Set getAuditablePropertyQNames()
           
 java.lang.String getAuditAccessed()
          For persistance use
 java.lang.String getAuditCreated()
          For persistance use
 java.lang.String getAuditCreator()
          For persistance use
 java.lang.String getAuditModified()
          For persistance use
 java.lang.String getAuditModifier()
          For persistance use
static boolean hasAuditableAspect(org.alfresco.service.namespace.QName typeQName, org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
           
static boolean hasAuditableProperty(java.util.Set qnames)
           
static boolean isAuditableProperty(org.alfresco.service.namespace.QName qname)
           
 void lock()
          Lock the entity against further updates to prevent accidental modification
 void setAuditAccessed(java.lang.String auditAccessed)
          For persistance use
 void setAuditCreated(java.lang.String auditCreated)
          For persistance use
 void setAuditCreator(java.lang.String auditCreator)
          For persistance use
 boolean setAuditModified(java.util.Date date, long modifiedDateToleranceMs)
           
 void setAuditModified(java.lang.String auditModified)
          For persistance use
 void setAuditModifier(java.lang.String auditModifier)
          For persistance use
 boolean setAuditValues(java.lang.String user, java.util.Date date, boolean force, long modifiedDateToleranceMs)
          Set all cm:auditable parameters as required.
 boolean setAuditValues(java.lang.String user, java.util.Date date, java.util.Map properties)
          Set all cm:auditable parameters as required, giving precedence to the supplied property map.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AuditablePropertiesEntity

public AuditablePropertiesEntity()
Default constructor with all null values.


AuditablePropertiesEntity

public AuditablePropertiesEntity(AuditablePropertiesEntity that)
Copy constructor to create an unlocked instance

Method Detail

getAuditablePropertyQNames

public static java.util.Set getAuditablePropertyQNames()
Returns:
Returns the QNames of the cm:auditable properties

hasAuditableProperty

public static boolean hasAuditableProperty(java.util.Set qnames)
Parameters:
qnames - the property names to check
Returns:
Returns true if the set contains a cm:auditable property

isAuditableProperty

public static boolean isAuditableProperty(org.alfresco.service.namespace.QName qname)
Returns:
Returns true if the property belongs to the cm:auditable aspect

hasAuditableAspect

public static boolean hasAuditableAspect(org.alfresco.service.namespace.QName typeQName,
                                         org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
Parameters:
typeQName - a node type
Returns:
true if the type given has the cm:auditable aspect by default

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

lock

public void lock()
Lock the entity against further updates to prevent accidental modification


getAuditableProperty

public java.io.Serializable getAuditableProperty(org.alfresco.service.namespace.QName qname)
Parameters:
qname - the property name
Returns:
Returns the value of the cm:auditable property or null

getAuditableProperties

public java.util.Map getAuditableProperties()
Returns:
Returns a Map of auditable properties

setAuditValues

public boolean setAuditValues(java.lang.String user,
                              java.util.Date date,
                              boolean force,
                              long modifiedDateToleranceMs)
Set all cm:auditable parameters as required. Where possible, the creation and modification data will be shared so as to reduce data duplication.

Parameters:
user - the username; null to use the fully-authenticated user
date - the creation or modification date; null to use the current system time
force - true to force the values to overwrite any pre-existing values
modifiedDateToleranceMs - the number of milliseconds' to tolerate before updating the modification date. Setting this to 1000L (say) will mean that the modification time will not be changed if the existing value is withing 1000 ms of the new time.
Returns:
Returns true if there were any changes made, otherwise false

setAuditValues

public boolean setAuditValues(java.lang.String user,
                              java.util.Date date,
                              java.util.Map properties)
Set all cm:auditable parameters as required, giving precedence to the supplied property map.

Parameters:
user - the username
date - the creation or modification date
properties - the properties to override the user and date
Returns:
Returns true if there were any changes made, otherwise false

getAuditCreator

public java.lang.String getAuditCreator()
For persistance use


setAuditCreator

public void setAuditCreator(java.lang.String auditCreator)
For persistance use


getAuditCreated

public java.lang.String getAuditCreated()
For persistance use


setAuditCreated

public void setAuditCreated(java.lang.String auditCreated)
For persistance use


getAuditModifier

public java.lang.String getAuditModifier()
For persistance use


setAuditModifier

public void setAuditModifier(java.lang.String auditModifier)
For persistance use


getAuditModified

public java.lang.String getAuditModified()
For persistance use


setAuditModified

public void setAuditModified(java.lang.String auditModified)
For persistance use


setAuditModified

public boolean setAuditModified(java.util.Date date,
                                long modifiedDateToleranceMs)
Parameters:
modifiedDateToleranceMs - the number of milliseconds' to tolerate before updating the modification date. Setting this to 1000L (say) will mean that the modification time will not be changed if the existing value is withing 1000 ms of the new time.
Returns:
Returns true if there were any changes made, otherwise false

getAuditAccessed

public java.lang.String getAuditAccessed()
For persistance use


setAuditAccessed

public void setAuditAccessed(java.lang.String auditAccessed)
For persistance use



Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.