public class ChangesetQuery extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ChangesetQuery.ChangesetQueryUrlException |
static class |
ChangesetQuery.ChangesetQueryUrlParser |
Modifier and Type | Field and Description |
---|---|
private Bounds |
bounds
the bounding box this query is restricted to.
|
private Collection<Long> |
changesetIds
a collection of changeset ids to query for
|
private Boolean |
closed
indicates whether only closed changesets are queried.
|
private Date |
closedAfter |
private Date |
createdBefore |
private Boolean |
open
indicates whether only open changesets are queried.
|
private Integer |
uid
the user id this query is restricted to.
|
private String |
userName
the user name this query is restricted to.
|
Constructor and Description |
---|
ChangesetQuery()
Constructs a new
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(String query)
Replies a changeset query object from the query part of a OSM API URL for querying changesets.
|
ChangesetQuery |
closedAfter(Date d)
Restricts the result to changesets which have been closed after the date given by
d . |
ChangesetQuery |
closedAfterAndCreatedBefore(Date closedAfter,
Date createdBefore)
Restricts the result to changesets which have been closed after
closedAfter and which
habe been created before createdBefore . |
ChangesetQuery |
forChangesetIds(Collection<Long> changesetIds)
Restricts the query to the given changeset ids (which are added to previously added ones).
|
ChangesetQuery |
forUser(int uid)
Restricts the query to changesets owned by the user with id
uid . |
ChangesetQuery |
forUser(String username)
Restricts the query to changesets owned by the user with user name
username . |
String |
getQueryString()
Replies the query string to be used in a query URL for the OSM API.
|
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.
|
String |
toString() |
private Integer uid
private String userName
private Bounds bounds
private Date closedAfter
private Date createdBefore
private Boolean open
private Boolean closed
private Collection<Long> changesetIds
public ChangesetQuery()
ChangesetQuery
.public static ChangesetQuery buildFromUrlQuery(String query) throws ChangesetQuery.ChangesetQueryUrlException
query
- the query partChangesetQuery.ChangesetQueryUrlException
- thrown if query doesn't consist of valid query parameterspublic ChangesetQuery forUser(int uid) throws IllegalArgumentException
uid
.uid
- the uid of the user. > 0 expected.IllegalArgumentException
- thrown if uid <= 0forUser(String)
public ChangesetQuery forUser(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.IllegalArgumentException
- thrown if username is null.forUser(int)
public boolean isRestrictedToPartiallyIdentifiedUser()
public String getUserName()
isRestrictedToPartiallyIdentifiedUser()
is false.public boolean isRestrictedToFullyIdentifiedUser()
public ChangesetQuery inBbox(double minLon, double minLat, double maxLon, double maxLat) throws IllegalArgumentException
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.IllegalArgumentException
- thrown 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.IllegalArgumentException
- thrown if min is nullIllegalArgumentException
- thrown if max is nullpublic ChangesetQuery inBbox(Bounds bbox) throws IllegalArgumentException
bbox
.bbox
- the bounding box. Must not be null.IllegalArgumentException
- thrown if bbox is null.public ChangesetQuery closedAfter(Date d) throws IllegalArgumentException
d
.
d
d is a date relative to the current time zone.d
- the date . Must not be null.IllegalArgumentException
- thrown if d is nullpublic ChangesetQuery closedAfterAndCreatedBefore(Date closedAfter, Date createdBefore) throws IllegalArgumentException
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.IllegalArgumentException
- thrown if closedAfter is nullIllegalArgumentException
- thrown 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(Collection<Long> changesetIds)
changesetIds
- the changeset idsIllegalArgumentException
- thrown if changesetIds is null.public String getQueryString()