use of org.adempiere.pipo2.PoFiller in project idempiere by idempiere.
the class FormAccessElementHandler method startElement.
public void startElement(PIPOContext ctx, Element element) throws SAXException {
List<String> excludes = defaultExcludeList(X_AD_Form_Access.Table_Name);
MFormAccess po = findPO(ctx, element);
if (po == null) {
po = new MFormAccess(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 FormElementHandler method startElement.
public void startElement(PIPOContext ctx, Element element) throws SAXException {
List<String> excludes = defaultExcludeList(X_AD_Form.Table_Name);
String entitytype = getStringValue(element, "EntityType");
if (isProcessElement(ctx.ctx, entitytype)) {
MForm mForm = findPO(ctx, element);
if (mForm == null) {
mForm = new MForm(ctx.ctx, 0, getTrxName(ctx));
}
PoFiller filler = new PoFiller(ctx, mForm, element, this);
List<String> notfounds = filler.autoFill(excludes);
if (notfounds.size() > 0) {
element.defer = true;
element.unresolved = notfounds.toString();
return;
}
element.recordId = mForm.get_ID();
if (mForm.is_new() || mForm.is_Changed()) {
X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, X_AD_Form.Table_Name, X_AD_Form.Table_ID);
String action = null;
if (!mForm.is_new()) {
backupRecord(ctx, impDetail.getAD_Package_Imp_Detail_ID(), X_AD_Form.Table_Name, mForm);
action = "Update";
} else {
action = "New";
}
if (mForm.save(getTrxName(ctx)) == true) {
logImportDetail(ctx, impDetail, 1, mForm.getName(), mForm.get_ID(), action);
element.recordId = mForm.get_ID();
element.requireRoleAccessUpdate = true;
} else {
logImportDetail(ctx, impDetail, 0, mForm.getName(), mForm.get_ID(), action);
throw new POSaveFailedException("Failed to save form definition " + mForm.getName());
}
}
} else {
element.skip = true;
}
}
use of org.adempiere.pipo2.PoFiller in project idempiere by idempiere.
the class GenericPOElementHandler method startElement.
public void startElement(PIPOContext ctx, Element element) throws SAXException {
String tableName = element.getElementValue();
PO po = findPO(ctx, element);
if (po == null) {
MTable table = MTable.get(ctx.ctx, tableName);
po = table.getPO(0, getTrxName(ctx));
}
PoFiller filler = new PoFiller(ctx, po, element, this);
List<String> excludes = defaultExcludeList(tableName);
List<String> notfounds = filler.autoFill(excludes);
/* Verify if the table has entitytype and check dictionary maintenance */
int idxet = po.get_ColumnIndex("EntityType");
if (idxet >= 0) {
String entityType = (String) po.get_Value(idxet);
if (!isProcessElement(ctx.ctx, entityType)) {
if (log.isLoggable(Level.INFO))
log.info("Generic PO not processed as it's official " + po.toString());
element.skip = true;
return;
}
}
if (notfounds.size() > 0) {
element.defer = true;
element.unresolved = notfounds.toString();
return;
}
String action = po.is_new() ? "New" : "Update";
po.saveEx();
element.recordId = po.get_ID();
X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, po.get_TableName(), po.get_Table_ID());
logImportDetail(ctx, impDetail, 1, po.toString(), element.recordId, action);
if (I_AD_Window.Table_Name.equals(tableName) || I_AD_Process.Table_Name.equals(tableName) || I_AD_Role.Table_Name.equals(tableName) || I_AD_Form.Table_Name.equals(tableName) || I_C_DocType.Table_Name.equals(tableName) || I_AD_InfoWindow.Table_Name.equals(tableName))
element.requireRoleAccessUpdate = true;
}
use of org.adempiere.pipo2.PoFiller in project idempiere by idempiere.
the class IndexColumnElementHandler 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, MTableIndex.Table_Name)) {
element.defer = true;
return;
}
List<String> excludes = defaultExcludeList(MIndexColumn.Table_Name);
MIndexColumn mIndexColumn = findPO(ctx, element);
if (mIndexColumn == null) {
int parentId = 0;
if (getParentId(element, MTableIndex.Table_Name) > 0) {
parentId = getParentId(element, MTableIndex.Table_Name);
} else {
Element pfElement = element.properties.get(MIndexColumn.COLUMNNAME_AD_TableIndex_ID);
parentId = ReferenceUtils.resolveReference(ctx.ctx, pfElement, getTrxName(ctx));
}
if (parentId <= 0) {
element.defer = true;
element.unresolved = "AD_TableIndex_ID";
return;
}
mIndexColumn = new MIndexColumn(ctx.ctx, 0, getTrxName(ctx));
mIndexColumn.setAD_TableIndex_ID(parentId);
excludes.add(MIndexColumn.COLUMNNAME_AD_TableIndex_ID);
}
PoFiller filler = new PoFiller(ctx, mIndexColumn, element, this);
if (mIndexColumn.getAD_IndexColumn_ID() == 0 && isOfficialId(element, "AD_IndexColumn_ID"))
filler.setInteger("AD_IndexColumn_ID");
excludes.add("AD_Column_ID");
int columnId = 0;
Element columnElement = element.properties.get("AD_Column_ID");
if (ReferenceUtils.isIDLookup(columnElement) || ReferenceUtils.isUUIDLookup(columnElement)) {
columnId = ReferenceUtils.resolveReference(ctx.ctx, columnElement, getTrxName(ctx));
}
if (columnId > 0)
mIndexColumn.setAD_Column_ID(columnId);
List<String> notfounds = filler.autoFill(excludes);
if (notfounds.size() > 0) {
element.defer = true;
element.unresolved = notfounds.toString();
return;
}
if (mIndexColumn.is_new() || mIndexColumn.is_Changed()) {
X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, MIndexColumn.Table_Name, MIndexColumn.Table_ID);
String action = null;
if (!mIndexColumn.is_new()) {
backupRecord(ctx, impDetail.getAD_Package_Imp_Detail_ID(), MIndexColumn.Table_Name, mIndexColumn);
action = "Update";
} else {
action = "New";
}
if (mIndexColumn.save(getTrxName(ctx)) == true) {
logImportDetail(ctx, impDetail, 1, mIndexColumn.toString(), mIndexColumn.get_ID(), action);
} else {
logImportDetail(ctx, impDetail, 0, mIndexColumn.toString(), mIndexColumn.get_ID(), action);
throw new POSaveFailedException("Failed to save AD_IndexColumn " + mIndexColumn.toString());
}
}
} else {
element.skip = true;
}
}
use of org.adempiere.pipo2.PoFiller in project idempiere by idempiere.
the class InfoColumnElementHandler method startElement.
public void startElement(PIPOContext ctx, Element element) throws SAXException {
List<String> excludes = defaultExcludeList(X_AD_InfoColumn.Table_Name);
String entitytype = getStringValue(element, "EntityType");
if (isProcessElement(ctx.ctx, entitytype)) {
if (isParentDefer(element, I_AD_InfoWindow.Table_Name)) {
element.defer = true;
return;
}
X_AD_InfoColumn mInfoColumn = findPO(ctx, element);
if (mInfoColumn == null) {
mInfoColumn = new X_AD_InfoColumn(ctx.ctx, 0, getTrxName(ctx));
}
PoFiller filler = new PoFiller(ctx, mInfoColumn, element, this);
List<String> notfounds = filler.autoFill(excludes);
if (notfounds.size() > 0) {
element.defer = true;
element.unresolved = notfounds.toString();
return;
}
element.recordId = mInfoColumn.get_ID();
if (mInfoColumn.is_new() || mInfoColumn.is_Changed()) {
X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, X_AD_InfoColumn.Table_Name, X_AD_InfoColumn.Table_ID);
String action = null;
if (!mInfoColumn.is_new()) {
backupRecord(ctx, impDetail.getAD_Package_Imp_Detail_ID(), X_AD_InfoColumn.Table_Name, mInfoColumn);
action = "Update";
} else {
action = "New";
}
if (mInfoColumn.save(getTrxName(ctx)) == true) {
logImportDetail(ctx, impDetail, 1, mInfoColumn.getColumnName(), mInfoColumn.get_ID(), action);
element.recordId = mInfoColumn.get_ID();
} else {
logImportDetail(ctx, impDetail, 0, mInfoColumn.getColumnName(), mInfoColumn.get_ID(), action);
throw new POSaveFailedException("Failed to save InfoColumn " + mInfoColumn.getColumnName());
}
}
} else {
element.skip = true;
}
}
Aggregations