Class PolicyScope


  • public class PolicyScope
    extends java.lang.Object
    Policy scope.

    Helper often used by policies which require information about a node to be gathered, for example onCopy or onCreateVersion.

    Author:
    Roy Wetherall
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Map<org.alfresco.service.cmr.repository.ChildAssociationRef,​org.alfresco.service.cmr.repository.ChildAssociationRef> alwaysTraverseMap
      Map of assocs that will always be traversed
      protected java.util.Map<org.alfresco.service.namespace.QName,​org.alfresco.repo.policy.AspectDetails> aspectCopyDetails
      The aspects
      protected java.util.List<org.alfresco.service.cmr.repository.ChildAssociationRef> childAssocs
      The child associations
      protected org.alfresco.service.namespace.QName classRef
      The class ref of the aspect
      protected java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> properties
      The properties
      protected java.util.List<org.alfresco.service.cmr.repository.AssociationRef> targetAssocs
      The target associations
    • Constructor Summary

      Constructors 
      Constructor Description
      PolicyScope​(org.alfresco.service.namespace.QName classRef)
      Constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.alfresco.repo.policy.AspectDetails addAspect​(org.alfresco.service.namespace.QName aspect)
      Add an aspect
      protected void addAssociation​(org.alfresco.service.cmr.repository.AssociationRef nodeAssocRef)
      Adds an association to be copied
      void addAssociation​(org.alfresco.service.namespace.QName classRef, org.alfresco.service.cmr.repository.AssociationRef nodeAssocRef)
      Add an association
      protected void addChildAssociation​(org.alfresco.service.cmr.repository.ChildAssociationRef childAssocRef)
      Add a child association
      protected void addChildAssociation​(org.alfresco.service.cmr.repository.ChildAssociationRef childAssocRef, boolean alwaysTraverseAssociation)
      Add a child association
      void addChildAssociation​(org.alfresco.service.namespace.QName classRef, org.alfresco.service.cmr.repository.ChildAssociationRef childAssocRef)
      Adds a child association
      void addChildAssociation​(org.alfresco.service.namespace.QName classRef, org.alfresco.service.cmr.repository.ChildAssociationRef childAssocRef, boolean alwaysTraverseAssociation)  
      void addProperty​(org.alfresco.service.namespace.QName qName, java.io.Serializable value)
      Add a property to the list
      void addProperty​(org.alfresco.service.namespace.QName classRef, org.alfresco.service.namespace.QName qName, java.io.Serializable value)
      Add a property
      java.util.Set<org.alfresco.service.namespace.QName> getAspects()
      Gets a list of the aspects
      java.util.List<org.alfresco.service.cmr.repository.AssociationRef> getAssociations()
      Gets the map of associations to be copied
      java.util.List<org.alfresco.service.cmr.repository.AssociationRef> getAssociations​(org.alfresco.service.namespace.QName classRef)
      Get associations
      java.util.List<org.alfresco.service.cmr.repository.ChildAssociationRef> getChildAssociations()
      Gets the child associations to be copied
      java.util.List<org.alfresco.service.cmr.repository.ChildAssociationRef> getChildAssociations​(org.alfresco.service.namespace.QName classRef)
      Get a child association
      java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> getProperties()
      Gets the map of properties
      java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> getProperties​(org.alfresco.service.namespace.QName classRef)
      Get the properties
      protected boolean isChildAssociationRefAlwaysTraversed​(org.alfresco.service.cmr.repository.ChildAssociationRef childAssocRef)
      Indicates whether a child association ref is always traversed or not
      boolean isChildAssociationRefAlwaysTraversed​(org.alfresco.service.namespace.QName classRef, org.alfresco.service.cmr.repository.ChildAssociationRef childAssocRef)  
      void removeAspect​(org.alfresco.service.namespace.QName aspect)
      Removes an aspect from the list
      void removeProperty​(org.alfresco.service.namespace.QName qName)
      Remove a property from the list
      void removeProperty​(org.alfresco.service.namespace.QName classRef, org.alfresco.service.namespace.QName qName)
      Removes a property from the list
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • aspectCopyDetails

        protected java.util.Map<org.alfresco.service.namespace.QName,​org.alfresco.repo.policy.AspectDetails> aspectCopyDetails
        The aspects
      • properties

        protected java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> properties
        The properties
      • childAssocs

        protected java.util.List<org.alfresco.service.cmr.repository.ChildAssociationRef> childAssocs
        The child associations
      • targetAssocs

        protected java.util.List<org.alfresco.service.cmr.repository.AssociationRef> targetAssocs
        The target associations
      • classRef

        protected org.alfresco.service.namespace.QName classRef
        The class ref of the aspect
      • alwaysTraverseMap

        protected java.util.Map<org.alfresco.service.cmr.repository.ChildAssociationRef,​org.alfresco.service.cmr.repository.ChildAssociationRef> alwaysTraverseMap
        Map of assocs that will always be traversed
    • Constructor Detail

      • PolicyScope

        public PolicyScope​(org.alfresco.service.namespace.QName classRef)
        Constructor
        Parameters:
        classRef - the class reference
    • Method Detail

      • addProperty

        public void addProperty​(org.alfresco.service.namespace.QName classRef,
                                org.alfresco.service.namespace.QName qName,
                                java.io.Serializable value)
        Add a property
        Parameters:
        classRef - the class reference
        qName - the qualified name of the property
        value - the value of the property
      • removeProperty

        public void removeProperty​(org.alfresco.service.namespace.QName classRef,
                                   org.alfresco.service.namespace.QName qName)
        Removes a property from the list
        Parameters:
        classRef - the class reference
        qName - the qualified name
      • getProperties

        public java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> getProperties​(org.alfresco.service.namespace.QName classRef)
        Get the properties
        Parameters:
        classRef - the class ref
        Returns:
        the properties that should be copied
      • addChildAssociation

        public void addChildAssociation​(org.alfresco.service.namespace.QName classRef,
                                        org.alfresco.service.cmr.repository.ChildAssociationRef childAssocRef)
        Adds a child association
        Parameters:
        classRef - QName
        childAssocRef - ChildAssociationRef
      • addChildAssociation

        public void addChildAssociation​(org.alfresco.service.namespace.QName classRef,
                                        org.alfresco.service.cmr.repository.ChildAssociationRef childAssocRef,
                                        boolean alwaysTraverseAssociation)
        Parameters:
        classRef - QName
        childAssocRef - ChildAssociationRef
        alwaysTraverseAssociation - boolean
      • getChildAssociations

        public java.util.List<org.alfresco.service.cmr.repository.ChildAssociationRef> getChildAssociations​(org.alfresco.service.namespace.QName classRef)
        Get a child association
        Parameters:
        classRef - QName
      • isChildAssociationRefAlwaysTraversed

        public boolean isChildAssociationRefAlwaysTraversed​(org.alfresco.service.namespace.QName classRef,
                                                            org.alfresco.service.cmr.repository.ChildAssociationRef childAssocRef)
      • addAssociation

        public void addAssociation​(org.alfresco.service.namespace.QName classRef,
                                   org.alfresco.service.cmr.repository.AssociationRef nodeAssocRef)
        Add an association
        Parameters:
        classRef - QName
        nodeAssocRef - AssociationRef
      • getAssociations

        public java.util.List<org.alfresco.service.cmr.repository.AssociationRef> getAssociations​(org.alfresco.service.namespace.QName classRef)
        Get associations
        Parameters:
        classRef - QName
      • addAspect

        public org.alfresco.repo.policy.AspectDetails addAspect​(org.alfresco.service.namespace.QName aspect)
        Add an aspect
        Parameters:
        aspect - the aspect class reference
        Returns:
        the apsect copy details (returned as a helper)
      • removeAspect

        public void removeAspect​(org.alfresco.service.namespace.QName aspect)
        Removes an aspect from the list
        Parameters:
        aspect - the aspect class reference
      • getAspects

        public java.util.Set<org.alfresco.service.namespace.QName> getAspects()
        Gets a list of the aspects
        Returns:
        a list of aspect to copy
      • addProperty

        public void addProperty​(org.alfresco.service.namespace.QName qName,
                                java.io.Serializable value)
        Add a property to the list
        Parameters:
        qName - the qualified name of the property
        value - the value of the property
      • removeProperty

        public void removeProperty​(org.alfresco.service.namespace.QName qName)
        Remove a property from the list
        Parameters:
        qName - the qualified name of the property
      • getProperties

        public java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> getProperties()
        Gets the map of properties
        Returns:
        map of property names and values
      • addChildAssociation

        protected void addChildAssociation​(org.alfresco.service.cmr.repository.ChildAssociationRef childAssocRef)
        Add a child association
        Parameters:
        childAssocRef - the child association reference
      • addChildAssociation

        protected void addChildAssociation​(org.alfresco.service.cmr.repository.ChildAssociationRef childAssocRef,
                                           boolean alwaysTraverseAssociation)
        Add a child association
        Parameters:
        childAssocRef - the child assoc reference
        alwaysTraverseAssociation - indicates whether the assoc should always be traversed
      • isChildAssociationRefAlwaysTraversed

        protected boolean isChildAssociationRefAlwaysTraversed​(org.alfresco.service.cmr.repository.ChildAssociationRef childAssocRef)
        Indicates whether a child association ref is always traversed or not
        Parameters:
        childAssocRef - the child association reference
        Returns:
        true if the assoc is always traversed, false otherwise
      • getChildAssociations

        public java.util.List<org.alfresco.service.cmr.repository.ChildAssociationRef> getChildAssociations()
        Gets the child associations to be copied
        Returns:
        map containing the child associations to be copied
      • addAssociation

        protected void addAssociation​(org.alfresco.service.cmr.repository.AssociationRef nodeAssocRef)
        Adds an association to be copied
        Parameters:
        nodeAssocRef - the association reference
      • getAssociations

        public java.util.List<org.alfresco.service.cmr.repository.AssociationRef> getAssociations()
        Gets the map of associations to be copied
        Returns:
        a map conatining the associations to be copied