package com.vci.omd.objects;
|
|
public class OtherInfo {
|
|
private int length = 0;
|
private boolean allowNull = false;
|
private int accuracy = 0;
|
private String enumName = "";
|
|
/**
|
* -1: 非参照
|
* 0: 参照业务类型
|
* 1: 参照链接类型
|
*/
|
private int refFlag = -1;
|
private String refTypeName = "";
|
/**
|
* 1:当前版本当前版次
|
* 3:最新版本最新版次
|
*/
|
private int version = 1;
|
public int getLength() {
|
return length;
|
}
|
public void setLength(int length) {
|
this.length = length;
|
}
|
public boolean isAllowNull() {
|
return allowNull;
|
}
|
public void setAllowNull(boolean allowNull) {
|
this.allowNull = allowNull;
|
}
|
public int getAccuracy() {
|
return accuracy;
|
}
|
public void setAccuracy(int accuracy) {
|
this.accuracy = accuracy;
|
}
|
public String getEnumName() {
|
return enumName;
|
}
|
public void setEnumName(String enumName) {
|
this.enumName = enumName;
|
}
|
|
/**
|
* -1: 非参照
|
* 0: 参照业务类型
|
* 1: 参照链接类型
|
*/
|
public int getRefFlag() {
|
return refFlag;
|
}
|
public void setRefFlag(int refFlag) {
|
this.refFlag = refFlag;
|
}
|
public String getRefTypeName() {
|
return refTypeName;
|
}
|
public void setRefTypeName(String refTypeName) {
|
this.refTypeName = refTypeName;
|
}
|
public int getVersion() {
|
return version;
|
}
|
public void setVersion(int version) {
|
this.version = version;
|
}
|
|
private static final String LENGTH = "length";
|
private static final String ALLOWNULL = "allowNull";
|
// private static final String ISFIXLEN = "isFixLen";
|
// private static final String OTHER = "other";
|
private static final String ACCURACY = "accuracy";
|
private static final String BTM = "btm";
|
private static final String ENUMNAME = "enumName";
|
private static final String LINKTYPENAME = "linkTypeName";
|
private static final String VERSION = "version";
|
|
/**
|
* 获取other中指定项目的值
|
* @return
|
*/
|
private static String getOtherValueByType(String other, String type){
|
String[] otherArray = other.split(";");
|
for(int i = 0; i < otherArray.length; i++){
|
String otherValue = otherArray[i];
|
if(otherValue.contains(type)){
|
return otherValue.substring(otherValue.indexOf("=") + 2, otherValue.length());
|
}
|
}
|
return null;
|
|
}
|
|
/**
|
* 将属性的other信息封装成OtherInfo对象
|
* @param text
|
* @return
|
*/
|
public static OtherInfo getOtherInfoByText(String text){
|
OtherInfo obj = new OtherInfo();
|
String value = getOtherValueByType(text, ACCURACY);
|
if(value != null && !value.equals("")){
|
obj.setAccuracy(Integer.valueOf(value));
|
}
|
value = getOtherValueByType(text, ALLOWNULL);
|
if(value != null && !value.equals("")){
|
if(value.equals("yes")){
|
obj.setAllowNull(true);
|
}else if(value.equals("no")){
|
obj.setAllowNull(false);
|
}
|
}
|
value = getOtherValueByType(text, BTM);
|
if(value != null && !value.equals("")){
|
obj.setRefFlag(0);
|
obj.setRefTypeName(String.valueOf(value));
|
}
|
value = getOtherValueByType(text, LINKTYPENAME);
|
if(value != null && !value.equals("")){
|
obj.setRefFlag(1);
|
obj.setRefTypeName(String.valueOf(value));
|
value = getOtherValueByType(text, VERSION);
|
if(value != null && !value.equals("")){
|
obj.setVersion(Integer.valueOf(value));
|
}
|
}
|
value = getOtherValueByType(text, ENUMNAME);
|
if(value != null && !value.equals("")){
|
obj.setEnumName(value);
|
}
|
value = getOtherValueByType(text, LENGTH);
|
if(value != null && !value.equals("")){
|
obj.setLength(Integer.valueOf(value));
|
}
|
return obj;
|
}
|
}
|