Mercurial > hg > ismi-richfaces
comparison src/main/java/de/mpiwg/itgroup/ismi/utils/templates/AbstractTemplate.java @ 1:2e911857a759
(none)
author | jurzua |
---|---|
date | Wed, 29 Oct 2014 14:00:28 +0000 |
parents | |
children | 4ec8d4cfad26 |
comparison
equal
deleted
inserted
replaced
0:74df02964906 | 1:2e911857a759 |
---|---|
1 package de.mpiwg.itgroup.ismi.utils.templates; | |
2 | |
3 import java.io.Serializable; | |
4 import java.util.ArrayList; | |
5 import java.util.List; | |
6 | |
7 import org.apache.commons.lang.StringUtils; | |
8 import org.mpi.openmind.repository.bo.Attribute; | |
9 import org.mpi.openmind.repository.bo.Entity; | |
10 import org.mpiwg.itgroup.escidoc.ESciDocHandler; | |
11 import org.mpiwg.itgroup.escidoc.bo.Publication; | |
12 | |
13 import de.mpiwg.itgroup.ismi.util.guiComponents.Reference; | |
14 | |
15 public abstract class AbstractTemplate implements Serializable{ | |
16 | |
17 private static final long serialVersionUID = -3998660931870870851L; | |
18 | |
19 | |
20 protected List<Entity> refEntityList = new ArrayList<Entity>(); | |
21 private List<ReferenceTemplate> referenceList = new ArrayList<AbstractTemplate.ReferenceTemplate>(); | |
22 | |
23 protected void loadRefernces(){ | |
24 try{ | |
25 for(Entity ref : refEntityList){ | |
26 this.referenceList.add(new ReferenceTemplate(ref)); | |
27 } | |
28 }catch (Exception e) { | |
29 e.printStackTrace(); | |
30 } | |
31 } | |
32 | |
33 public class ReferenceTemplate implements Serializable{ | |
34 | |
35 private static final long serialVersionUID = -8257628538319156038L; | |
36 | |
37 private String escidocLabel; | |
38 private String additionalInf; | |
39 private String endnoteId; | |
40 private String endnoteContent; | |
41 | |
42 public ReferenceTemplate(Entity ent){ | |
43 | |
44 Attribute att = ent.getAttributeByName(Reference.ESCIDOC_ID); | |
45 try { | |
46 if(att != null && StringUtils.isNotEmpty(att.getValue())){ | |
47 Publication pub = ESciDocHandler.getPublicationById(att.getValue()); | |
48 if(pub != null){ | |
49 this.escidocLabel = pub.getHTMLLabel(); | |
50 } | |
51 } | |
52 } catch (Exception e) { | |
53 e.printStackTrace(); | |
54 } | |
55 | |
56 | |
57 this.additionalInf = (ent.getAttributeByName("additional_information") != null) ? ent.getAttributeByName("additional_information").getValue() : null; | |
58 this.endnoteId = (ent.getAttributeByName("endnote-id") != null) ? ent.getAttributeByName("endnote-id").getValue() : null; | |
59 this.endnoteContent = (ent.getAttributeByName("endnote-content") != null) ? ent.getAttributeByName("endnote-content").getValue() : null; | |
60 | |
61 } | |
62 | |
63 public String getEscidocLabel() { | |
64 return escidocLabel; | |
65 } | |
66 public void setEscidocLabel(String escidocLabel) { | |
67 this.escidocLabel = escidocLabel; | |
68 } | |
69 public String getAdditionalInf() { | |
70 return additionalInf; | |
71 } | |
72 public void setAdditionalInf(String additionalInf) { | |
73 this.additionalInf = additionalInf; | |
74 } | |
75 public String getEndnoteId() { | |
76 return endnoteId; | |
77 } | |
78 public void setEndnoteId(String endnoteId) { | |
79 this.endnoteId = endnoteId; | |
80 } | |
81 public String getEndnoteContent() { | |
82 return endnoteContent; | |
83 } | |
84 public void setEndnoteContent(String endnoteContent) { | |
85 this.endnoteContent = endnoteContent; | |
86 } | |
87 } | |
88 | |
89 public List<ReferenceTemplate> getReferenceList() { | |
90 return referenceList; | |
91 } | |
92 | |
93 public void setReferenceList(List<ReferenceTemplate> referenceList) { | |
94 this.referenceList = referenceList; | |
95 } | |
96 } |