Class ChangesetQuery

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private Bounds bounds
      the bounding box this query is restricted to.
      private java.util.Collection<java.lang.Long> changesetIds
      a collection of changeset ids to query for
      private java.lang.Boolean closed
      indicates whether only closed changesets are queried.
      private java.time.Instant closedAfter
      the date after which changesets have been closed this query is restricted to.
      private java.time.Instant createdBefore
      the date before which changesets have been created this query is restricted to.
      private static java.lang.String DISPLAY_NAME  
      private static java.lang.String ERROR_UNEXPECTED_VALUE_CHANGESET_QUERY_URL  
      static int MAX_CHANGESETS_NUMBER
      Maximum number of changesets returned by the OSM API call "/changesets?"
      private java.lang.Boolean open
      indicates whether only open changesets are queried.
      private java.lang.Integer uid
      the user id this query is restricted to.
      private java.lang.String userName
      the user name this query is restricted to.
    • Constructor Summary

      Constructors 
      Constructor Description
      ChangesetQuery()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ChangesetQuery beingClosed​(boolean isClosed)
      Restricts the result to changesets which are or aren't closed, depending on the value of isClosed
      ChangesetQuery beingOpen​(boolean isOpen)
      Restricts the result to changesets which are or aren't open, depending on the value of isOpen
      static ChangesetQuery buildFromUrlQuery​(java.lang.String query)
      Replies a changeset query object from the query part of a OSM API URL for querying changesets.
      ChangesetQuery closedAfter​(java.time.Instant d)
      Restricts the result to changesets which have been closed after the date given by d.
      ChangesetQuery closedAfterAndCreatedBefore​(java.time.Instant closedAfter, java.time.Instant createdBefore)
      Restricts the result to changesets which have been closed after closedAfter and which have been created before createdBefore.
      ChangesetQuery forChangesetIds​(java.util.Collection<java.lang.Long> changesetIds)
      Restricts the query to the given changeset ids (which are added to previously added ones).
      static ChangesetQuery forCurrentUser()
      Replies a changeset query object restricted to the current user, if known.
      ChangesetQuery forUser​(int uid)
      Restricts the query to changesets owned by the user with id uid.
      ChangesetQuery forUser​(java.lang.String userName)
      Restricts the query to changesets owned by the user with user name username.
      java.util.Collection<java.lang.Long> getAdditionalChangesetIds()
      Replies the list of additional changeset ids to query.
      Bounds getBounds()
      Replies the bounding box this query is restricted to.
      java.time.Instant getClosedAfter()
      Replies the date after which changesets have been closed this query is restricted to.
      java.time.Instant getCreatedBefore()
      Replies the date before which changesets have been created this query is restricted to.
      java.lang.String getQueryString()
      Replies the query string to be used in a query URL for the OSM API.
      java.lang.Boolean getRestrictionToClosed()
      Replies true/false if this query is restricted to changesets which are or aren't closed.
      java.lang.Boolean getRestrictionToOpen()
      Replies true/false if this query is restricted to changesets which are or aren't open.
      java.lang.String getUserName()
      Replies the user name which this query is restricted to.
      ChangesetQuery inBbox​(double minLon, double minLat, double maxLon, double maxLat)
      Replies a query which is restricted to a bounding box.
      ChangesetQuery inBbox​(Bounds bbox)
      Replies a query which is restricted to a bounding box given by bbox.
      ChangesetQuery inBbox​(LatLon min, LatLon max)
      Replies a query which is restricted to a bounding box.
      boolean isRestrictedToFullyIdentifiedUser()
      Replies true if this query is restricted to user whom know the user id for.
      boolean isRestrictedToPartiallyIdentifiedUser()
      Replies true if this query is restricted to user whom we only know the user name for.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • uid

        private java.lang.Integer uid
        the user id this query is restricted to. null, if no restriction to a user id applies
      • userName

        private java.lang.String userName
        the user name this query is restricted to. null, if no restriction to a user name applies
      • bounds

        private Bounds bounds
        the bounding box this query is restricted to. null, if no restriction to a bounding box applies
      • closedAfter

        private java.time.Instant closedAfter
        the date after which changesets have been closed this query is restricted to. null, if no restriction to closure date applies
      • createdBefore

        private java.time.Instant createdBefore
        the date before which changesets have been created this query is restricted to. null, if no restriction to creation date applies
      • open

        private java.lang.Boolean open
        indicates whether only open changesets are queried. null, if no restrictions regarding open changesets apply
      • closed

        private java.lang.Boolean closed
        indicates whether only closed changesets are queried. null, if no restrictions regarding closed changesets apply
      • changesetIds

        private java.util.Collection<java.lang.Long> changesetIds
        a collection of changeset ids to query for
    • Method Detail

      • forCurrentUser

        public static ChangesetQuery forCurrentUser()
        Replies a changeset query object restricted to the current user, if known.
        Returns:
        a changeset query object restricted to the current user, if known
        Throws:
        java.lang.IllegalStateException - if current user is anonymous
        Since:
        12495
      • forUser

        public ChangesetQuery forUser​(int uid)
        Restricts the query to changesets owned by the user with id uid.
        Parameters:
        uid - the uid of the user. > 0 expected.
        Returns:
        the query object with the applied restriction
        Throws:
        java.lang.IllegalArgumentException - if uid <= 0
        See Also:
        forUser(String)
      • forUser

        public ChangesetQuery forUser​(java.lang.String userName)
        Restricts the query to changesets owned by the user with user name username.

        Caveat: for historical reasons the username might not be unique! It is recommended to use forUser(int) to restrict the query to a specific user.

        Parameters:
        userName - the username. Must not be null.
        Returns:
        the query object with the applied restriction
        Throws:
        java.lang.IllegalArgumentException - if username is null.
        See Also:
        forUser(int)
      • isRestrictedToPartiallyIdentifiedUser

        public boolean isRestrictedToPartiallyIdentifiedUser()
        Replies true if this query is restricted to user whom we only know the user name for.
        Returns:
        true if this query is restricted to user whom we only know the user name for
      • getRestrictionToOpen

        public java.lang.Boolean getRestrictionToOpen()
        Replies true/false if this query is restricted to changesets which are or aren't open.
        Returns:
        whether changesets should or should not be open, or null if there is no restriction
        Since:
        14039
      • getRestrictionToClosed

        public java.lang.Boolean getRestrictionToClosed()
        Replies true/false if this query is restricted to changesets which are or aren't closed.
        Returns:
        whether changesets should or should not be closed, or null if there is no restriction
        Since:
        14039
      • getClosedAfter

        public java.time.Instant getClosedAfter()
        Replies the date after which changesets have been closed this query is restricted to.
        Returns:
        the date after which changesets have been closed this query is restricted to. null, if no restriction to closure date applies
        Since:
        14039
      • getCreatedBefore

        public java.time.Instant getCreatedBefore()
        Replies the date before which changesets have been created this query is restricted to.
        Returns:
        the date before which changesets have been created this query is restricted to. null, if no restriction to creation date applies
        Since:
        14039
      • getAdditionalChangesetIds

        public final java.util.Collection<java.lang.Long> getAdditionalChangesetIds()
        Replies the list of additional changeset ids to query.
        Returns:
        the list of additional changeset ids to query (never null)
        Since:
        14039
      • getBounds

        public final Bounds getBounds()
        Replies the bounding box this query is restricted to.
        Returns:
        the bounding box this query is restricted to. null, if no restriction to a bounding box applies
        Since:
        14039
      • getUserName

        public java.lang.String getUserName()
        Replies the user name which this query is restricted to. null, if this query isn't restricted to a user name, i.e. if isRestrictedToPartiallyIdentifiedUser() is false.
        Returns:
        the user name which this query is restricted to
      • isRestrictedToFullyIdentifiedUser

        public boolean isRestrictedToFullyIdentifiedUser()
        Replies true if this query is restricted to user whom know the user id for.
        Returns:
        true if this query is restricted to user whom know the user id for
      • inBbox

        public ChangesetQuery inBbox​(double minLon,
                                     double minLat,
                                     double maxLon,
                                     double maxLat)
        Replies a query which is restricted to a bounding box.
        Parameters:
        minLon - min longitude of the bounding box. Valid longitude value expected.
        minLat - min latitude of the bounding box. Valid latitude value expected.
        maxLon - max longitude of the bounding box. Valid longitude value expected.
        maxLat - max latitude of the bounding box. Valid latitude value expected.
        Returns:
        the restricted changeset query
        Throws:
        java.lang.IllegalArgumentException - if either of the parameters isn't a valid longitude or latitude value
      • inBbox

        public ChangesetQuery inBbox​(LatLon min,
                                     LatLon max)
        Replies a query which is restricted to a bounding box.
        Parameters:
        min - the min lat/lon coordinates of the bounding box. Must not be null.
        max - the max lat/lon coordinates of the bounding box. Must not be null.
        Returns:
        the restricted changeset query
        Throws:
        java.lang.IllegalArgumentException - if min is null
        java.lang.IllegalArgumentException - if max is null
      • inBbox

        public ChangesetQuery inBbox​(Bounds bbox)
        Replies a query which is restricted to a bounding box given by bbox.
        Parameters:
        bbox - the bounding box. Must not be null.
        Returns:
        the changeset query
        Throws:
        java.lang.IllegalArgumentException - if bbox is null.
      • closedAfter

        public ChangesetQuery closedAfter​(java.time.Instant d)
        Restricts the result to changesets which have been closed after the date given by d. d d is a date relative to the current time zone.
        Parameters:
        d - the date. Must not be null.
        Returns:
        the restricted changeset query
        Throws:
        java.lang.IllegalArgumentException - if d is null
      • closedAfterAndCreatedBefore

        public ChangesetQuery closedAfterAndCreatedBefore​(java.time.Instant closedAfter,
                                                          java.time.Instant createdBefore)
        Restricts the result to changesets which have been closed after closedAfter and which have been created before createdBefore. Both dates are expressed relative to the current time zone.
        Parameters:
        closedAfter - only reply changesets closed after this date. Must not be null.
        createdBefore - only reply changesets created before this date. Must not be null.
        Returns:
        the restricted changeset query
        Throws:
        java.lang.IllegalArgumentException - if closedAfter is null
        java.lang.IllegalArgumentException - if createdBefore is null
      • beingOpen

        public ChangesetQuery beingOpen​(boolean isOpen)
        Restricts the result to changesets which are or aren't open, depending on the value of isOpen
        Parameters:
        isOpen - whether changesets should or should not be open
        Returns:
        the restricted changeset query
      • beingClosed

        public ChangesetQuery beingClosed​(boolean isClosed)
        Restricts the result to changesets which are or aren't closed, depending on the value of isClosed
        Parameters:
        isClosed - whether changesets should or should not be open
        Returns:
        the restricted changeset query
      • forChangesetIds

        public ChangesetQuery forChangesetIds​(java.util.Collection<java.lang.Long> changesetIds)
        Restricts the query to the given changeset ids (which are added to previously added ones).
        Parameters:
        changesetIds - the changeset ids
        Returns:
        the query object with the applied restriction
        Throws:
        java.lang.IllegalArgumentException - if changesetIds is null.
      • getQueryString

        public java.lang.String getQueryString()
        Replies the query string to be used in a query URL for the OSM API.
        Returns:
        the query string
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object