fr.cnes.sitools.tasks.business
Class TaskManager

java.lang.Object
  extended by fr.cnes.sitools.tasks.business.TaskManager

public final class TaskManager
extends java.lang.Object

Singleton class for managing Tasks

Author:
m.gond (AKKA Technologies)

Method Summary
 Task createTask(org.restlet.Context context, org.restlet.Request request, org.restlet.Response response, ResourceModel model, org.restlet.security.User user, java.util.logging.Level loggerLvl, boolean persist)
          Create a new Task
 boolean deleteTask(java.lang.String taskId, boolean deleteModel)
          Delete A Task and its model if deleteModel = true
 Task getById(java.lang.String taskId)
          Get a Task for the specified taskId
 java.util.List<Task> getByResourceModel(java.lang.String resourceModelId)
          Gets all the tasks with the same resourceModel specified by the given resourceModelId
static TaskManager getInstance()
          Gets the instance value
 TaskStoreXML getStore()
          getStore
 java.util.List<TaskModel> getTaskModelsPage(ResourceCollectionFilter filter, java.util.List<TaskModel> result)
          Get the list of TaskModel according to filter and full list Used by the TaskCollectionResource, only an helpfull method
 java.util.List<Task> getTasks()
          Return the list of persisted tasks
 void init(org.restlet.Context context)
          Initialize the Manager
 void runAsynchrone(Task task, org.restlet.Context context)
          Run the given Task synchronously
 void runSynchrone(Task task)
          Run the given Task synchronously
 void updateTask(Task task)
          Persist the Task
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static TaskManager getInstance()
Gets the instance value

Returns:
the instance

init

public void init(org.restlet.Context context)
Initialize the Manager

Parameters:
context - the Context

createTask

public Task createTask(org.restlet.Context context,
                       org.restlet.Request request,
                       org.restlet.Response response,
                       ResourceModel model,
                       org.restlet.security.User user,
                       java.util.logging.Level loggerLvl,
                       boolean persist)
Create a new Task

Parameters:
context - the Restlet Context of the Task
request - the request object
response - the response object
model - the Resource model
user - the User
loggerLvl - the level of the logger
persist - if the task needs to be persisted or not
Returns:
a new Task

runSynchrone

public void runSynchrone(Task task)
Run the given Task synchronously

Parameters:
task - the Task

runAsynchrone

public void runAsynchrone(Task task,
                          org.restlet.Context context)
Run the given Task synchronously

Parameters:
task - the Task
context - the context

getByResourceModel

public java.util.List<Task> getByResourceModel(java.lang.String resourceModelId)
Gets all the tasks with the same resourceModel specified by the given resourceModelId

Parameters:
resourceModelId - The id of the resourceModel
Returns:
ArrayList

getById

public Task getById(java.lang.String taskId)
Get a Task for the specified taskId

Parameters:
taskId - The id
Returns:
A Task corresponding to the following taskId

updateTask

public void updateTask(Task task)
Persist the Task

Parameters:
task - The Task to persist

deleteTask

public boolean deleteTask(java.lang.String taskId,
                          boolean deleteModel)
Delete A Task and its model if deleteModel = true

Parameters:
taskId - the id of the task
deleteModel - if it has to delete the model as well
Returns:
true if the task is deleted, false otherwise

getTasks

public java.util.List<Task> getTasks()
Return the list of persisted tasks

Returns:
the list of tasks persisted

getTaskModelsPage

public java.util.List<TaskModel> getTaskModelsPage(ResourceCollectionFilter filter,
                                                   java.util.List<TaskModel> result)
Get the list of TaskModel according to filter and full list Used by the TaskCollectionResource, only an helpfull method

Parameters:
filter - query filters
result - global results
Returns:
the list of TaskModel to be returned in the page

getStore

public TaskStoreXML getStore()
getStore

Returns:
the TaskStoreXML


Copyright © 2010-2013 CNES. All Rights Reserved.