123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- package com.sysmodel.datamodel.xmlmodel.impl;
- import com.sysmodel.datamodel.xmlmodel.able.Property;
- import com.sysmodel.xformmodel.able.Validate;
- import com.sysmodel.xformmodel.impl.ValidateImpl;
- public class PropertyImpl implements Property, Cloneable{
- private String name;
- private String description;
- private String dataType;
- private int length;
- private String scale;
- private String referenceParentName;
- private boolean unique;
- private boolean display;
- private String refConstant;
- private Validate Validate = new ValidateImpl();
- public String getDescription() {
- return description;
- }
- public void setDescription(String description) {
- this.description = description;
- }
- public boolean isDisplay() {
- return display;
- }
- public void setDisplay(boolean display) {
- this.display = display;
- }
- public boolean isUnique() {
- return unique;
- }
- public void setUnique(boolean unique) {
- this.unique = unique;
- }
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public String getReferenceParentName() {
- return referenceParentName;
- }
- public void setReferenceParentName(String referenceParentName) {
- this.referenceParentName = referenceParentName;
- }
- public String getScale() {
- return scale;
- }
- public void setScale(String scale) {
- this.scale = scale;
- }
- public String getDataType() {
- return dataType;
- }
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
- public int getLength() {
- return length;
- }
- public void setLength(int length) {
- this.length = length;
- }
- public String toString() {
- return name;
- }
- public boolean equals(Object obj) {
- if (obj instanceof PropertyImpl) {
- if (((PropertyImpl) obj).name.equals(this.name))
- return true;
- }
- return false;
- }
- public String getRefConstant() {
- return refConstant;
- }
- public void setRefConstant(String refConstant) {
- this.refConstant = refConstant;
- }
- public Validate getValidate() {
- return Validate;
- }
- public void setValidate(Validate validate) {
- Validate = validate;
- }
- public Object clone() {
- PropertyImpl o = null;
- try {
- o = (PropertyImpl) super.clone();
- o.Validate = (Validate) Validate.clone();
- } catch (CloneNotSupportedException e) {
- e.printStackTrace();
- }
- return o;
- }
- public String getFieldDefine() {
- StringBuffer sb = new StringBuffer();
- sb.append("XML中定义 中文名:" + this.description + " 英文名:" + this.name + " ");
- if (this.getDataType().equals("date")) {
- sb.append("数据类型: date" + " 日期格式:" + this.getScale());
- } else if (this.getDataType().equals("string")) {
- sb.append("数据类型: string" + " 最大长度: " + this.getLength());
- } else if (this.getDataType().equals("number")) {
- sb.append("数据类型: number" + " 最大长度: " + this.getLength() + " 小数位: " + this.getScale());
- } else if (this.getDataType().equals("blob")) {
- sb.append("数据类型: blob");
- } else if (this.getDataType().equals("clob")) {
- sb.append("数据类型: clob");
- }
- if (!this.getRefConstant().equals("")) {
- sb.append("引用常量: " + this.getRefConstant());
- }
- return sb.toString();
- }
- }
|