a64b81d1998bcd90c4bd9065cb741a873bbe1b01.svn-base 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. package com.sysmodel.datamodel.xmlmodel.impl;
  2. import com.sysmodel.datamodel.xmlmodel.Reference;
  3. import com.sysmodel.datamodel.xmlmodel.able.MdpAttribute;
  4. public class MdpAttributeImpl implements MdpAttribute{
  5. private boolean validate;
  6. private String name;
  7. private String ngoogleEn;
  8. private String oldName;
  9. private String description;
  10. private String unit;
  11. private boolean logicPrimaryKey;
  12. private String dataType;
  13. private int referenceType;
  14. private String scale;
  15. private int precision;
  16. private boolean index;
  17. private String indexType = null;
  18. private String defaultValue = null;
  19. private boolean notNull = false;
  20. private Reference reference = null;
  21. private boolean isAutoIncrement;
  22. private boolean isReadOnly;
  23. private boolean isSearchable;
  24. private boolean isSigned;
  25. private int columnDisplaySize;
  26. private String fieldType;
  27. public String getDataType() {
  28. return dataType;
  29. }
  30. public void setDataType(String dataType) {
  31. this.dataType = dataType;
  32. }
  33. public String getDescription() {
  34. return description;
  35. }
  36. public void setDescription(String description) {
  37. this.description = description;
  38. }
  39. public boolean isIndex() {
  40. return index;
  41. }
  42. public void setIndex(boolean index) {
  43. this.index = index;
  44. }
  45. public boolean isLogicPrimaryKey() {
  46. return logicPrimaryKey;
  47. }
  48. public void setLogicPrimaryKey(boolean logicPrimaryKey) {
  49. this.logicPrimaryKey = logicPrimaryKey;
  50. }
  51. public String getName() {
  52. return name;
  53. }
  54. public void setName(String name) {
  55. this.name = name;
  56. }
  57. public int getPrecision() {
  58. return precision;
  59. }
  60. public void setPrecision(int precision) {
  61. this.precision = precision;
  62. }
  63. public Reference getReference() {
  64. return reference;
  65. }
  66. public void setReference(Reference reference) {
  67. this.reference = reference;
  68. }
  69. public int getReferenceType() {
  70. return referenceType;
  71. }
  72. public void setReferenceType(int referenceType) {
  73. this.referenceType = referenceType;
  74. }
  75. public String getScale() {
  76. return scale;
  77. }
  78. public void setScale(String scale) {
  79. this.scale = scale;
  80. }
  81. public boolean isValidate() {
  82. return validate;
  83. }
  84. public void setValidate(boolean validate) {
  85. this.validate = validate;
  86. }
  87. public String getDefaultValue() {
  88. return defaultValue;
  89. }
  90. public void setDefaultValue(String defaultValue) {
  91. this.defaultValue = defaultValue;
  92. }
  93. public String getIndexType() {
  94. return indexType;
  95. }
  96. public void setIndexType(String indexType) {
  97. this.indexType = indexType;
  98. }
  99. public boolean isNotNull() {
  100. return notNull;
  101. }
  102. public void setNotNull(boolean notNull) {
  103. this.notNull = notNull;
  104. }
  105. public String getUnit() {
  106. return unit;
  107. }
  108. public void setUnit(String unit) {
  109. this.unit = unit;
  110. }
  111. public boolean equals(Object obj) {
  112. if (obj instanceof MdpClassImpl) {
  113. MdpAttributeImpl temp = (MdpAttributeImpl) obj;
  114. if (temp.name.equals(this.name))
  115. return true;
  116. }
  117. return false;
  118. }
  119. public String getFieldDefine() {
  120. StringBuffer sb = new StringBuffer();
  121. sb.append("XML中定义 中文名:" + this.description + " 英文名:" + this.name + " ");
  122. if (this.getDataType().equals("date")) {
  123. sb.append("数据类型: date" + " 日期格式:" + this.getScale());
  124. } else if (this.getDataType().equals("string")) {
  125. sb.append("数据类型: string" + " 最大长度: " + this.getPrecision());
  126. } else if (this.getDataType().equals("number")) {
  127. sb.append("数据类型: number" + " 最大长度: " + this.getPrecision() + " 小数位: " + this.getScale());
  128. } else if (this.getDataType().equals("blob")) {
  129. sb.append("数据类型: blob");
  130. } else if (this.getDataType().equals("clob")) {
  131. sb.append("数据类型: clob");
  132. }
  133. if (this.referenceType != 0) {
  134. if (this.reference != null) {
  135. sb.append(" 引用类型:" + this.referenceType);
  136. if (this.referenceType == 1) {
  137. sb.append(" 引用表编号 :");
  138. sb.append(this.reference.getReferenceTable());
  139. sb.append(" 引用字段:" + this.reference.getStoreName());
  140. sb.append(" 展示字段" + this.reference.getDisplayName());
  141. }
  142. if (this.referenceType == 2) {
  143. sb.append(" 引用常量 :");
  144. sb.append(this.reference.getReferenceTable());
  145. }
  146. }
  147. }
  148. return sb.toString();
  149. }
  150. public String toString() {
  151. return description;
  152. }
  153. public String getOldName() {
  154. return oldName;
  155. }
  156. public void setOldName(String oldName) {
  157. this.oldName = oldName;
  158. }
  159. public String getNgoogleEn() {
  160. return ngoogleEn;
  161. }
  162. public void setNgoogleEn(String ngoogleEn) {
  163. this.ngoogleEn = ngoogleEn;
  164. }
  165. public boolean isAutoIncrement() {
  166. return isAutoIncrement;
  167. }
  168. public void setAutoIncrement(boolean isAutoIncrement) {
  169. this.isAutoIncrement = isAutoIncrement;
  170. }
  171. public boolean isReadOnly() {
  172. return isReadOnly;
  173. }
  174. public void setReadOnly(boolean isReadOnly) {
  175. this.isReadOnly = isReadOnly;
  176. }
  177. public boolean isSearchable() {
  178. return isSearchable;
  179. }
  180. public void setSearchable(boolean isSearchable) {
  181. this.isSearchable = isSearchable;
  182. }
  183. public boolean isSigned() {
  184. return isSigned;
  185. }
  186. public void setSigned(boolean isSigned) {
  187. this.isSigned = isSigned;
  188. }
  189. public int getColumnDisplaySize() {
  190. return columnDisplaySize;
  191. }
  192. public void setColumnDisplaySize(int columnDisplaySize) {
  193. this.columnDisplaySize = columnDisplaySize;
  194. }
  195. public String getFieldType() {
  196. return fieldType;
  197. }
  198. public void setFieldType(String fieldType) {
  199. this.fieldType = fieldType;
  200. }
  201. }