| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
package org.demosys.web.story.impl; |
| 7 |
|
import java.util.HashMap; |
| 8 |
|
import org.demosys.web.story.CreateStoryException; |
| 9 |
|
import org.demosys.web.story.StoryService; |
| 10 |
|
import org.demosys.web.story.StoryView; |
| 11 |
|
|
| 12 |
|
|
| 13 |
18 |
public class MemoryStoryService implements StoryService { |
| 14 |
18 |
private HashMap memory = new HashMap(); |
| 15 |
|
|
| 16 |
|
public synchronized void newStory(StoryView story) |
| 17 |
|
throws CreateStoryException { |
| 18 |
0 |
if (memory.containsKey(story.getTitle())) { |
| 19 |
6 |
throw new CreateStoryException("Existe deja en Base"); |
| 20 |
6 |
} |
| 21 |
|
|
| 22 |
0 |
memory.put(story.getTitle(), story.clone()); |
| 23 |
0 |
} |
| 24 |
|
} |