Class AuditablePropertiesEntity

  • All Implemented Interfaces:
    java.io.Serializable

    public class AuditablePropertiesEntity
    extends java.lang.Object
    implements java.io.Serializable
    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
    Author:
    Derek Hulley
    See Also:
    Serialized Form
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> getAuditableProperties()  
      java.io.Serializable getAuditableProperty​(org.alfresco.service.namespace.QName qname)  
      static java.util.Set<org.alfresco.service.namespace.QName> 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<org.alfresco.service.namespace.QName> 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
      void setAuditModified​(java.lang.String auditModified)
      For persistance use
      boolean setAuditModified​(java.util.Date date, long modifiedDateToleranceMs)  
      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<org.alfresco.service.namespace.QName,​java.io.Serializable> 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<org.alfresco.service.namespace.QName> getAuditablePropertyQNames()
        Returns:
        Returns the QNames of the cm:auditable properties
      • hasAuditableProperty

        public static boolean hasAuditableProperty​(java.util.Set<org.alfresco.service.namespace.QName> 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<org.alfresco.service.namespace.QName,​java.io.Serializable> 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<org.alfresco.service.namespace.QName,​java.io.Serializable> 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