1
|
1 package de.mpiwg.itgroup.ismi.publicView.pages;
|
|
2
|
|
3 import java.util.ArrayList;
|
|
4
|
|
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 JSFDynamicPage extends AbstractBean{
|
|
17
|
|
18 private static final long serialVersionUID = 8946353053956179797L;
|
|
19
|
|
20 private Long currentEntId;
|
|
21 private ViewerPage page;
|
|
22 private Map<String, List<String>> attMap;
|
|
23 private Map<String, String> attMapTextAlign;
|
|
24 private List<String> labelList;
|
|
25
|
|
26 public void load(Long currentEntId){
|
|
27 Entity ent = getWrapper().getEntityById(currentEntId);
|
|
28 this.page = null;
|
|
29
|
|
30 this.attMap = new HashMap<String, List<String>>();
|
|
31 this.attMapTextAlign = new HashMap<String, String>();
|
|
32 this.labelList = new ArrayList<String>();
|
|
33 if(ent != null){
|
|
34
|
|
35 this.page = getWrapper().getViewerPage(ent.getObjectClass());
|
|
36 if(page != null){
|
|
37 List<ViewerAttribute> attList = getWrapper().getViewerAttributes(page.getId());
|
|
38 for(ViewerAttribute att : attList){
|
|
39 try {
|
|
40 //TODO show always???
|
|
41 this.attMapTextAlign.put(att.getLabel(), att.getTextAlign());
|
|
42 List<String> values = OMUtils.resolveQuery(currentEntId, att.getQuery(), getWrapper(), att.getContentType());
|
|
43 this.attMap.put(att.getLabel(), values);
|
|
44 this.labelList.add(att.getLabel());
|
|
45 } catch (Exception e) {
|
|
46 e.printStackTrace();
|
|
47 }
|
|
48 }
|
|
49 }
|
|
50 }
|
119
|
51 //System.out.println("");
|
1
|
52 }
|
|
53
|
|
54
|
|
55 public Long getCurrentEntId() {
|
|
56 return currentEntId;
|
|
57 }
|
|
58
|
|
59 public void setCurrentEntId(Long currentEntId) {
|
|
60 this.currentEntId = currentEntId;
|
|
61 }
|
|
62
|
|
63 public ViewerPage getPage() {
|
|
64 return page;
|
|
65 }
|
|
66
|
|
67
|
|
68 public void setPage(ViewerPage page) {
|
|
69 this.page = page;
|
|
70 }
|
|
71
|
|
72
|
|
73 public Map<String, List<String>> getAttMap() {
|
|
74 return attMap;
|
|
75 }
|
|
76
|
|
77
|
|
78 public void setAttMap(Map<String, List<String>> attMap) {
|
|
79 this.attMap = attMap;
|
|
80 }
|
|
81
|
|
82 public List<String> getLabels(){
|
|
83 return this.labelList;
|
|
84 }
|
|
85
|
|
86 public Map<String, String> getAttMapTextAlign() {
|
|
87 return attMapTextAlign;
|
|
88 }
|
|
89
|
|
90 }
|