Mercurial > hg > ismi-richfaces
diff src/main/java/de/mpiwg/itgroup/ismi/publicView/pages/JSFDynamicPage.java @ 1:2e911857a759
(none)
author | jurzua |
---|---|
date | Wed, 29 Oct 2014 14:00:28 +0000 |
parents | |
children | 4aa8c425685d |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/de/mpiwg/itgroup/ismi/publicView/pages/JSFDynamicPage.java Wed Oct 29 14:00:28 2014 +0000 @@ -0,0 +1,90 @@ +package de.mpiwg.itgroup.ismi.publicView.pages; + +import java.util.ArrayList; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.mpi.openmind.repository.bo.Entity; +import org.mpi.openmind.repository.bo.ViewerAttribute; +import org.mpi.openmind.repository.bo.ViewerPage; +import org.mpi.openmind.repository.utils.OMUtils; + +import de.mpiwg.itgroup.ismi.entry.beans.AbstractBean; + +public class JSFDynamicPage extends AbstractBean{ + + private static final long serialVersionUID = 8946353053956179797L; + + private Long currentEntId; + private ViewerPage page; + private Map<String, List<String>> attMap; + private Map<String, String> attMapTextAlign; + private List<String> labelList; + + public void load(Long currentEntId){ + Entity ent = getWrapper().getEntityById(currentEntId); + this.page = null; + + this.attMap = new HashMap<String, List<String>>(); + this.attMapTextAlign = new HashMap<String, String>(); + this.labelList = new ArrayList<String>(); + if(ent != null){ + + this.page = getWrapper().getViewerPage(ent.getObjectClass()); + if(page != null){ + List<ViewerAttribute> attList = getWrapper().getViewerAttributes(page.getId()); + for(ViewerAttribute att : attList){ + try { + //TODO show always??? + this.attMapTextAlign.put(att.getLabel(), att.getTextAlign()); + List<String> values = OMUtils.resolveQuery(currentEntId, att.getQuery(), getWrapper(), att.getContentType()); + this.attMap.put(att.getLabel(), values); + this.labelList.add(att.getLabel()); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + } + System.out.println(""); + } + + + public Long getCurrentEntId() { + return currentEntId; + } + + public void setCurrentEntId(Long currentEntId) { + this.currentEntId = currentEntId; + } + + public ViewerPage getPage() { + return page; + } + + + public void setPage(ViewerPage page) { + this.page = page; + } + + + public Map<String, List<String>> getAttMap() { + return attMap; + } + + + public void setAttMap(Map<String, List<String>> attMap) { + this.attMap = attMap; + } + + public List<String> getLabels(){ + return this.labelList; + } + + public Map<String, String> getAttMapTextAlign() { + return attMapTextAlign; + } + +}