1 24 package org.ofbiz.entity.model; 25 26 import org.ofbiz.base.util.UtilXml; 27 import org.w3c.dom.Element ; 28 29 37 public class ModelInfo { 38 39 public static final String module = ModelInfo.class.getName(); 40 41 protected ModelInfo def; 42 43 protected String title = ""; 44 45 46 protected String description = ""; 47 48 49 protected String copyright = ""; 50 51 52 protected String author = ""; 53 54 55 protected String version = ""; 56 57 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 getTitle() { return "None"; } 69 public String getAuthor() { return "None"; } 70 public String getCopyright() { return "Copyright (c) 2001 The Open For Business Project - www.ofbiz.org"; } 71 public String getVersion() { return "1.0"; } 72 public String getDescription() { return "None"; } 73 }; 74 75 public void populateFromAttributes(Element 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 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 93 public String getTitle() { 94 return this.title != null ? this.title : def.getTitle(); 95 } 96 97 public void setTitle(String title) { 98 this.title = title; 99 } 100 101 102 public String getDescription() { 103 return this.description != null ? this.description : def.getDescription(); 104 } 105 106 public void setDescription(String description) { 107 this.description = description; 108 } 109 110 111 public String getCopyright() { 112 return this.copyright != null ? this.copyright : def.getCopyright(); 113 } 114 115 public void setCopyright(String copyright) { 116 this.copyright = copyright; 117 } 118 119 120 public String getAuthor() { 121 return this.author != null ? this.author : def.getAuthor(); 122 } 123 124 public void setAuthor(String author) { 125 this.author = author; 126 } 127 128 129 public String getVersion() { 130 return this.version != null ? this.version : def.getVersion(); 131 } 132 133 public void setVersion(String version) { 134 this.version = version; 135 } 136 } 137 | Popular Tags |