1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| |
8 |
| |
9 |
| |
10 |
| |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
15 |
| |
16 |
| |
17 |
| |
18 |
| package org.qedeq.kernel.bo.module; |
19 |
| |
20 |
| import org.qedeq.kernel.base.module.ChapterList; |
21 |
| import org.qedeq.kernel.base.module.Header; |
22 |
| import org.qedeq.kernel.base.module.LiteratureItemList; |
23 |
| import org.qedeq.kernel.base.module.Qedeq; |
24 |
| import org.qedeq.kernel.dto.module.ChapterListVo; |
25 |
| import org.qedeq.kernel.dto.module.ChapterVo; |
26 |
| import org.qedeq.kernel.dto.module.HeaderVo; |
27 |
| import org.qedeq.kernel.dto.module.LiteratureItemListVo; |
28 |
| import org.qedeq.kernel.utility.EqualsUtility; |
29 |
| |
30 |
| |
31 |
| |
32 |
| |
33 |
| |
34 |
| |
35 |
| |
36 |
| |
37 |
| public final class QedeqBo implements Qedeq { |
38 |
| |
39 |
| |
40 |
| private HeaderVo header; |
41 |
| |
42 |
| |
43 |
| private ChapterListVo chapterList; |
44 |
| |
45 |
| |
46 |
| private final ModuleLabels moduleLabels; |
47 |
| |
48 |
| |
49 |
| private LiteratureItemList literatureItemList; |
50 |
| |
51 |
| |
52 |
| private QedeqBoState state; |
53 |
| |
54 |
| |
55 |
| |
56 |
| |
57 |
55
| public QedeqBo() {
|
58 |
55
| moduleLabels = new ModuleLabels();
|
59 |
55
| state = QedeqBoState.STATE_CREATING;
|
60 |
| } |
61 |
| |
62 |
| |
63 |
| |
64 |
| |
65 |
| |
66 |
| |
67 |
25
| public final void setHeader(final HeaderVo header) {
|
68 |
25
| this.header = header;
|
69 |
| } |
70 |
| |
71 |
261
| public final Header getHeader() {
|
72 |
261
| return header;
|
73 |
| } |
74 |
| |
75 |
| |
76 |
| |
77 |
| |
78 |
| |
79 |
| |
80 |
23
| public final void setChapterList(final ChapterListVo chapters) {
|
81 |
23
| this.chapterList = chapters;
|
82 |
| } |
83 |
| |
84 |
222
| public final ChapterList getChapterList() {
|
85 |
222
| return chapterList;
|
86 |
| } |
87 |
| |
88 |
| |
89 |
| |
90 |
| |
91 |
| |
92 |
| |
93 |
7
| public final void addChapter(final ChapterVo chapter) {
|
94 |
7
| if (chapterList == null) {
|
95 |
4
| chapterList = new ChapterListVo();
|
96 |
| } |
97 |
7
| chapterList.add(chapter);
|
98 |
| } |
99 |
| |
100 |
| |
101 |
| |
102 |
| |
103 |
| |
104 |
| |
105 |
15
| public void setLiteratureItemList(final LiteratureItemListVo literatureItemList) {
|
106 |
15
| this.literatureItemList = literatureItemList;
|
107 |
| } |
108 |
| |
109 |
185
| public LiteratureItemList getLiteratureItemList() {
|
110 |
185
| return literatureItemList;
|
111 |
| } |
112 |
| |
113 |
61
| public boolean equals(final Object obj) {
|
114 |
61
| if (!(obj instanceof QedeqBo)) {
|
115 |
6
| return false;
|
116 |
| } |
117 |
55
| final QedeqBo other = (QedeqBo) obj;
|
118 |
55
| return EqualsUtility.equals(getHeader(), other.getHeader())
|
119 |
| && EqualsUtility.equals(getChapterList(), other.getChapterList()) |
120 |
| && EqualsUtility.equals(getLiteratureItemList(), other.getLiteratureItemList()); |
121 |
| } |
122 |
| |
123 |
34
| public int hashCode() {
|
124 |
34
| return (getHeader() != null ? getHeader().hashCode() : 0)
|
125 |
34
| ^ (getChapterList() != null ? 1 ^ getChapterList().hashCode() : 0)
|
126 |
34
| ^ (getLiteratureItemList() != null ? 2 ^ getLiteratureItemList().hashCode() : 0);
|
127 |
| } |
128 |
| |
129 |
37
| public String toString() {
|
130 |
37
| final StringBuffer buffer = new StringBuffer();
|
131 |
37
| buffer.append(getHeader() + "\n\n");
|
132 |
37
| buffer.append(getChapterList() + "\n\n");
|
133 |
37
| buffer.append(getLiteratureItemList());
|
134 |
37
| return buffer.toString();
|
135 |
| } |
136 |
| |
137 |
| |
138 |
| |
139 |
| |
140 |
| |
141 |
| |
142 |
306
| public final ModuleLabels getModuleLabels() {
|
143 |
306
| return moduleLabels;
|
144 |
| } |
145 |
| |
146 |
| |
147 |
| |
148 |
| |
149 |
| |
150 |
| |
151 |
1
| public final QedeqBoState getState() {
|
152 |
1
| return state;
|
153 |
| } |
154 |
| |
155 |
| |
156 |
| |
157 |
| |
158 |
| |
159 |
| |
160 |
5
| public final void setState(final QedeqBoState state) {
|
161 |
5
| this.state = state;
|
162 |
| } |
163 |
| |
164 |
| |
165 |
| |
166 |
| |
167 |
| |
168 |
| |
169 |
0
| public final ModuleAddress getModuleAddress() {
|
170 |
| |
171 |
0
| return null;
|
172 |
| } |
173 |
| |
174 |
| } |