Package org.maproulette.client.api
Class ProjectAPI
- java.lang.Object
-
- org.maproulette.client.api.ProjectAPI
-
-
Constructor Summary
Constructors Constructor Description ProjectAPI(IMapRouletteConnection connection)ProjectAPI(MapRouletteConfiguration configuration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<Challenge>children(long identifier, int limit, int page)Retrieve the children of the ProjectProjectcreate(Project project)Creates an object in MapRoulette.booleandelete(long identifier)Deletes an object in MapRoulette based on the provided identifierjava.util.List<Project>find(java.lang.String matcher, long parent, int limit, int page)Finds a list of elementsbooleanforceDelete(long identifier)By default MapRoulette will not actually delete any object, but rather flag the object for deletion.java.util.Optional<Project>get(long identifier)Gets the object type associated with the service.java.util.Optional<Project>get(long parentIdentifier, java.lang.String name)Gets the object type associated with the service based on the object namejava.util.Optional<Project>get(java.lang.String name)Projects have no parents, so we create a function that will ignore the valueProjectupdate(Project project)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
-
ProjectAPI
public ProjectAPI(MapRouletteConfiguration configuration)
-
ProjectAPI
public ProjectAPI(IMapRouletteConnection connection)
-
-
Method Detail
-
get
public java.util.Optional<Project> get(java.lang.String name) throws MapRouletteException
Projects have no parents, so we create a function that will ignore the value- Parameters:
name- The name of the project to retrieve- Returns:
- An optional
Projectif found by name - Throws:
MapRouletteException- If any exceptions occur while retrieving the project
-
get
public java.util.Optional<Project> 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<Project>- 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<Project> get(long identifier) throws MapRouletteException
Description copied from interface:IAPIGets the object type associated with the service.- Specified by:
getin interfaceIAPI<Project>- 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<Project> 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<Project>- 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
-
children
public java.util.List<Challenge> children(long identifier, int limit, int page) throws MapRouletteException
Retrieve the children of the Project- Parameters:
identifier- The identifier of the projectlimit- To limit the amount of returned taskspage- For paging- Returns:
- A list of
Challenges that belong to the provided challenge - Throws:
MapRouletteException- If any exceptions occur during API Restful request
-
create
public Project create(Project project) 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<Project>- Parameters:
project- 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 Project update(Project project) throws MapRouletteException
Description copied from interface:IAPIUpdates an object in MapRoulette.- Specified by:
updatein interfaceIAPI<Project>- Parameters:
project- 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<Project>- 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 MapRouletteExceptionDescription copied from interface:IAPIBy default MapRoulette will not actually delete any object, but rather flag the object for deletion. This function will add a flag to the URI that will force the deletion of an object.- Specified by:
forceDeletein interfaceIAPI<Project>- 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
-
-