View Javadoc
1 /* 2 * Demosys. 3 * 4 * Terms of license - http://opensource.org/licenses/apachepl.php 5 */ 6 package org.demosys.web.iteration.impl; 7 import java.util.ArrayList; 8 import java.util.HashMap; 9 import org.demosys.web.iteration.*; 10 /*** 11 */ 12 public class MemoryIterationService implements IterationService { 13 private HashMap memory = new HashMap(); 14 15 public synchronized void newIteration(IterationView iteration) 16 throws CreateIterationException { 17 if (memory.containsKey(iteration.getTitle())) { 18 throw new CreateIterationException("Existe deja en Base"); 19 } 20 21 memory.put(iteration.getTitle(), iteration.clone()); 22 } 23 24 25 public synchronized void updateIteration(IterationView iteration) 26 throws CreateIterationException { 27 if (memory.containsKey(iteration.getTitle())) { 28 throw new CreateIterationException("Existe deja en Base"); 29 } 30 31 memory.put(iteration.getTitle(), iteration.clone()); 32 } 33 34 35 public synchronized IterationViewList getAllIterations() { 36 IterationViewList list = new IterationViewList(); 37 list.setIterations(new ArrayList(memory.values())); 38 return list; 39 } 40 41 42 public synchronized void deleteIteration(String title) 43 throws UnknownIterationException { 44 if (memory.containsKey(title) == false) { 45 throw new UnknownIterationException(); 46 } 47 48 memory.remove(title); 49 } 50 }

This page was automatically generated by Maven