Class TaskAPI

  • All Implemented Interfaces:
    IAPI<Task>

    public class TaskAPI
    extends java.lang.Object
    implements IAPI<Task>
    That Task service handles the API requests for Tasks
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Task create​(Task task)
      Creates an object in MapRoulette.
      boolean delete​(long identifier)
      Deletes an object in MapRoulette based on the provided identifier
      java.util.List<Task> find​(java.lang.String matcher, long parent, int limit, int page)
      Finds a list of elements
      boolean forceDelete​(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 name
      Task update​(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
    • Method Detail

      • get

        public java.util.Optional<Task> get​(long parentIdentifier,
                                            java.lang.String name)
                                     throws MapRouletteException
        Description copied from interface: IAPI
        Gets the object type associated with the service based on the object name
        Specified by:
        get in interface IAPI<Task>
        Parameters:
        parentIdentifier - The identifier of parent of the object
        name - 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: IAPI
        Gets the object type associated with the service.
        Specified by:
        get in interface IAPI<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: IAPI
        Finds a list of elements
        Specified by:
        find in interface IAPI<Task>
        Parameters:
        matcher - A string query to match based on names
        parent - The parent identifier, use -1 if want to ignore it.
        limit - How many elements to limit the results by
        page - 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: IAPI
        Creates an object in MapRoulette. For creation if the object is in the cache it will just respond with the cached object.
        Specified by:
        create in interface IAPI<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: IAPI
        Updates an object in MapRoulette.
        Specified by:
        update in interface IAPI<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 MapRouletteException
        Description copied from interface: IAPI
        Deletes an object in MapRoulette based on the provided identifier
        Specified by:
        delete in interface IAPI<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 MapRouletteException
        For a Task there is no delayed deletion available, so a delete and forceDelete amounts to the same thing.
        Specified by:
        forceDelete in interface IAPI<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