Class AbstractDestination

  • All Implemented Interfaces:
    com.globalmentor.beans.PropertyBindable, com.globalmentor.beans.PropertyConstrainable, Destination
    Direct Known Subclasses:
    AbstractReferenceDestination, ComponentDestination

    public abstract class AbstractDestination
    extends com.globalmentor.beans.BoundPropertyObject
    implements Destination
    Abstract implementation of a navigation point, its properties, and its restrictions. Destinations of identical types with identical paths and path patterns are considered equal.
    Author:
    Garret Wilson
    • Field Summary

      • Fields inherited from class com.globalmentor.beans.BoundPropertyObject

        NO_PROPERTY_CHANGE_LISTENERS, NO_VETOABLE_CHANGE_LISTENERS
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractDestination​(com.globalmentor.net.URIPath path)
      Path constructor.
      AbstractDestination​(java.util.regex.Pattern pathPattern)
      Path pattern constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object object)
      boolean exists​(GuiseSession session, com.globalmentor.net.URIPath navigationPath, Bookmark bookmark, java.net.URI referrerURI)
      Determines if the given path does indeed exist for this destination.
      java.lang.Iterable<Category> getCategories()  
      java.util.Optional<io.urf.model.UrfResourceDescription> getDescription​(GuiseSession session, com.globalmentor.net.URIPath navigationPath, Bookmark bookmark, java.net.URI referrerURI)
      Returns a description of the resource for this destination at the given navigation path and bookmark.
      com.globalmentor.net.URIPath getPath()  
      com.globalmentor.net.URIPath getPath​(GuiseSession session, com.globalmentor.net.URIPath path, Bookmark bookmark, java.net.URI referrerURI)
      Determines the path to use for the requested path.
      java.util.regex.Pattern getPathPattern()  
      int hashCode()  
      boolean isAuthorized​(GuiseSession session, com.globalmentor.net.URIPath navigationPath, Bookmark bookmark, java.net.URI referrerURI)
      Determines if access to the given path is authorized for access by the current user, if any.
      void setCategories​(java.util.List<Category> categories)
      Sets the categories.
      • Methods inherited from class com.globalmentor.beans.BoundPropertyObject

        addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, createPostponedPropertyChangeEvent, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, getForwardPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeSupport, getRepeatPropertyChangeListener, getRepeatVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, getVetoableChangeSupport, hasPropertyChangeListeners, hasVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface com.globalmentor.beans.PropertyBindable

        addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, hasPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
    • Constructor Detail

      • AbstractDestination

        public AbstractDestination​(com.globalmentor.net.URIPath path)
        Path constructor.
        Parameters:
        path - The application context-relative path within the Guise container context, which does not begin with '/'.
        Throws:
        java.lang.NullPointerException - if the path is null.
        java.lang.IllegalArgumentException - if the provided path is absolute.
      • AbstractDestination

        public AbstractDestination​(java.util.regex.Pattern pathPattern)
        Path pattern constructor.
        Parameters:
        pathPattern - The pattern to match an application context-relative path within the Guise container context, which does not begin with '/'.
        Throws:
        java.lang.NullPointerException - if the path pattern is null.
    • Method Detail

      • getCategories

        public java.lang.Iterable<Category> getCategories()
        Specified by:
        getCategories in interface Destination
        Returns:
        The read-only iterable of categories.
      • setCategories

        public void setCategories​(java.util.List<Category> categories)
        Description copied from interface: Destination
        Sets the categories.
        Specified by:
        setCategories in interface Destination
        Parameters:
        categories - The list of new categories.
      • getPath

        public com.globalmentor.net.URIPath getPath()
        Specified by:
        getPath in interface Destination
        Returns:
        The application context-relative path within the Guise container context, which does not begin with '/', or null if there is no path specified for this destination.
      • getPathPattern

        public java.util.regex.Pattern getPathPattern()
        Specified by:
        getPathPattern in interface Destination
        Returns:
        The pattern to match an application context-relative path within the Guise container context, which does not begin with '/', or null if there is no path pattern specified for this destination.
      • getPath

        public com.globalmentor.net.URIPath getPath​(GuiseSession session,
                                                    com.globalmentor.net.URIPath path,
                                                    Bookmark bookmark,
                                                    java.net.URI referrerURI)
                                             throws com.globalmentor.net.ResourceIOException
        Description copied from interface: Destination
        Determines the path to use for the requested path. If there is a preferred path, it is returned; otherwise, the path is returned unmodified. If there is no principal or the principal is not the owner of the identified resource; the determined path is a collection path; and there exists a discoverable home page in the collection, this version returns the path to the home page.
        Specified by:
        getPath in interface Destination
        Parameters:
        session - The current Guise session.
        path - The navigation path relative to the application context path.
        bookmark - The bookmark for this path, or null if there is no bookmark.
        referrerURI - The URI of the referring destination or other entity with no query or fragment, or null if no referring URI is known.
        Returns:
        The preferred path.
        Throws:
        com.globalmentor.net.ResourceIOException - if there is an error accessing the resource.
      • exists

        public boolean exists​(GuiseSession session,
                              com.globalmentor.net.URIPath navigationPath,
                              Bookmark bookmark,
                              java.net.URI referrerURI)
                       throws com.globalmentor.net.ResourceIOException
        Description copied from interface: Destination
        Determines if the given path does indeed exist for this destination.
        Specified by:
        exists in interface Destination
        Parameters:
        session - The current Guise session.
        navigationPath - The navigation path relative to the application context path.
        bookmark - The bookmark for which navigation should occur at this navigation path, or null if there is no bookmark involved in navigation.
        referrerURI - The URI of the referring navigation panel or other entity with no query or fragment, or null if no referring URI is known.
        Returns:
        Whether the requested path exists.
        Throws:
        com.globalmentor.net.ResourceIOException - if there is an error accessing the resource.
      • isAuthorized

        public boolean isAuthorized​(GuiseSession session,
                                    com.globalmentor.net.URIPath navigationPath,
                                    Bookmark bookmark,
                                    java.net.URI referrerURI)
                             throws com.globalmentor.net.ResourceIOException
        Determines if access to the given path is authorized for access by the current user, if any.

        The result of this method for resources that do not exist is undefined; it is assumed that this method will not be called unless Destination.exists(GuiseSession, URIPath, Bookmark, URI) returns true for that resource, although this method must not produce an error if the resource does not exist.

        This method allows the underlying platform to handle unauthorized resources. If this implementation wishes to handle unauthorized resources, this method should return true and provide a resource that indicates the true resource is unauthorized or at the appropriate time redirect to an unauthorized indication page.

        This implementation authorizes all resources.

        Specified by:
        isAuthorized in interface Destination
        Parameters:
        session - The current Guise session.
        navigationPath - The navigation path relative to the application context path.
        bookmark - The bookmark for which navigation should occur at this navigation path, or null if there is no bookmark involved in navigation.
        referrerURI - The URI of the referring navigation panel or other entity with no query or fragment, or null if no referring URI is known.
        Returns:
        Whether the requested path exists.
        Throws:
        com.globalmentor.net.ResourceIOException - if there is an error accessing the resource.
      • getDescription

        public java.util.Optional<io.urf.model.UrfResourceDescription> getDescription​(GuiseSession session,
                                                                                      com.globalmentor.net.URIPath navigationPath,
                                                                                      Bookmark bookmark,
                                                                                      java.net.URI referrerURI)
                                                                               throws com.globalmentor.net.ResourceIOException
        Returns a description of the resource for this destination at the given navigation path and bookmark.
        Specified by:
        getDescription in interface Destination
        Implementation Specification:
        This implementation returns an empty description.
        Parameters:
        session - The current Guise session.
        navigationPath - The navigation path relative to the application context path.
        bookmark - The bookmark for which navigation should occur at this navigation path, or null if there is no bookmark involved in navigation.
        referrerURI - The URI of the referring navigation panel or other entity with no query or fragment, or null if no referring URI is known.
        Returns:
        A description of the indicated navigation path for this destination, which will not be present if nothing exists at the given navigation path.
        Throws:
        com.globalmentor.net.ResourceIOException - if there is an error accessing the resource.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object object)

        This implementation considers destinations of identical types with identical paths and path patterns to be equivalent.

        Overrides:
        equals in class java.lang.Object