package biz.book;
|
|
import java.util.List;
|
|
import biz.constants.MdSubject;
|
import foundation.dao.DataSource;
|
import foundation.data.entity.Entity;
|
import foundation.util.Util;
|
|
public class BookCommandMeta {
|
|
private String id;
|
private String code;
|
private String name;
|
private BookName bookName;
|
private String docType;
|
private OrderRight orderRight;
|
private StockType stockType;
|
private QtyCommand qtyCommand;
|
private boolean negativeConvert;
|
private FreezeCondition freezeCondition;
|
private String warehouseDirection;
|
private String warehouseSource;
|
private String filter;
|
private String bookSource;
|
private String dataSource;
|
|
public void load(Entity entity) {
|
id = entity.getString("id");
|
bookName = BookBucket.getInstance().get(entity.getString("book_name"));
|
code = entity.getString("code");
|
name = entity.getString("name");
|
docType = entity.getString("doc_type");
|
|
orderRight = OrderRight.parse(entity.getString("order_right"));
|
stockType = StockType.parse(entity.getString("stock_type"));
|
|
qtyCommand = new QtyCommand();
|
qtyCommand.load(entity);
|
|
negativeConvert = entity.getBoolean("is_negative_convert", false);
|
freezeCondition = FreezeCondition.parse(entity.getString("freeze_condition"));
|
warehouseDirection = entity.getString("warehouse_direction", "");
|
warehouseSource = entity.getString("warehouse_source", "");
|
|
bookSource = entity.getString("book_source", "document.id");
|
filter = entity.getString("filter");
|
dataSource = entity.getString("data_source");
|
}
|
|
public String getId() {
|
return id;
|
}
|
|
public String getCode() {
|
return code;
|
}
|
|
public String getName() {
|
return name;
|
}
|
|
public String getDocType() {
|
return docType;
|
}
|
|
public OrderRight getOrderRight() {
|
return orderRight;
|
}
|
|
public StockType getStockType() {
|
return stockType;
|
}
|
|
public QtyCommand getQtyCommand() {
|
return qtyCommand;
|
}
|
|
public boolean isNegativeConvert() {
|
return negativeConvert;
|
}
|
|
public String getWarehouseDirection() {
|
return warehouseDirection;
|
}
|
|
public String getWarehouseSource() {
|
return warehouseSource;
|
}
|
|
public FreezeCondition getFreezeCondition() {
|
return freezeCondition;
|
}
|
|
public String getFilter() {
|
if (Util.isEmpty(filter)) {
|
return " 1 = 1 ";
|
}
|
return filter;
|
}
|
|
public DataSource getDataSource() {
|
if ("file".equalsIgnoreCase(dataSource)) {
|
return DataSource.File;
|
}
|
if ("request".equalsIgnoreCase(dataSource)) {
|
return DataSource.Request;
|
}
|
|
return DataSource.DB;
|
}
|
|
public String getBookSource() {
|
return bookSource;
|
}
|
|
public String getFlowTableName() {
|
return bookName.getFlowTable();
|
}
|
|
public String getDetailTable() {
|
return bookName.getDetailTable();
|
}
|
|
public String getValueField() {
|
return bookName.getValueField();
|
}
|
|
public BookDimension getBookDimension() {
|
return bookName.getDimension();
|
}
|
|
public List<MdSubject> getSubjects() {
|
return bookName.getDimension().getDetails();
|
}
|
|
}
|