Package org.maproulette.client.api
Class ChallengeAPI
- java.lang.Object
-
- org.maproulette.client.api.ChallengeAPI
-
-
Constructor Summary
Constructors Constructor Description ChallengeAPI(IMapRouletteConnection connection)ChallengeAPI(MapRouletteConfiguration configuration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<Task>children(long identifier, int limit, int page)Retrieve the children of the ChallengeChallengecreate(Challenge challenge)Creates an object in MapRoulette.booleandelete(long identifier)Deletes an object in MapRoulette based on the provided identifierjava.util.List<Challenge>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<Challenge>get(long identifier)Gets the object type associated with the service.java.util.Optional<Challenge>get(long parentIdentifier, java.lang.String name)The name is a dash delimited string [PROJECT_ID]-[CHALLENGE_NAME]Challengeupdate(Challenge challenge)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
-
ChallengeAPI
public ChallengeAPI(MapRouletteConfiguration configuration)
-
ChallengeAPI
public ChallengeAPI(IMapRouletteConnection connection)
-
-
Method Detail
-
get
public java.util.Optional<Challenge> get(long parentIdentifier, java.lang.String name) throws MapRouletteException
The name is a dash delimited string [PROJECT_ID]-[CHALLENGE_NAME]- Specified by:
getin interfaceIAPI<Challenge>- Parameters:
parentIdentifier- The identifier of the parent objectname- The name of the object- Returns:
- An optional
object - Throws:
MapRouletteException- If any exceptions occur while trying to retrieve the object
-
get
public java.util.Optional<Challenge> get(long identifier) throws MapRouletteException
Description copied from interface:IAPIGets the object type associated with the service.- Specified by:
getin interfaceIAPI<Challenge>- 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<Challenge> 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<Challenge>- 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<Task> children(long identifier, int limit, int page) throws MapRouletteException
Retrieve the children of the Challenge- Parameters:
identifier- The identifier of the challengelimit- To limit the amount of returned taskspage- For paging- Returns:
- A list of
Tasks that belong to the provided challenge - Throws:
MapRouletteException- If any exceptions occur during API Restful request
-
create
public Challenge create(Challenge challenge) 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<Challenge>- Parameters:
challenge- 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 Challenge update(Challenge challenge) throws MapRouletteException
Description copied from interface:IAPIUpdates an object in MapRoulette.- Specified by:
updatein interfaceIAPI<Challenge>- Parameters:
challenge- 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<Challenge>- 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<Challenge>- 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
-
-