1
|
1 package de.mpiwg.itgroup.ismi.utils.templates;
|
|
2
|
|
3 import java.util.List;
|
|
4
|
|
5 import org.mpi.openmind.cache.WrapperService;
|
|
6 import org.mpi.openmind.repository.bo.Entity;
|
|
7
|
|
8 public class DigitalizationTemplate implements Comparable<DigitalizationTemplate>{
|
|
9
|
|
10 private String codexOv;
|
|
11 private String codexId;
|
|
12 private Entity entity;
|
|
13 private String pages;
|
|
14 private List<Entity> titlesInCodex;
|
|
15
|
|
16 private WrapperService om;
|
|
17 private boolean initialized = false;
|
|
18
|
|
19 private boolean hasCodex = false;
|
|
20
|
|
21 public DigitalizationTemplate(Entity digi, WrapperService om){
|
|
22 this.entity = digi;
|
|
23 this.om = om;
|
|
24 }
|
|
25
|
|
26 public void init(){
|
|
27 this.initialized = true;
|
|
28 this.pages = om.getAttributeByName(entity.getId(), "num_files").getValue();
|
|
29
|
|
30 List<Entity> list = om.getTargetsForSourceRelation(entity, "is_digitalization_of", "CODEX", 1);
|
|
31 if(list.size() > 0){
|
|
32 Entity codex = list.get(0);
|
|
33 this.codexOv = codex.getOwnValue();
|
|
34 this.codexId = codex.getId().toString();
|
|
35 this.titlesInCodex = om.getSourcesForTargetRelation(codex, "is_part_of", "WITNESS", -1);
|
|
36 this.hasCodex = true;
|
|
37 }
|
|
38 }
|
|
39
|
|
40 public boolean isHasCodex(){
|
|
41 return this.hasCodex;
|
|
42 }
|
|
43
|
|
44 public String getCodexId() {
|
|
45 if(!initialized)
|
|
46 this.init();
|
|
47 return codexId;
|
|
48 }
|
|
49
|
|
50 public Entity getEntity() {
|
|
51 return entity;
|
|
52 }
|
|
53
|
|
54 public String getCodexOv(){
|
|
55 return this.codexOv;
|
|
56 }
|
|
57
|
|
58 public String getPages() {
|
|
59 if(!initialized)
|
|
60 this.init();
|
|
61 return pages;
|
|
62 }
|
|
63
|
|
64 public List<Entity> getTitlesInCodex() {
|
|
65 if(!initialized)
|
|
66 this.init();
|
|
67 return titlesInCodex;
|
|
68 }
|
|
69
|
|
70 public int compareTo(DigitalizationTemplate o) {
|
|
71 return this.entity.getOwnValue().compareTo(o.getEntity().getOwnValue());
|
|
72 }
|
|
73 }
|