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
the date after which changesets have been closed this query is restricted to.
|
private java.util.Date |
createdBefore
the date before which changesets have been created this query is restricted to.
|
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.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.util.Date |
getClosedAfter()
Replies the date after which changesets have been closed this query is restricted to.
|
java.util.Date |
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(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.Boolean getRestrictionToOpen()
null if there is no restrictionpublic java.lang.Boolean getRestrictionToClosed()
null if there is no restrictionpublic java.util.Date getClosedAfter()
null, if no restriction to closure date appliespublic java.util.Date getCreatedBefore()
null, if no restriction to creation date appliespublic final java.util.Collection<java.lang.Long> getAdditionalChangesetIds()
public final Bounds getBounds()
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)
isOpenisOpen - whether changesets should or should not be openpublic ChangesetQuery beingClosed(boolean isClosed)
isClosedisClosed - 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