1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.mycore.frontend.classeditor.json;
20
21 import java.util.List;
22 import java.util.Optional;
23 import java.util.SortedSet;
24
25 import org.mycore.datamodel.classifications2.MCRCategory;
26 import org.mycore.datamodel.classifications2.MCRCategoryID;
27 import org.mycore.datamodel.classifications2.MCRLabel;
28 import org.mycore.datamodel.classifications2.impl.MCRCategoryImpl;
29
30
31
32
33
34
35 public class MCRJSONCategory implements MCRCategory {
36 private MCRCategoryImpl category;
37
38 private Boolean hasChildren = null;
39
40 private int positionInParent;
41
42 private MCRCategoryID parentID;
43
44 public void setParent(MCRCategory parent) {
45 category.setParent(parent);
46 }
47
48 public void setChildren(List<MCRCategory> children) {
49 category.setChildren(children);
50 }
51
52 public MCRJSONCategory() {
53 category = new MCRCategoryImpl();
54 }
55
56 public MCRJSONCategory(MCRCategory category) {
57 this.category = (MCRCategoryImpl) category;
58 }
59
60 public int getLeft() {
61 return category.getLeft();
62 }
63
64 public int getLevel() {
65 return category.getLevel();
66 }
67
68 public void setHasChildren(boolean hasChildren) {
69 this.hasChildren = hasChildren;
70 }
71
72 public boolean hasChildren() {
73 if (hasChildren == null) {
74 hasChildren = category.hasChildren();
75 }
76 return hasChildren;
77 }
78
79 public List<MCRCategory> getChildren() {
80 return category.getChildren();
81 }
82
83 public int getPositionInParent() {
84 return positionInParent;
85 }
86
87 public void setPositionInParent(int positionInParent) {
88 this.positionInParent = positionInParent;
89 }
90
91 public MCRCategoryID getId() {
92 return category.getId();
93 }
94
95 public SortedSet<MCRLabel> getLabels() {
96 return category.getLabels();
97 }
98
99 public MCRCategory getRoot() {
100 return category.getRoot();
101 }
102
103 public java.net.URI getURI() {
104 return category.getURI();
105 }
106
107 public void setId(MCRCategoryID id) {
108 category.setId(id);
109 }
110
111 public void setURI(java.net.URI uri) {
112 category.setURI(uri);
113 }
114
115 public MCRCategory getParent() {
116 return category.getParent();
117 }
118
119 public Optional<MCRLabel> getCurrentLabel() {
120 return category.getCurrentLabel();
121 }
122
123 public void setLabels(SortedSet<MCRLabel> labels) {
124 category.setLabels(labels);
125 }
126
127 public Optional<MCRLabel> getLabel(String lang) {
128 return category.getLabel(lang);
129 }
130
131 public void setParentID(MCRCategoryID parentID) {
132 this.parentID = parentID;
133 }
134
135 public MCRCategoryID getParentID() {
136 return parentID;
137 }
138
139 @Override
140 public boolean isClassification() {
141 return category.isClassification();
142 }
143
144 @Override
145 public boolean isCategory() {
146 return category.isCategory();
147 }
148
149 public MCRCategoryImpl asMCRImpl() {
150 return category;
151 }
152
153 }