use of org.adempiere.pipo2.PoFiller in project idempiere by idempiere.
the class TaskAccessElementHandler method startElement.
public void startElement(PIPOContext ctx, Element element) throws SAXException {
List<String> excludes = defaultExcludeList(X_AD_Task_Access.Table_Name);
X_AD_Task_Access po = findPO(ctx, element);
if (po == null) {
po = new X_AD_Task_Access(ctx.ctx, 0, getTrxName(ctx));
}
PoFiller filler = new PoFiller(ctx, po, element, this);
List<String> notfounds = filler.autoFill(excludes);
if (notfounds.size() > 0) {
element.defer = true;
element.unresolved = notfounds.toString();
return;
}
po.saveEx();
}
use of org.adempiere.pipo2.PoFiller in project idempiere by idempiere.
the class TaskElementHandler method startElement.
public void startElement(PIPOContext ctx, Element element) throws SAXException {
List<String> excludes = defaultExcludeList(X_AD_Task.Table_Name);
String entitytype = getStringValue(element, "EntityType");
if (isProcessElement(ctx.ctx, entitytype)) {
MTask mTask = findPO(ctx, element);
if (mTask == null) {
mTask = new MTask(ctx.ctx, 0, getTrxName(ctx));
}
PoFiller filler = new PoFiller(ctx, mTask, element, this);
List<String> notfounds = filler.autoFill(excludes);
if (notfounds.size() > 0) {
element.defer = true;
element.unresolved = notfounds.toString();
return;
}
element.recordId = mTask.get_ID();
if (mTask.is_new() || mTask.is_Changed()) {
X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, X_AD_Task.Table_Name, X_AD_Task.Table_ID);
String action = null;
if (!mTask.is_new()) {
backupRecord(ctx, impDetail.getAD_Package_Imp_Detail_ID(), X_AD_Task.Table_Name, mTask);
action = "Update";
} else {
action = "New";
}
if (mTask.save(getTrxName(ctx)) == true) {
logImportDetail(ctx, impDetail, 1, mTask.getName(), mTask.get_ID(), action);
element.recordId = mTask.get_ID();
} else {
logImportDetail(ctx, impDetail, 0, mTask.getName(), mTask.get_ID(), action);
throw new POSaveFailedException("Failed to save Task " + mTask.getName());
}
}
} else {
element.skip = true;
}
}
use of org.adempiere.pipo2.PoFiller in project idempiere by idempiere.
the class UserRoleElementHandler method startElement.
public void startElement(PIPOContext ctx, Element element) throws SAXException {
List<String> excludes = defaultExcludeList(X_AD_User_Roles.Table_Name);
X_AD_User_Roles po = findPO(ctx, element);
if (po == null) {
po = new X_AD_User_Roles(ctx.ctx, 0, getTrxName(ctx));
}
PoFiller filler = new PoFiller(ctx, po, element, this);
List<String> notfounds = filler.autoFill(excludes);
if (notfounds.size() > 0) {
element.defer = true;
element.unresolved = notfounds.toString();
return;
}
po.saveEx();
}
use of org.adempiere.pipo2.PoFiller in project idempiere by idempiere.
the class ViewColumnElementHandler method startElement.
@Override
public void startElement(PIPOContext ctx, Element element) throws SAXException {
String entitytype = getStringValue(element, "EntityType");
if (isProcessElement(ctx.ctx, entitytype)) {
if (isParentDefer(element, MViewComponent.Table_Name)) {
element.defer = true;
return;
}
List<String> excludes = defaultExcludeList(MViewColumn.Table_Name);
MViewColumn mViewColumn = findPO(ctx, element);
if (mViewColumn == null) {
int parentId = 0;
if (getParentId(element, MViewComponent.Table_Name) > 0) {
parentId = getParentId(element, MViewComponent.Table_Name);
} else {
Element pfElement = element.properties.get(MViewColumn.COLUMNNAME_AD_ViewComponent_ID);
parentId = ReferenceUtils.resolveReference(ctx.ctx, pfElement, getTrxName(ctx));
}
if (parentId <= 0) {
element.defer = true;
element.unresolved = "AD_ViewComponent_ID";
return;
}
mViewColumn = new MViewColumn(ctx.ctx, 0, getTrxName(ctx));
mViewColumn.setAD_ViewComponent_ID(parentId);
excludes.add(MViewColumn.COLUMNNAME_AD_ViewComponent_ID);
}
PoFiller filler = new PoFiller(ctx, mViewColumn, element, this);
if (mViewColumn.getAD_ViewColumn_ID() == 0 && isOfficialId(element, "AD_ViewColumn_ID"))
filler.setInteger("AD_ViewColumn_ID");
List<String> notfounds = filler.autoFill(excludes);
if (notfounds.size() > 0) {
element.defer = true;
element.unresolved = notfounds.toString();
return;
}
if (mViewColumn.is_new() || mViewColumn.is_Changed()) {
X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, MViewColumn.Table_Name, MViewColumn.Table_ID);
String action = null;
if (!mViewColumn.is_new()) {
backupRecord(ctx, impDetail.getAD_Package_Imp_Detail_ID(), MViewColumn.Table_Name, mViewColumn);
action = "Update";
} else {
action = "New";
}
if (mViewColumn.save(getTrxName(ctx)) == true) {
logImportDetail(ctx, impDetail, 1, mViewColumn.toString(), mViewColumn.get_ID(), action);
} else {
logImportDetail(ctx, impDetail, 0, mViewColumn.toString(), mViewColumn.get_ID(), action);
throw new POSaveFailedException("Failed to save AD_ViewColumn " + mViewColumn.toString());
}
}
} else {
element.skip = true;
}
}
use of org.adempiere.pipo2.PoFiller in project idempiere by idempiere.
the class ViewComponentElementHandler method startElement.
@Override
public void startElement(PIPOContext ctx, Element element) throws SAXException {
String entitytype = getStringValue(element, "EntityType");
if (isProcessElement(ctx.ctx, entitytype)) {
MViewComponent mViewComponent = findPO(ctx, element);
if (mViewComponent == null) {
mViewComponent = new MViewComponent(ctx.ctx, 0, getTrxName(ctx));
}
PoFiller filler = new PoFiller(ctx, mViewComponent, element, this);
List<String> excludes = defaultExcludeList(MViewComponent.Table_Name);
List<String> notfounds = filler.autoFill(excludes);
if (notfounds.size() > 0) {
element.defer = true;
element.unresolved = notfounds.toString();
return;
}
if (mViewComponent.is_new() || mViewComponent.is_Changed()) {
X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, MViewComponent.Table_Name, MViewComponent.Table_ID);
String action = null;
if (!mViewComponent.is_new()) {
backupRecord(ctx, impDetail.getAD_Package_Imp_Detail_ID(), MViewComponent.Table_Name, mViewComponent);
action = "Update";
} else {
action = "New";
}
if (mViewComponent.save(getTrxName(ctx)) == true) {
logImportDetail(ctx, impDetail, 1, mViewComponent.getName(), mViewComponent.get_ID(), action);
element.recordId = mViewComponent.getAD_ViewComponent_ID();
} else {
logImportDetail(ctx, impDetail, 0, mViewComponent.getName(), mViewComponent.get_ID(), action);
throw new POSaveFailedException("Failed to save AD_ViewComponent " + mViewComponent.getName());
}
}
} else {
element.skip = true;
}
}
Aggregations