1
|
1 package de.mpiwg.itgroup.ismi.auxObjects;
|
|
2 import java.io.Serializable;
|
|
3 import java.util.ArrayList;
|
|
4 import java.util.HashMap;
|
|
5 import java.util.List;
|
|
6 import java.util.Map;
|
|
7
|
|
8 import org.mpi.openmind.repository.bo.Attribute;
|
|
9 import org.mpi.openmind.repository.bo.Entity;
|
|
10
|
|
11 //[upgrade]import org.mpi.openmind.repository.bo.Entity;
|
|
12
|
|
13 /**
|
|
14 * @author jurzua
|
|
15 *
|
|
16 * change [25.06.2010-jurzua] replace results and attributes with a tuple entity-att
|
|
17 *
|
|
18 * TODO analyze if the attribute is necessary... I think the description should be enough.
|
|
19 *
|
|
20 */
|
|
21 public class ResultSet implements Serializable{
|
|
22
|
|
23 private static final long serialVersionUID = -6799519951054874744L;
|
|
24
|
|
25 private String name;
|
|
26 private List<Entity> results = new ArrayList<Entity>();
|
|
27 private Map<Long, Attribute> attMap = new HashMap<Long, Attribute>();
|
|
28 private Map<Long, String> descriptionMap = new HashMap<Long, String>();
|
|
29
|
|
30 public void setTuple(Entity ent, Attribute att){
|
|
31 if(!this.results.contains(ent)){
|
|
32 this.results.add(ent);
|
|
33 }
|
|
34 this.attMap.put(ent.getId(), att);
|
|
35 }
|
|
36
|
|
37 public void setDescription(Long id, String desc){
|
|
38 this.descriptionMap.put(id, desc);
|
|
39 }
|
|
40 public void setDescription(Entity ent, String desc){
|
|
41 this.descriptionMap.put(ent.getId(), desc);
|
|
42 }
|
|
43
|
|
44 public ResultSet(String ot) {
|
|
45 name=ot;
|
|
46 }
|
|
47
|
|
48 /**
|
|
49 * @return Results set als Array of DisplayEntity.
|
|
50 * Array is needed because the DataTable-Object of ICEFaces expects arrays and not Lists.
|
|
51 */
|
|
52 public DisplayEntity[] getResultsArray() {
|
|
53 DisplayEntity[] retArray = new DisplayEntity[results.size()];
|
|
54
|
|
55 int i = 0;
|
|
56 for(Entity ent : results){
|
|
57 retArray[i] = new DisplayEntity(ent);
|
|
58 i++;
|
|
59 }
|
|
60
|
|
61 return retArray;
|
|
62 }
|
|
63
|
|
64
|
|
65 public String getName() {
|
|
66 return name;
|
|
67 }
|
|
68
|
|
69 public void setName(String name) {
|
|
70 this.name = name;
|
|
71 }
|
|
72
|
|
73 public List<Entity> getResults() {
|
|
74 return results;
|
|
75 }
|
|
76
|
|
77 public void setResults(List<Entity> results) {
|
|
78 this.results = results;
|
|
79 }
|
|
80
|
|
81 public Map<Long, Attribute> getAttMap() {
|
|
82 return attMap;
|
|
83 }
|
|
84
|
|
85 public void setAttMap(Map<Long, Attribute> attMap) {
|
|
86 this.attMap = attMap;
|
|
87 }
|
|
88
|
|
89 public Map<Long, String> getDescriptionMap() {
|
|
90 return descriptionMap;
|
|
91 }
|
|
92
|
|
93 public void setDescriptionMap(Map<Long, String> descriptionMap) {
|
|
94 this.descriptionMap = descriptionMap;
|
|
95 }
|
|
96 }
|