org.openstreetmap.josm.io
Class ChangesetQuery

java.lang.Object
  extended by org.openstreetmap.josm.io.ChangesetQuery

public class ChangesetQuery
extends java.lang.Object


Nested Class Summary
static class ChangesetQuery.ChangesetQueryUrlException
           
static class ChangesetQuery.ChangesetQueryUrlParser
           
 
Field Summary
private  Bounds bounds
          the bounding box this query is restricted to.
private  java.lang.Boolean closed
          indicates whether only closed changesets are queried.
private  java.util.Date closedAfter
           
private  java.util.Date createdBefore
           
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
ChangesetQuery()
           
 
Method Summary
 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 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()
           
 
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.util.Date closedAfter

createdBefore

private java.util.Date createdBefore

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 open changesets apply

Constructor Detail

ChangesetQuery

public ChangesetQuery()
Method Detail

buildFromUrlQuery

public static ChangesetQuery buildFromUrlQuery(java.lang.String query)
                                        throws ChangesetQuery.ChangesetQueryUrlException
Replies a changeset query object from the query part of a OSM API URL for querying changesets.

Parameters:
query - the query part
Returns:
the query object
Throws:
ChangesetQuery.ChangesetQueryUrlException - thrown if query doesn't consist of valid query parameters

forUser

public ChangesetQuery forUser(int uid)
                       throws java.lang.IllegalArgumentException
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 - thrown 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 - thrown 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

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)
                      throws java.lang.IllegalArgumentException
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 - thrown 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 coordiantes of the bounding box. Must not be null.
Returns:
the restricted changeset query
Throws:
java.lang.IllegalArgumentException - thrown if min is null
java.lang.IllegalArgumentException - thrown if max is null

inBbox

public ChangesetQuery inBbox(Bounds bbox)
                      throws java.lang.IllegalArgumentException
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 - thrown if bbox is null.

closedAfter

public ChangesetQuery closedAfter(java.util.Date d)
                           throws java.lang.IllegalArgumentException
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 - thrown if d is null

closedAfterAndCreatedBefore

public ChangesetQuery closedAfterAndCreatedBefore(java.util.Date closedAfter,
                                                  java.util.Date createdBefore)
                                           throws java.lang.IllegalArgumentException
Restricts the result to changesets which have been closed after closedAfter and which habe 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 - thrown if closedAfter is null
java.lang.IllegalArgumentException - thrown 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

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


JOSM