public void pageBeginRender(PageEvent event) { if (getModel() == null) { setModel(new NewsPapers()); } ResourceAll resource = (ResourceAll) getModel(); if (resource.getCopyrightId() != null) { ResourceReferen reference = getResourceService().getResourceReferen(resource.getCopyrightId()); if (reference != null) setCopyRightName(reference.getName()); } }
public String getPreAddress() { ResourceAll resource = (ResourceAll) getModel(); String url = ""; if (resource instanceof Ebook) { // 图书 Ebook book = (Ebook) resource; url = getResourceService().getPreviewCoverImg(resource.getId(), book.getBookPic()); } if (resource instanceof Magazine) { // 杂志 Magazine magazine = (Magazine) resource; url = getResourceService().getPreviewCoverImg(resource.getId(), magazine.getImage()); } if (resource instanceof NewsPapers) { // 报纸 NewsPapers newsPapers = (NewsPapers) resource; url = getResourceService().getPreviewCoverImg(resource.getId(), newsPapers.getImage()); } if (resource instanceof Comics) { // 漫画 Comics comics = (Comics) resource; url = getResourceService().getPreviewCoverImg(resource.getId(), comics.getImage()); } String imgPath = "<img src='" + url + "' width='100' height='100' align='absmiddle'/>"; return imgPath; }