KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ofbiz > entity > model > ModelInfo


1 /*
2  * $Id: ModelInfo.java 5462 2005-08-05 18:35:48Z jonesde $
3  *
4  * Copyright (c) 2001-2005 The Open For Business Project - www.ofbiz.org
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, including without limitation
9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the
11  * Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included
14  * in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
21  * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
22  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */

24 package org.ofbiz.entity.model;
25
26 import org.ofbiz.base.util.UtilXml;
27 import org.w3c.dom.Element JavaDoc;
28
29 /**
30  * Generic Entity - Entity model class
31  *
32  * @author <a HREF="mailto:jonesde@ofbiz.org">David E. Jones</a>
33  * @author <a HREF="mailto:jaz@ofbiz.org">Andy Zeneski</a>
34  * @version $Rev: 5462 $
35  * @since 2.0
36  */

37 public class ModelInfo {
38     
39     public static final String JavaDoc module = ModelInfo.class.getName();
40
41     protected ModelInfo def;
42     /** The title for documentation purposes */
43     protected String JavaDoc title = "";
44
45     /** The description for documentation purposes */
46     protected String JavaDoc description = "";
47
48     /** The copyright for documentation purposes */
49     protected String JavaDoc copyright = "";
50
51     /** The author for documentation purposes */
52     protected String JavaDoc author = "";
53
54     /** The version for documentation purposes */
55     protected String JavaDoc version = "";
56
57     // ===== CONSTRUCTORS =====
58

59     public ModelInfo() {
60         this(DEFAULT);
61     }
62
63     public ModelInfo(ModelInfo def) {
64         this.def = def;
65     }
66
67     public static final ModelInfo DEFAULT = new ModelInfo() {
68         public String JavaDoc getTitle() { return "None"; }
69         public String JavaDoc getAuthor() { return "None"; }
70         public String JavaDoc getCopyright() { return "Copyright (c) 2001 The Open For Business Project - www.ofbiz.org"; }
71         public String JavaDoc getVersion() { return "1.0"; }
72         public String JavaDoc getDescription() { return "None"; }
73     };
74
75     public void populateFromAttributes(Element JavaDoc element) {
76         author = element.getAttribute("author");
77         copyright = element.getAttribute("copyright");
78         description = UtilXml.childElementValue(element, "description");
79         title = element.getAttribute("title");
80         version = element.getAttribute("version");
81     }
82
83     public void populateFromElements(Element JavaDoc element) {
84         author = UtilXml.childElementValue(element, "author");
85         copyright = UtilXml.childElementValue(element, "copyright");
86         description = UtilXml.childElementValue(element, "description");
87         title = UtilXml.childElementValue(element, "title");
88         version = UtilXml.childElementValue(element, "version");
89     }
90
91     // Strings to go in the comment header.
92
/** The title for documentation purposes */
93     public String JavaDoc getTitle() {
94         return this.title != null ? this.title : def.getTitle();
95     }
96
97     public void setTitle(String JavaDoc title) {
98         this.title = title;
99     }
100
101     /** The description for documentation purposes */
102     public String JavaDoc getDescription() {
103         return this.description != null ? this.description : def.getDescription();
104     }
105
106     public void setDescription(String JavaDoc description) {
107         this.description = description;
108     }
109
110     /** The copyright for documentation purposes */
111     public String JavaDoc getCopyright() {
112         return this.copyright != null ? this.copyright : def.getCopyright();
113     }
114
115     public void setCopyright(String JavaDoc copyright) {
116         this.copyright = copyright;
117     }
118
119     /** The author for documentation purposes */
120     public String JavaDoc getAuthor() {
121         return this.author != null ? this.author : def.getAuthor();
122     }
123
124     public void setAuthor(String JavaDoc author) {
125         this.author = author;
126     }
127
128     /** The version for documentation purposes */
129     public String JavaDoc getVersion() {
130         return this.version != null ? this.version : def.getVersion();
131     }
132
133     public void setVersion(String JavaDoc version) {
134         this.version = version;
135     }
136 }
137
Popular Tags