public class ChangesetQuery extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ChangesetQuery.ChangesetQueryUrlException
Exception thrown for invalid changeset queries.
|
static class |
ChangesetQuery.ChangesetQueryUrlParser
Changeset query URL parser.
|
Modifier and Type | Field and 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.util.Date |
closedAfter |
private java.util.Date |
createdBefore |
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 and Description |
---|
ChangesetQuery() |
Modifier and Type | Method and 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.util.Date d)
Restricts the result to changesets which have been closed after the date given by
d . |
ChangesetQuery |
closedAfterAndCreatedBefore(java.util.Date closedAfter,
java.util.Date createdBefore)
Restricts the result to changesets which have been closed after
closedAfter and which
habe 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.lang.String |
getQueryString()
Replies the query string to be used in a query URL for the OSM API.
|
java.lang.String |
getUserName()
Replies the user name which this query is restricted to.
|
ChangesetQuery |
inBbox(Bounds bbox)
Replies a query which is restricted to a bounding box given by
bbox . |
ChangesetQuery |
inBbox(double minLon,
double minLat,
double maxLon,
double maxLat)
Replies a query which is restricted to a bounding box.
|
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() |
public static final int MAX_CHANGESETS_NUMBER
private java.lang.Integer uid
private java.lang.String userName
private Bounds bounds
private java.util.Date closedAfter
private java.util.Date createdBefore
private java.lang.Boolean open
private java.lang.Boolean closed
private java.util.Collection<java.lang.Long> changesetIds
public ChangesetQuery()
public static ChangesetQuery buildFromUrlQuery(java.lang.String query) throws ChangesetQuery.ChangesetQueryUrlException
query
- the query partChangesetQuery.ChangesetQueryUrlException
- if query doesn't consist of valid query parameterspublic static ChangesetQuery forCurrentUser()
java.lang.IllegalStateException
- if current user is anonymouspublic ChangesetQuery forUser(int uid)
uid
.uid
- the uid of the user. > 0 expected.java.lang.IllegalArgumentException
- if uid <= 0forUser(String)
public ChangesetQuery forUser(java.lang.String username)
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.username
- the username. Must not be null.java.lang.IllegalArgumentException
- if username is null.forUser(int)
public boolean isRestrictedToPartiallyIdentifiedUser()
public java.lang.String getUserName()
isRestrictedToPartiallyIdentifiedUser()
is false.public boolean isRestrictedToFullyIdentifiedUser()
public ChangesetQuery inBbox(double minLon, double minLat, double maxLon, double maxLat)
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.java.lang.IllegalArgumentException
- if either of the parameters isn't a valid longitude or
latitude valuepublic ChangesetQuery inBbox(LatLon min, LatLon max)
min
- the min lat/lon coordinates of the bounding box. Must not be null.max
- the max lat/lon coordiantes of the bounding box. Must not be null.java.lang.IllegalArgumentException
- if min is nulljava.lang.IllegalArgumentException
- if max is nullpublic ChangesetQuery inBbox(Bounds bbox)
bbox
.bbox
- the bounding box. Must not be null.java.lang.IllegalArgumentException
- if bbox is null.public ChangesetQuery closedAfter(java.util.Date d)
d
.
d
d is a date relative to the current time zone.d
- the date . Must not be null.java.lang.IllegalArgumentException
- if d is nullpublic ChangesetQuery closedAfterAndCreatedBefore(java.util.Date closedAfter, java.util.Date createdBefore)
closedAfter
and which
habe been created before createdBefore
. Both dates are expressed relative to the current
time zone.closedAfter
- only reply changesets closed after this date. Must not be null.createdBefore
- only reply changesets created before this date. Must not be null.java.lang.IllegalArgumentException
- if closedAfter is nulljava.lang.IllegalArgumentException
- if createdBefore is nullpublic ChangesetQuery beingOpen(boolean isOpen)
isOpen
isOpen
- whether changesets should or should not be openpublic ChangesetQuery beingClosed(boolean isClosed)
isClosed
isClosed
- whether changesets should or should not be openpublic ChangesetQuery forChangesetIds(java.util.Collection<java.lang.Long> changesetIds)
changesetIds
- the changeset idsjava.lang.IllegalArgumentException
- if changesetIds is null.public java.lang.String getQueryString()
public java.lang.String toString()
toString
in class java.lang.Object