com.day.cq.wcm.api
Class PageModification

java.lang.Object
  extended by com.day.cq.wcm.api.PageModification
All Implemented Interfaces:
Serializable

public final class PageModification
extends Object
implements Serializable

This class encapsulates the information coming along with a page modification. The order of modifications is as follows:

  • for newly created pages: PageModification.ModificationType.CREATED, then PageModification.ModificationType.MODIFIED
  • for modified pages: PageModification.ModificationType.MODIFIED
  • for pages having a new version created: PageModification.ModificationType.VERSION_CREATED
  • for moved pages: PageModification.ModificationType.MOVED
  • for deleted pages: PageModification.ModificationType.DELETED
  • See Also:
    Serialized Form

    Nested Class Summary
    static class PageModification.ModificationType
              The modification type.
     
    Method Summary
    static PageModification created(String path, String template, String above, String userObject)
              Create a new PageModification that represents a page creation.
    static PageModification deleted(String path, String userObject)
              Create a new PageModification that represents a page deletion.
     boolean equals(Object o)
              Overridden to alter the preconditions when two modifications are considered equal.
    static PageModification fromEventProperties(org.apache.sling.event.EventPropertiesMap props)
              Create a page modification from properties.
     String getAbove()
               
     String getDestination()
               
     org.apache.sling.event.EventPropertiesMap getEventProperties()
              Get a dictionary with all event properties.
     Date getModificationDate()
               
     Set<String> getModificationPaths()
              Get the list of changes for a modification of the page.
     String getPath()
              The path of the page.
     String getTemplate()
               
     PageModification.ModificationType getType()
               
     String getUserId()
               
     String getVersionId()
               
     int hashCode()
              Returns a hash code value for the object.
    static PageModification modified(String path, String vid, String userObject, Set<String> changes)
              Create a new PageModification that represents a page modification.
    static PageModification moved(String path, String destination, String above, String userObject)
              Create a new PageModification that represents a page moval.
    static PageModification pageRestored(String path, String vid, String userObject)
              Create a new PageModification that represents a version created.
     org.osgi.service.event.Event toEvent()
              Convert a single modification to an event.
     String toString()
              Return a string representation of this object
    static PageModification versionCreated(String path, String vid, String userObject)
              Create a new PageModification that represents a version created.
    static PageModification versionDeleted(String path, String vid, String userObject)
              Create a new PageModification that represents a version deleted.
     
    Methods inherited from class java.lang.Object
    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
     

    Method Detail

    created

    public static PageModification created(String path,
                                           String template,
                                           String above,
                                           String userObject)
    Create a new PageModification that represents a page creation.

    Parameters:
    path - handle to new page
    template - template of new page
    above - label of successor sibling
    userObject - An optional user object which might be used to identify this instance or its source. This parameter is only provided on behalf of an client of this class.
    Returns:
    modification

    modified

    public static PageModification modified(String path,
                                            String vid,
                                            String userObject,
                                            Set<String> changes)
    Create a new PageModification that represents a page modification.

    Parameters:
    path - path of page
    userObject - An optional user object which might be used to identify this instance or its source. This parameter is only provided on behalf of an client of this class.
    changes - A set of changes (paths) - optional
    Returns:
    modification

    moved

    public static PageModification moved(String path,
                                         String destination,
                                         String above,
                                         String userObject)
    Create a new PageModification that represents a page moval.

    Parameters:
    path - handle of page
    destination - new page destination, may be null
    above - label of successor sibling, may be null
    userObject - An optional user object which might be used to identify this instance or its source. This parameter is only provided on behalf of an client of this class.
    Returns:
    modification

    deleted

    public static PageModification deleted(String path,
                                           String userObject)
    Create a new PageModification that represents a page deletion.

    Parameters:
    path - handle of page
    userObject - An optional user object which might be used to identify this instance or its source. This parameter is only provided on behalf of an client of this class.
    Returns:
    modification

    versionCreated

    public static PageModification versionCreated(String path,
                                                  String vid,
                                                  String userObject)
    Create a new PageModification that represents a version created.

    Parameters:
    path - handle of page
    userObject - An optional user object which might be used to identify this instance or its source. This parameter is only provided on behalf of an client of this class.
    Returns:
    modification

    versionDeleted

    public static PageModification versionDeleted(String path,
                                                  String vid,
                                                  String userObject)
    Create a new PageModification that represents a version deleted.

    Parameters:
    path - handle of page
    userObject - An optional user object which might be used to identify this instance or its source. This parameter is only provided on behalf of an client of this class.
    Returns:
    modification

    pageRestored

    public static PageModification pageRestored(String path,
                                                String vid,
                                                String userObject)
    Create a new PageModification that represents a version created.

    Parameters:
    path - handle of page
    userObject - An optional user object which might be used to identify this instance or its source. This parameter is only provided on behalf of an client of this class.
    Returns:
    modification

    getPath

    public String getPath()
    The path of the page.

    Returns:
    The path of the page.

    getDestination

    public String getDestination()

    getTemplate

    public String getTemplate()

    getAbove

    public String getAbove()

    getType

    public PageModification.ModificationType getType()

    getVersionId

    public String getVersionId()

    getUserId

    public String getUserId()

    getModificationDate

    public Date getModificationDate()

    getModificationPaths

    public Set<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(Object o)
    Overridden to alter the preconditions when two modifications are considered equal.

    Overrides:
    equals in class 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 Object
    Returns:
    a hash code value for this object.
    See Also:
    Object.equals(java.lang.Object), Hashtable

    toString

    public String toString()
    Return a string representation of this object

    Overrides:
    toString in class Object
    Returns:
    string representation

    getEventProperties

    public org.apache.sling.event.EventPropertiesMap getEventProperties()
    Get a dictionary with all event properties.


    fromEventProperties

    public static PageModification fromEventProperties(org.apache.sling.event.EventPropertiesMap props)
    Create a page modification from properties.


    toEvent

    public org.osgi.service.event.Event toEvent()
    Convert a single modification to an event.



    Copyright © 2008 Day Management AG. All Rights Reserved.