0
|
1 package de.mpiwg.anteater.events;
|
|
2
|
|
3 import java.io.File;
|
|
4 import java.util.ArrayList;
|
|
5 import java.util.List;
|
|
6
|
|
7 import de.mpiwg.anteater.AnteaterConfiguration;
|
|
8 import de.mpiwg.anteater.events.processors.EventCreatorProcessor;
|
|
9 import de.mpiwg.anteater.events.processors.IEventProcessor;
|
|
10 import de.mpiwg.anteater.events.processors.PermitOrApplicantEventProcessor;
|
|
11 import de.mpiwg.anteater.results.ResultsCarrier;
|
|
12 import de.mpiwg.anteater.xml.impl.EventXMLManager;
|
|
13
|
|
14 public class EventController {
|
|
15
|
|
16 private List<IEventProcessor> processors;
|
|
17 private AnteaterConfiguration configuration;
|
|
18
|
|
19 public EventController(AnteaterConfiguration configuration) {
|
|
20 processors = new ArrayList<IEventProcessor>();
|
|
21 processors.add(new EventCreatorProcessor());
|
|
22 processors.add(new PermitOrApplicantEventProcessor());
|
|
23 this.configuration = configuration;
|
|
24 }
|
|
25
|
|
26 public void createEvents(List<ResultsCarrier> results) {
|
|
27
|
|
28 for (ResultsCarrier carrier : results) {
|
|
29 List<ResearchEvent> events = new ArrayList<ResearchEvent>();
|
|
30
|
|
31 for (IEventProcessor processor : processors) {
|
|
32 processor.processEvents(events, carrier);
|
|
33 }
|
|
34
|
|
35 File textfile = new File(carrier.getTextInfo().getFilepath());
|
|
36 String resultFile = configuration.getEventFolderPath() + File.separator + textfile.getName();
|
|
37 EventXMLManager eventManager = new EventXMLManager(resultFile);
|
|
38
|
|
39 for (ResearchEvent event : events) {
|
|
40 eventManager.addEvent(event);
|
|
41 }
|
|
42 }
|
|
43 }
|
|
44 }
|