Page tree
Skip to end of metadata
Go to start of metadata

Package summary

A task is a long action running on the platform. This is not a job/software but its a big action executed by the user.
For example, when a user wants to delete a project, we need to remove all project data (soft or hard delete).
Before doing the big request: The client may ask the server to create a Task object.
When doing the request, the client just needs to pass the parameter task (= id task). If the service support Task, server will update the task progress during the request.
The client may ask the task progress during the request execution on the server. 

Package main classes

Domain

DomainDescriptionMain properties
Task

A task running on the platform.
 

int progress

The Task domain is not a real GORM/Hibernate domain. The file is located under src/groovy.
Its not a domain because it must be outside any "hibernate session". The progress updating must be visible during the current request for an other request.

Service

ServiceDescriptionMain properties
TaskService

Op for task running on the platform.
 

def createNewTask
def updateTask(Task task, int progress, String comment)
def finishTask(Task task)

Package description

  1. Client create a task resource.

    POST /api/task.json

    Server create the task (progress=0) and response the task object.
     

  2. Client send a "big" request to the server (e.g. delete a project and all its data) and send the task id as a parameter.

    DELETE /api/project/5.json?task=123
  3. If the service support task param, it modify the task progress value during the request

    def doBigRequest(Task task) {
    	taskService.updateTask(task,10)
    	//do op
    	taskService.updateTask(task,50)
    	//do op
    	taskService.updateTask(task,90)
    	//do op
    	taskService.finishTask(task)
    }
  4. Just after sending the request, the client regulary ask the task progress to the server. The client may update a progress bar with the task progress value.
  5. Server finished the task

  • No labels