Class IntegrityChecker

    • Constructor Detail

      • IntegrityChecker

        public IntegrityChecker()
    • Method Detail

      • setWarnInTransaction

        public static void setWarnInTransaction()
        Downgrade violations to warnings within the current transaction. This is temporary and is dependent on there being a current transaction active against the current thread. When set, this will override the global failure behaviour.
      • isWarnInTransaction

        public static boolean isWarnInTransaction()
        Returns:
        Returns true if the current transaction should only warn on violations. If false, the global setting will take effect.
        See Also:
        setWarnInTransaction()
      • setPolicyComponent

        public void setPolicyComponent​(PolicyComponent policyComponent)
        Parameters:
        policyComponent - the component to register behaviour with
      • setDictionaryService

        public void setDictionaryService​(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
        Parameters:
        dictionaryService - the dictionary against which to confirm model details
      • setNodeService

        public void setNodeService​(org.alfresco.service.cmr.repository.NodeService nodeService)
        Parameters:
        nodeService - the node service to use for browsing node structures
      • setTenantService

        public void setTenantService​(org.alfresco.repo.tenant.TenantService tenantService)
      • setEnabled

        public void setEnabled​(boolean enabled)
        Parameters:
        enabled - set to false to disable integrity checking completely
      • setTraceOn

        public void setTraceOn​(boolean traceOn)
        Parameters:
        traceOn - set to true to enable stack traces recording of events
      • setFailOnViolation

        public void setFailOnViolation​(boolean failOnViolation)
        Parameters:
        failOnViolation - set to true to force failure by RuntimeException when a violation occurs.
      • setMaxErrorsPerTransaction

        public void setMaxErrorsPerTransaction​(int maxLogNumberPerTransaction)
        Parameters:
        maxLogNumberPerTransaction - upper limit on how many violations are logged when multiple violations have been found.
      • setStoresToIgnore

        public void setStoresToIgnore​(java.util.List<java.lang.String> storesToIgnore)
        Parameters:
        storesToIgnore - stores (eg. workspace://version2Store) which will be ignored by integrity checker. Note: assumes associations are within a store.
      • init

        public void init()
        Registers the system-level policy behaviours
      • onUpdateProperties

        public void onUpdateProperties​(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                                       java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> before,
                                       java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> after)
        Description copied from interface: NodeServicePolicies.OnUpdatePropertiesPolicy
        Called after a node's properties have been changed.
        Specified by:
        onUpdateProperties in interface NodeServicePolicies.OnUpdatePropertiesPolicy
        Parameters:
        nodeRef - reference to the updated node
        before - the node's properties before the change
        after - the node's properties after the change
        See Also:
        PropertiesIntegrityEvent
      • onDeleteNode

        public void onDeleteNode​(org.alfresco.service.cmr.repository.ChildAssociationRef childAssocRef,
                                 boolean isArchivedNode)
        No checking performed: The association changes will be handled
        Specified by:
        onDeleteNode in interface NodeServicePolicies.OnDeleteNodePolicy
        Parameters:
        childAssocRef - the primary parent-child association of the deleted node
        isArchivedNode - indicates whether the node has been archived rather than purged
      • checkIntegrity

        public void checkIntegrity()
                            throws IntegrityException
        Runs several types of checks, querying specifically for events that will necessitate each type of test.

        The interface contracts also requires that all events for the transaction get cleaned up.

        Throws:
        IntegrityException
      • beforeCommit

        public void beforeCommit​(boolean readOnly)
        Specified by:
        beforeCommit in interface org.alfresco.util.transaction.TransactionListener
      • beforeCompletion

        public void beforeCompletion()
        Specified by:
        beforeCompletion in interface org.alfresco.util.transaction.TransactionListener
      • afterCommit

        public void afterCommit()
        Specified by:
        afterCommit in interface org.alfresco.util.transaction.TransactionListener
      • afterRollback

        public void afterRollback()
        Specified by:
        afterRollback in interface org.alfresco.util.transaction.TransactionListener