Package org.maproulette.client.api
Class TaskAPI
- java.lang.Object
-
- org.maproulette.client.api.TaskAPI
-
-
Constructor Summary
Constructors Constructor Description TaskAPI(IMapRouletteConnection connection)TaskAPI(MapRouletteConfiguration configuration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Taskcreate(Task task)Creates an object in MapRoulette.booleandelete(long identifier)Deletes an object in MapRoulette based on the provided identifierjava.util.List<Task>find(java.lang.String matcher, long parent, int limit, int page)Finds a list of elementsbooleanforceDelete(long identifier)For a Task there is no delayed deletion available, so a delete and forceDelete amounts to the same thing.java.util.Optional<Task>get(long identifier)Gets the object type associated with the service.java.util.Optional<Task>get(long parentIdentifier, java.lang.String name)Gets the object type associated with the service based on the object nameTaskupdate(Task task)Updates an object in MapRoulette.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.maproulette.client.api.IAPI
createUpdate
-
-
-
-
Constructor Detail
-
TaskAPI
public TaskAPI(MapRouletteConfiguration configuration)
-
TaskAPI
public TaskAPI(IMapRouletteConnection connection)
-
-
Method Detail
-
get
public java.util.Optional<Task> get(long parentIdentifier, java.lang.String name) throws MapRouletteException
Description copied from interface:IAPIGets the object type associated with the service based on the object name- Specified by:
getin interfaceIAPI<Task>- Parameters:
parentIdentifier- The identifier of parent of the objectname- The name of the object- Returns:
- The object of Optional if not found
- Throws:
MapRouletteException- If there are any exceptions while retrieving the object
-
get
public java.util.Optional<Task> get(long identifier) throws MapRouletteException
Description copied from interface:IAPIGets the object type associated with the service.- Specified by:
getin interfaceIAPI<Task>- Parameters:
identifier- The identifier of the object- Returns:
- The object or Optional if not found
- Throws:
MapRouletteException- If there are any exceptions while retrieving the object
-
find
public java.util.List<Task> find(java.lang.String matcher, long parent, int limit, int page) throws MapRouletteException
Description copied from interface:IAPIFinds a list of elements- Specified by:
findin interfaceIAPI<Task>- Parameters:
matcher- A string query to match based on namesparent- The parent identifier, use -1 if want to ignore it.limit- How many elements to limit the results bypage- For paging the limited results- Returns:
- A list of elements
- Throws:
MapRouletteException- Any API exceptions
-
create
public Task create(Task task) throws MapRouletteException
Description copied from interface:IAPICreates an object in MapRoulette. For creation if the object is in the cache it will just respond with the cached object.- Specified by:
createin interfaceIAPI<Task>- Parameters:
task- The object to create of type T- Returns:
- The newly created identifier of the object
- Throws:
MapRouletteException- If there are any exceptions while creating/updating or retrieving the objects
-
update
public Task update(Task task) throws MapRouletteException
Description copied from interface:IAPIUpdates an object in MapRoulette.- Specified by:
updatein interfaceIAPI<Task>- Parameters:
task- The object to update of type T- Returns:
- Whether the update succeeded or not
- Throws:
MapRouletteException- If there are any exceptions while creating/updating or retrieving the objects
-
delete
public boolean delete(long identifier) throws MapRouletteExceptionDescription copied from interface:IAPIDeletes an object in MapRoulette based on the provided identifier- Specified by:
deletein interfaceIAPI<Task>- Parameters:
identifier- The identifier for the object to delete- Returns:
- true if object was deleted
- Throws:
MapRouletteException- If there are any exceptions while deleting the object
-
forceDelete
public boolean forceDelete(long identifier) throws MapRouletteExceptionFor a Task there is no delayed deletion available, so a delete and forceDelete amounts to the same thing.- Specified by:
forceDeletein interfaceIAPI<Task>- Parameters:
identifier- The identifier for the object to delete- Returns:
- true if succeeds
- Throws:
MapRouletteException- If there is any exceptions thrown while executing the Restful API delete request
-
-