package frame.file;
|
|
import org.apache.poi.ss.format.CellFormatType;
|
|
import com.alibaba.druid.sql.ast.statement.SQLCommentStatement.Type;
|
|
import frame.data.DataType;
|
import frame.data.meta.EntityMeta;
|
import frame.data.meta.Field;
|
|
public class IOMappingItemRuntime {
|
private IOMappingItem item;
|
private String fromField;
|
private DataType fromType;
|
private String toField;
|
private int toIndex;
|
private DataType toType;
|
|
public IOMappingItemRuntime(IOMappingItem ioMappingItem, String fromField, Field fieldByFrom, String toField, Field fieldByto) {
|
item = ioMappingItem;
|
this.fromField = fromField == null ? null : fromField.toLowerCase();
|
|
if (fieldByFrom != null) {
|
fromType = fieldByFrom.getDataType();
|
}
|
else {
|
fromType = null;
|
}
|
|
//2. set to
|
this.toField = toField == null ? null : toField.toLowerCase();
|
|
if (fieldByto != null) {
|
toType = fieldByto.getDataType();
|
}
|
else {
|
toType = null;
|
}
|
}
|
|
public CellDataType[] getExportType() {
|
if (item != null) {
|
CellDataType[] result = item.getExportType();
|
|
if (result != null) {
|
return result;
|
}
|
}
|
|
Ce cellType = CellTypes.toExcelCellType(fromType);
|
return new CellFormatType[1] { cellType.Value };
|
}
|
|
public IOMappingItem getItem() {
|
return item;
|
}
|
|
public String getFromField() {
|
return fromField;
|
}
|
|
|
public DataType getFromType() {
|
return fromType;
|
}
|
|
public String getToField() {
|
return toField;
|
}
|
|
public int getToIndex() {
|
return toIndex;
|
}
|
|
public DataType getToType() {
|
return toType;
|
}
|
|
}
|