View Javadoc
1 /* 2 * Demosys. 3 * 4 * Terms of license - http://opensource.org/licenses/apachepl.php 5 */ 6 package org.demosys.task; 7 import java.util.HashMap; 8 /*** 9 */ 10 public class MemoryTaskService implements TaskService { 11 private HashMap memory = new HashMap(); 12 13 public synchronized void newTask(TaskView task) 14 throws CreationTaskException { 15 if (memory.containsKey(task.getTitle())) { 16 throw new CreationTaskException("Existe deja en Base"); 17 } 18 19 //if (task.getTitle().length()<2) { 20 // throw new CreateTaskException("task.new.error.title"); 21 // } 22 memory.put(task.getTitle(), task.clone()); 23 } 24 25 26 public synchronized TaskView getTask(String title) 27 throws ModificationTaskException { 28 if (false == memory.containsKey(title)) { 29 throw new ModificationTaskException("Inconnue en base"); 30 } 31 32 return (TaskView)memory.get(title); 33 } 34 }

This page was automatically generated by Maven