use of org.compiere.model.X_AD_Ref_Table in project idempiere by idempiere.
the class ReferenceTableElementHandler method startElement.
public void startElement(PIPOContext ctx, Element element) throws SAXException {
List<String> excludes = defaultExcludeList(X_AD_Ref_Table.Table_Name);
String entitytype = getStringValue(element, "EntityType");
if (isProcessElement(ctx.ctx, entitytype)) {
if (isParentSkip(element, null)) {
element.skip = true;
return;
}
X_AD_Ref_Table refTable = findPO(ctx, element);
if (refTable == null) {
refTable = new X_AD_Ref_Table(ctx.ctx, 0, getTrxName(ctx));
}
String action = refTable.is_new() ? "New" : "Update";
PoFiller filler = new PoFiller(ctx, refTable, element, this);
List<String> notfounds = filler.autoFill(excludes);
if (notfounds.size() > 0) {
element.defer = true;
element.unresolved = notfounds.toString();
return;
}
Element displayElement = element.properties.get("AD_Display");
int displayColumnId = ReferenceUtils.resolveReference(ctx.ctx, displayElement, getTrxName(ctx));
refTable.setAD_Display(displayColumnId);
Element keyElement = element.properties.get("AD_Key");
int keyColumnId = ReferenceUtils.resolveReference(ctx.ctx, keyElement, getTrxName(ctx));
refTable.setAD_Key(keyColumnId);
if (refTable.is_new() || refTable.is_Changed()) {
refTable.saveEx();
X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, X_AD_Ref_Table.Table_Name, X_AD_Ref_Table.Table_ID);
int AD_Reference_ID = refTable.getAD_Reference_ID();
MReference adReference = new MReference(ctx.ctx, AD_Reference_ID, getTrxName(ctx));
logImportDetail(ctx, impDetail, 1, adReference.getName(), refTable.getAD_Reference_ID(), action);
}
} else {
element.skip = true;
}
}
Aggregations