bf104896012c0b99c7fcdba9ce263f12d434c618.svn-base 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. package com.sysmodel.datamodel.xmlmodel.impl;
  2. import com.sysmodel.datamodel.xmlmodel.able.Property;
  3. import com.sysmodel.xformmodel.able.Validate;
  4. import com.sysmodel.xformmodel.impl.ValidateImpl;
  5. public class PropertyImpl implements Property, Cloneable{
  6. private String name;
  7. private String description;
  8. private String dataType;
  9. private int length;
  10. private String scale;
  11. private String referenceParentName;
  12. private boolean unique;
  13. private boolean display;
  14. private String refConstant;
  15. private Validate Validate = new ValidateImpl();
  16. public String getDescription() {
  17. return description;
  18. }
  19. public void setDescription(String description) {
  20. this.description = description;
  21. }
  22. public boolean isDisplay() {
  23. return display;
  24. }
  25. public void setDisplay(boolean display) {
  26. this.display = display;
  27. }
  28. public boolean isUnique() {
  29. return unique;
  30. }
  31. public void setUnique(boolean unique) {
  32. this.unique = unique;
  33. }
  34. public String getName() {
  35. return name;
  36. }
  37. public void setName(String name) {
  38. this.name = name;
  39. }
  40. public String getReferenceParentName() {
  41. return referenceParentName;
  42. }
  43. public void setReferenceParentName(String referenceParentName) {
  44. this.referenceParentName = referenceParentName;
  45. }
  46. public String getScale() {
  47. return scale;
  48. }
  49. public void setScale(String scale) {
  50. this.scale = scale;
  51. }
  52. public String getDataType() {
  53. return dataType;
  54. }
  55. public void setDataType(String dataType) {
  56. this.dataType = dataType;
  57. }
  58. public int getLength() {
  59. return length;
  60. }
  61. public void setLength(int length) {
  62. this.length = length;
  63. }
  64. public String toString() {
  65. return name;
  66. }
  67. public boolean equals(Object obj) {
  68. if (obj instanceof PropertyImpl) {
  69. if (((PropertyImpl) obj).name.equals(this.name))
  70. return true;
  71. }
  72. return false;
  73. }
  74. public String getRefConstant() {
  75. return refConstant;
  76. }
  77. public void setRefConstant(String refConstant) {
  78. this.refConstant = refConstant;
  79. }
  80. public Validate getValidate() {
  81. return Validate;
  82. }
  83. public void setValidate(Validate validate) {
  84. Validate = validate;
  85. }
  86. public Object clone() {
  87. PropertyImpl o = null;
  88. try {
  89. o = (PropertyImpl) super.clone();
  90. o.Validate = (Validate) Validate.clone();
  91. } catch (CloneNotSupportedException e) {
  92. e.printStackTrace();
  93. }
  94. return o;
  95. }
  96. public String getFieldDefine() {
  97. StringBuffer sb = new StringBuffer();
  98. sb.append("XML中定义 中文名:" + this.description + " 英文名:" + this.name + " ");
  99. if (this.getDataType().equals("date")) {
  100. sb.append("数据类型: date" + " 日期格式:" + this.getScale());
  101. } else if (this.getDataType().equals("string")) {
  102. sb.append("数据类型: string" + " 最大长度: " + this.getLength());
  103. } else if (this.getDataType().equals("number")) {
  104. sb.append("数据类型: number" + " 最大长度: " + this.getLength() + " 小数位: " + this.getScale());
  105. } else if (this.getDataType().equals("blob")) {
  106. sb.append("数据类型: blob");
  107. } else if (this.getDataType().equals("clob")) {
  108. sb.append("数据类型: clob");
  109. }
  110. if (!this.getRefConstant().equals("")) {
  111. sb.append("引用常量: " + this.getRefConstant());
  112. }
  113. return sb.toString();
  114. }
  115. }