Class PageModification

  • All Implemented Interfaces:
    java.io.Serializable

    public final class PageModification
    extends java.lang.Object
    implements java.io.Serializable
    This class encapsulates the information coming along with a page modification.
    See Also:
    Serialized Form
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static PageModification created​(java.lang.String path, java.lang.String above, java.lang.String userId)
      Create a new PageModification that represents a page creation.
      static PageModification deleted​(java.lang.String path, java.lang.String userId)
      Create a new PageModification that represents a page deletion.
      boolean equals​(java.lang.Object o)
      Overridden to alter the preconditions when two modifications are considered equal.
      static PageModification fromEventProperties​(java.util.Map<java.lang.String,​java.lang.Object> props)
      Create a page modification from properties.
      java.lang.String getAbove()  
      java.lang.String getDestination()  
      java.util.Map<java.lang.String,​java.lang.Object> getEventProperties()
      Get a dictionary with all event properties.
      java.util.Date getModificationDate()  
      java.util.Set<java.lang.String> getModificationPaths()
      Get the list of changes for a modification of the page.
      java.lang.String getPath()
      The path of the page.
      PageModification.ModificationType getType()  
      java.lang.String getUserId()  
      java.lang.String getVersionId()  
      int hashCode()
      Returns a hash code value for the object.
      static PageModification modified​(java.lang.String path, java.lang.String vid, java.lang.String userId, java.util.Set<java.lang.String> changes)
      Create a new PageModification that represents a page modification.
      static PageModification moved​(java.lang.String path, java.lang.String destination, java.lang.String above, java.lang.String userId)
      Create a new PageModification that represents a page moval.
      static PageModification pageInvalid​(java.lang.String path, long time)
      Create a new PageModification that represents that the page became invalid due to an off-time reached.
      static PageModification pageRestored​(java.lang.String path, java.lang.String vid, java.lang.String userId)
      Create a new PageModification that represents a version created.
      static PageModification pageValid​(java.lang.String path, long time)
      Create a new PageModification that represents that the page became valid due to an on-time reached.
      static PageModification rolledout​(java.lang.String path, java.lang.String userId)
      Create a new PageModification that represents a version deleted.
      Event toEvent()
      Convert a single modification to an event.
      java.lang.String toString()
      Return a string representation of this object
      static PageModification versionCreated​(java.lang.String path, java.lang.String vid, java.lang.String userId)
      Create a new PageModification that represents a version created.
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • created

        public static PageModification created​(java.lang.String path,
                                               java.lang.String above,
                                               java.lang.String userId)
        Create a new PageModification that represents a page creation.
        Parameters:
        path - path to new page
        above - label of successor sibling
        userId - the id of the user that caused this modification.
        Returns:
        modification
      • modified

        public static PageModification modified​(java.lang.String path,
                                                java.lang.String vid,
                                                java.lang.String userId,
                                                java.util.Set<java.lang.String> changes)
        Create a new PageModification that represents a page modification.
        Parameters:
        path - path of page
        vid - the version name
        userId - the id of the user that caused this modification.
        changes - A set of changes (paths) - optional
        Returns:
        modification
      • moved

        public static PageModification moved​(java.lang.String path,
                                             java.lang.String destination,
                                             java.lang.String above,
                                             java.lang.String userId)
        Create a new PageModification that represents a page moval.
        Parameters:
        path - path of page
        destination - new page destination, may be null
        above - label of successor sibling, may be null
        userId - the id of the user that caused this modification.
        Returns:
        modification
      • deleted

        public static PageModification deleted​(java.lang.String path,
                                               java.lang.String userId)
        Create a new PageModification that represents a page deletion.
        Parameters:
        path - path of page
        userId - the id of the user that caused this modification.
        Returns:
        modification
      • versionCreated

        public static PageModification versionCreated​(java.lang.String path,
                                                      java.lang.String vid,
                                                      java.lang.String userId)
        Create a new PageModification that represents a version created.
        Parameters:
        path - path of page
        vid - the versio name
        userId - the id of the user that caused this modification.
        Returns:
        modification
      • pageRestored

        public static PageModification pageRestored​(java.lang.String path,
                                                    java.lang.String vid,
                                                    java.lang.String userId)
        Create a new PageModification that represents a version created.
        Parameters:
        path - path of page
        vid - the vesion name
        userId - the id of the user that caused this modification.
        Returns:
        modification
      • pageValid

        public static PageModification pageValid​(java.lang.String path,
                                                 long time)
        Create a new PageModification that represents that the page became valid due to an on-time reached.
        Parameters:
        path - path of page
        time - the on-time
        Returns:
        modification
      • pageInvalid

        public static PageModification pageInvalid​(java.lang.String path,
                                                   long time)
        Create a new PageModification that represents that the page became invalid due to an off-time reached.
        Parameters:
        path - path of page
        time - the off-time
        Returns:
        modification
      • rolledout

        public static PageModification rolledout​(java.lang.String path,
                                                 java.lang.String userId)
        Create a new PageModification that represents a version deleted.
        Parameters:
        path - path of page
        userId - the id of the user that caused this modification.
        Returns:
        modification
      • getPath

        public java.lang.String getPath()
        The path of the page.
        Returns:
        The path of the page.
      • getDestination

        public java.lang.String getDestination()
      • getAbove

        public java.lang.String getAbove()
      • getVersionId

        public java.lang.String getVersionId()
      • getUserId

        public java.lang.String getUserId()
      • getModificationDate

        public java.util.Date getModificationDate()
      • getModificationPaths

        public java.util.Set<java.lang.String> getModificationPaths()
        Get the list of changes for a modification of the page.
        Returns:
        A set of relative paths or null.
      • equals

        public final boolean equals​(java.lang.Object o)
        Overridden to alter the preconditions when two modifications are considered equal.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        o - object to compare this object against
        Returns:
        true if this object is considered equal to the other object, otherwise false
      • hashCode

        public int hashCode()
        Returns a hash code value for the object. Replaced in order to return the same hashcode for two objects that are considered equal according to the equals(java.lang.Object) method implemented above.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        a hash code value for this object.
        See Also:
        Object.equals(java.lang.Object), Hashtable
      • toString

        public java.lang.String toString()
        Return a string representation of this object
        Overrides:
        toString in class java.lang.Object
        Returns:
        string representation
      • getEventProperties

        public java.util.Map<java.lang.String,​java.lang.Object> getEventProperties()
        Get a dictionary with all event properties.
        Returns:
        an map of event properties
      • fromEventProperties

        public static PageModification fromEventProperties​(java.util.Map<java.lang.String,​java.lang.Object> props)
        Create a page modification from properties.
        Parameters:
        props - the event properties
        Returns:
        a page modification object
      • toEvent

        public Event toEvent()
        Convert a single modification to an event.
        Returns:
        a page event