1
|
1 package de.mpiwg.itgroup.ismi.publicView.pages;
|
|
2
|
|
3 import java.util.ArrayList;
|
|
4 import java.util.Collection;
|
|
5 import java.util.HashMap;
|
|
6 import java.util.List;
|
|
7 import java.util.Map;
|
|
8
|
|
9 import org.mpi.openmind.repository.bo.Entity;
|
|
10 import org.mpi.openmind.repository.bo.ViewerAttribute;
|
|
11 import org.mpi.openmind.repository.bo.ViewerPage;
|
|
12 import org.mpi.openmind.repository.utils.OMUtils;
|
|
13
|
|
14 import de.mpiwg.itgroup.ismi.entry.beans.AbstractBean;
|
|
15
|
|
16 public class DynamicPage extends AbstractBean{
|
|
17 private static final long serialVersionUID = -3539502586578459996L;
|
|
18
|
|
19 private Long entId;
|
|
20 private ViewerPage page;
|
|
21 private Map<String, List<String>> attMap;
|
|
22 private Map<String, String> attMapTextAlign;
|
|
23 private List<String> labelList;
|
|
24
|
|
25
|
|
26 public void load(String entId){
|
|
27 try {
|
|
28 this.load(Long.parseLong(entId));
|
|
29 } catch (Exception e) {
|
|
30 e.printStackTrace();
|
|
31 }
|
|
32 }
|
|
33
|
|
34 public void load(Long entId){
|
|
35 Entity ent = getWrapper().getEntityById(entId);
|
|
36 this.page = null;
|
|
37
|
|
38 this.attMap = new HashMap<String, List<String>>();
|
|
39 this.attMapTextAlign = new HashMap<String, String>();
|
|
40 this.labelList = new ArrayList<String>();
|
|
41 if(ent != null){
|
|
42
|
|
43 this.page = getWrapper().getViewerPage(ent.getObjectClass());
|
|
44 if(page != null){
|
|
45 List<ViewerAttribute> attList = getWrapper().getViewerAttributes(page.getId());
|
|
46 for(ViewerAttribute att : attList){
|
|
47 try {
|
|
48
|
|
49 if(att.getDisplayMode() != ViewerAttribute.HIDE){
|
|
50 this.attMapTextAlign.put(att.getLabel(), att.getTextAlign());
|
|
51 List<String> values = OMUtils.resolveQuery(entId, att.getQuery(), getWrapper(), att.getContentType());
|
|
52
|
|
53 if(values.size() > 0 || att.getDisplayMode() == ViewerAttribute.SHOW_ALWAYS){
|
|
54 this.attMap.put(att.getLabel(), values);
|
|
55 this.labelList.add(att.getLabel());
|
|
56 }
|
|
57 }
|
|
58
|
|
59 } catch (Exception e) {
|
|
60 e.printStackTrace();
|
|
61 }
|
|
62 }
|
|
63 }
|
|
64 }
|
|
65 }
|
|
66
|
|
67 public Long getEntId() {
|
|
68 return entId;
|
|
69 }
|
|
70
|
|
71
|
|
72 public void setEntId(Long entId) {
|
|
73 this.entId = entId;
|
|
74 }
|
|
75
|
|
76
|
|
77 public ViewerPage getPage() {
|
|
78 return page;
|
|
79 }
|
|
80
|
|
81
|
|
82 public void setPage(ViewerPage page) {
|
|
83 this.page = page;
|
|
84 }
|
|
85
|
|
86
|
|
87 public Map<String, List<String>> getAttMap() {
|
|
88 return attMap;
|
|
89 }
|
|
90
|
|
91
|
|
92 public void setAttMap(Map<String, List<String>> attMap) {
|
|
93 this.attMap = attMap;
|
|
94 }
|
|
95
|
|
96 public List<String> getLabels(){
|
|
97 return this.labelList;
|
|
98 }
|
|
99
|
|
100 public Map<String, String> getAttMapTextAlign() {
|
|
101 return attMapTextAlign;
|
|
102 }
|
|
103
|
|
104 }
|