KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > outerj > daisy > books > publisher > impl > bookmodel > Section


1 /*
2  * Copyright 2004 Outerthought bvba and Schaubroeck nv
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.outerj.daisy.books.publisher.impl.bookmodel;
17
18 import org.outerx.daisy.x10Bookdef.SectionDocument;
19
20 public class Section implements SectionContainer {
21     private long documentId = -1;
22     private long branchId = -1;
23     private long languageId = -1;
24     private String JavaDoc version;
25     private String JavaDoc type;
26     private String JavaDoc bookStorePath;
27     private String JavaDoc title;
28     private SectionContainerHelper sectionContainerHelper = new SectionContainerHelper();
29
30     public long getDocumentId() {
31         return documentId;
32     }
33
34     public void setDocumentId(long documentId) {
35         this.documentId = documentId;
36     }
37
38     public long getBranchId() {
39         return branchId;
40     }
41
42     public void setBranchId(long branchId) {
43         this.branchId = branchId;
44     }
45
46     public long getLanguageId() {
47         return languageId;
48     }
49
50     public void setLanguageId(long languageId) {
51         this.languageId = languageId;
52     }
53
54     public String JavaDoc getVersion() {
55         return version;
56     }
57
58     public void setVersion(String JavaDoc version) {
59         this.version = version;
60     }
61
62     public String JavaDoc getType() {
63         return type;
64     }
65
66     public void setType(String JavaDoc type) {
67         this.type = type;
68     }
69
70     public String JavaDoc getBookStorePath() {
71         return bookStorePath;
72     }
73
74     public void setBookStorePath(String JavaDoc bookStorePath) {
75         this.bookStorePath = bookStorePath;
76     }
77
78     public String JavaDoc getTitle() {
79         return title;
80     }
81
82     public void setTitle(String JavaDoc title) {
83         this.title = title;
84     }
85
86     public void addSection(Section section) {
87         sectionContainerHelper.addSection(section);
88     }
89
90     public Section[] getSections() {
91         return sectionContainerHelper.getSections();
92     }
93
94     public SectionDocument.Section getXml() {
95         SectionDocument.Section sectionXml = SectionDocument.Section.Factory.newInstance();
96
97         if (documentId != -1)
98             sectionXml.setDocumentId(documentId);
99         if (branchId != -1)
100             sectionXml.setBranch(String.valueOf(branchId));
101         if (languageId != -1)
102             sectionXml.setLanguage(String.valueOf(languageId));
103         if (version != null)
104             sectionXml.setVersion(version);
105         if (type != null)
106             sectionXml.setType(type);
107         if (bookStorePath != null)
108             sectionXml.setBookStorePath(bookStorePath);
109         if (title != null)
110             sectionXml.setTitle(title);
111
112         sectionContainerHelper.addXml(sectionXml);
113
114         return sectionXml;
115     }
116 }
117
Popular Tags