use of org.adempiere.pipo2.PoFiller 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;
}
}
use of org.adempiere.pipo2.PoFiller in project idempiere by idempiere.
the class WorkflowNodeNextConditionElementHandler method startElement.
public void startElement(PIPOContext ctx, Element element) throws SAXException {
List<String> excludes = defaultExcludeList(X_AD_WF_NextCondition.Table_Name);
String entitytype = getStringValue(element, "EntityType");
if (isProcessElement(ctx.ctx, entitytype)) {
/* if (isParentSkip(element, null)) {
element.skip = true;
return;
}*/
MWFNextCondition mWFNodeNextCondition = findPO(ctx, element);
if (mWFNodeNextCondition == null) {
mWFNodeNextCondition = new MWFNextCondition(ctx.ctx, 0, getTrxName(ctx));
}
PoFiller filler = new PoFiller(ctx, mWFNodeNextCondition, element, this);
List<String> notfounds = filler.autoFill(excludes);
if (notfounds.size() > 0) {
element.defer = true;
element.unresolved = notfounds.toString();
return;
}
if (mWFNodeNextCondition.is_new() || mWFNodeNextCondition.is_Changed()) {
X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, X_AD_WF_NextCondition.Table_Name, X_AD_WF_NextCondition.Table_ID);
String action = null;
if (!mWFNodeNextCondition.is_new()) {
backupRecord(ctx, impDetail.getAD_Package_Imp_Detail_ID(), X_AD_WF_NextCondition.Table_Name, mWFNodeNextCondition);
action = "Update";
} else {
action = "New";
}
if (mWFNodeNextCondition.save(getTrxName(ctx)) == true) {
log.info("m_WFNodeNextCondition save success");
logImportDetail(ctx, impDetail, 1, String.valueOf(mWFNodeNextCondition.get_ID()), mWFNodeNextCondition.get_ID(), action);
} else {
log.info("m_WFNodeNextCondition save failure");
logImportDetail(ctx, impDetail, 0, String.valueOf(mWFNodeNextCondition.get_ID()), mWFNodeNextCondition.get_ID(), action);
throw new POSaveFailedException("Failed to save WorkflowNodeNextCondition");
}
}
} else {
element.skip = true;
}
}
use of org.adempiere.pipo2.PoFiller in project idempiere by idempiere.
the class WorkflowNodeNextElementHandler method startElement.
public void startElement(PIPOContext ctx, Element element) throws SAXException {
List<String> excludes = defaultExcludeList(MWFNodeNext.Table_Name);
String entitytype = getStringValue(element, "EntityType");
if (isProcessElement(ctx.ctx, entitytype)) {
/*if (isParentSkip(element, null)) {
element.skip = true;
return;
}*/
MWFNodeNext mWFNodeNext = findPO(ctx, element);
if (mWFNodeNext == null) {
mWFNodeNext = new MWFNodeNext(ctx.ctx, 0, getTrxName(ctx));
}
PoFiller filler = new PoFiller(ctx, mWFNodeNext, element, this);
List<String> notfounds = filler.autoFill(excludes);
if (notfounds.size() > 0) {
element.defer = true;
element.unresolved = notfounds.toString();
return;
}
if (mWFNodeNext.is_new() || mWFNodeNext.is_Changed()) {
X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, X_AD_WF_NodeNext.Table_Name, X_AD_WF_NodeNext.Table_ID);
String action = null;
if (!mWFNodeNext.is_new()) {
backupRecord(ctx, impDetail.getAD_Package_Imp_Detail_ID(), X_AD_WF_NodeNext.Table_Name, mWFNodeNext);
action = "Update";
} else {
action = "New";
}
if (mWFNodeNext.save(getTrxName(ctx)) == true) {
log.info("m_WFNodeNext save success");
logImportDetail(ctx, impDetail, 1, String.valueOf(mWFNodeNext.get_ID()), mWFNodeNext.get_ID(), action);
} else {
log.info("m_WFNodeNext save failure");
logImportDetail(ctx, impDetail, 0, String.valueOf(mWFNodeNext.get_ID()), mWFNodeNext.get_ID(), action);
throw new POSaveFailedException("Failed to save WorkflowNodeNext");
}
}
} else {
element.skip = true;
}
}
Aggregations