1 | /** |
2 | * |
3 | */ |
4 | package de.uka.ipd.sdq.sensorframework.dao.file; |
5 | |
6 | import java.util.Collection; |
7 | import java.util.Collections; |
8 | |
9 | import de.uka.ipd.sdq.sensorframework.dao.file.entities.ExperimentRunImpl; |
10 | import de.uka.ipd.sdq.sensorframework.dao.file.entities.ScalabilityExperimentRunImpl; |
11 | import de.uka.ipd.sdq.sensorframework.entities.ExperimentRun; |
12 | import de.uka.ipd.sdq.sensorframework.entities.dao.IExperimentRunDAO; |
13 | |
14 | /** |
15 | * @author Ihssane El-Oudghiri |
16 | * @author Steffen Becker |
17 | * |
18 | * Data Access Object (DAO) for persistence of ExperimentRun Objects. |
19 | * |
20 | */ |
21 | public class FileExperimentRunDAO extends AbstractFileDAO<ExperimentRun> implements IExperimentRunDAO { |
22 | |
23 | public FileExperimentRunDAO(FileDAOFactory factory, IDGenerator idGen) { |
24 | super(factory,idGen,FileDAOFactory.EXPRUN_FILE_NAME_PREFIX); |
25 | } |
26 | |
27 | public ExperimentRun addExperimentRun(String p_experimentdatetime) { |
28 | ExperimentRunImpl expRun = new ExperimentRunImpl(factory); |
29 | expRun.setExperimentRunID(idGen.getNextExperimentRunID()); |
30 | expRun.setExperimentDateTime(p_experimentdatetime); |
31 | |
32 | this.putEntity(expRun); |
33 | |
34 | return expRun; |
35 | } |
36 | |
37 | public ExperimentRun addScalabilityExperimentRun(String p_experimentdatetime) { |
38 | ScalabilityExperimentRunImpl expRun = new ScalabilityExperimentRunImpl(factory); |
39 | expRun.setExperimentRunID(idGen.getNextExperimentRunID()); |
40 | expRun.setExperimentDateTime(p_experimentdatetime); |
41 | |
42 | this.putEntity(expRun); |
43 | |
44 | return expRun; |
45 | } |
46 | |
47 | public Collection<ExperimentRun> getExperimentRuns() { |
48 | return Collections.unmodifiableCollection(getAllEntities()); |
49 | } |
50 | |
51 | public void removeExperimentRun(ExperimentRun experimentRun, |
52 | boolean doCascade) { |
53 | this.removeEntity(experimentRun, doCascade); |
54 | } |
55 | } |