2pack refactoring
- make adding packin/packout support for new table easier - use po instead of direct sql where possible - more to come later
This commit is contained in:
parent
fecd8269ad
commit
69d3b96908
|
@ -16,6 +16,7 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.adempiere.pipo.handler;
|
package org.adempiere.pipo.handler;
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
@ -29,12 +30,15 @@ import org.adempiere.pipo.PackOut;
|
||||||
import org.adempiere.pipo.PoFiller;
|
import org.adempiere.pipo.PoFiller;
|
||||||
import org.adempiere.pipo.exception.POSaveFailedException;
|
import org.adempiere.pipo.exception.POSaveFailedException;
|
||||||
import org.compiere.model.X_AD_Element;
|
import org.compiere.model.X_AD_Element;
|
||||||
|
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.xml.sax.Attributes;
|
import org.xml.sax.Attributes;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import org.xml.sax.helpers.AttributesImpl;
|
import org.xml.sax.helpers.AttributesImpl;
|
||||||
|
|
||||||
public class AdElementHandler extends AbstractElementHandler {
|
import java.sql.ResultSet;
|
||||||
|
|
||||||
|
public class AdElementHandler extends AbstractElementHandler implements IPackOutHandler {
|
||||||
|
|
||||||
private List<Integer> processedElements = new ArrayList<Integer>();
|
private List<Integer> processedElements = new ArrayList<Integer>();
|
||||||
|
|
||||||
|
@ -44,7 +48,6 @@ public class AdElementHandler extends AbstractElementHandler {
|
||||||
public void startElement(Properties ctx, Element element)
|
public void startElement(Properties ctx, Element element)
|
||||||
throws SAXException {
|
throws SAXException {
|
||||||
String elementValue = element.getElementValue();
|
String elementValue = element.getElementValue();
|
||||||
int AD_Backup_ID = -1;
|
|
||||||
String Object_Status = null;
|
String Object_Status = null;
|
||||||
|
|
||||||
Attributes atts = element.attributes;
|
Attributes atts = element.attributes;
|
||||||
|
@ -62,7 +65,7 @@ public class AdElementHandler extends AbstractElementHandler {
|
||||||
if (id <= 0 && atts.getValue("AD_Element_ID") != null && Integer.parseInt(atts.getValue("AD_Element_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
if (id <= 0 && atts.getValue("AD_Element_ID") != null && Integer.parseInt(atts.getValue("AD_Element_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
||||||
m_AdElement.setAD_Element_ID(Integer.parseInt(atts.getValue("AD_Element_ID")));
|
m_AdElement.setAD_Element_ID(Integer.parseInt(atts.getValue("AD_Element_ID")));
|
||||||
if (id > 0) {
|
if (id > 0) {
|
||||||
AD_Backup_ID = copyRecord(ctx, AD_ELEMENT, m_AdElement);
|
backupRecord(ctx, AD_ELEMENT, m_AdElement);
|
||||||
Object_Status = "Update";
|
Object_Status = "Update";
|
||||||
if (processedElements.contains(id)) {
|
if (processedElements.contains(id)) {
|
||||||
element.skip = true;
|
element.skip = true;
|
||||||
|
@ -70,7 +73,6 @@ public class AdElementHandler extends AbstractElementHandler {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Object_Status = "New";
|
Object_Status = "New";
|
||||||
AD_Backup_ID = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PoFiller pf = new PoFiller(m_AdElement, atts);
|
PoFiller pf = new PoFiller(m_AdElement, atts);
|
||||||
|
@ -92,7 +94,7 @@ public class AdElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
if (m_AdElement.save(getTrxName(ctx)) == true) {
|
if (m_AdElement.save(getTrxName(ctx)) == true) {
|
||||||
record_log(ctx, 1, m_AdElement.getName(), "Element",
|
record_log(ctx, 1, m_AdElement.getName(), "Element",
|
||||||
m_AdElement.get_ID(), AD_Backup_ID, Object_Status,
|
m_AdElement.get_ID(), Object_Status,
|
||||||
AD_ELEMENT, get_IDWithColumn(ctx, "AD_Table",
|
AD_ELEMENT, get_IDWithColumn(ctx, "AD_Table",
|
||||||
"TableName", AD_ELEMENT));
|
"TableName", AD_ELEMENT));
|
||||||
|
|
||||||
|
@ -102,7 +104,7 @@ public class AdElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
record_log(ctx, 0, m_AdElement.getName(), "Element",
|
record_log(ctx, 0, m_AdElement.getName(), "Element",
|
||||||
m_AdElement.get_ID(), AD_Backup_ID, Object_Status,
|
m_AdElement.get_ID(), Object_Status,
|
||||||
AD_ELEMENT, get_IDWithColumn(ctx, "AD_Table",
|
AD_ELEMENT, get_IDWithColumn(ctx, "AD_Table",
|
||||||
"TableName", AD_ELEMENT));
|
"TableName", AD_ELEMENT));
|
||||||
throw new POSaveFailedException("Reference");
|
throw new POSaveFailedException("Reference");
|
||||||
|
@ -115,7 +117,7 @@ public class AdElementHandler extends AbstractElementHandler {
|
||||||
public void endElement(Properties ctx, Element element) throws SAXException {
|
public void endElement(Properties ctx, Element element) throws SAXException {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void create(Properties ctx, TransformerHandler document)
|
protected void create(Properties ctx, TransformerHandler document)
|
||||||
throws SAXException {
|
throws SAXException {
|
||||||
|
|
||||||
|
|
||||||
|
@ -136,8 +138,14 @@ public class AdElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
PackOut packOut = (PackOut)ctx.get("PackOutProcess");
|
PackOut packOut = (PackOut)ctx.get("PackOutProcess");
|
||||||
|
|
||||||
packOut.createTranslations(X_AD_Element.Table_Name,
|
|
||||||
m_AdElement.get_ID(), document);
|
try{
|
||||||
|
new CommonTranslationHandler().packOut(packOut,null,null,document,null,m_AdElement.get_ID());
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
log.info(e.toString());
|
||||||
|
}
|
||||||
|
|
||||||
document.endElement("", "", "element");
|
document.endElement("", "", "element");
|
||||||
}
|
}
|
||||||
|
@ -166,4 +174,15 @@ public class AdElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
return atts;
|
return atts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void packOut(PackOut packout, ResultSet header, ResultSet detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
|
||||||
|
{
|
||||||
|
if(recordId <= 0 )
|
||||||
|
recordId = detail.getInt(X_AD_Element.COLUMNNAME_AD_Element_ID);
|
||||||
|
|
||||||
|
Env.setContext(packout.getCtx(), X_AD_Element.COLUMNNAME_AD_Element_ID, recordId);
|
||||||
|
|
||||||
|
this.create(packout.getCtx(), packOutDocument);
|
||||||
|
packout.getCtx().remove(X_AD_Element.COLUMNNAME_AD_Element_ID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
@ -33,19 +34,23 @@ import javax.xml.transform.sax.TransformerHandler;
|
||||||
|
|
||||||
import org.adempiere.pipo.AbstractElementHandler;
|
import org.adempiere.pipo.AbstractElementHandler;
|
||||||
import org.adempiere.pipo.Element;
|
import org.adempiere.pipo.Element;
|
||||||
|
|
||||||
import org.compiere.Adempiere;
|
import org.compiere.Adempiere;
|
||||||
import org.compiere.model.X_AD_Package_Exp_Detail;
|
import org.compiere.model.X_AD_Package_Exp_Detail;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.model.X_AD_Package_Imp_Backup;
|
||||||
|
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.xml.sax.Attributes;
|
import org.xml.sax.Attributes;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import org.xml.sax.helpers.AttributesImpl;
|
import org.xml.sax.helpers.AttributesImpl;
|
||||||
|
|
||||||
public class CodeSnipitElementHandler extends AbstractElementHandler {
|
import java.sql.ResultSet;
|
||||||
|
import org.adempiere.pipo.PackOut;
|
||||||
|
|
||||||
|
public class CodeSnipitElementHandler extends AbstractElementHandler implements IPackOutHandler {
|
||||||
|
|
||||||
public void startElement(Properties ctx, Element element) throws SAXException {
|
public void startElement(Properties ctx, Element element) throws SAXException {
|
||||||
String elementValue = element.getElementValue();
|
String elementValue = element.getElementValue();
|
||||||
int AD_Backup_ID = -1;
|
|
||||||
String Object_Status = null;
|
String Object_Status = null;
|
||||||
log.info(elementValue);
|
log.info(elementValue);
|
||||||
Object_Status = "Update";
|
Object_Status = "Update";
|
||||||
|
@ -58,10 +63,8 @@ public class CodeSnipitElementHandler extends AbstractElementHandler {
|
||||||
String oldCode = atts.getValue("oldcode");
|
String oldCode = atts.getValue("oldcode");
|
||||||
String newCode = atts.getValue("newcode");
|
String newCode = atts.getValue("newcode");
|
||||||
|
|
||||||
int idDetail=0;
|
|
||||||
InputStream source; // Stream for reading from the source file.
|
InputStream source; // Stream for reading from the source file.
|
||||||
OutputStream copy; // Stream for writing the copy.
|
OutputStream copy; // Stream for writing the copy.
|
||||||
File currentDirectory = new File(".");
|
|
||||||
|
|
||||||
String packagePath=null;
|
String packagePath=null;
|
||||||
String sourcePath=null;
|
String sourcePath=null;
|
||||||
|
@ -125,42 +128,29 @@ public class CodeSnipitElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
int success = readReplace(targetDirectoryModified+sourceName, oldCode, newCode);
|
int success = readReplace(targetDirectoryModified+sourceName, oldCode, newCode);
|
||||||
|
|
||||||
// Record in log
|
// Record in log
|
||||||
int idBackup = DB.getNextID (getClientId(ctx), "AD_Package_Imp_Backup", getTrxName(ctx));
|
|
||||||
if (success != -1){
|
if (success != -1){
|
||||||
try {
|
try {
|
||||||
idDetail = record_log (ctx, 1, sourceName,"codesnipit", 0,0, Object_Status,sourceName,0);
|
record_log (ctx, 1, sourceName,"codesnipit", 0, Object_Status,sourceName,0);
|
||||||
} catch (SAXException e) {
|
} catch (SAXException e) {
|
||||||
log.info ("setfile:"+e);
|
log.info ("setfile:"+e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
try {
|
try {
|
||||||
idDetail = record_log (ctx, 0, sourceName,"codesnipit", 0,0, Object_Status,sourceName,0);
|
record_log (ctx, 0, sourceName,"codesnipit", 0, Object_Status,sourceName,0);
|
||||||
} catch (SAXException e) {
|
} catch (SAXException e) {
|
||||||
log.info ("setfile:"+e);
|
log.info ("setfile:"+e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Record in transaction file
|
|
||||||
StringBuffer sqlB = new StringBuffer ("Insert INTO AD_Package_Imp_Backup")
|
|
||||||
.append( "(AD_Client_ID, AD_Org_ID, CreatedBy, UpdatedBy, " )
|
|
||||||
.append( "AD_PACKAGE_IMP_BACKUP_ID, AD_PACKAGE_IMP_DETAIL_ID, AD_PACKAGE_IMP_ID," )
|
|
||||||
.append( " AD_PACKAGE_IMP_ORG_DIR, AD_PACKAGE_IMP_BCK_DIR)" )
|
|
||||||
.append( "VALUES(" )
|
|
||||||
.append( " "+ Env.getAD_Client_ID(ctx) )
|
|
||||||
.append( ", "+ Env.getAD_Org_ID(ctx) )
|
|
||||||
.append( ", "+ Env.getAD_User_ID(ctx) )
|
|
||||||
.append( ", "+ Env.getAD_User_ID(ctx) )
|
|
||||||
.append( ", " + idBackup )
|
|
||||||
.append( ", " + idDetail )
|
|
||||||
.append( ", " + getPackageImpId(ctx) )
|
|
||||||
.append( ", '" + targetDirectoryModified+sourceName )
|
|
||||||
.append( "', '" + packagePath+File.separator+"backup"+File.separator+fileDate+"_"+sourceName )
|
|
||||||
.append( "')");
|
|
||||||
|
|
||||||
int no = DB.executeUpdate (sqlB.toString(), getTrxName(ctx));
|
//Record in transaction file
|
||||||
if (no == -1)
|
X_AD_Package_Imp_Backup backup = new X_AD_Package_Imp_Backup(ctx, 0, getTrxName(ctx));
|
||||||
log.info("Insert to import backup failed");
|
backup.setAD_Org_ID(Env.getAD_Org_ID(ctx));
|
||||||
|
backup.setAD_Package_Imp_ID(getPackageImpId(ctx));
|
||||||
|
backup.setAD_Package_Imp_Org_Dir(targetDirectoryModified+sourceName );
|
||||||
|
backup.setAD_Package_Imp_Bck_Dir(packagePath+File.separator+"backup"+File.separator+fileDate+"_"+sourceName);
|
||||||
|
backup.saveEx();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -238,4 +228,19 @@ public class CodeSnipitElementHandler extends AbstractElementHandler {
|
||||||
atts.addAttribute("","","ReleaseNo","CDATA",ReleaseNo);
|
atts.addAttribute("","","ReleaseNo","CDATA",ReleaseNo);
|
||||||
return atts;
|
return atts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void packOut(PackOut packout, ResultSet header, ResultSet detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
|
||||||
|
{
|
||||||
|
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_Destination_Directory, detail.getString(X_AD_Package_Exp_Detail.COLUMNNAME_Destination_Directory));
|
||||||
|
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_FileName, detail.getString(X_AD_Package_Exp_Detail.COLUMNNAME_Destination_FileName));
|
||||||
|
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_AD_Package_Code_Old, detail.getString(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Package_Code_Old));
|
||||||
|
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_AD_Package_Code_New, detail.getString(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Package_Code_New));
|
||||||
|
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_ReleaseNo,detail.getString(X_AD_Package_Exp_Detail.COLUMNNAME_ReleaseNo));
|
||||||
|
this.create(packout.getCtx(), packOutDocument);
|
||||||
|
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_File_Directory);
|
||||||
|
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_FileName);
|
||||||
|
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Package_Code_Old);
|
||||||
|
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Package_Code_New);
|
||||||
|
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_ReleaseNo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,14 +85,12 @@ public class ColumnElementHandler extends AbstractElementHandler {
|
||||||
MColumn m_Column = new MColumn(ctx, id, getTrxName(ctx));
|
MColumn m_Column = new MColumn(ctx, id, getTrxName(ctx));
|
||||||
if (id <= 0 && atts.getValue("AD_Column_ID") != null && Integer.parseInt(atts.getValue("AD_Column_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
if (id <= 0 && atts.getValue("AD_Column_ID") != null && Integer.parseInt(atts.getValue("AD_Column_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
||||||
m_Column.setAD_Column_ID(Integer.parseInt(atts.getValue("AD_Column_ID")));
|
m_Column.setAD_Column_ID(Integer.parseInt(atts.getValue("AD_Column_ID")));
|
||||||
int AD_Backup_ID = -1;
|
|
||||||
String Object_Status = null;
|
String Object_Status = null;
|
||||||
if (id > 0) {
|
if (id > 0) {
|
||||||
AD_Backup_ID = copyRecord(ctx, "AD_Column", m_Column);
|
backupRecord(ctx, "AD_Column", m_Column);
|
||||||
Object_Status = "Update";
|
Object_Status = "Update";
|
||||||
} else {
|
} else {
|
||||||
Object_Status = "New";
|
Object_Status = "New";
|
||||||
AD_Backup_ID = 0;
|
|
||||||
}
|
}
|
||||||
m_Column.setColumnName(columnName);
|
m_Column.setColumnName(columnName);
|
||||||
|
|
||||||
|
@ -177,12 +175,12 @@ public class ColumnElementHandler extends AbstractElementHandler {
|
||||||
adElement.setName(m_Column.getColumnName());
|
adElement.setName(m_Column.getColumnName());
|
||||||
if (adElement.save(getTrxName(ctx)) == true) {
|
if (adElement.save(getTrxName(ctx)) == true) {
|
||||||
record_log(ctx, 1, m_Column.getName(), "Element", adElement
|
record_log(ctx, 1, m_Column.getName(), "Element", adElement
|
||||||
.getAD_Element_ID(), AD_Backup_ID, "New",
|
.getAD_Element_ID(), "New",
|
||||||
"AD_Element", get_IDWithColumn(ctx, "AD_Table",
|
"AD_Element", get_IDWithColumn(ctx, "AD_Table",
|
||||||
"TableName", "AD_Element"));
|
"TableName", "AD_Element"));
|
||||||
} else {
|
} else {
|
||||||
record_log(ctx, 0, m_Column.getName(), "Element", adElement
|
record_log(ctx, 0, m_Column.getName(), "Element", adElement
|
||||||
.getAD_Element_ID(), AD_Backup_ID, "New",
|
.getAD_Element_ID(), "New",
|
||||||
"AD_Element", get_IDWithColumn(ctx, "AD_Table",
|
"AD_Element", get_IDWithColumn(ctx, "AD_Table",
|
||||||
"TableName", "AD_Element"));
|
"TableName", "AD_Element"));
|
||||||
}
|
}
|
||||||
|
@ -233,13 +231,13 @@ public class ColumnElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
if (m_Column.save(getTrxName(ctx)) == true) {
|
if (m_Column.save(getTrxName(ctx)) == true) {
|
||||||
record_log(ctx, 1, m_Column.getName(), "Column", m_Column
|
record_log(ctx, 1, m_Column.getName(), "Column", m_Column
|
||||||
.get_ID(), AD_Backup_ID, Object_Status, "AD_Column",
|
.get_ID(), Object_Status, "AD_Column",
|
||||||
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
||||||
"AD_Column"));
|
"AD_Column"));
|
||||||
element.recordId = m_Column.getAD_Column_ID();
|
element.recordId = m_Column.getAD_Column_ID();
|
||||||
} else {
|
} else {
|
||||||
record_log(ctx, 0, m_Column.getName(), "Column", m_Column
|
record_log(ctx, 0, m_Column.getName(), "Column", m_Column
|
||||||
.get_ID(), AD_Backup_ID, Object_Status, "AD_Column",
|
.get_ID(), Object_Status, "AD_Column",
|
||||||
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
||||||
"AD_Column"));
|
"AD_Column"));
|
||||||
throw new POSaveFailedException("Failed to import column.");
|
throw new POSaveFailedException("Failed to import column.");
|
||||||
|
@ -252,13 +250,13 @@ public class ColumnElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
if (success == 1) {
|
if (success == 1) {
|
||||||
record_log(ctx, 1, m_Column.getColumnName(), "dbColumn",
|
record_log(ctx, 1, m_Column.getColumnName(), "dbColumn",
|
||||||
m_Column.get_ID(), 0, Object_Status, atts.getValue(
|
m_Column.get_ID(), Object_Status, atts.getValue(
|
||||||
"ADTableNameID").toUpperCase(),
|
"ADTableNameID").toUpperCase(),
|
||||||
get_IDWithColumn(ctx, "AD_Table", "TableName", atts
|
get_IDWithColumn(ctx, "AD_Table", "TableName", atts
|
||||||
.getValue("ADTableNameID").toUpperCase()));
|
.getValue("ADTableNameID").toUpperCase()));
|
||||||
} else {
|
} else {
|
||||||
record_log(ctx, 0, m_Column.getColumnName(), "dbColumn",
|
record_log(ctx, 0, m_Column.getColumnName(), "dbColumn",
|
||||||
m_Column.get_ID(), 0, Object_Status, atts.getValue(
|
m_Column.get_ID(), Object_Status, atts.getValue(
|
||||||
"ADTableNameID").toUpperCase(),
|
"ADTableNameID").toUpperCase(),
|
||||||
get_IDWithColumn(ctx, "AD_Table", "TableName", atts
|
get_IDWithColumn(ctx, "AD_Table", "TableName", atts
|
||||||
.getValue("ADTableNameID").toUpperCase()));
|
.getValue("ADTableNameID").toUpperCase()));
|
||||||
|
@ -390,12 +388,12 @@ public class ColumnElementHandler extends AbstractElementHandler {
|
||||||
AttributesImpl atts = new AttributesImpl();
|
AttributesImpl atts = new AttributesImpl();
|
||||||
X_AD_Column m_Column = new X_AD_Column(ctx, AD_Column_ID,
|
X_AD_Column m_Column = new X_AD_Column(ctx, AD_Column_ID,
|
||||||
getTrxName(ctx));
|
getTrxName(ctx));
|
||||||
createColumnBinding(atts, m_Column);
|
createColumnBinding(ctx, atts, m_Column);
|
||||||
document.startElement("", "", "column", atts);
|
document.startElement("", "", "column", atts);
|
||||||
document.endElement("", "", "column");
|
document.endElement("", "", "column");
|
||||||
}
|
}
|
||||||
|
|
||||||
private AttributesImpl createColumnBinding(AttributesImpl atts,
|
private AttributesImpl createColumnBinding(Properties ctx, AttributesImpl atts,
|
||||||
X_AD_Column m_Column) {
|
X_AD_Column m_Column) {
|
||||||
String sql = null;
|
String sql = null;
|
||||||
String name = null;
|
String name = null;
|
||||||
|
@ -435,8 +433,7 @@ public class ColumnElementHandler extends AbstractElementHandler {
|
||||||
} else
|
} else
|
||||||
atts.addAttribute("", "", "ADReferenceNameValueID", "CDATA", "");
|
atts.addAttribute("", "", "ADReferenceNameValueID", "CDATA", "");
|
||||||
if (m_Column.getAD_Table_ID() > 0) {
|
if (m_Column.getAD_Table_ID() > 0) {
|
||||||
sql = "SELECT TableName FROM AD_Table WHERE AD_Table_ID=?";
|
name = MTable.getTableName(ctx, m_Column.getAD_Table_ID());
|
||||||
name = DB.getSQLValueString(null, sql, m_Column.getAD_Table_ID());
|
|
||||||
atts.addAttribute("", "", "ADTableNameID", "CDATA", name);
|
atts.addAttribute("", "", "ADTableNameID", "CDATA", name);
|
||||||
} else
|
} else
|
||||||
atts.addAttribute("", "", "ADTableNameID", "CDATA", "");
|
atts.addAttribute("", "", "ADTableNameID", "CDATA", "");
|
||||||
|
|
|
@ -13,17 +13,19 @@ import org.adempiere.pipo.AbstractElementHandler;
|
||||||
import org.adempiere.pipo.AttributeFiller;
|
import org.adempiere.pipo.AttributeFiller;
|
||||||
import org.adempiere.pipo.Element;
|
import org.adempiere.pipo.Element;
|
||||||
import org.adempiere.pipo.ElementHandler;
|
import org.adempiere.pipo.ElementHandler;
|
||||||
|
import org.adempiere.pipo.PackOut;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.xml.sax.Attributes;
|
import org.xml.sax.Attributes;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import org.xml.sax.helpers.AttributesImpl;
|
import org.xml.sax.helpers.AttributesImpl;
|
||||||
|
|
||||||
public class CommonTranslationHandler extends AbstractElementHandler implements ElementHandler{
|
import org.compiere.model.X_AD_Element;
|
||||||
|
|
||||||
|
public class CommonTranslationHandler extends AbstractElementHandler implements ElementHandler,IPackOutHandler{
|
||||||
|
|
||||||
public static final String CONTEXT_KEY__PARENT_TABLE = "currentParentTableForTranslation";
|
public static final String CONTEXT_KEY__PARENT_TABLE = "currentParentTableForTranslation";
|
||||||
public static final String CONTEXT_KEY__PARENT_RECORD_ID = "currentParentTableRecordID_ForTranslation";
|
public static final String CONTEXT_KEY__PARENT_RECORD_ID = "currentParentTableRecordID_ForTranslation";
|
||||||
|
|
||||||
public static final String SPECIAL_ATRRIBUTE__TABLE_NAME = "ParentTable";
|
public static final String SPECIAL_ATRRIBUTE__TABLE_NAME = "ParentTable";
|
||||||
|
|
||||||
|
|
||||||
|
@ -312,5 +314,17 @@ public class CommonTranslationHandler extends AbstractElementHandler implements
|
||||||
|
|
||||||
return arg.toString().substring(1, arg.toString().length()-1);
|
return arg.toString().substring(1, arg.toString().length()-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
public void packOut(PackOut packout, ResultSet header, ResultSet detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
|
||||||
|
{
|
||||||
|
if("true".equals(packout.getCtx().getProperty("isHandleTranslations"))){
|
||||||
|
|
||||||
|
Env.setContext(packout.getCtx(), CommonTranslationHandler.CONTEXT_KEY__PARENT_TABLE,X_AD_Element.Table_Name);
|
||||||
|
Env.setContext(packout.getCtx(), CommonTranslationHandler.CONTEXT_KEY__PARENT_RECORD_ID,recordId);
|
||||||
|
this.create(packout.getCtx(), packOutDocument);
|
||||||
|
packout.getCtx().remove(CommonTranslationHandler.CONTEXT_KEY__PARENT_TABLE);
|
||||||
|
packout.getCtx().remove(CommonTranslationHandler.CONTEXT_KEY__PARENT_RECORD_ID);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ import javax.xml.transform.sax.TransformerHandler;
|
||||||
import org.adempiere.pipo.AbstractElementHandler;
|
import org.adempiere.pipo.AbstractElementHandler;
|
||||||
import org.adempiere.pipo.Element;
|
import org.adempiere.pipo.Element;
|
||||||
import org.adempiere.pipo.IDFinder;
|
import org.adempiere.pipo.IDFinder;
|
||||||
|
import org.adempiere.pipo.PackOut;
|
||||||
import org.adempiere.pipo.exception.POSaveFailedException;
|
import org.adempiere.pipo.exception.POSaveFailedException;
|
||||||
import org.compiere.model.MTable;
|
import org.compiere.model.MTable;
|
||||||
import org.compiere.model.PO;
|
import org.compiere.model.PO;
|
||||||
|
@ -50,10 +51,9 @@ import org.xml.sax.helpers.AttributesImpl;
|
||||||
* @author Low Heng Sin
|
* @author Low Heng Sin
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class DataElementHandler extends AbstractElementHandler {
|
public class DataElementHandler extends AbstractElementHandler implements IPackOutHandler {
|
||||||
|
|
||||||
private PO genericPO = null;
|
private PO genericPO = null;
|
||||||
int AD_Backup_ID = -1;
|
|
||||||
String objectStatus = null;
|
String objectStatus = null;
|
||||||
String d_tablename = null;
|
String d_tablename = null;
|
||||||
|
|
||||||
|
@ -112,12 +112,11 @@ public class DataElementHandler extends AbstractElementHandler {
|
||||||
if (id > 0){
|
if (id > 0){
|
||||||
if (genericPO == null || genericPO.get_ID() != id)
|
if (genericPO == null || genericPO.get_ID() != id)
|
||||||
throw new SAXException("id not found");
|
throw new SAXException("id not found");
|
||||||
AD_Backup_ID = copyRecord(ctx,d_tablename,genericPO);
|
backupRecord(ctx,d_tablename,genericPO);
|
||||||
objectStatus = "Update";
|
objectStatus = "Update";
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
objectStatus = "New";
|
objectStatus = "New";
|
||||||
AD_Backup_ID =0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// keyXname and lookupkeyXname.
|
// keyXname and lookupkeyXname.
|
||||||
|
@ -220,9 +219,9 @@ public class DataElementHandler extends AbstractElementHandler {
|
||||||
public void endElement(Properties ctx, Element element) throws SAXException {
|
public void endElement(Properties ctx, Element element) throws SAXException {
|
||||||
if (genericPO != null) {
|
if (genericPO != null) {
|
||||||
if (genericPO.save(getTrxName(ctx))== true)
|
if (genericPO.save(getTrxName(ctx))== true)
|
||||||
record_log (ctx, 1, genericPO.get_TableName(),"Data", genericPO.get_ID(),AD_Backup_ID, objectStatus,d_tablename,get_IDWithColumn(ctx, "AD_Table", "TableName", d_tablename));
|
record_log (ctx, 1, genericPO.get_TableName(),"Data", genericPO.get_ID(),objectStatus,d_tablename,get_IDWithColumn(ctx, "AD_Table", "TableName", d_tablename));
|
||||||
else {
|
else {
|
||||||
record_log (ctx, 0, genericPO.get_TableName(),"Data", genericPO.get_ID(),AD_Backup_ID, objectStatus,d_tablename,get_IDWithColumn(ctx, "AD_Table", "TableName", d_tablename));
|
record_log (ctx, 0, genericPO.get_TableName(),"Data", genericPO.get_ID(),objectStatus,d_tablename,get_IDWithColumn(ctx, "AD_Table", "TableName", d_tablename));
|
||||||
throw new POSaveFailedException("GenericPO");
|
throw new POSaveFailedException("GenericPO");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -406,5 +405,13 @@ public class DataElementHandler extends AbstractElementHandler {
|
||||||
document.endElement("","","data");
|
document.endElement("","","data");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
public void packOut(PackOut packout, ResultSet header, ResultSet detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
|
||||||
|
{
|
||||||
|
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_AD_Table_ID, detail.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Table_ID));
|
||||||
|
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_SQLStatement, detail.getString(X_AD_Package_Exp_Detail.COLUMNNAME_SQLStatement));
|
||||||
|
this.create(packout.getCtx(), packOutDocument);
|
||||||
|
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Table_ID);
|
||||||
|
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_SQLStatement);
|
||||||
|
}
|
||||||
|
}
|
|
@ -20,6 +20,7 @@ import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
import java.sql.ResultSet;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
@ -28,9 +29,10 @@ import javax.xml.transform.sax.TransformerHandler;
|
||||||
|
|
||||||
import org.adempiere.pipo.AbstractElementHandler;
|
import org.adempiere.pipo.AbstractElementHandler;
|
||||||
import org.adempiere.pipo.Element;
|
import org.adempiere.pipo.Element;
|
||||||
|
import org.adempiere.pipo.PackOut;
|
||||||
import org.compiere.Adempiere;
|
import org.compiere.Adempiere;
|
||||||
import org.compiere.model.X_AD_Package_Exp_Detail;
|
import org.compiere.model.X_AD_Package_Exp_Detail;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.model.X_AD_Package_Imp_Backup;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.xml.sax.Attributes;
|
import org.xml.sax.Attributes;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
@ -38,9 +40,20 @@ import org.xml.sax.helpers.AttributesImpl;
|
||||||
|
|
||||||
public class DistFileElementHandler extends AbstractElementHandler {
|
public class DistFileElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
|
String fileDest;
|
||||||
|
|
||||||
|
public DistFileElementHandler()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public DistFileElementHandler(String fileDest)
|
||||||
|
{
|
||||||
|
this.fileDest=fileDest;
|
||||||
|
}
|
||||||
|
|
||||||
public void startElement(Properties ctx, Element element) throws SAXException {
|
public void startElement(Properties ctx, Element element) throws SAXException {
|
||||||
String elementValue = element.getElementValue();
|
String elementValue = element.getElementValue();
|
||||||
int AD_Backup_ID = -1;
|
|
||||||
String Object_Status = null;
|
String Object_Status = null;
|
||||||
Attributes atts = element.attributes;
|
Attributes atts = element.attributes;
|
||||||
log.info(elementValue+" "+atts.getValue("name"));
|
log.info(elementValue+" "+atts.getValue("name"));
|
||||||
|
@ -55,7 +68,6 @@ public class DistFileElementHandler extends AbstractElementHandler {
|
||||||
String targetDirectory = atts.getValue("targetDirectory");
|
String targetDirectory = atts.getValue("targetDirectory");
|
||||||
|
|
||||||
Object_Status = "New";
|
Object_Status = "New";
|
||||||
int idDetail=0;
|
|
||||||
InputStream inputStream; // Stream for reading from the source file.
|
InputStream inputStream; // Stream for reading from the source file.
|
||||||
OutputStream outputStream; // Stream for writing the copy.
|
OutputStream outputStream; // Stream for writing the copy.
|
||||||
|
|
||||||
|
@ -138,41 +150,27 @@ public class DistFileElementHandler extends AbstractElementHandler {
|
||||||
//Copy File
|
//Copy File
|
||||||
int success = copyFile (inputStream,outputStream);
|
int success = copyFile (inputStream,outputStream);
|
||||||
//Record in log
|
//Record in log
|
||||||
int idBackup = DB.getNextID (getClientId(ctx), "AD_Package_Imp_Backup", getTrxName(ctx));
|
|
||||||
if (success != -1){
|
if (success != -1){
|
||||||
try {
|
try {
|
||||||
idDetail = record_log (ctx, 1, fileName,"file", 0,0, Object_Status,fileName,0);
|
record_log (ctx, 1, fileName,"file", 0, Object_Status,fileName,0);
|
||||||
} catch (SAXException e) {
|
} catch (SAXException e) {
|
||||||
log.info ("setfile:"+e);
|
log.info ("setfile:"+e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
try {
|
try {
|
||||||
idDetail = record_log (ctx, 0, fileName,"file", 0,0, Object_Status,fileName,0);
|
record_log (ctx, 0, fileName,"file", 0, Object_Status,fileName,0);
|
||||||
} catch (SAXException e) {
|
} catch (SAXException e) {
|
||||||
log.info ("setfile:"+e);
|
log.info ("setfile:"+e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Record in transaction file
|
//Record in transaction file
|
||||||
StringBuffer sqlB = new StringBuffer ("Insert INTO AD_Package_Imp_Backup" )
|
X_AD_Package_Imp_Backup backup = new X_AD_Package_Imp_Backup(ctx, 0, getTrxName(ctx));
|
||||||
.append( "(AD_Client_ID, AD_Org_ID, CreatedBy, UpdatedBy, " )
|
backup.setAD_Org_ID(Env.getAD_Org_ID(ctx));
|
||||||
.append( "AD_PACKAGE_IMP_BACKUP_ID, AD_PACKAGE_IMP_DETAIL_ID, AD_PACKAGE_IMP_ID," )
|
backup.setAD_Package_Imp_Org_Dir(fullTargetPath+fileName);
|
||||||
.append( " AD_PACKAGE_IMP_ORG_DIR, AD_PACKAGE_IMP_BCK_DIR)" )
|
backup.setAD_Package_Imp_Bck_Dir(packagePath+File.separator+"backup"+File.separator+fileDate+"_"+fileName);
|
||||||
.append( "VALUES(" )
|
backup.setAD_Package_Imp_ID(getPackageImpId(ctx));
|
||||||
.append( " "+ Env.getAD_Client_ID(ctx) )
|
backup.saveEx();
|
||||||
.append( ", "+ Env.getAD_Org_ID(ctx) )
|
|
||||||
.append( ", "+ Env.getAD_User_ID(ctx) )
|
|
||||||
.append( ", "+ Env.getAD_User_ID(ctx) )
|
|
||||||
.append( ", " + idBackup )
|
|
||||||
.append( ", " + idDetail )
|
|
||||||
.append( ", " + getPackageImpId(ctx) )
|
|
||||||
.append( ", '" + fullTargetPath+fileName )
|
|
||||||
.append( "', '" + packagePath+File.separator+"backup"+File.separator+fileDate+"_"+fileName )
|
|
||||||
.append( "')");
|
|
||||||
|
|
||||||
int no = DB.executeUpdate (sqlB.toString(), getTrxName(ctx));
|
|
||||||
if (no == -1)
|
|
||||||
log.info("Insert to import backup failed");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -194,5 +192,17 @@ public class DistFileElementHandler extends AbstractElementHandler {
|
||||||
document.startElement("","","distfile",atts);
|
document.startElement("","","distfile",atts);
|
||||||
document.endElement("","","distfile");
|
document.endElement("","","distfile");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void doPackout(PackOut packout, ResultSet header, ResultSet detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,AttributesImpl atts,int recordId) throws Exception
|
||||||
|
{
|
||||||
|
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_FileName, detail.getString(X_AD_Package_Exp_Detail.COLUMNNAME_FileName));
|
||||||
|
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_ReleaseNo, detail.getString(X_AD_Package_Exp_Detail.COLUMNNAME_ReleaseNo));
|
||||||
|
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_Target_Directory, detail.getString(X_AD_Package_Exp_Detail.COLUMNNAME_Target_Directory));
|
||||||
|
Env.setContext(packout.getCtx(), "Source_Directory", fileDest);
|
||||||
|
this.create(packout.getCtx(), packOutDocument);
|
||||||
|
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_FileName);
|
||||||
|
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_ReleaseNo);
|
||||||
|
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_Target_Directory);
|
||||||
|
packout.getCtx().remove("Source_Directory");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ import org.xml.sax.Attributes;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import org.xml.sax.helpers.AttributesImpl;
|
import org.xml.sax.helpers.AttributesImpl;
|
||||||
|
|
||||||
public class DynValRuleElementHandler extends AbstractElementHandler {
|
public class DynValRuleElementHandler extends AbstractElementHandler implements IPackOutHandler {
|
||||||
|
|
||||||
private List<Integer> rules = new ArrayList<Integer>();
|
private List<Integer> rules = new ArrayList<Integer>();
|
||||||
|
|
||||||
|
@ -53,15 +53,13 @@ public class DynValRuleElementHandler extends AbstractElementHandler {
|
||||||
X_AD_Val_Rule m_ValRule = new X_AD_Val_Rule(ctx, id, getTrxName(ctx));
|
X_AD_Val_Rule m_ValRule = new X_AD_Val_Rule(ctx, id, getTrxName(ctx));
|
||||||
if (id <= 0 && atts.getValue("AD_Val_Rule_ID") != null && Integer.parseInt(atts.getValue("AD_Val_Rule_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
if (id <= 0 && atts.getValue("AD_Val_Rule_ID") != null && Integer.parseInt(atts.getValue("AD_Val_Rule_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
||||||
m_ValRule.setAD_Val_Rule_ID(Integer.parseInt(atts.getValue("AD_Val_Rule_ID")));
|
m_ValRule.setAD_Val_Rule_ID(Integer.parseInt(atts.getValue("AD_Val_Rule_ID")));
|
||||||
int AD_Backup_ID = -1;
|
|
||||||
String Object_Status = null;
|
String Object_Status = null;
|
||||||
if (id > 0){
|
if (id > 0){
|
||||||
AD_Backup_ID = copyRecord(ctx, "AD_Val_Rule",m_ValRule);
|
backupRecord(ctx, "AD_Val_Rule",m_ValRule);
|
||||||
Object_Status = "Update";
|
Object_Status = "Update";
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Object_Status = "New";
|
Object_Status = "New";
|
||||||
AD_Backup_ID =0;
|
|
||||||
}
|
}
|
||||||
m_ValRule.setDescription(getStringValue(atts, "Description"));
|
m_ValRule.setDescription(getStringValue(atts, "Description"));
|
||||||
m_ValRule.setEntityType(atts.getValue("EntityType"));
|
m_ValRule.setEntityType(atts.getValue("EntityType"));
|
||||||
|
@ -70,10 +68,10 @@ public class DynValRuleElementHandler extends AbstractElementHandler {
|
||||||
m_ValRule.setType(atts.getValue("Type"));
|
m_ValRule.setType(atts.getValue("Type"));
|
||||||
m_ValRule.setCode(atts.getValue("Code"));
|
m_ValRule.setCode(atts.getValue("Code"));
|
||||||
if (m_ValRule.save(getTrxName(ctx)) == true){
|
if (m_ValRule.save(getTrxName(ctx)) == true){
|
||||||
record_log (ctx, 1, m_ValRule.getName(),"ValRule", m_ValRule.get_ID(),AD_Backup_ID, Object_Status,"AD_Val_Rule",get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_Val_Rule"));
|
record_log (ctx, 1, m_ValRule.getName(),"ValRule", m_ValRule.get_ID(),Object_Status,"AD_Val_Rule",get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_Val_Rule"));
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
record_log (ctx, 0, m_ValRule.getName(),"ValRule", m_ValRule.get_ID(),AD_Backup_ID, Object_Status,"AD_Val_Rule",get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_Val_Rule"));
|
record_log (ctx, 0, m_ValRule.getName(),"ValRule", m_ValRule.get_ID(),Object_Status,"AD_Val_Rule",get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_Val_Rule"));
|
||||||
throw new POSaveFailedException("Failed to save dynamic validation rule.");
|
throw new POSaveFailedException("Failed to save dynamic validation rule.");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -85,7 +83,7 @@ public class DynValRuleElementHandler extends AbstractElementHandler {
|
||||||
public void endElement(Properties ctx, Element element) throws SAXException {
|
public void endElement(Properties ctx, Element element) throws SAXException {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void create(Properties ctx, TransformerHandler document)
|
protected void create(Properties ctx, TransformerHandler document)
|
||||||
throws SAXException {
|
throws SAXException {
|
||||||
int AD_Val_Rule_ID = Env.getContextAsInt(ctx, X_AD_Package_Exp_Detail.COLUMNNAME_AD_Val_Rule_ID);
|
int AD_Val_Rule_ID = Env.getContextAsInt(ctx, X_AD_Package_Exp_Detail.COLUMNNAME_AD_Val_Rule_ID);
|
||||||
if (rules.contains(AD_Val_Rule_ID))
|
if (rules.contains(AD_Val_Rule_ID))
|
||||||
|
@ -136,4 +134,17 @@ public class DynValRuleElementHandler extends AbstractElementHandler {
|
||||||
atts.addAttribute("","","isActive","CDATA",(m_ValRule.isActive()== true ? "true":"false"));
|
atts.addAttribute("","","isActive","CDATA",(m_ValRule.isActive()== true ? "true":"false"));
|
||||||
return atts;
|
return atts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void packOut(PackOut packout, ResultSet header, ResultSet detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
|
||||||
|
{
|
||||||
|
|
||||||
|
if(recordId <= 0 )
|
||||||
|
recordId = detail.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Val_Rule_ID);
|
||||||
|
|
||||||
|
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_AD_Val_Rule_ID, recordId);
|
||||||
|
|
||||||
|
this.create(packout.getCtx(), packOutDocument);
|
||||||
|
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Val_Rule_ID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,14 +105,12 @@ public class FieldElementHandler extends AbstractElementHandler {
|
||||||
MField m_Field = new MField(ctx, id, getTrxName(ctx));
|
MField m_Field = new MField(ctx, id, getTrxName(ctx));
|
||||||
if (id <= 0 && atts.getValue("AD_Field_ID") != null && Integer.parseInt(atts.getValue("AD_Field_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
if (id <= 0 && atts.getValue("AD_Field_ID") != null && Integer.parseInt(atts.getValue("AD_Field_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
||||||
m_Field.setAD_Field_ID(Integer.parseInt(atts.getValue("AD_Field_ID")));
|
m_Field.setAD_Field_ID(Integer.parseInt(atts.getValue("AD_Field_ID")));
|
||||||
int AD_Backup_ID = -1;
|
|
||||||
String Object_Status = null;
|
String Object_Status = null;
|
||||||
if (id > 0) {
|
if (id > 0) {
|
||||||
AD_Backup_ID = copyRecord(ctx, "AD_Field", m_Field);
|
backupRecord(ctx, "AD_Field", m_Field);
|
||||||
Object_Status = "Update";
|
Object_Status = "Update";
|
||||||
} else {
|
} else {
|
||||||
Object_Status = "New";
|
Object_Status = "New";
|
||||||
AD_Backup_ID = 0;
|
|
||||||
}
|
}
|
||||||
m_Field.setName(atts.getValue("Name"));
|
m_Field.setName(atts.getValue("Name"));
|
||||||
m_Field.setAD_Column_ID(columnid);
|
m_Field.setAD_Column_ID(columnid);
|
||||||
|
@ -161,13 +159,13 @@ public class FieldElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
if (m_Field.save(getTrxName(ctx)) == true) {
|
if (m_Field.save(getTrxName(ctx)) == true) {
|
||||||
record_log(ctx, 1, m_Field.getName(), "Field", m_Field
|
record_log(ctx, 1, m_Field.getName(), "Field", m_Field
|
||||||
.get_ID(), AD_Backup_ID, Object_Status, "AD_Field",
|
.get_ID(), Object_Status, "AD_Field",
|
||||||
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
||||||
"AD_Field"));
|
"AD_Field"));
|
||||||
element.recordId = m_Field.getAD_Field_ID();
|
element.recordId = m_Field.getAD_Field_ID();
|
||||||
} else {
|
} else {
|
||||||
record_log(ctx, 0, m_Field.getName(), "Field", m_Field
|
record_log(ctx, 0, m_Field.getName(), "Field", m_Field
|
||||||
.get_ID(), AD_Backup_ID, Object_Status, "AD_Field",
|
.get_ID(), Object_Status, "AD_Field",
|
||||||
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
||||||
"AD_Field"));
|
"AD_Field"));
|
||||||
throw new POSaveFailedException("Failed to save field definition.");
|
throw new POSaveFailedException("Failed to save field definition.");
|
||||||
|
@ -193,21 +191,36 @@ public class FieldElementHandler extends AbstractElementHandler {
|
||||||
createFieldBinding(atts, m_Field);
|
createFieldBinding(atts, m_Field);
|
||||||
|
|
||||||
PackOut packOut = (PackOut)ctx.get("PackOutProcess");
|
PackOut packOut = (PackOut)ctx.get("PackOutProcess");
|
||||||
|
|
||||||
if(m_Field.getAD_FieldGroup_ID() > 0){
|
|
||||||
packOut.createFieldGroupElement(m_Field.getAD_FieldGroup_ID(), document);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(m_Field.getAD_Reference_ID() > 0) {
|
try
|
||||||
packOut.createReference(m_Field.getAD_Reference_ID(), document);
|
{
|
||||||
}
|
if(m_Field.getAD_FieldGroup_ID() > 0)
|
||||||
|
{
|
||||||
|
IPackOutHandler handler = packOut.getHandler("FG");
|
||||||
|
handler.packOut(packOut,null,null,document,null,m_Field.getAD_FieldGroup_ID());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_Field.getAD_Reference_ID()>0)
|
||||||
|
{
|
||||||
|
IPackOutHandler handler = packOut.getHandler("REF");
|
||||||
|
handler.packOut(packOut,null,null,document,null,m_Field.getAD_Reference_ID());
|
||||||
|
}
|
||||||
|
|
||||||
if (m_Field.getAD_Reference_Value_ID() > 0) {
|
if (m_Field.getAD_Reference_Value_ID()>0)
|
||||||
packOut.createReference(m_Field.getAD_Reference_Value_ID(), document);
|
{
|
||||||
}
|
IPackOutHandler handler = packOut.getHandler("REF");
|
||||||
|
handler.packOut(packOut,null,null,document,null,m_Field.getAD_Reference_Value_ID());
|
||||||
|
}
|
||||||
|
|
||||||
if (m_Field.getAD_Val_Rule_ID() > 0) {
|
if (m_Field.getAD_Val_Rule_ID()>0)
|
||||||
packOut.createDynamicRuleValidation(m_Field.getAD_Val_Rule_ID(), document);
|
{
|
||||||
|
IPackOutHandler handler = packOut.getHandler("V");
|
||||||
|
handler.packOut(packOut,null,null,document,null,m_Field.getAD_Val_Rule_ID());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
log.info(e.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
document.startElement("", "", "field", atts);
|
document.startElement("", "", "field", atts);
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.adempiere.pipo.handler;
|
package org.adempiere.pipo.handler;
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
@ -34,15 +35,17 @@ import org.xml.sax.Attributes;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import org.xml.sax.helpers.AttributesImpl;
|
import org.xml.sax.helpers.AttributesImpl;
|
||||||
|
|
||||||
public class FieldGroupElementHandler extends AbstractElementHandler {
|
import java.sql.ResultSet;
|
||||||
|
|
||||||
|
public class FieldGroupElementHandler extends AbstractElementHandler implements IPackOutHandler{
|
||||||
|
|
||||||
|
|
||||||
private List<Integer> processedFieldGroups = new ArrayList<Integer>();
|
private List<Integer> processedFieldGroups = new ArrayList<Integer>();
|
||||||
|
|
||||||
|
|
||||||
public void startElement(Properties ctx, Element element)
|
public void startElement(Properties ctx, Element element)
|
||||||
throws SAXException {
|
throws SAXException {
|
||||||
String elementValue = element.getElementValue();
|
String elementValue = element.getElementValue();
|
||||||
int AD_Backup_ID = -1;
|
|
||||||
String Object_Status = null;
|
String Object_Status = null;
|
||||||
|
|
||||||
Attributes atts = element.attributes;
|
Attributes atts = element.attributes;
|
||||||
|
@ -60,7 +63,7 @@ public class FieldGroupElementHandler extends AbstractElementHandler {
|
||||||
if (id <= 0 && atts.getValue("AD_FieldGroup_ID") != null && Integer.parseInt(atts.getValue("AD_FieldGroup_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
if (id <= 0 && atts.getValue("AD_FieldGroup_ID") != null && Integer.parseInt(atts.getValue("AD_FieldGroup_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
||||||
fieldGroup.setAD_FieldGroup_ID(Integer.parseInt(atts.getValue("AD_FieldGroup_ID")));
|
fieldGroup.setAD_FieldGroup_ID(Integer.parseInt(atts.getValue("AD_FieldGroup_ID")));
|
||||||
if (id > 0) {
|
if (id > 0) {
|
||||||
AD_Backup_ID = copyRecord(ctx, X_AD_FieldGroup.Table_Name, fieldGroup);
|
backupRecord(ctx, X_AD_FieldGroup.Table_Name, fieldGroup);
|
||||||
Object_Status = "Update";
|
Object_Status = "Update";
|
||||||
if (processedFieldGroups.contains(id)) {
|
if (processedFieldGroups.contains(id)) {
|
||||||
element.skip = true;
|
element.skip = true;
|
||||||
|
@ -68,7 +71,6 @@ public class FieldGroupElementHandler extends AbstractElementHandler {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Object_Status = "New";
|
Object_Status = "New";
|
||||||
AD_Backup_ID = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PoFiller pf = new PoFiller(fieldGroup, atts);
|
PoFiller pf = new PoFiller(fieldGroup, atts);
|
||||||
|
@ -81,7 +83,7 @@ public class FieldGroupElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
if (fieldGroup.save(getTrxName(ctx)) == true) {
|
if (fieldGroup.save(getTrxName(ctx)) == true) {
|
||||||
record_log(ctx, 1, fieldGroup.getName(), "FieldGroup",
|
record_log(ctx, 1, fieldGroup.getName(), "FieldGroup",
|
||||||
fieldGroup.get_ID(), AD_Backup_ID, Object_Status,
|
fieldGroup.get_ID(), Object_Status,
|
||||||
X_AD_FieldGroup.Table_Name, get_IDWithColumn(ctx, "AD_Table",
|
X_AD_FieldGroup.Table_Name, get_IDWithColumn(ctx, "AD_Table",
|
||||||
"TableName", X_AD_FieldGroup.Table_Name));
|
"TableName", X_AD_FieldGroup.Table_Name));
|
||||||
|
|
||||||
|
@ -91,7 +93,7 @@ public class FieldGroupElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
record_log(ctx, 0, fieldGroup.getName(), "FieldGroup",
|
record_log(ctx, 0, fieldGroup.getName(), "FieldGroup",
|
||||||
fieldGroup.get_ID(), AD_Backup_ID, Object_Status,
|
fieldGroup.get_ID(), Object_Status,
|
||||||
X_AD_FieldGroup.Table_Name, get_IDWithColumn(ctx, "AD_Table",
|
X_AD_FieldGroup.Table_Name, get_IDWithColumn(ctx, "AD_Table",
|
||||||
"TableName", X_AD_FieldGroup.Table_Name));
|
"TableName", X_AD_FieldGroup.Table_Name));
|
||||||
throw new POSaveFailedException("Reference");
|
throw new POSaveFailedException("Reference");
|
||||||
|
@ -104,7 +106,7 @@ public class FieldGroupElementHandler extends AbstractElementHandler {
|
||||||
public void endElement(Properties ctx, Element element) throws SAXException {
|
public void endElement(Properties ctx, Element element) throws SAXException {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void create(Properties ctx, TransformerHandler document)
|
protected void create(Properties ctx, TransformerHandler document)
|
||||||
throws SAXException {
|
throws SAXException {
|
||||||
|
|
||||||
|
|
||||||
|
@ -124,10 +126,14 @@ public class FieldGroupElementHandler extends AbstractElementHandler {
|
||||||
document.startElement("", "", "fieldgroup", atts);
|
document.startElement("", "", "fieldgroup", atts);
|
||||||
|
|
||||||
PackOut packOut = (PackOut)ctx.get("PackOutProcess");
|
PackOut packOut = (PackOut)ctx.get("PackOutProcess");
|
||||||
|
|
||||||
packOut.createTranslations(X_AD_FieldGroup.Table_Name,
|
|
||||||
fieldGroup.get_ID(), document);
|
|
||||||
|
|
||||||
|
try{
|
||||||
|
new CommonTranslationHandler().packOut(packOut,null,null,document,null,fieldGroup.get_ID());
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
log.info(e.toString());
|
||||||
|
}
|
||||||
document.endElement("", "", "fieldgroup");
|
document.endElement("", "", "fieldgroup");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,4 +152,15 @@ public class FieldGroupElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
return atts;
|
return atts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void packOut(PackOut packout, ResultSet header, ResultSet detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
|
||||||
|
{
|
||||||
|
if (recordId <= 0)
|
||||||
|
recordId = detail.getInt(X_AD_FieldGroup.COLUMNNAME_AD_FieldGroup_ID);
|
||||||
|
|
||||||
|
Env.setContext(packout.getCtx(), X_AD_FieldGroup.COLUMNNAME_AD_FieldGroup_ID, recordId);
|
||||||
|
|
||||||
|
this.create(packout.getCtx(), packOutDocument);
|
||||||
|
packout.getCtx().remove(X_AD_FieldGroup.COLUMNNAME_AD_FieldGroup_ID);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,94 @@
|
||||||
|
package org.adempiere.pipo.handler;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import javax.xml.transform.sax.TransformerHandler;
|
||||||
|
|
||||||
|
import org.adempiere.pipo.PackOut;
|
||||||
|
import org.compiere.model.X_AD_Package_Exp;
|
||||||
|
import org.compiere.model.X_AD_Package_Exp_Detail;
|
||||||
|
import org.compiere.util.CLogger;
|
||||||
|
import org.xml.sax.helpers.AttributesImpl;
|
||||||
|
|
||||||
|
public class FileElementHandler implements IPackOutHandler{
|
||||||
|
|
||||||
|
private CLogger log = CLogger.getCLogger(FileElementHandler.class);
|
||||||
|
|
||||||
|
public void packOut(PackOut packout, ResultSet header, ResultSet detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
|
||||||
|
{
|
||||||
|
log.log(Level.INFO,"In PackOut.java handling Code or Other 2pack module creation");
|
||||||
|
String fullDirectory = header.getString(X_AD_Package_Exp.COLUMNNAME_File_Directory) + header.getString(X_AD_Package_Exp.COLUMNNAME_Name)+header.getString(X_AD_Package_Exp_Detail.COLUMNNAME_Target_Directory);
|
||||||
|
log.log(Level.INFO,"fullDirectory" + fullDirectory);
|
||||||
|
String targetDirectoryModified=null;
|
||||||
|
char fileseperator1 = '/';
|
||||||
|
char fileseperator2 = '\\';
|
||||||
|
//Correct package for proper file seperator
|
||||||
|
if (File.separator.equals("/")){
|
||||||
|
targetDirectoryModified = fullDirectory.replace(fileseperator2,fileseperator1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
targetDirectoryModified = fullDirectory.replace(fileseperator1,fileseperator2);
|
||||||
|
|
||||||
|
String target_File = (targetDirectoryModified);
|
||||||
|
fullDirectory = detail.getString(X_AD_Package_Exp_Detail.COLUMNNAME_File_Directory);
|
||||||
|
targetDirectoryModified=null;
|
||||||
|
//Correct package for proper file seperator
|
||||||
|
if (File.separator.equals("/")){
|
||||||
|
targetDirectoryModified = fullDirectory.replace(fileseperator2,fileseperator1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
targetDirectoryModified = fullDirectory.replace(fileseperator2,fileseperator1);
|
||||||
|
|
||||||
|
packout.copyCode(
|
||||||
|
targetDirectoryModified + detail.getString(X_AD_Package_Exp_Detail.COLUMNNAME_FileName),
|
||||||
|
target_File + detail.getString(X_AD_Package_Exp_Detail.COLUMNNAME_FileName)
|
||||||
|
);
|
||||||
|
|
||||||
|
AttributesImpl atts = new AttributesImpl();
|
||||||
|
|
||||||
|
if(detail.getString(X_AD_Package_Exp_Detail.COLUMNNAME_Destination_Directory) != null){
|
||||||
|
|
||||||
|
fullDirectory = detail.getString(X_AD_Package_Exp_Detail.COLUMNNAME_Destination_Directory);
|
||||||
|
String destinationDirectoryModified=null;
|
||||||
|
|
||||||
|
//Correct package for proper file seperator
|
||||||
|
if (File.separator.equals("/")){
|
||||||
|
destinationDirectoryModified = fullDirectory.replace(fileseperator2,fileseperator1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
destinationDirectoryModified = fullDirectory.replace(fileseperator2,fileseperator1);
|
||||||
|
|
||||||
|
try{
|
||||||
|
new DistFileElementHandler(destinationDirectoryModified).doPackout(packout,null,detail,packOutDocument,null,null,0);
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
System.err.println(e.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(detail.getString(X_AD_Package_Exp_Detail.COLUMNNAME_FileName) != null){
|
||||||
|
packageDocument.startElement("","","file",atts);
|
||||||
|
packageDocument.characters(("File: "+detail.getString(X_AD_Package_Exp_Detail.COLUMNNAME_FileName)).toCharArray(),0,("File: "+detail.getString(X_AD_Package_Exp_Detail.COLUMNNAME_FileName)).length());
|
||||||
|
packageDocument.endElement("","","file");
|
||||||
|
}
|
||||||
|
packageDocument.startElement("","","filedirectory",atts);
|
||||||
|
packageDocument.characters(
|
||||||
|
("Directory: " + detail.getString(X_AD_Package_Exp_Detail.COLUMNNAME_Target_Directory)).toCharArray(),
|
||||||
|
0,
|
||||||
|
("Directory: " + detail.getString(X_AD_Package_Exp_Detail.COLUMNNAME_Target_Directory)).length());
|
||||||
|
packageDocument.endElement("","","filedirectory");
|
||||||
|
|
||||||
|
packageDocument.startElement("","","filenotes",atts);
|
||||||
|
packageDocument.characters(
|
||||||
|
("Notes: " + detail.getString(X_AD_Package_Exp_Detail.COLUMNNAME_Description)).toCharArray(),
|
||||||
|
0,
|
||||||
|
(("Notes: " + detail.getString(X_AD_Package_Exp_Detail.COLUMNNAME_Description)).length()));
|
||||||
|
packageDocument.endElement("","","filenotes");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.adempiere.pipo.handler;
|
package org.adempiere.pipo.handler;
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
@ -28,13 +29,15 @@ import org.adempiere.pipo.PackOut;
|
||||||
import org.adempiere.pipo.exception.POSaveFailedException;
|
import org.adempiere.pipo.exception.POSaveFailedException;
|
||||||
import org.compiere.model.MForm;
|
import org.compiere.model.MForm;
|
||||||
import org.compiere.model.X_AD_Form;
|
import org.compiere.model.X_AD_Form;
|
||||||
|
import org.compiere.model.X_AD_Package_Exp_Detail;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.xml.sax.Attributes;
|
import org.xml.sax.Attributes;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import org.xml.sax.helpers.AttributesImpl;
|
import org.xml.sax.helpers.AttributesImpl;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
|
||||||
public class FormElementHandler extends AbstractElementHandler {
|
public class FormElementHandler extends AbstractElementHandler implements IPackOutHandler {
|
||||||
|
|
||||||
private List<Integer> forms = new ArrayList<Integer>();
|
private List<Integer> forms = new ArrayList<Integer>();
|
||||||
|
|
||||||
|
@ -48,17 +51,15 @@ public class FormElementHandler extends AbstractElementHandler {
|
||||||
String name = atts.getValue("ADFormNameID");
|
String name = atts.getValue("ADFormNameID");
|
||||||
int id = get_ID(ctx, "AD_Form", name);
|
int id = get_ID(ctx, "AD_Form", name);
|
||||||
MForm m_Form = new MForm(ctx, id, getTrxName(ctx));
|
MForm m_Form = new MForm(ctx, id, getTrxName(ctx));
|
||||||
int AD_Backup_ID = -1;
|
|
||||||
String Object_Status = null;
|
String Object_Status = null;
|
||||||
if (id <= 0 && atts.getValue("AD_Form_ID") != null && Integer.parseInt(atts.getValue("AD_Form_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
if (id <= 0 && atts.getValue("AD_Form_ID") != null && Integer.parseInt(atts.getValue("AD_Form_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
||||||
m_Form.setAD_Form_ID(Integer.parseInt(atts.getValue("AD_Form_ID")));
|
m_Form.setAD_Form_ID(Integer.parseInt(atts.getValue("AD_Form_ID")));
|
||||||
if (id > 0){
|
if (id > 0){
|
||||||
AD_Backup_ID = copyRecord(ctx, "AD_Form",m_Form);
|
backupRecord(ctx, "AD_Form",m_Form);
|
||||||
Object_Status = "Update";
|
Object_Status = "Update";
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Object_Status = "New";
|
Object_Status = "New";
|
||||||
AD_Backup_ID =0;
|
|
||||||
}
|
}
|
||||||
m_Form.setClassname (atts.getValue("Classname"));
|
m_Form.setClassname (atts.getValue("Classname"));
|
||||||
m_Form.setIsBetaFunctionality (Boolean.valueOf(atts.getValue("isBetaFunctionality")).booleanValue());
|
m_Form.setIsBetaFunctionality (Boolean.valueOf(atts.getValue("isBetaFunctionality")).booleanValue());
|
||||||
|
@ -70,10 +71,10 @@ public class FormElementHandler extends AbstractElementHandler {
|
||||||
m_Form.setName(atts.getValue("Name"));
|
m_Form.setName(atts.getValue("Name"));
|
||||||
|
|
||||||
if (m_Form.save(getTrxName(ctx)) == true){
|
if (m_Form.save(getTrxName(ctx)) == true){
|
||||||
record_log (ctx, 1, m_Form.getName(),"Form", m_Form.get_ID(),AD_Backup_ID, Object_Status,"AD_Form",get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_Form"));
|
record_log (ctx, 1, m_Form.getName(),"Form", m_Form.get_ID(), Object_Status,"AD_Form",get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_Form"));
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
record_log (ctx, 0, m_Form.getName(),"Form", m_Form.get_ID(),AD_Backup_ID, Object_Status,"AD_Form",get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_Form"));
|
record_log (ctx, 0, m_Form.getName(),"Form", m_Form.get_ID(), Object_Status,"AD_Form",get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_Form"));
|
||||||
throw new POSaveFailedException("Failed to save form definition");
|
throw new POSaveFailedException("Failed to save form definition");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -84,7 +85,7 @@ public class FormElementHandler extends AbstractElementHandler {
|
||||||
public void endElement(Properties ctx, Element element) throws SAXException {
|
public void endElement(Properties ctx, Element element) throws SAXException {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void create(Properties ctx, TransformerHandler document)
|
protected void create(Properties ctx, TransformerHandler document)
|
||||||
throws SAXException {
|
throws SAXException {
|
||||||
int AD_Form_ID = Env.getContextAsInt(ctx, "AD_Form_ID");
|
int AD_Form_ID = Env.getContextAsInt(ctx, "AD_Form_ID");
|
||||||
if (forms.contains(AD_Form_ID)) return;
|
if (forms.contains(AD_Form_ID)) return;
|
||||||
|
@ -126,4 +127,15 @@ public class FormElementHandler extends AbstractElementHandler {
|
||||||
return atts;
|
return atts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void packOut(PackOut packout, ResultSet header, ResultSet detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
|
||||||
|
{
|
||||||
|
if(recordId <= 0)
|
||||||
|
recordId = detail.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Form_ID);
|
||||||
|
|
||||||
|
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_AD_Form_ID, recordId);
|
||||||
|
|
||||||
|
this.create(packout.getCtx(), packOutDocument);
|
||||||
|
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Form_ID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
package org.adempiere.pipo.handler;
|
||||||
|
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import javax.xml.transform.sax.TransformerHandler;
|
||||||
|
import org.adempiere.pipo.PackOut;
|
||||||
|
|
||||||
|
public interface IPackOutHandler {
|
||||||
|
|
||||||
|
public void packOut(PackOut packout, ResultSet header, ResultSet detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ import org.xml.sax.Attributes;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import org.xml.sax.helpers.AttributesImpl;
|
import org.xml.sax.helpers.AttributesImpl;
|
||||||
|
|
||||||
public class ImpFormatElementHandler extends AbstractElementHandler {
|
public class ImpFormatElementHandler extends AbstractElementHandler implements IPackOutHandler {
|
||||||
|
|
||||||
private ImpFormatRowElementHandler rowHandler = new ImpFormatRowElementHandler();
|
private ImpFormatRowElementHandler rowHandler = new ImpFormatRowElementHandler();
|
||||||
|
|
||||||
|
@ -48,7 +48,6 @@ public class ImpFormatElementHandler extends AbstractElementHandler {
|
||||||
public void startElement(Properties ctx, Element element)
|
public void startElement(Properties ctx, Element element)
|
||||||
throws SAXException {
|
throws SAXException {
|
||||||
String elementValue = element.getElementValue();
|
String elementValue = element.getElementValue();
|
||||||
int AD_Backup_ID = -1;
|
|
||||||
String Object_Status = null;
|
String Object_Status = null;
|
||||||
Attributes atts = element.attributes;
|
Attributes atts = element.attributes;
|
||||||
log.info(elementValue + " " + atts.getValue("Name"));
|
log.info(elementValue + " " + atts.getValue("Name"));
|
||||||
|
@ -59,11 +58,10 @@ public class ImpFormatElementHandler extends AbstractElementHandler {
|
||||||
if (id <= 0 && atts.getValue("AD_ImpFormat_ID") != null && Integer.parseInt(atts.getValue("AD_ImpFormat_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
if (id <= 0 && atts.getValue("AD_ImpFormat_ID") != null && Integer.parseInt(atts.getValue("AD_ImpFormat_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
||||||
m_ImpFormat.setAD_ImpFormat_ID(Integer.parseInt(atts.getValue("AD_ImpFormat_ID")));
|
m_ImpFormat.setAD_ImpFormat_ID(Integer.parseInt(atts.getValue("AD_ImpFormat_ID")));
|
||||||
if (id > 0) {
|
if (id > 0) {
|
||||||
AD_Backup_ID = copyRecord(ctx, "AD_ImpFormat", m_ImpFormat);
|
backupRecord(ctx, "AD_ImpFormat", m_ImpFormat);
|
||||||
Object_Status = "Update";
|
Object_Status = "Update";
|
||||||
} else {
|
} else {
|
||||||
Object_Status = "New";
|
Object_Status = "New";
|
||||||
AD_Backup_ID = 0;
|
|
||||||
}
|
}
|
||||||
m_ImpFormat.setName(atts.getValue("Name"));
|
m_ImpFormat.setName(atts.getValue("Name"));
|
||||||
String name = atts.getValue("ADTableNameID");
|
String name = atts.getValue("ADTableNameID");
|
||||||
|
@ -87,12 +85,12 @@ public class ImpFormatElementHandler extends AbstractElementHandler {
|
||||||
m_ImpFormat.setFormatType(atts.getValue("FormatType"));
|
m_ImpFormat.setFormatType(atts.getValue("FormatType"));
|
||||||
if (m_ImpFormat.save(getTrxName(ctx)) == true) {
|
if (m_ImpFormat.save(getTrxName(ctx)) == true) {
|
||||||
record_log(ctx, 1, m_ImpFormat.getName(), "ImpFormat", m_ImpFormat
|
record_log(ctx, 1, m_ImpFormat.getName(), "ImpFormat", m_ImpFormat
|
||||||
.get_ID(), AD_Backup_ID, Object_Status, "AD_ImpFormat",
|
.get_ID(), Object_Status, "AD_ImpFormat",
|
||||||
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
||||||
"AD_ImpFormat"));
|
"AD_ImpFormat"));
|
||||||
} else {
|
} else {
|
||||||
record_log(ctx, 0, m_ImpFormat.getName(), "ImpFormat", m_ImpFormat
|
record_log(ctx, 0, m_ImpFormat.getName(), "ImpFormat", m_ImpFormat
|
||||||
.get_ID(), AD_Backup_ID, Object_Status, "AD_ImpFormat",
|
.get_ID(), Object_Status, "AD_ImpFormat",
|
||||||
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
||||||
"AD_ImpFormat"));
|
"AD_ImpFormat"));
|
||||||
throw new POSaveFailedException("Failed to save Import Format.");
|
throw new POSaveFailedException("Failed to save Import Format.");
|
||||||
|
@ -102,7 +100,7 @@ public class ImpFormatElementHandler extends AbstractElementHandler {
|
||||||
public void endElement(Properties ctx, Element element) throws SAXException {
|
public void endElement(Properties ctx, Element element) throws SAXException {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void create(Properties ctx, TransformerHandler document)
|
protected void create(Properties ctx, TransformerHandler document)
|
||||||
throws SAXException {
|
throws SAXException {
|
||||||
int import_id = Env.getContextAsInt(ctx,
|
int import_id = Env.getContextAsInt(ctx,
|
||||||
X_AD_Package_Exp_Detail.COLUMNNAME_AD_ImpFormat_ID);
|
X_AD_Package_Exp_Detail.COLUMNNAME_AD_ImpFormat_ID);
|
||||||
|
@ -179,4 +177,14 @@ public class ImpFormatElementHandler extends AbstractElementHandler {
|
||||||
.getFormatType() != null ? m_ImpFormat.getFormatType() : ""));
|
.getFormatType() != null ? m_ImpFormat.getFormatType() : ""));
|
||||||
return atts;
|
return atts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void packOut(PackOut packout, ResultSet header, ResultSet detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
|
||||||
|
{
|
||||||
|
if(recordId <= 0)
|
||||||
|
recordId = detail.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_ImpFormat_ID);
|
||||||
|
|
||||||
|
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_AD_ImpFormat_ID, recordId);
|
||||||
|
this.create(packout.getCtx(), packOutDocument);
|
||||||
|
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_AD_ImpFormat_ID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,12 +73,11 @@ public class ImpFormatRowElementHandler extends AbstractElementHandler {
|
||||||
if (id <= 0 && atts.getValue("AD_ImpFormat_Row_ID") != null && Integer.parseInt(atts.getValue("AD_ImpFormat_Row_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
if (id <= 0 && atts.getValue("AD_ImpFormat_Row_ID") != null && Integer.parseInt(atts.getValue("AD_ImpFormat_Row_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
||||||
m_ImpFormat_row.setAD_ImpFormat_Row_ID(Integer.parseInt(atts.getValue("AD_ImpFormat_Row_ID")));
|
m_ImpFormat_row.setAD_ImpFormat_Row_ID(Integer.parseInt(atts.getValue("AD_ImpFormat_Row_ID")));
|
||||||
if (id > 0){
|
if (id > 0){
|
||||||
AD_Backup_ID = copyRecord(ctx, "AD_ImpFormat",m_ImpFormat_row);
|
backupRecord(ctx, "AD_ImpFormat",m_ImpFormat_row);
|
||||||
Object_Status = "Update";
|
Object_Status = "Update";
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Object_Status = "New";
|
Object_Status = "New";
|
||||||
AD_Backup_ID =0;
|
|
||||||
}
|
}
|
||||||
m_ImpFormat_row.setName(atts.getValue("Name"));
|
m_ImpFormat_row.setName(atts.getValue("Name"));
|
||||||
m_ImpFormat_row.setIsActive(atts.getValue("isActive") != null ? Boolean.valueOf(atts.getValue("isActive")).booleanValue():true);
|
m_ImpFormat_row.setIsActive(atts.getValue("isActive") != null ? Boolean.valueOf(atts.getValue("isActive")).booleanValue():true);
|
||||||
|
@ -96,10 +95,10 @@ public class ImpFormatRowElementHandler extends AbstractElementHandler {
|
||||||
m_ImpFormat_row.setSeqNo(Integer.parseInt(atts.getValue("SeqNo")));
|
m_ImpFormat_row.setSeqNo(Integer.parseInt(atts.getValue("SeqNo")));
|
||||||
m_ImpFormat_row.setStartNo(Integer.parseInt(atts.getValue("StartNo")));
|
m_ImpFormat_row.setStartNo(Integer.parseInt(atts.getValue("StartNo")));
|
||||||
if (m_ImpFormat_row.save(getTrxName(ctx)) == true){
|
if (m_ImpFormat_row.save(getTrxName(ctx)) == true){
|
||||||
record_log (ctx, 1, m_ImpFormat_row.getName(),"ImpFormatRow", m_ImpFormat_row.get_ID(),AD_Backup_ID, Object_Status,"AD_ImpFormat",get_IDWithColumn(ctx, "AD_Table", "TableName", "m_ImpFormat_row"));
|
record_log (ctx, 1, m_ImpFormat_row.getName(),"ImpFormatRow", m_ImpFormat_row.get_ID(),Object_Status,"AD_ImpFormat",get_IDWithColumn(ctx, "AD_Table", "TableName", "m_ImpFormat_row"));
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
record_log (ctx, 0, m_ImpFormat_row.getName(),"ImpFormatRow", m_ImpFormat_row.get_ID(),AD_Backup_ID, Object_Status,"AD_ImpFormat",get_IDWithColumn(ctx, "AD_Table", "TableName", "m_ImpFormat_row"));
|
record_log (ctx, 0, m_ImpFormat_row.getName(),"ImpFormatRow", m_ImpFormat_row.get_ID(),Object_Status,"AD_ImpFormat",get_IDWithColumn(ctx, "AD_Table", "TableName", "m_ImpFormat_row"));
|
||||||
throw new POSaveFailedException("Failed to import Import Format Row.");
|
throw new POSaveFailedException("Failed to import Import Format Row.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,18 +28,19 @@ import org.adempiere.pipo.AbstractElementHandler;
|
||||||
import org.adempiere.pipo.Element;
|
import org.adempiere.pipo.Element;
|
||||||
import org.adempiere.pipo.PackOut;
|
import org.adempiere.pipo.PackOut;
|
||||||
import org.compiere.model.X_AD_Menu;
|
import org.compiere.model.X_AD_Menu;
|
||||||
|
import org.compiere.model.X_AD_Package_Exp_Detail;
|
||||||
|
import org.compiere.model.X_AD_Task;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.xml.sax.Attributes;
|
import org.xml.sax.Attributes;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import org.xml.sax.helpers.AttributesImpl;
|
import org.xml.sax.helpers.AttributesImpl;
|
||||||
|
|
||||||
public class MenuElementHandler extends AbstractElementHandler {
|
public class MenuElementHandler extends AbstractElementHandler implements IPackOutHandler {
|
||||||
|
|
||||||
public void startElement(Properties ctx, Element element)
|
public void startElement(Properties ctx, Element element)
|
||||||
throws SAXException {
|
throws SAXException {
|
||||||
String elementValue = element.getElementValue();
|
String elementValue = element.getElementValue();
|
||||||
int AD_Backup_ID = -1;
|
|
||||||
String Object_Status = null;
|
String Object_Status = null;
|
||||||
Attributes atts = element.attributes;
|
Attributes atts = element.attributes;
|
||||||
log.info(elementValue + " " + atts.getValue("ADMenuNameID"));
|
log.info(elementValue + " " + atts.getValue("ADMenuNameID"));
|
||||||
|
@ -57,13 +58,13 @@ public class MenuElementHandler extends AbstractElementHandler {
|
||||||
if (menuid <= 0 && atts.getValue("AD_Menu_ID") != null && Integer.parseInt(atts.getValue("AD_Menu_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
if (menuid <= 0 && atts.getValue("AD_Menu_ID") != null && Integer.parseInt(atts.getValue("AD_Menu_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
||||||
m_Menu.setAD_Menu_ID(Integer.parseInt(atts.getValue("AD_Menu_ID")));
|
m_Menu.setAD_Menu_ID(Integer.parseInt(atts.getValue("AD_Menu_ID")));
|
||||||
if (menuid > 0) {
|
if (menuid > 0) {
|
||||||
AD_Backup_ID = copyRecord(ctx, "AD_Menu", m_Menu);
|
backupRecord(ctx, "AD_Menu", m_Menu);
|
||||||
Object_Status = "Update";
|
Object_Status = "Update";
|
||||||
} else {
|
} else {
|
||||||
Object_Status = "New";
|
Object_Status = "New";
|
||||||
AD_Backup_ID = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
m_Menu.setName(name);
|
m_Menu.setName(name);
|
||||||
name = atts.getValue("ADWindowNameID");
|
name = atts.getValue("ADWindowNameID");
|
||||||
if (name != null && name.trim().length() > 0) {
|
if (name != null && name.trim().length() > 0) {
|
||||||
|
@ -142,7 +143,7 @@ public class MenuElementHandler extends AbstractElementHandler {
|
||||||
if (m_Menu.save(getTrxName(ctx)) == true) {
|
if (m_Menu.save(getTrxName(ctx)) == true) {
|
||||||
try {
|
try {
|
||||||
idDetail = record_log(ctx, 1, m_Menu.getName(), "Menu", m_Menu
|
idDetail = record_log(ctx, 1, m_Menu.getName(), "Menu", m_Menu
|
||||||
.get_ID(), AD_Backup_ID, Object_Status, "AD_Menu",
|
.get_ID(), Object_Status, "AD_Menu",
|
||||||
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
||||||
"AD_Menu"));
|
"AD_Menu"));
|
||||||
} catch (SAXException e) {
|
} catch (SAXException e) {
|
||||||
|
@ -151,7 +152,7 @@ public class MenuElementHandler extends AbstractElementHandler {
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
idDetail = record_log(ctx, 0, m_Menu.getName(), "Menu", m_Menu
|
idDetail = record_log(ctx, 0, m_Menu.getName(), "Menu", m_Menu
|
||||||
.get_ID(), AD_Backup_ID, Object_Status, "AD_Menu",
|
.get_ID(), Object_Status, "AD_Menu",
|
||||||
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
||||||
"AD_Menu"));
|
"AD_Menu"));
|
||||||
} catch (SAXException e) {
|
} catch (SAXException e) {
|
||||||
|
@ -387,25 +388,29 @@ public class MenuElementHandler extends AbstractElementHandler {
|
||||||
|| rs.getInt("AD_FORM_ID") > 0
|
|| rs.getInt("AD_FORM_ID") > 0
|
||||||
|| rs.getInt("AD_WORKBENCH_ID") > 0) {
|
|| rs.getInt("AD_WORKBENCH_ID") > 0) {
|
||||||
// Call CreateWindow.
|
// Call CreateWindow.
|
||||||
if (rs.getInt("AD_WINDOW_ID") > 0) {
|
if (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Window_ID)>0)
|
||||||
packOut.createWindow(rs.getInt("AD_WINDOW_ID"), document);
|
{
|
||||||
|
IPackOutHandler handler = packOut.getHandler("W");
|
||||||
|
handler.packOut(packOut,null,rs,document,null,0);
|
||||||
}
|
}
|
||||||
// Call CreateProcess.
|
else if (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Process_ID)>0)
|
||||||
else if (rs.getInt("AD_PROCESS_ID") > 0) {
|
{
|
||||||
packOut.createProcess(rs.getInt("AD_PROCESS_ID"), document);
|
IPackOutHandler handler = packOut.getHandler("P");
|
||||||
|
handler.packOut(packOut,null,rs,document,null,0);
|
||||||
|
} else if (rs.getInt(X_AD_Task.COLUMNNAME_AD_Task_ID)>0)
|
||||||
|
{
|
||||||
|
IPackOutHandler handler = packOut.getHandler("K");
|
||||||
|
handler.packOut(packOut,null,rs,document,null,0);
|
||||||
}
|
}
|
||||||
// Call CreateTask.
|
else if (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Form_ID) > 0)
|
||||||
else if (rs.getInt("AD_TASK_ID") > 0) {
|
{
|
||||||
packOut.createTask(rs.getInt("AD_TASK_ID"), document);
|
IPackOutHandler handler = packOut.getHandler("X");
|
||||||
|
handler.packOut(packOut,null,rs,document,null,0);
|
||||||
}
|
}
|
||||||
// Call CreateForm.
|
else if (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Workflow_ID) > 0)
|
||||||
else if (rs.getInt("AD_FORM_ID") > 0) {
|
{
|
||||||
packOut.createForm(rs.getInt("AD_FORM_ID"), document);
|
IPackOutHandler handler = packOut.getHandler("F");
|
||||||
}
|
handler.packOut(packOut,null,rs,document,null,0);
|
||||||
// Call CreateWorkflow
|
|
||||||
else if (rs.getInt("AD_Workflow_ID") > 0) {
|
|
||||||
packOut.createWorkflow(rs.getInt("AD_Workflow_ID"),
|
|
||||||
document);
|
|
||||||
}
|
}
|
||||||
// Call CreateModule because entry is a summary menu
|
// Call CreateModule because entry is a summary menu
|
||||||
} else {
|
} else {
|
||||||
|
@ -440,9 +445,10 @@ public class MenuElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
AttributesImpl atts = new AttributesImpl();
|
AttributesImpl atts = new AttributesImpl();
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
pstmt = DB.prepareStatement(sql, getTrxName(ctx));
|
pstmt = DB.prepareStatement(sql, getTrxName(ctx));
|
||||||
try {
|
try {
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
// Menu tag Start.
|
// Menu tag Start.
|
||||||
X_AD_Menu m_Menu = new X_AD_Menu(ctx, rs.getInt("AD_Menu_ID"),
|
X_AD_Menu m_Menu = new X_AD_Menu(ctx, rs.getInt("AD_Menu_ID"),
|
||||||
|
@ -456,26 +462,30 @@ public class MenuElementHandler extends AbstractElementHandler {
|
||||||
|| rs.getInt("AD_FORM_ID") > 0
|
|| rs.getInt("AD_FORM_ID") > 0
|
||||||
|| rs.getInt("AD_WORKBENCH_ID") > 0) {
|
|| rs.getInt("AD_WORKBENCH_ID") > 0) {
|
||||||
// Call CreateWindow.
|
// Call CreateWindow.
|
||||||
if (rs.getInt("AD_WINDOW_ID") > 0) {
|
if (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Window_ID)>0)
|
||||||
packOut.createWindow(rs.getInt("AD_WINDOW_ID"), document);
|
{
|
||||||
|
IPackOutHandler handler = packOut.getHandler("W");
|
||||||
|
handler.packOut(packOut,null,rs,document,null,0);
|
||||||
}
|
}
|
||||||
// Call CreateProcess.
|
else if (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Process_ID)>0)
|
||||||
else if (rs.getInt("AD_PROCESS_ID") > 0) {
|
{
|
||||||
packOut.createProcess(rs.getInt("AD_PROCESS_ID"),
|
IPackOutHandler handler = packOut.getHandler("P");
|
||||||
document);
|
handler.packOut(packOut,null,rs,document,null,0);
|
||||||
}
|
}
|
||||||
// Call CreateTask.
|
else if (rs.getInt(X_AD_Task.COLUMNNAME_AD_Task_ID)>0)
|
||||||
else if (rs.getInt("AD_TASK_ID") > 0) {
|
{
|
||||||
packOut.createTask(rs.getInt("AD_TASK_ID"), document);
|
IPackOutHandler handler = packOut.getHandler("K");
|
||||||
|
handler.packOut(packOut,null,rs,document,null,0);
|
||||||
}
|
}
|
||||||
// Call CreateForm.
|
else if (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Form_ID) > 0)
|
||||||
else if (rs.getInt("AD_FORM_ID") > 0) {
|
{
|
||||||
packOut.createForm(rs.getInt("AD_FORM_ID"), document);
|
IPackOutHandler handler = packOut.getHandler("X");
|
||||||
|
handler.packOut(packOut,null,rs,document,null,0);
|
||||||
}
|
}
|
||||||
// Call CreateWorkflow
|
else if (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Workflow_ID) > 0)
|
||||||
else if (rs.getInt("AD_Workflow_ID") > 0) {
|
{
|
||||||
packOut.createWorkflow(rs.getInt("AD_Workflow_ID"),
|
IPackOutHandler handler = packOut.getHandler("F");
|
||||||
document);
|
handler.packOut(packOut,null,rs,document,null,0);
|
||||||
}
|
}
|
||||||
// Call CreateModule because entry is a summary menu
|
// Call CreateModule because entry is a summary menu
|
||||||
} else {
|
} else {
|
||||||
|
@ -483,18 +493,29 @@ public class MenuElementHandler extends AbstractElementHandler {
|
||||||
}
|
}
|
||||||
document.endElement("", "", "menu");
|
document.endElement("", "", "menu");
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.log(Level.SEVERE, "getWindows", e);
|
log.log(Level.SEVERE, "getWindows", e);
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
DB.close(rs, pstmt);
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close();
|
|
||||||
} catch (Exception e) {
|
|
||||||
}
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void packOut(PackOut packout, ResultSet header, ResultSet detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
|
||||||
|
{
|
||||||
|
if(recordId <= 0)
|
||||||
|
recordId = detail.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Menu_ID);
|
||||||
|
|
||||||
|
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_AD_Menu_ID, recordId);
|
||||||
|
|
||||||
|
this.create(packout.getCtx(), packOutDocument);
|
||||||
|
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Menu_ID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ import org.xml.sax.Attributes;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import org.xml.sax.helpers.AttributesImpl;
|
import org.xml.sax.helpers.AttributesImpl;
|
||||||
|
|
||||||
public class MessageElementHandler extends AbstractElementHandler {
|
public class MessageElementHandler extends AbstractElementHandler implements IPackOutHandler{
|
||||||
|
|
||||||
private List<Integer> messages = new ArrayList<Integer>();
|
private List<Integer> messages = new ArrayList<Integer>();
|
||||||
|
|
||||||
|
@ -52,17 +52,15 @@ public class MessageElementHandler extends AbstractElementHandler {
|
||||||
int id = get_IDWithColumn(ctx, "AD_Message", "value", value);
|
int id = get_IDWithColumn(ctx, "AD_Message", "value", value);
|
||||||
|
|
||||||
MMessage m_Message = new MMessage(ctx, id, getTrxName(ctx));
|
MMessage m_Message = new MMessage(ctx, id, getTrxName(ctx));
|
||||||
int AD_Backup_ID = -1;
|
|
||||||
String Object_Status = null;
|
String Object_Status = null;
|
||||||
if (id <= 0 && atts.getValue("AD_Message_ID") != null && Integer.parseInt(atts.getValue("AD_Message_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
if (id <= 0 && atts.getValue("AD_Message_ID") != null && Integer.parseInt(atts.getValue("AD_Message_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
||||||
m_Message.setAD_Message_ID(Integer.parseInt(atts.getValue("AD_Message_ID")));
|
m_Message.setAD_Message_ID(Integer.parseInt(atts.getValue("AD_Message_ID")));
|
||||||
if (id > 0){
|
if (id > 0){
|
||||||
AD_Backup_ID = copyRecord(ctx, "AD_Message",m_Message);
|
backupRecord(ctx, "AD_Message",m_Message);
|
||||||
Object_Status = "Update";
|
Object_Status = "Update";
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Object_Status = "New";
|
Object_Status = "New";
|
||||||
AD_Backup_ID =0;
|
|
||||||
}
|
}
|
||||||
m_Message.setMsgText(getStringValue(atts, "MsgText"));
|
m_Message.setMsgText(getStringValue(atts, "MsgText"));
|
||||||
m_Message.setMsgTip(getStringValue(atts, "MsgTip"));
|
m_Message.setMsgTip(getStringValue(atts, "MsgTip"));
|
||||||
|
@ -71,10 +69,10 @@ public class MessageElementHandler extends AbstractElementHandler {
|
||||||
m_Message.setValue(value);
|
m_Message.setValue(value);
|
||||||
m_Message.setMsgType(atts.getValue("MsgType"));
|
m_Message.setMsgType(atts.getValue("MsgType"));
|
||||||
if (m_Message.save(getTrxName(ctx)) == true){
|
if (m_Message.save(getTrxName(ctx)) == true){
|
||||||
record_log (ctx, 1, m_Message.getValue(),"Message", m_Message.get_ID(),AD_Backup_ID, Object_Status,"AD_Message",get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_Message"));
|
record_log (ctx, 1, m_Message.getValue(),"Message", m_Message.get_ID(),Object_Status,"AD_Message",get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_Message"));
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
record_log (ctx, 0, m_Message.getValue(),"Message", m_Message.get_ID(),AD_Backup_ID, Object_Status,"AD_Message",get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_Message"));
|
record_log (ctx, 0, m_Message.getValue(),"Message", m_Message.get_ID(),Object_Status,"AD_Message",get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_Message"));
|
||||||
throw new POSaveFailedException("Failed to save message.");
|
throw new POSaveFailedException("Failed to save message.");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -136,4 +134,15 @@ public class MessageElementHandler extends AbstractElementHandler {
|
||||||
atts.addAttribute("","","isActive","CDATA",(m_Message.isActive()== true ? "true":"false"));
|
atts.addAttribute("","","isActive","CDATA",(m_Message.isActive()== true ? "true":"false"));
|
||||||
return atts;
|
return atts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void packOut(PackOut packout, ResultSet header, ResultSet detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
|
||||||
|
{
|
||||||
|
if(recordId <= 0)
|
||||||
|
recordId = detail.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Message_ID);
|
||||||
|
|
||||||
|
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_AD_Message_ID, recordId);
|
||||||
|
|
||||||
|
this.create(packout.getCtx(), packOutDocument);
|
||||||
|
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Message_ID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,16 +53,14 @@ public class PreferenceElementHandler extends AbstractElementHandler {
|
||||||
" and AD_Window_ID = ?");
|
" and AD_Window_ID = ?");
|
||||||
int id = DB.getSQLValue(getTrxName(ctx), sqlB.toString(), windowid);
|
int id = DB.getSQLValue(getTrxName(ctx), sqlB.toString(), windowid);
|
||||||
MPreference m_Preference = new MPreference(ctx, id, getTrxName(ctx));
|
MPreference m_Preference = new MPreference(ctx, id, getTrxName(ctx));
|
||||||
int AD_Backup_ID = -1;
|
|
||||||
String Object_Status = null;
|
String Object_Status = null;
|
||||||
if (id <= 0 && atts.getValue("AD_Preference_ID") != null && Integer.parseInt(atts.getValue("AD_Preference_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
if (id <= 0 && atts.getValue("AD_Preference_ID") != null && Integer.parseInt(atts.getValue("AD_Preference_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
||||||
m_Preference.setAD_Preference_ID(Integer.parseInt(atts.getValue("AD_Preference_ID")));
|
m_Preference.setAD_Preference_ID(Integer.parseInt(atts.getValue("AD_Preference_ID")));
|
||||||
if (id > 0) {
|
if (id > 0) {
|
||||||
AD_Backup_ID = copyRecord(ctx, "AD_Preference", m_Preference);
|
backupRecord(ctx, "AD_Preference", m_Preference);
|
||||||
Object_Status = "Update";
|
Object_Status = "Update";
|
||||||
} else {
|
} else {
|
||||||
Object_Status = "New";
|
Object_Status = "New";
|
||||||
AD_Backup_ID = 0;
|
|
||||||
}
|
}
|
||||||
sqlB = null;
|
sqlB = null;
|
||||||
m_Preference.setAD_Window_ID(windowid);
|
m_Preference.setAD_Window_ID(windowid);
|
||||||
|
@ -70,12 +68,12 @@ public class PreferenceElementHandler extends AbstractElementHandler {
|
||||||
m_Preference.setValue(atts.getValue("Value"));
|
m_Preference.setValue(atts.getValue("Value"));
|
||||||
if (m_Preference.save(getTrxName(ctx)) == true) {
|
if (m_Preference.save(getTrxName(ctx)) == true) {
|
||||||
record_log(ctx, 1, m_Preference.getAttribute(), "Preference",
|
record_log(ctx, 1, m_Preference.getAttribute(), "Preference",
|
||||||
m_Preference.get_ID(), AD_Backup_ID, Object_Status,
|
m_Preference.get_ID(), Object_Status,
|
||||||
"AD_Preference", get_IDWithColumn(ctx, "AD_Table",
|
"AD_Preference", get_IDWithColumn(ctx, "AD_Table",
|
||||||
"TableName", "AD_Preference"));
|
"TableName", "AD_Preference"));
|
||||||
} else {
|
} else {
|
||||||
record_log(ctx, 0, m_Preference.getAttribute(), "Preference",
|
record_log(ctx, 0, m_Preference.getAttribute(), "Preference",
|
||||||
m_Preference.get_ID(), AD_Backup_ID, Object_Status,
|
m_Preference.get_ID(), Object_Status,
|
||||||
"AD_Preference", get_IDWithColumn(ctx, "AD_Table",
|
"AD_Preference", get_IDWithColumn(ctx, "AD_Table",
|
||||||
"TableName", "AD_Preference"));
|
"TableName", "AD_Preference"));
|
||||||
throw new POSaveFailedException("Failed to save Preference");
|
throw new POSaveFailedException("Failed to save Preference");
|
||||||
|
|
|
@ -42,7 +42,7 @@ import org.xml.sax.Attributes;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import org.xml.sax.helpers.AttributesImpl;
|
import org.xml.sax.helpers.AttributesImpl;
|
||||||
|
|
||||||
public class PrintFormatElementHandler extends AbstractElementHandler {
|
public class PrintFormatElementHandler extends AbstractElementHandler implements IPackOutHandler {
|
||||||
|
|
||||||
private PrintFormatItemElementHandler itemHandler = new PrintFormatItemElementHandler();
|
private PrintFormatItemElementHandler itemHandler = new PrintFormatItemElementHandler();
|
||||||
|
|
||||||
|
@ -51,7 +51,6 @@ public class PrintFormatElementHandler extends AbstractElementHandler {
|
||||||
public void startElement(Properties ctx, Element element)
|
public void startElement(Properties ctx, Element element)
|
||||||
throws SAXException {
|
throws SAXException {
|
||||||
String elementValue = element.getElementValue();
|
String elementValue = element.getElementValue();
|
||||||
int AD_Backup_ID = -1;
|
|
||||||
String Object_Status = null;
|
String Object_Status = null;
|
||||||
Attributes atts = element.attributes;
|
Attributes atts = element.attributes;
|
||||||
log.info(elementValue + " " + atts.getValue("Name"));
|
log.info(elementValue + " " + atts.getValue("Name"));
|
||||||
|
@ -63,11 +62,10 @@ public class PrintFormatElementHandler extends AbstractElementHandler {
|
||||||
if (id <= 0 && atts.getValue("AD_PrintFormat_ID") != null && Integer.parseInt(atts.getValue("AD_PrintFormat_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
if (id <= 0 && atts.getValue("AD_PrintFormat_ID") != null && Integer.parseInt(atts.getValue("AD_PrintFormat_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
||||||
m_PrintFormat.setAD_PrintFormat_ID(Integer.parseInt(atts.getValue("AD_PrintFormat_ID")));
|
m_PrintFormat.setAD_PrintFormat_ID(Integer.parseInt(atts.getValue("AD_PrintFormat_ID")));
|
||||||
if (id > 0) {
|
if (id > 0) {
|
||||||
AD_Backup_ID = copyRecord(ctx, "AD_PrintFormat", m_PrintFormat);
|
backupRecord(ctx, "AD_PrintFormat", m_PrintFormat);
|
||||||
Object_Status = "Update";
|
Object_Status = "Update";
|
||||||
} else {
|
} else {
|
||||||
Object_Status = "New";
|
Object_Status = "New";
|
||||||
AD_Backup_ID = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
name = atts.getValue("ADReportviewnameID");
|
name = atts.getValue("ADReportviewnameID");
|
||||||
|
@ -89,12 +87,12 @@ public class PrintFormatElementHandler extends AbstractElementHandler {
|
||||||
m_Table.setTableName(name);
|
m_Table.setTableName(name);
|
||||||
if (m_Table.save(getTrxName(ctx)) == true) {
|
if (m_Table.save(getTrxName(ctx)) == true) {
|
||||||
record_log(ctx, 1, m_Table.getName(), "Table",
|
record_log(ctx, 1, m_Table.getName(), "Table",
|
||||||
m_Table.get_ID(), 0, "New", "AD_Table",
|
m_Table.get_ID(), "New", "AD_Table",
|
||||||
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
||||||
"AD_Table"));
|
"AD_Table"));
|
||||||
} else {
|
} else {
|
||||||
record_log(ctx, 0, m_Table.getName(), "Table",
|
record_log(ctx, 0, m_Table.getName(), "Table",
|
||||||
m_Table.get_ID(), 0, "New", "AD_Table",
|
m_Table.get_ID(), "New", "AD_Table",
|
||||||
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
||||||
"AD_Table"));
|
"AD_Table"));
|
||||||
}
|
}
|
||||||
|
@ -165,13 +163,13 @@ public class PrintFormatElementHandler extends AbstractElementHandler {
|
||||||
.booleanValue());
|
.booleanValue());
|
||||||
if (m_PrintFormat.save(getTrxName(ctx)) == true) {
|
if (m_PrintFormat.save(getTrxName(ctx)) == true) {
|
||||||
record_log(ctx, 1, m_PrintFormat.getName(), "PrintFormat",
|
record_log(ctx, 1, m_PrintFormat.getName(), "PrintFormat",
|
||||||
m_PrintFormat.get_ID(), AD_Backup_ID, Object_Status,
|
m_PrintFormat.get_ID(), Object_Status,
|
||||||
"AD_PrintFormat", get_IDWithColumn(ctx, "AD_Table",
|
"AD_PrintFormat", get_IDWithColumn(ctx, "AD_Table",
|
||||||
"TableName", "AD_PrintFormat"));
|
"TableName", "AD_PrintFormat"));
|
||||||
element.recordId = m_PrintFormat.getAD_PrintFormat_ID();
|
element.recordId = m_PrintFormat.getAD_PrintFormat_ID();
|
||||||
} else {
|
} else {
|
||||||
record_log(ctx, 0, m_PrintFormat.getName(), "PrintFormat",
|
record_log(ctx, 0, m_PrintFormat.getName(), "PrintFormat",
|
||||||
m_PrintFormat.get_ID(), AD_Backup_ID, Object_Status,
|
m_PrintFormat.get_ID(), Object_Status,
|
||||||
"AD_PrintFormat", get_IDWithColumn(ctx, "AD_Table",
|
"AD_PrintFormat", get_IDWithColumn(ctx, "AD_Table",
|
||||||
"TableName", "AD_PrintFormat"));
|
"TableName", "AD_PrintFormat"));
|
||||||
throw new POSaveFailedException("Failed to save Print Format");
|
throw new POSaveFailedException("Failed to save Print Format");
|
||||||
|
@ -349,4 +347,16 @@ public class PrintFormatElementHandler extends AbstractElementHandler {
|
||||||
.isDefault() == true ? "true" : "false"));
|
.isDefault() == true ? "true" : "false"));
|
||||||
return atts;
|
return atts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void packOut(PackOut packout, ResultSet header, ResultSet detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
|
||||||
|
{
|
||||||
|
if(recordId <= 0)
|
||||||
|
recordId = detail.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_PrintFormat_ID);
|
||||||
|
|
||||||
|
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_AD_PrintFormat_ID, recordId);
|
||||||
|
|
||||||
|
this.create(packout.getCtx(), packOutDocument);
|
||||||
|
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_AD_PrintFormat_ID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,6 @@ public class PrintFormatItemElementHandler extends AbstractElementHandler {
|
||||||
public void startElement(Properties ctx, Element element)
|
public void startElement(Properties ctx, Element element)
|
||||||
throws SAXException {
|
throws SAXException {
|
||||||
String elementValue = element.getElementValue();
|
String elementValue = element.getElementValue();
|
||||||
int AD_Backup_ID = -1;
|
|
||||||
String Object_Status = null;
|
String Object_Status = null;
|
||||||
Attributes atts = element.attributes;
|
Attributes atts = element.attributes;
|
||||||
log.info(elementValue + " " + atts.getValue("Name"));
|
log.info(elementValue + " " + atts.getValue("Name"));
|
||||||
|
@ -56,12 +55,11 @@ public class PrintFormatItemElementHandler extends AbstractElementHandler {
|
||||||
if (id <= 0 && atts.getValue("AD_PrintFormatItem_ID") != null && Integer.parseInt(atts.getValue("AD_PrintFormatItem_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
if (id <= 0 && atts.getValue("AD_PrintFormatItem_ID") != null && Integer.parseInt(atts.getValue("AD_PrintFormatItem_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
||||||
m_PrintFormatItem.setAD_PrintFormatItem_ID(Integer.parseInt(atts.getValue("AD_PrintFormatItem_ID")));
|
m_PrintFormatItem.setAD_PrintFormatItem_ID(Integer.parseInt(atts.getValue("AD_PrintFormatItem_ID")));
|
||||||
if (id > 0) {
|
if (id > 0) {
|
||||||
AD_Backup_ID = copyRecord(ctx, "AD_PrintFormatItem",
|
backupRecord(ctx, "AD_PrintFormatItem",
|
||||||
m_PrintFormatItem);
|
m_PrintFormatItem);
|
||||||
Object_Status = "Update";
|
Object_Status = "Update";
|
||||||
} else {
|
} else {
|
||||||
Object_Status = "New";
|
Object_Status = "New";
|
||||||
AD_Backup_ID = 0;
|
|
||||||
}
|
}
|
||||||
m_PrintFormatItem.setName(name);
|
m_PrintFormatItem.setName(name);
|
||||||
name = atts.getValue("ADPrintFormatNameID");
|
name = atts.getValue("ADPrintFormatNameID");
|
||||||
|
@ -232,12 +230,12 @@ public class PrintFormatItemElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
if (m_PrintFormatItem.save(getTrxName(ctx)) == true) {
|
if (m_PrintFormatItem.save(getTrxName(ctx)) == true) {
|
||||||
record_log(ctx, 1, m_PrintFormatItem.getName(), "PrintFormatItem",
|
record_log(ctx, 1, m_PrintFormatItem.getName(), "PrintFormatItem",
|
||||||
m_PrintFormatItem.get_ID(), AD_Backup_ID, Object_Status,
|
m_PrintFormatItem.get_ID(), Object_Status,
|
||||||
"AD_PrintFormatItem", get_IDWithColumn(ctx, "AD_Table",
|
"AD_PrintFormatItem", get_IDWithColumn(ctx, "AD_Table",
|
||||||
"TableName", "AD_PrintFormatItem"));
|
"TableName", "AD_PrintFormatItem"));
|
||||||
} else {
|
} else {
|
||||||
record_log(ctx, 0, m_PrintFormatItem.getName(), "PrintFormatItem",
|
record_log(ctx, 0, m_PrintFormatItem.getName(), "PrintFormatItem",
|
||||||
m_PrintFormatItem.get_ID(), AD_Backup_ID, Object_Status,
|
m_PrintFormatItem.get_ID(), Object_Status,
|
||||||
"AD_PrintFormatItem", get_IDWithColumn(ctx, "AD_Table",
|
"AD_PrintFormatItem", get_IDWithColumn(ctx, "AD_Table",
|
||||||
"TableName", "AD_PrintFormatItem"));
|
"TableName", "AD_PrintFormatItem"));
|
||||||
throw new POSaveFailedException("PrintFormatItem");
|
throw new POSaveFailedException("PrintFormatItem");
|
||||||
|
|
|
@ -31,6 +31,7 @@ import org.adempiere.pipo.Element;
|
||||||
import org.adempiere.pipo.PackOut;
|
import org.adempiere.pipo.PackOut;
|
||||||
import org.adempiere.pipo.exception.DatabaseAccessException;
|
import org.adempiere.pipo.exception.DatabaseAccessException;
|
||||||
import org.adempiere.pipo.exception.POSaveFailedException;
|
import org.adempiere.pipo.exception.POSaveFailedException;
|
||||||
|
import org.compiere.model.X_AD_Package_Exp_Detail;
|
||||||
import org.compiere.model.X_AD_Process;
|
import org.compiere.model.X_AD_Process;
|
||||||
import org.compiere.model.X_AD_Process_Para;
|
import org.compiere.model.X_AD_Process_Para;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
|
@ -39,7 +40,7 @@ import org.xml.sax.Attributes;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import org.xml.sax.helpers.AttributesImpl;
|
import org.xml.sax.helpers.AttributesImpl;
|
||||||
|
|
||||||
public class ProcessElementHandler extends AbstractElementHandler {
|
public class ProcessElementHandler extends AbstractElementHandler implements IPackOutHandler{
|
||||||
|
|
||||||
private ProcessParaElementHandler paraHandler = new ProcessParaElementHandler();
|
private ProcessParaElementHandler paraHandler = new ProcessParaElementHandler();
|
||||||
|
|
||||||
|
@ -59,11 +60,10 @@ public class ProcessElementHandler extends AbstractElementHandler {
|
||||||
id = get_IDWithColumn(ctx, "AD_Process", "Value", value);
|
id = get_IDWithColumn(ctx, "AD_Process", "Value", value);
|
||||||
|
|
||||||
X_AD_Process m_Process = null;
|
X_AD_Process m_Process = null;
|
||||||
int AD_Backup_ID = -1;
|
|
||||||
String Object_Status = null;
|
String Object_Status = null;
|
||||||
if (id > 0) {
|
if (id > 0) {
|
||||||
m_Process = new X_AD_Process(ctx, id, getTrxName(ctx));
|
m_Process = new X_AD_Process(ctx, id, getTrxName(ctx));
|
||||||
AD_Backup_ID = copyRecord(ctx, "AD_Process", m_Process);
|
backupRecord(ctx, "AD_Process", m_Process);
|
||||||
Object_Status = "Update";
|
Object_Status = "Update";
|
||||||
} else {
|
} else {
|
||||||
m_Process = new X_AD_Process(ctx, id, getTrxName(ctx));
|
m_Process = new X_AD_Process(ctx, id, getTrxName(ctx));
|
||||||
|
@ -71,7 +71,6 @@ public class ProcessElementHandler extends AbstractElementHandler {
|
||||||
"AD_Process", getTrxName(ctx));
|
"AD_Process", getTrxName(ctx));
|
||||||
m_Process.setAD_Process_ID(id);
|
m_Process.setAD_Process_ID(id);
|
||||||
Object_Status = "New";
|
Object_Status = "New";
|
||||||
AD_Backup_ID = 0;
|
|
||||||
}
|
}
|
||||||
if (id <= 0 && atts.getValue("AD_Process_ID") != null && Integer.parseInt(atts.getValue("AD_Process_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
if (id <= 0 && atts.getValue("AD_Process_ID") != null && Integer.parseInt(atts.getValue("AD_Process_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
||||||
m_Process.setAD_Process_ID(Integer.parseInt(atts.getValue("AD_Process_ID")));
|
m_Process.setAD_Process_ID(Integer.parseInt(atts.getValue("AD_Process_ID")));
|
||||||
|
@ -146,13 +145,13 @@ public class ProcessElementHandler extends AbstractElementHandler {
|
||||||
m_Process.setJasperReport(getStringValue(atts, "JasperReport"));
|
m_Process.setJasperReport(getStringValue(atts, "JasperReport"));
|
||||||
if (m_Process.save(getTrxName(ctx)) == true) {
|
if (m_Process.save(getTrxName(ctx)) == true) {
|
||||||
record_log(ctx, 1, m_Process.getName(), "Process", m_Process
|
record_log(ctx, 1, m_Process.getName(), "Process", m_Process
|
||||||
.get_ID(), AD_Backup_ID, Object_Status, "AD_Process",
|
.get_ID(), Object_Status, "AD_Process",
|
||||||
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
||||||
"AD_Process"));
|
"AD_Process"));
|
||||||
element.recordId = m_Process.getAD_Process_ID();
|
element.recordId = m_Process.getAD_Process_ID();
|
||||||
} else {
|
} else {
|
||||||
record_log(ctx, 0, m_Process.getName(), "Process", m_Process
|
record_log(ctx, 0, m_Process.getName(), "Process", m_Process
|
||||||
.get_ID(), AD_Backup_ID, Object_Status, "AD_Process",
|
.get_ID(), Object_Status, "AD_Process",
|
||||||
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
||||||
"AD_Process"));
|
"AD_Process"));
|
||||||
throw new POSaveFailedException("Process");
|
throw new POSaveFailedException("Process");
|
||||||
|
@ -186,19 +185,20 @@ public class ProcessElementHandler extends AbstractElementHandler {
|
||||||
log.log(Level.INFO, "AD_ReportView_ID: "
|
log.log(Level.INFO, "AD_ReportView_ID: "
|
||||||
+ m_Process.getAD_Process_ID());
|
+ m_Process.getAD_Process_ID());
|
||||||
|
|
||||||
if (m_Process.isReport() && m_Process.getAD_ReportView_ID() > 0) {
|
if (m_Process.isReport() && m_Process.getAD_ReportView_ID() > 0)
|
||||||
packOut.createReportview(m_Process.getAD_ReportView_ID(),
|
{
|
||||||
document);
|
IPackOutHandler handler = packOut.getHandler("R");
|
||||||
|
handler.packOut(packOut,null,null,document,null,m_Process.getAD_ReportView_ID());
|
||||||
|
|
||||||
}
|
}
|
||||||
if (m_Process.isReport() && m_Process.getAD_PrintFormat_ID() > 0) {
|
if (m_Process.isReport() && m_Process.getAD_PrintFormat_ID() > 0)
|
||||||
|
{
|
||||||
packOut.createPrintFormat(m_Process.getAD_PrintFormat_ID(),
|
IPackOutHandler handler = packOut.getHandler("PFT");
|
||||||
document);
|
handler.packOut(packOut,null,null,document,null,m_Process.getAD_PrintFormat_ID());
|
||||||
}
|
}
|
||||||
if (m_Process.getAD_Workflow_ID() > 0) {
|
if (m_Process.getAD_Workflow_ID() > 0) {
|
||||||
|
IPackOutHandler handler = packOut.getHandler("F");
|
||||||
packOut.createWorkflow(m_Process.getAD_Workflow_ID(),
|
handler.packOut(packOut,null,null,document,null,m_Process.getAD_Workflow_ID());
|
||||||
document);
|
|
||||||
}
|
}
|
||||||
createProcessBinding(atts, m_Process);
|
createProcessBinding(atts, m_Process);
|
||||||
document.startElement("", "", "process", atts);
|
document.startElement("", "", "process", atts);
|
||||||
|
@ -210,15 +210,24 @@ public class ProcessElementHandler extends AbstractElementHandler {
|
||||||
try {
|
try {
|
||||||
ResultSet rsP = pstmtP.executeQuery();
|
ResultSet rsP = pstmtP.executeQuery();
|
||||||
while (rsP.next()) {
|
while (rsP.next()) {
|
||||||
if (rsP.getInt("AD_Reference_ID") > 0)
|
|
||||||
packOut.createReference(rsP
|
if (rsP.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Reference_ID)>0)
|
||||||
.getInt("AD_Reference_ID"), document);
|
{
|
||||||
if (rsP.getInt("AD_Reference_Value_ID") > 0)
|
IPackOutHandler handler = packOut.getHandler("REF");
|
||||||
packOut.createReference(rsP
|
handler.packOut(packOut,null,rsP,document,null,0);
|
||||||
.getInt("AD_Reference_Value_ID"),
|
}
|
||||||
document);
|
|
||||||
if (rsP.getInt("AD_Val_Rule_ID") > 0)
|
if (rsP.getInt("AD_Reference_Value_ID")>0)
|
||||||
packOut.createDynamicRuleValidation (rsP.getInt("AD_Val_Rule_ID"), document);
|
{
|
||||||
|
IPackOutHandler handler = packOut.getHandler("REF");
|
||||||
|
handler.packOut(packOut,null,null,document,null,rsP.getInt("AD_Reference_Value_ID"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rsP.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Val_Rule_ID)>0)
|
||||||
|
{
|
||||||
|
IPackOutHandler handler = packOut.getHandler("V");
|
||||||
|
handler.packOut(packOut,null,rsP,document,null,0);
|
||||||
|
}
|
||||||
|
|
||||||
createProcessPara(ctx, document, rsP
|
createProcessPara(ctx, document, rsP
|
||||||
.getInt("AD_Process_Para_ID"));
|
.getInt("AD_Process_Para_ID"));
|
||||||
|
@ -344,4 +353,15 @@ public class ProcessElementHandler extends AbstractElementHandler {
|
||||||
(m_Process.getJasperReport() != null ? m_Process.getJasperReport() : ""));
|
(m_Process.getJasperReport() != null ? m_Process.getJasperReport() : ""));
|
||||||
return atts;
|
return atts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void packOut(PackOut packout, ResultSet header, ResultSet detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
|
||||||
|
{
|
||||||
|
if(recordId <= 0)
|
||||||
|
recordId = detail.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Process_ID);
|
||||||
|
|
||||||
|
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_AD_Process_ID, recordId);
|
||||||
|
|
||||||
|
this.create(packout.getCtx(), packOutDocument);
|
||||||
|
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Process_ID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,17 +76,15 @@ public class ProcessParaElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
X_AD_Process_Para m_Process_para = new X_AD_Process_Para(ctx, id,
|
X_AD_Process_Para m_Process_para = new X_AD_Process_Para(ctx, id,
|
||||||
getTrxName(ctx));
|
getTrxName(ctx));
|
||||||
int AD_Backup_ID = -1;
|
|
||||||
String Object_Status = null;
|
String Object_Status = null;
|
||||||
if (id <= 0 && atts.getValue("AD_Process_Para_ID") != null && Integer.parseInt(atts.getValue("AD_Process_Para_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
if (id <= 0 && atts.getValue("AD_Process_Para_ID") != null && Integer.parseInt(atts.getValue("AD_Process_Para_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
||||||
m_Process_para.setAD_Process_Para_ID(Integer.parseInt(atts.getValue("AD_Process_Para_ID")));
|
m_Process_para.setAD_Process_Para_ID(Integer.parseInt(atts.getValue("AD_Process_Para_ID")));
|
||||||
if (id > 0) {
|
if (id > 0) {
|
||||||
AD_Backup_ID = copyRecord(ctx, "AD_Process_Para",
|
backupRecord(ctx, "AD_Process_Para",
|
||||||
m_Process_para);
|
m_Process_para);
|
||||||
Object_Status = "Update";
|
Object_Status = "Update";
|
||||||
} else {
|
} else {
|
||||||
Object_Status = "New";
|
Object_Status = "New";
|
||||||
AD_Backup_ID = 0;
|
|
||||||
}
|
}
|
||||||
m_Process_para.setName(atts.getValue("Name"));
|
m_Process_para.setName(atts.getValue("Name"));
|
||||||
|
|
||||||
|
@ -114,12 +112,12 @@ public class ProcessParaElementHandler extends AbstractElementHandler {
|
||||||
adElement.setName(m_Process_para.getName());
|
adElement.setName(m_Process_para.getName());
|
||||||
if (adElement.save(getTrxName(ctx)) == true) {
|
if (adElement.save(getTrxName(ctx)) == true) {
|
||||||
record_log(ctx, 1, m_Process_para.getName(), "Element", adElement
|
record_log(ctx, 1, m_Process_para.getName(), "Element", adElement
|
||||||
.getAD_Element_ID(), AD_Backup_ID, "New",
|
.getAD_Element_ID(), "New",
|
||||||
"AD_Element", get_IDWithColumn(ctx, "AD_Table",
|
"AD_Element", get_IDWithColumn(ctx, "AD_Table",
|
||||||
"TableName", "AD_Element"));
|
"TableName", "AD_Element"));
|
||||||
} else {
|
} else {
|
||||||
record_log(ctx, 0, m_Process_para.getName(), "Element", adElement
|
record_log(ctx, 0, m_Process_para.getName(), "Element", adElement
|
||||||
.getAD_Element_ID(), AD_Backup_ID, "New",
|
.getAD_Element_ID(), "New",
|
||||||
"AD_Element", get_IDWithColumn(ctx, "AD_Table",
|
"AD_Element", get_IDWithColumn(ctx, "AD_Table",
|
||||||
"TableName", "AD_Element"));
|
"TableName", "AD_Element"));
|
||||||
}
|
}
|
||||||
|
@ -185,12 +183,12 @@ public class ProcessParaElementHandler extends AbstractElementHandler {
|
||||||
.booleanValue());
|
.booleanValue());
|
||||||
if (m_Process_para.save(getTrxName(ctx)) == true) {
|
if (m_Process_para.save(getTrxName(ctx)) == true) {
|
||||||
record_log(ctx, 1, m_Process_para.getName(), "Process_para",
|
record_log(ctx, 1, m_Process_para.getName(), "Process_para",
|
||||||
m_Process_para.get_ID(), AD_Backup_ID, Object_Status,
|
m_Process_para.get_ID(), Object_Status,
|
||||||
"AD_Process_para", get_IDWithColumn(ctx, "AD_Table",
|
"AD_Process_para", get_IDWithColumn(ctx, "AD_Table",
|
||||||
"TableName", "AD_Process_para"));
|
"TableName", "AD_Process_para"));
|
||||||
} else {
|
} else {
|
||||||
record_log(ctx, 0, m_Process_para.getName(), "Process_para",
|
record_log(ctx, 0, m_Process_para.getName(), "Process_para",
|
||||||
m_Process_para.get_ID(), AD_Backup_ID, Object_Status,
|
m_Process_para.get_ID(), Object_Status,
|
||||||
"AD_Process_para", get_IDWithColumn(ctx, "AD_Table",
|
"AD_Process_para", get_IDWithColumn(ctx, "AD_Table",
|
||||||
"TableName", "AD_Process_para"));
|
"TableName", "AD_Process_para"));
|
||||||
throw new POSaveFailedException("ProcessPara");
|
throw new POSaveFailedException("ProcessPara");
|
||||||
|
|
|
@ -31,6 +31,7 @@ import org.adempiere.pipo.Element;
|
||||||
import org.adempiere.pipo.PackOut;
|
import org.adempiere.pipo.PackOut;
|
||||||
import org.adempiere.pipo.exception.DatabaseAccessException;
|
import org.adempiere.pipo.exception.DatabaseAccessException;
|
||||||
import org.adempiere.pipo.exception.POSaveFailedException;
|
import org.adempiere.pipo.exception.POSaveFailedException;
|
||||||
|
import org.compiere.model.X_AD_Package_Exp_Detail;
|
||||||
import org.compiere.model.X_AD_Ref_List;
|
import org.compiere.model.X_AD_Ref_List;
|
||||||
import org.compiere.model.X_AD_Ref_Table;
|
import org.compiere.model.X_AD_Ref_Table;
|
||||||
import org.compiere.model.X_AD_Reference;
|
import org.compiere.model.X_AD_Reference;
|
||||||
|
@ -40,7 +41,7 @@ import org.xml.sax.Attributes;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import org.xml.sax.helpers.AttributesImpl;
|
import org.xml.sax.helpers.AttributesImpl;
|
||||||
|
|
||||||
public class ReferenceElementHandler extends AbstractElementHandler {
|
public class ReferenceElementHandler extends AbstractElementHandler implements IPackOutHandler{
|
||||||
|
|
||||||
private ReferenceListElementHandler listHandler = new ReferenceListElementHandler();
|
private ReferenceListElementHandler listHandler = new ReferenceListElementHandler();
|
||||||
private ReferenceTableElementHandler tableHandler = new ReferenceTableElementHandler();
|
private ReferenceTableElementHandler tableHandler = new ReferenceTableElementHandler();
|
||||||
|
@ -50,7 +51,6 @@ public class ReferenceElementHandler extends AbstractElementHandler {
|
||||||
public void startElement(Properties ctx, Element element)
|
public void startElement(Properties ctx, Element element)
|
||||||
throws SAXException {
|
throws SAXException {
|
||||||
String elementValue = element.getElementValue();
|
String elementValue = element.getElementValue();
|
||||||
int AD_Backup_ID = -1;
|
|
||||||
String Object_Status = null;
|
String Object_Status = null;
|
||||||
|
|
||||||
Attributes atts = element.attributes;
|
Attributes atts = element.attributes;
|
||||||
|
@ -67,7 +67,7 @@ public class ReferenceElementHandler extends AbstractElementHandler {
|
||||||
if (id <= 0 && atts.getValue("AD_Reference_ID") != null && Integer.parseInt(atts.getValue("AD_Reference_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
if (id <= 0 && atts.getValue("AD_Reference_ID") != null && Integer.parseInt(atts.getValue("AD_Reference_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
||||||
m_Reference.setAD_Reference_ID(Integer.parseInt(atts.getValue("AD_Reference_ID")));
|
m_Reference.setAD_Reference_ID(Integer.parseInt(atts.getValue("AD_Reference_ID")));
|
||||||
if (id > 0) {
|
if (id > 0) {
|
||||||
AD_Backup_ID = copyRecord(ctx, "AD_Reference", m_Reference);
|
backupRecord(ctx, "AD_Reference", m_Reference);
|
||||||
Object_Status = "Update";
|
Object_Status = "Update";
|
||||||
if (references.contains(id)) {
|
if (references.contains(id)) {
|
||||||
element.skip = true;
|
element.skip = true;
|
||||||
|
@ -75,7 +75,6 @@ public class ReferenceElementHandler extends AbstractElementHandler {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Object_Status = "New";
|
Object_Status = "New";
|
||||||
AD_Backup_ID = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Reference.setDescription(getStringValue(atts,"Description"));
|
m_Reference.setDescription(getStringValue(atts,"Description"));
|
||||||
|
@ -89,14 +88,14 @@ public class ReferenceElementHandler extends AbstractElementHandler {
|
||||||
m_Reference.setValidationType(atts.getValue("ValidationType"));
|
m_Reference.setValidationType(atts.getValue("ValidationType"));
|
||||||
if (m_Reference.save(getTrxName(ctx)) == true) {
|
if (m_Reference.save(getTrxName(ctx)) == true) {
|
||||||
record_log(ctx, 1, m_Reference.getName(), "Reference",
|
record_log(ctx, 1, m_Reference.getName(), "Reference",
|
||||||
m_Reference.get_ID(), AD_Backup_ID, Object_Status,
|
m_Reference.get_ID(), Object_Status,
|
||||||
"AD_Reference", get_IDWithColumn(ctx, "AD_Table",
|
"AD_Reference", get_IDWithColumn(ctx, "AD_Table",
|
||||||
"TableName", "AD_Reference"));
|
"TableName", "AD_Reference"));
|
||||||
references.add(m_Reference.getAD_Reference_ID());
|
references.add(m_Reference.getAD_Reference_ID());
|
||||||
element.recordId = m_Reference.getAD_Reference_ID();
|
element.recordId = m_Reference.getAD_Reference_ID();
|
||||||
} else {
|
} else {
|
||||||
record_log(ctx, 0, m_Reference.getName(), "Reference",
|
record_log(ctx, 0, m_Reference.getName(), "Reference",
|
||||||
m_Reference.get_ID(), AD_Backup_ID, Object_Status,
|
m_Reference.get_ID(), Object_Status,
|
||||||
"AD_Reference", get_IDWithColumn(ctx, "AD_Table",
|
"AD_Reference", get_IDWithColumn(ctx, "AD_Table",
|
||||||
"TableName", "AD_Reference"));
|
"TableName", "AD_Reference"));
|
||||||
throw new POSaveFailedException("Reference");
|
throw new POSaveFailedException("Reference");
|
||||||
|
@ -276,4 +275,14 @@ public class ReferenceElementHandler extends AbstractElementHandler {
|
||||||
: ""));
|
: ""));
|
||||||
return atts;
|
return atts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void packOut(PackOut packout, ResultSet header, ResultSet detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
|
||||||
|
{
|
||||||
|
if(recordId <= 0)
|
||||||
|
recordId = detail.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Reference_ID);
|
||||||
|
|
||||||
|
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_AD_Reference_ID, recordId);
|
||||||
|
this.create(packout.getCtx(), packOutDocument);
|
||||||
|
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Reference_ID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,6 @@ public class ReferenceListElementHandler extends AbstractElementHandler {
|
||||||
public void startElement(Properties ctx, Element element)
|
public void startElement(Properties ctx, Element element)
|
||||||
throws SAXException {
|
throws SAXException {
|
||||||
String elementValue = element.getElementValue();
|
String elementValue = element.getElementValue();
|
||||||
int AD_Backup_ID = -1;
|
|
||||||
String Object_Status = null;
|
String Object_Status = null;
|
||||||
Attributes atts = element.attributes;
|
Attributes atts = element.attributes;
|
||||||
log.info(elementValue + " " + atts.getValue("Name"));
|
log.info(elementValue + " " + atts.getValue("Name"));
|
||||||
|
@ -64,11 +63,10 @@ public class ReferenceListElementHandler extends AbstractElementHandler {
|
||||||
if (AD_Ref_List_ID <= 0 && atts.getValue("AD_Ref_List_ID") != null && Integer.parseInt(atts.getValue("AD_Ref_List_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
if (AD_Ref_List_ID <= 0 && atts.getValue("AD_Ref_List_ID") != null && Integer.parseInt(atts.getValue("AD_Ref_List_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
||||||
m_Ref_List.setAD_Ref_List_ID(Integer.parseInt(atts.getValue("AD_Ref_List_ID")));
|
m_Ref_List.setAD_Ref_List_ID(Integer.parseInt(atts.getValue("AD_Ref_List_ID")));
|
||||||
if (AD_Ref_List_ID > 0) {
|
if (AD_Ref_List_ID > 0) {
|
||||||
AD_Backup_ID = copyRecord(ctx, "AD_Ref_List", m_Ref_List);
|
backupRecord(ctx, "AD_Ref_List", m_Ref_List);
|
||||||
Object_Status = "Update";
|
Object_Status = "Update";
|
||||||
} else {
|
} else {
|
||||||
Object_Status = "New";
|
Object_Status = "New";
|
||||||
AD_Backup_ID = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Ref_List.setAD_Reference_ID(AD_Reference_ID);
|
m_Ref_List.setAD_Reference_ID(AD_Reference_ID);
|
||||||
|
@ -81,12 +79,12 @@ public class ReferenceListElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
if (m_Ref_List.save(getTrxName(ctx)) == true) {
|
if (m_Ref_List.save(getTrxName(ctx)) == true) {
|
||||||
record_log(ctx, 1, m_Ref_List.getName(), "Reference List",
|
record_log(ctx, 1, m_Ref_List.getName(), "Reference List",
|
||||||
m_Ref_List.get_ID(), AD_Backup_ID, Object_Status,
|
m_Ref_List.get_ID(), Object_Status,
|
||||||
"AD_Ref_List", get_IDWithColumn(ctx, "AD_Table",
|
"AD_Ref_List", get_IDWithColumn(ctx, "AD_Table",
|
||||||
"TableName", "AD_Ref_List"));
|
"TableName", "AD_Ref_List"));
|
||||||
} else {
|
} else {
|
||||||
record_log(ctx, 0, m_Ref_List.getName(), "Reference List",
|
record_log(ctx, 0, m_Ref_List.getName(), "Reference List",
|
||||||
m_Ref_List.get_ID(), AD_Backup_ID, Object_Status,
|
m_Ref_List.get_ID(), Object_Status,
|
||||||
"AD_Ref_List", get_IDWithColumn(ctx, "AD_Table",
|
"AD_Ref_List", get_IDWithColumn(ctx, "AD_Table",
|
||||||
"TableName", "AD_Ref_List"));
|
"TableName", "AD_Ref_List"));
|
||||||
throw new POSaveFailedException("ReferenceList");
|
throw new POSaveFailedException("ReferenceList");
|
||||||
|
|
|
@ -42,8 +42,6 @@ public class ReferenceTableElementHandler extends AbstractElementHandler {
|
||||||
public void startElement(Properties ctx, Element element)
|
public void startElement(Properties ctx, Element element)
|
||||||
throws SAXException {
|
throws SAXException {
|
||||||
String elementValue = element.getElementValue();
|
String elementValue = element.getElementValue();
|
||||||
int AD_Backup_ID = -1;
|
|
||||||
String Object_Status = null;
|
|
||||||
|
|
||||||
log.info(elementValue);
|
log.info(elementValue);
|
||||||
Attributes atts = element.attributes;
|
Attributes atts = element.attributes;
|
||||||
|
@ -79,11 +77,11 @@ public class ReferenceTableElementHandler extends AbstractElementHandler {
|
||||||
m_Table.setTableName(atts.getValue("ADTableNameID"));
|
m_Table.setTableName(atts.getValue("ADTableNameID"));
|
||||||
if (m_Table.save(getTrxName(ctx)) == true) {
|
if (m_Table.save(getTrxName(ctx)) == true) {
|
||||||
record_log(ctx, 1, m_Table.getName(), "Table", m_Table
|
record_log(ctx, 1, m_Table.getName(), "Table", m_Table
|
||||||
.get_ID(), 0, "New", "AD_Table", get_IDWithColumn(
|
.get_ID(), "New", "AD_Table", get_IDWithColumn(
|
||||||
ctx, "AD_Table", "TableName", "AD_Table"));
|
ctx, "AD_Table", "TableName", "AD_Table"));
|
||||||
} else {
|
} else {
|
||||||
record_log(ctx, 0, m_Table.getName(), "Table", m_Table
|
record_log(ctx, 0, m_Table.getName(), "Table", m_Table
|
||||||
.get_ID(), 0, "New", "AD_Table", get_IDWithColumn(
|
.get_ID(), "New", "AD_Table", get_IDWithColumn(
|
||||||
ctx, "AD_Table", "TableName", "AD_Table"));
|
ctx, "AD_Table", "TableName", "AD_Table"));
|
||||||
}
|
}
|
||||||
tableId = get_IDWithColumn(ctx, "AD_Table", "TableName", atts
|
tableId = get_IDWithColumn(ctx, "AD_Table", "TableName", atts
|
||||||
|
@ -102,11 +100,11 @@ public class ReferenceTableElementHandler extends AbstractElementHandler {
|
||||||
m_Column.setAD_Reference_ID(30);
|
m_Column.setAD_Reference_ID(30);
|
||||||
if (m_Column.save(getTrxName(ctx)) == true) {
|
if (m_Column.save(getTrxName(ctx)) == true) {
|
||||||
record_log(ctx, 1, m_Column.getName(), "Column", m_Column
|
record_log(ctx, 1, m_Column.getName(), "Column", m_Column
|
||||||
.get_ID(), 0, "New", "AD_Column", get_IDWithColumn(
|
.get_ID(), "New", "AD_Column", get_IDWithColumn(
|
||||||
ctx, "AD_Table", "TableName", "AD_Column"));
|
ctx, "AD_Table", "TableName", "AD_Column"));
|
||||||
} else {
|
} else {
|
||||||
record_log(ctx, 0, m_Column.getName(), "Column", m_Column
|
record_log(ctx, 0, m_Column.getName(), "Column", m_Column
|
||||||
.get_ID(), 0, "New", "AD_Column", get_IDWithColumn(
|
.get_ID(), "New", "AD_Column", get_IDWithColumn(
|
||||||
ctx, "AD_Table", "TableName", "AD_Column"));
|
ctx, "AD_Table", "TableName", "AD_Column"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,11 +121,11 @@ public class ReferenceTableElementHandler extends AbstractElementHandler {
|
||||||
m_Column.setAD_Reference_ID(30);
|
m_Column.setAD_Reference_ID(30);
|
||||||
if (m_Column.save(getTrxName(ctx)) == true) {
|
if (m_Column.save(getTrxName(ctx)) == true) {
|
||||||
record_log(ctx, 1, m_Column.getName(), "Column", m_Column
|
record_log(ctx, 1, m_Column.getName(), "Column", m_Column
|
||||||
.get_ID(), 0, "New", "AD_Column", get_IDWithColumn(
|
.get_ID(), "New", "AD_Column", get_IDWithColumn(
|
||||||
ctx, "AD_Table", "TableName", "AD_Column"));
|
ctx, "AD_Table", "TableName", "AD_Column"));
|
||||||
} else {
|
} else {
|
||||||
record_log(ctx, 0, m_Column.getName(), "Column", m_Column
|
record_log(ctx, 0, m_Column.getName(), "Column", m_Column
|
||||||
.get_ID(), 0, "New", "AD_Column", get_IDWithColumn(
|
.get_ID(), "New", "AD_Column", get_IDWithColumn(
|
||||||
ctx, "AD_Table", "TableName", "AD_Column"));
|
ctx, "AD_Table", "TableName", "AD_Column"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -156,12 +154,12 @@ public class ReferenceTableElementHandler extends AbstractElementHandler {
|
||||||
int no = DB.executeUpdate(sqlB.toString(), getTrxName(ctx));
|
int no = DB.executeUpdate(sqlB.toString(), getTrxName(ctx));
|
||||||
if (no > 0) {
|
if (no > 0) {
|
||||||
record_log(ctx, 1, atts.getValue("ADRefenceNameID"),
|
record_log(ctx, 1, atts.getValue("ADRefenceNameID"),
|
||||||
"Reference Table", AD_Reference_ID, 0, "Update", "AD_Ref_Table",
|
"Reference Table", AD_Reference_ID, "Update", "AD_Ref_Table",
|
||||||
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
||||||
"AD_Ref_Table"));
|
"AD_Ref_Table"));
|
||||||
} else {
|
} else {
|
||||||
record_log(ctx, 0, atts.getValue("ADRefenceNameID"),
|
record_log(ctx, 0, atts.getValue("ADRefenceNameID"),
|
||||||
"Reference Table", AD_Reference_ID, 0, "Update", "AD_Ref_Table",
|
"Reference Table", AD_Reference_ID, "Update", "AD_Ref_Table",
|
||||||
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
||||||
"AD_Ref_Table"));
|
"AD_Ref_Table"));
|
||||||
throw new POSaveFailedException("ReferenceTable");
|
throw new POSaveFailedException("ReferenceTable");
|
||||||
|
@ -185,12 +183,12 @@ public class ReferenceTableElementHandler extends AbstractElementHandler {
|
||||||
int no = DB.executeUpdate(sqlB.toString(), getTrxName(ctx));
|
int no = DB.executeUpdate(sqlB.toString(), getTrxName(ctx));
|
||||||
if (no > 0) {
|
if (no > 0) {
|
||||||
record_log(ctx, 1, atts.getValue("ADRefenceNameID"),
|
record_log(ctx, 1, atts.getValue("ADRefenceNameID"),
|
||||||
"Reference Table", AD_Reference_ID, 0, "New", "AD_Ref_Table",
|
"Reference Table", AD_Reference_ID, "New", "AD_Ref_Table",
|
||||||
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
||||||
"AD_Ref_Table"));
|
"AD_Ref_Table"));
|
||||||
} else {
|
} else {
|
||||||
record_log(ctx, 0, atts.getValue("ADRefenceNameID"),
|
record_log(ctx, 0, atts.getValue("ADRefenceNameID"),
|
||||||
"Reference Table", AD_Reference_ID, 0, "New", "AD_Ref_Table",
|
"Reference Table", AD_Reference_ID, "New", "AD_Ref_Table",
|
||||||
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
||||||
"AD_Ref_Table"));
|
"AD_Ref_Table"));
|
||||||
throw new POSaveFailedException("ReferenceTable");
|
throw new POSaveFailedException("ReferenceTable");
|
||||||
|
|
|
@ -36,7 +36,6 @@ public class ReportViewColElementHandler extends AbstractElementHandler {
|
||||||
public void startElement(Properties ctx, Element element)
|
public void startElement(Properties ctx, Element element)
|
||||||
throws SAXException {
|
throws SAXException {
|
||||||
String elementValue = element.getElementValue();
|
String elementValue = element.getElementValue();
|
||||||
int AD_Backup_ID = -1;
|
|
||||||
String Object_Status = null;
|
String Object_Status = null;
|
||||||
|
|
||||||
Attributes atts = element.attributes;
|
Attributes atts = element.attributes;
|
||||||
|
@ -84,12 +83,11 @@ public class ReportViewColElementHandler extends AbstractElementHandler {
|
||||||
if (id <= 0 && atts.getValue("AD_ReportView_Col_ID") != null && Integer.parseInt(atts.getValue("AD_ReportView_Col_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
if (id <= 0 && atts.getValue("AD_ReportView_Col_ID") != null && Integer.parseInt(atts.getValue("AD_ReportView_Col_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
||||||
m_Reportview_Col.setAD_ReportView_Col_ID(Integer.parseInt(atts.getValue("AD_ReportView_Col_ID")));
|
m_Reportview_Col.setAD_ReportView_Col_ID(Integer.parseInt(atts.getValue("AD_ReportView_Col_ID")));
|
||||||
if (id > 0) {
|
if (id > 0) {
|
||||||
AD_Backup_ID = copyRecord(ctx, "AD_Reportview_Col",
|
backupRecord(ctx, "AD_Reportview_Col",
|
||||||
m_Reportview_Col);
|
m_Reportview_Col);
|
||||||
Object_Status = "Update";
|
Object_Status = "Update";
|
||||||
} else {
|
} else {
|
||||||
Object_Status = "New";
|
Object_Status = "New";
|
||||||
AD_Backup_ID = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isGroupFunction = Boolean.valueOf(
|
boolean isGroupFunction = Boolean.valueOf(
|
||||||
|
@ -110,13 +108,13 @@ public class ReportViewColElementHandler extends AbstractElementHandler {
|
||||||
if (m_Reportview_Col.save(getTrxName(ctx)) == true) {
|
if (m_Reportview_Col.save(getTrxName(ctx)) == true) {
|
||||||
record_log(ctx, 1, "" + m_Reportview_Col.getAD_ReportView_ID(),
|
record_log(ctx, 1, "" + m_Reportview_Col.getAD_ReportView_ID(),
|
||||||
"Reportview_Col", m_Reportview_Col.get_ID(),
|
"Reportview_Col", m_Reportview_Col.get_ID(),
|
||||||
AD_Backup_ID, Object_Status, "AD_Reportview_Col",
|
Object_Status, "AD_Reportview_Col",
|
||||||
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
||||||
"AD_Reportview_Col"));
|
"AD_Reportview_Col"));
|
||||||
} else {
|
} else {
|
||||||
record_log(ctx, 0, "" + m_Reportview_Col.getAD_ReportView_ID(),
|
record_log(ctx, 0, "" + m_Reportview_Col.getAD_ReportView_ID(),
|
||||||
"Reportview_Col", m_Reportview_Col.get_ID(),
|
"Reportview_Col", m_Reportview_Col.get_ID(),
|
||||||
AD_Backup_ID, Object_Status, "AD_Reportview_Col",
|
Object_Status, "AD_Reportview_Col",
|
||||||
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
||||||
"AD_Reportview_Col"));
|
"AD_Reportview_Col"));
|
||||||
throw new POSaveFailedException("ReportViewCol");
|
throw new POSaveFailedException("ReportViewCol");
|
||||||
|
|
|
@ -32,6 +32,7 @@ import org.adempiere.pipo.PackOut;
|
||||||
import org.adempiere.pipo.exception.DatabaseAccessException;
|
import org.adempiere.pipo.exception.DatabaseAccessException;
|
||||||
import org.adempiere.pipo.exception.POSaveFailedException;
|
import org.adempiere.pipo.exception.POSaveFailedException;
|
||||||
import org.compiere.model.MTable;
|
import org.compiere.model.MTable;
|
||||||
|
import org.compiere.model.X_AD_Package_Exp_Detail;
|
||||||
import org.compiere.model.X_AD_ReportView;
|
import org.compiere.model.X_AD_ReportView;
|
||||||
import org.compiere.model.X_AD_ReportView_Col;
|
import org.compiere.model.X_AD_ReportView_Col;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
|
@ -40,7 +41,7 @@ import org.xml.sax.Attributes;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import org.xml.sax.helpers.AttributesImpl;
|
import org.xml.sax.helpers.AttributesImpl;
|
||||||
|
|
||||||
public class ReportViewElementHandler extends AbstractElementHandler {
|
public class ReportViewElementHandler extends AbstractElementHandler implements IPackOutHandler{
|
||||||
|
|
||||||
private ReportViewColElementHandler columnHandler = new ReportViewColElementHandler();
|
private ReportViewColElementHandler columnHandler = new ReportViewColElementHandler();
|
||||||
|
|
||||||
|
@ -49,11 +50,9 @@ public class ReportViewElementHandler extends AbstractElementHandler {
|
||||||
public void startElement(Properties ctx, Element element)
|
public void startElement(Properties ctx, Element element)
|
||||||
throws SAXException {
|
throws SAXException {
|
||||||
String elementValue = element.getElementValue();
|
String elementValue = element.getElementValue();
|
||||||
int AD_Backup_ID = -1;
|
|
||||||
String Object_Status = null;
|
String Object_Status = null;
|
||||||
Attributes atts = element.attributes;
|
Attributes atts = element.attributes;
|
||||||
log.info(elementValue + " " + atts.getValue("ADReportviewnameID"));
|
log.info(elementValue + " " + atts.getValue("ADReportviewnameID"));
|
||||||
String entitytype = atts.getValue("EntityType");
|
|
||||||
String name = atts.getValue("ADReportviewnameID");
|
String name = atts.getValue("ADReportviewnameID");
|
||||||
|
|
||||||
int id = get_ID(ctx, "AD_ReportView", name);
|
int id = get_ID(ctx, "AD_ReportView", name);
|
||||||
|
@ -62,11 +61,10 @@ public class ReportViewElementHandler extends AbstractElementHandler {
|
||||||
if (id <= 0 && atts.getValue("AD_ReportView_ID") != null && Integer.parseInt(atts.getValue("AD_ReportView_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
if (id <= 0 && atts.getValue("AD_ReportView_ID") != null && Integer.parseInt(atts.getValue("AD_ReportView_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
||||||
m_Reportview.setAD_ReportView_ID(Integer.parseInt(atts.getValue("AD_ReportView_ID")));
|
m_Reportview.setAD_ReportView_ID(Integer.parseInt(atts.getValue("AD_ReportView_ID")));
|
||||||
if (id > 0) {
|
if (id > 0) {
|
||||||
AD_Backup_ID = copyRecord(ctx, "AD_Reportview", m_Reportview);
|
backupRecord(ctx, "AD_Reportview", m_Reportview);
|
||||||
Object_Status = "Update";
|
Object_Status = "Update";
|
||||||
} else {
|
} else {
|
||||||
Object_Status = "New";
|
Object_Status = "New";
|
||||||
AD_Backup_ID = 0;
|
|
||||||
}
|
}
|
||||||
String Name = atts.getValue("ADTableNameID");
|
String Name = atts.getValue("ADTableNameID");
|
||||||
id = get_IDWithColumn(ctx, "AD_Table", "TableName", Name);
|
id = get_IDWithColumn(ctx, "AD_Table", "TableName", Name);
|
||||||
|
@ -78,12 +76,12 @@ public class ReportViewElementHandler extends AbstractElementHandler {
|
||||||
m_Table.setTableName(Name);
|
m_Table.setTableName(Name);
|
||||||
if (m_Table.save(getTrxName(ctx)) == true) {
|
if (m_Table.save(getTrxName(ctx)) == true) {
|
||||||
record_log(ctx, 1, m_Table.getName(), "Table",
|
record_log(ctx, 1, m_Table.getName(), "Table",
|
||||||
m_Table.get_ID(), 0, "New", "AD_Table",
|
m_Table.get_ID(), "New", "AD_Table",
|
||||||
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
||||||
"AD_Table"));
|
"AD_Table"));
|
||||||
} else {
|
} else {
|
||||||
record_log(ctx, 0, m_Table.getName(), "Table",
|
record_log(ctx, 0, m_Table.getName(), "Table",
|
||||||
m_Table.get_ID(), 0, "New", "AD_Table",
|
m_Table.get_ID(), "New", "AD_Table",
|
||||||
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
||||||
"AD_Table"));
|
"AD_Table"));
|
||||||
}
|
}
|
||||||
|
@ -100,13 +98,13 @@ public class ReportViewElementHandler extends AbstractElementHandler {
|
||||||
m_Reportview.setWhereClause(getStringValue(atts,"WhereClause"));
|
m_Reportview.setWhereClause(getStringValue(atts,"WhereClause"));
|
||||||
if (m_Reportview.save(getTrxName(ctx)) == true) {
|
if (m_Reportview.save(getTrxName(ctx)) == true) {
|
||||||
record_log(ctx, 1, m_Reportview.getName(), "Reportview",
|
record_log(ctx, 1, m_Reportview.getName(), "Reportview",
|
||||||
m_Reportview.get_ID(), AD_Backup_ID, Object_Status,
|
m_Reportview.get_ID(), Object_Status,
|
||||||
"AD_Reportview", get_IDWithColumn(ctx, "AD_Table",
|
"AD_Reportview", get_IDWithColumn(ctx, "AD_Table",
|
||||||
"TableName", "AD_Reportview"));
|
"TableName", "AD_Reportview"));
|
||||||
element.recordId = m_Reportview.getAD_ReportView_ID();
|
element.recordId = m_Reportview.getAD_ReportView_ID();
|
||||||
} else {
|
} else {
|
||||||
record_log(ctx, 0, m_Reportview.getName(), "Reportview",
|
record_log(ctx, 0, m_Reportview.getName(), "Reportview",
|
||||||
m_Reportview.get_ID(), AD_Backup_ID, Object_Status,
|
m_Reportview.get_ID(), Object_Status,
|
||||||
"AD_Reportview", get_IDWithColumn(ctx, "AD_Table",
|
"AD_Reportview", get_IDWithColumn(ctx, "AD_Table",
|
||||||
"TableName", "AD_Reportview"));
|
"TableName", "AD_Reportview"));
|
||||||
throw new POSaveFailedException("ReportView");
|
throw new POSaveFailedException("ReportView");
|
||||||
|
@ -146,10 +144,11 @@ public class ReportViewElementHandler extends AbstractElementHandler {
|
||||||
ResultSet rs1 = pstmt1.executeQuery();
|
ResultSet rs1 = pstmt1.executeQuery();
|
||||||
while (rs1.next()) {
|
while (rs1.next()) {
|
||||||
// Export Table if neccessary
|
// Export Table if neccessary
|
||||||
packOut.createTable(rs1.getInt("AD_Table_ID"),
|
IPackOutHandler tableHandler = packOut.getHandler("T");
|
||||||
document);
|
tableHandler.packOut(packOut,null,rs1,document,null,0);
|
||||||
packOut.createPrintFormat(rs1
|
IPackOutHandler pftHandler = packOut.getHandler("PFT");
|
||||||
.getInt("AD_Printformat_ID"), document);
|
pftHandler.packOut(packOut,null,rs1,document,null,0);
|
||||||
|
|
||||||
}
|
}
|
||||||
rs1.close();
|
rs1.close();
|
||||||
pstmt1.close();
|
pstmt1.close();
|
||||||
|
@ -264,4 +263,15 @@ public class ReportViewElementHandler extends AbstractElementHandler {
|
||||||
.getWhereClause() : ""));
|
.getWhereClause() : ""));
|
||||||
return atts;
|
return atts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void packOut(PackOut packout, ResultSet header, ResultSet detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
|
||||||
|
{
|
||||||
|
if(recordId <= 0)
|
||||||
|
recordId = detail.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_ReportView_ID);
|
||||||
|
|
||||||
|
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_AD_ReportView_ID, recordId);
|
||||||
|
|
||||||
|
this.create(packout.getCtx(), packOutDocument);
|
||||||
|
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_AD_ReportView_ID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ import org.xml.sax.Attributes;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import org.xml.sax.helpers.AttributesImpl;
|
import org.xml.sax.helpers.AttributesImpl;
|
||||||
|
|
||||||
public class RoleElementHandler extends AbstractElementHandler {
|
public class RoleElementHandler extends AbstractElementHandler implements IPackOutHandler{
|
||||||
|
|
||||||
private List<Integer> roles = new ArrayList<Integer>();
|
private List<Integer> roles = new ArrayList<Integer>();
|
||||||
|
|
||||||
|
@ -69,16 +69,13 @@ public class RoleElementHandler extends AbstractElementHandler {
|
||||||
int id = get_ID(ctx, "AD_Role", name);
|
int id = get_ID(ctx, "AD_Role", name);
|
||||||
MRole m_Role = new MRole(ctx, id, getTrxName(ctx));
|
MRole m_Role = new MRole(ctx, id, getTrxName(ctx));
|
||||||
|
|
||||||
int AD_Backup_ID = -1;
|
|
||||||
String Object_Status = null;
|
String Object_Status = null;
|
||||||
if (id <= 0 && atts.getValue("AD_Role_ID") != null && Integer.parseInt(atts.getValue("AD_Role_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
if (id <= 0 && atts.getValue("AD_Role_ID") != null && Integer.parseInt(atts.getValue("AD_Role_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
||||||
m_Role.setAD_Role_ID(Integer.parseInt(atts.getValue("AD_Role_ID")));
|
m_Role.setAD_Role_ID(Integer.parseInt(atts.getValue("AD_Role_ID")));
|
||||||
if (id > 0) {
|
if (id > 0) {
|
||||||
AD_Backup_ID = copyRecord(ctx, "AD_Role", m_Role);
|
|
||||||
Object_Status = "Update";
|
Object_Status = "Update";
|
||||||
} else {
|
} else {
|
||||||
Object_Status = "New";
|
Object_Status = "New";
|
||||||
AD_Backup_ID = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Role.setName(name);
|
m_Role.setName(name);
|
||||||
|
@ -188,12 +185,12 @@ public class RoleElementHandler extends AbstractElementHandler {
|
||||||
if (m_Role.save(getTrxName(ctx)) == true) {
|
if (m_Role.save(getTrxName(ctx)) == true) {
|
||||||
|
|
||||||
record_log(ctx, 1, m_Role.getName(), "Role", m_Role.get_ID(),
|
record_log(ctx, 1, m_Role.getName(), "Role", m_Role.get_ID(),
|
||||||
AD_Backup_ID, Object_Status, "AD_Role", get_IDWithColumn(
|
Object_Status, "AD_Role", get_IDWithColumn(
|
||||||
ctx, "AD_Table", "TableName", "AD_Role"));
|
ctx, "AD_Table", "TableName", "AD_Role"));
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
record_log(ctx, 0, m_Role.getName(), "Role", m_Role.get_ID(),
|
record_log(ctx, 0, m_Role.getName(), "Role", m_Role.get_ID(),
|
||||||
AD_Backup_ID, Object_Status, "AD_Role", get_IDWithColumn(
|
Object_Status, "AD_Role", get_IDWithColumn(
|
||||||
ctx, "AD_Table", "TableName", "AD_Role"));
|
ctx, "AD_Table", "TableName", "AD_Role"));
|
||||||
throw new POSaveFailedException("Role");
|
throw new POSaveFailedException("Role");
|
||||||
}
|
}
|
||||||
|
@ -517,4 +514,15 @@ public class RoleElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
return atts;
|
return atts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void packOut(PackOut packout, ResultSet header, ResultSet detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
|
||||||
|
{
|
||||||
|
if(recordId <= 0)
|
||||||
|
recordId = detail.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Role_ID);
|
||||||
|
|
||||||
|
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_AD_Role_ID, recordId);
|
||||||
|
|
||||||
|
this.create(packout.getCtx(), packOutDocument);
|
||||||
|
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Role_ID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ package org.adempiere.pipo.handler;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
@ -26,6 +27,7 @@ import javax.xml.transform.sax.TransformerHandler;
|
||||||
|
|
||||||
import org.adempiere.pipo.AbstractElementHandler;
|
import org.adempiere.pipo.AbstractElementHandler;
|
||||||
import org.adempiere.pipo.Element;
|
import org.adempiere.pipo.Element;
|
||||||
|
import org.adempiere.pipo.PackOut;
|
||||||
import org.compiere.model.X_AD_Package_Exp_Detail;
|
import org.compiere.model.X_AD_Package_Exp_Detail;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
@ -33,13 +35,11 @@ import org.xml.sax.Attributes;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import org.xml.sax.helpers.AttributesImpl;
|
import org.xml.sax.helpers.AttributesImpl;
|
||||||
|
|
||||||
public class SQLStatementElementHandler extends AbstractElementHandler {
|
public class SQLStatementElementHandler extends AbstractElementHandler implements IPackOutHandler{
|
||||||
|
|
||||||
public void startElement(Properties ctx, Element element) throws SAXException {
|
public void startElement(Properties ctx, Element element) throws SAXException {
|
||||||
String elementValue = element.getElementValue();
|
String elementValue = element.getElementValue();
|
||||||
int AD_Backup_ID = -1;
|
|
||||||
String Object_Status = null;
|
|
||||||
|
|
||||||
log.info(elementValue);
|
log.info(elementValue);
|
||||||
Attributes atts = element.attributes;
|
Attributes atts = element.attributes;
|
||||||
String DBType = atts.getValue("DBType");
|
String DBType = atts.getValue("DBType");
|
||||||
|
@ -50,7 +50,7 @@ public class SQLStatementElementHandler extends AbstractElementHandler {
|
||||||
try {
|
try {
|
||||||
if(DBType.equals("ALL")) {
|
if(DBType.equals("ALL")) {
|
||||||
int n = pstmt.executeUpdate();
|
int n = pstmt.executeUpdate();
|
||||||
log.info("Executed SQL Statement: "+ atts.getValue("statement"));
|
log.info("Executed SQL Statement: "+ atts.getValue("statement") + " ReturnValue="+n);
|
||||||
}
|
}
|
||||||
else if(DB.isOracle() == true && DBType.equals("Oracle")) {
|
else if(DB.isOracle() == true && DBType.equals("Oracle")) {
|
||||||
pstmt.executeUpdate();
|
pstmt.executeUpdate();
|
||||||
|
@ -70,7 +70,7 @@ public class SQLStatementElementHandler extends AbstractElementHandler {
|
||||||
try {
|
try {
|
||||||
Statement stmt = m_con.createStatement();
|
Statement stmt = m_con.createStatement();
|
||||||
int n = stmt.executeUpdate (atts.getValue("statement"));
|
int n = stmt.executeUpdate (atts.getValue("statement"));
|
||||||
log.info("Executed SQL Statement for PostgreSQL: "+ atts.getValue("statement"));
|
log.info("Executed SQL Statement for PostgreSQL: "+ atts.getValue("statement") + " ReturnValue="+n);
|
||||||
// Postgres needs to commit DDL statements
|
// Postgres needs to commit DDL statements
|
||||||
if (m_con != null && !m_con.getAutoCommit())
|
if (m_con != null && !m_con.getAutoCommit())
|
||||||
m_con.commit();
|
m_con.commit();
|
||||||
|
@ -106,4 +106,13 @@ public class SQLStatementElementHandler extends AbstractElementHandler {
|
||||||
return atts;
|
return atts;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void packOut(PackOut packout, ResultSet header, ResultSet detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int field) throws Exception
|
||||||
|
{
|
||||||
|
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_SQLStatement, detail.getString(X_AD_Package_Exp_Detail.COLUMNNAME_SQLStatement));
|
||||||
|
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_DBType, detail.getString(X_AD_Package_Exp_Detail.COLUMNNAME_DBType));
|
||||||
|
this.create(packout.getCtx(), packOutDocument);
|
||||||
|
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_SQLStatement);
|
||||||
|
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_DBType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,15 +81,13 @@ public class TabElementHandler extends AbstractElementHandler {
|
||||||
MTab m_Tab = new MTab(ctx, id, getTrxName(ctx));
|
MTab m_Tab = new MTab(ctx, id, getTrxName(ctx));
|
||||||
if (id <= 0 && atts.getValue("AD_Tab_ID") != null && Integer.parseInt(atts.getValue("AD_Tab_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
if (id <= 0 && atts.getValue("AD_Tab_ID") != null && Integer.parseInt(atts.getValue("AD_Tab_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
||||||
m_Tab.setAD_Tab_ID(Integer.parseInt(atts.getValue("AD_Tab_ID")));
|
m_Tab.setAD_Tab_ID(Integer.parseInt(atts.getValue("AD_Tab_ID")));
|
||||||
int AD_Backup_ID = -1;
|
|
||||||
String Object_Status = null;
|
String Object_Status = null;
|
||||||
if (id > 0){
|
if (id > 0){
|
||||||
AD_Backup_ID = copyRecord(ctx, "AD_Tab",m_Tab);
|
backupRecord(ctx, "AD_Tab",m_Tab);
|
||||||
Object_Status = "Update";
|
Object_Status = "Update";
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Object_Status = "New";
|
Object_Status = "New";
|
||||||
AD_Backup_ID =0;
|
|
||||||
}
|
}
|
||||||
sqlB = null;
|
sqlB = null;
|
||||||
m_Tab.setName(name);
|
m_Tab.setName(name);
|
||||||
|
@ -170,10 +168,10 @@ public class TabElementHandler extends AbstractElementHandler {
|
||||||
m_Tab.setIsAdvancedTab(Boolean.valueOf(atts.getValue("isAdvancedTab")).booleanValue());
|
m_Tab.setIsAdvancedTab(Boolean.valueOf(atts.getValue("isAdvancedTab")).booleanValue());
|
||||||
}
|
}
|
||||||
if (m_Tab.save(getTrxName(ctx)) == true){
|
if (m_Tab.save(getTrxName(ctx)) == true){
|
||||||
record_log (ctx, 1, m_Tab.getName(),"Tab", m_Tab.get_ID(),AD_Backup_ID, Object_Status,"AD_Tab",get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_Tab"));
|
record_log (ctx, 1, m_Tab.getName(),"Tab", m_Tab.get_ID(),Object_Status,"AD_Tab",get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_Tab"));
|
||||||
element.recordId = m_Tab.getAD_Tab_ID();
|
element.recordId = m_Tab.getAD_Tab_ID();
|
||||||
} else {
|
} else {
|
||||||
record_log (ctx, 0, m_Tab.getName(),"Tab", m_Tab.get_ID(),AD_Backup_ID, Object_Status,"AD_Tab",get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_Tab"));
|
record_log (ctx, 0, m_Tab.getName(),"Tab", m_Tab.get_ID(),Object_Status,"AD_Tab",get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_Tab"));
|
||||||
throw new POSaveFailedException("Tab");
|
throw new POSaveFailedException("Tab");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -228,7 +226,15 @@ public class TabElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
if(m_Tab.getAD_Process_ID() > 0 )
|
if(m_Tab.getAD_Process_ID() > 0 )
|
||||||
{
|
{
|
||||||
packOut.createProcess(m_Tab.getAD_Process_ID(), document);
|
try
|
||||||
|
{
|
||||||
|
IPackOutHandler handler = packOut.getHandler("P");
|
||||||
|
handler.packOut(packOut,null,null,document,null,m_Tab.getAD_Process_ID());
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
log.info(e.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -327,5 +333,4 @@ public class TabElementHandler extends AbstractElementHandler {
|
||||||
atts.addAttribute("","","Syncfields","CDATA","false");
|
atts.addAttribute("","","Syncfields","CDATA","false");
|
||||||
return atts;
|
return atts;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ import org.xml.sax.Attributes;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import org.xml.sax.helpers.AttributesImpl;
|
import org.xml.sax.helpers.AttributesImpl;
|
||||||
|
|
||||||
public class TableElementHandler extends AbstractElementHandler {
|
public class TableElementHandler extends AbstractElementHandler implements IPackOutHandler{
|
||||||
private ColumnElementHandler columnHandler = new ColumnElementHandler();
|
private ColumnElementHandler columnHandler = new ColumnElementHandler();
|
||||||
|
|
||||||
private List<Integer>tables = new ArrayList<Integer>();
|
private List<Integer>tables = new ArrayList<Integer>();
|
||||||
|
@ -68,15 +68,13 @@ public class TableElementHandler extends AbstractElementHandler {
|
||||||
MTable m_Table = new MTable(ctx, id, getTrxName(ctx));
|
MTable m_Table = new MTable(ctx, id, getTrxName(ctx));
|
||||||
if (id <= 0 && atts.getValue("AD_Table_ID") != null && Integer.parseInt(atts.getValue("AD_Table_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
if (id <= 0 && atts.getValue("AD_Table_ID") != null && Integer.parseInt(atts.getValue("AD_Table_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
||||||
m_Table.setAD_Table_ID(Integer.parseInt(atts.getValue("AD_Table_ID")));
|
m_Table.setAD_Table_ID(Integer.parseInt(atts.getValue("AD_Table_ID")));
|
||||||
int AD_Backup_ID = -1;
|
|
||||||
String Object_Status = null;
|
String Object_Status = null;
|
||||||
if (id > 0){
|
if (id > 0){
|
||||||
AD_Backup_ID = copyRecord(ctx, "AD_Table",m_Table);
|
backupRecord(ctx, "AD_Table",m_Table);
|
||||||
Object_Status = "Update";
|
Object_Status = "Update";
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Object_Status = "New";
|
Object_Status = "New";
|
||||||
AD_Backup_ID =0;
|
|
||||||
}
|
}
|
||||||
m_Table.setTableName(tableName);
|
m_Table.setTableName(tableName);
|
||||||
String Name = atts.getValue("ADWindowNameID");
|
String Name = atts.getValue("ADWindowNameID");
|
||||||
|
@ -109,13 +107,13 @@ public class TableElementHandler extends AbstractElementHandler {
|
||||||
m_Table.setReplicationType(getStringValue(atts,"ReplicationType"));
|
m_Table.setReplicationType(getStringValue(atts,"ReplicationType"));
|
||||||
m_Table.setTableName(atts.getValue("TableName"));
|
m_Table.setTableName(atts.getValue("TableName"));
|
||||||
if (m_Table.save(getTrxName(ctx)) == true){
|
if (m_Table.save(getTrxName(ctx)) == true){
|
||||||
record_log (ctx, 1, m_Table.getName(),"Table", m_Table.get_ID(),AD_Backup_ID, Object_Status,"AD_Table",get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_Table"));
|
record_log (ctx, 1, m_Table.getName(),"Table", m_Table.get_ID(),Object_Status,"AD_Table",get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_Table"));
|
||||||
tables.add(m_Table.getAD_Table_ID());
|
tables.add(m_Table.getAD_Table_ID());
|
||||||
packIn.addTable(tableName, m_Table.getAD_Table_ID());
|
packIn.addTable(tableName, m_Table.getAD_Table_ID());
|
||||||
element.recordId = m_Table.getAD_Table_ID();
|
element.recordId = m_Table.getAD_Table_ID();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
record_log (ctx, 0, m_Table.getName(),"Table", m_Table.get_ID(),AD_Backup_ID, Object_Status,"AD_Table",get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_Table"));
|
record_log (ctx, 0, m_Table.getName(),"Table", m_Table.get_ID(),Object_Status,"AD_Table",get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_Table"));
|
||||||
throw new POSaveFailedException("Table");
|
throw new POSaveFailedException("Table");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -162,21 +160,33 @@ public class TableElementHandler extends AbstractElementHandler {
|
||||||
ResultSet rs1 = pstmt1.executeQuery();
|
ResultSet rs1 = pstmt1.executeQuery();
|
||||||
|
|
||||||
while (rs1.next()){
|
while (rs1.next()){
|
||||||
|
IPackOutHandler handler = packOut.getHandler("ELE");
|
||||||
|
handler.packOut(packOut,null,rs1,document,null,0);
|
||||||
|
|
||||||
packOut.createAdElement(rs1.getInt("AD_Element_ID"), document);
|
if (rs1.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Reference_ID)>0)
|
||||||
|
{
|
||||||
if (rs1.getInt("AD_Reference_ID")>0)
|
handler = packOut.getHandler("REF");
|
||||||
packOut.createReference (rs1.getInt("AD_Reference_ID"), document);
|
handler.packOut(packOut,null,rs1,document,null,0);
|
||||||
|
}
|
||||||
|
|
||||||
if (rs1.getInt("AD_Reference_Value_ID")>0)
|
if (rs1.getInt("AD_Reference_Value_ID")>0)
|
||||||
packOut.createReference (rs1.getInt("AD_Reference_Value_ID"), document);
|
{
|
||||||
|
handler = packOut.getHandler("REF");
|
||||||
|
handler.packOut(packOut,null,null,document,null,rs1.getInt("AD_Reference_Value_ID"));
|
||||||
|
}
|
||||||
|
|
||||||
if (rs1.getInt("AD_Process_ID")>0)
|
if (rs1.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Process_ID)>0)
|
||||||
packOut.createProcess (rs1.getInt("AD_Process_ID"), document);
|
{
|
||||||
|
handler = packOut.getHandler("P");
|
||||||
|
handler.packOut(packOut,null,rs1,document,null,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rs1.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Val_Rule_ID)>0)
|
||||||
|
{
|
||||||
|
handler = packOut.getHandler("V");
|
||||||
|
handler.packOut(packOut,rs,rs1,document,null,0);
|
||||||
|
}
|
||||||
|
|
||||||
if (rs1.getInt("AD_Val_Rule_ID")>0)
|
|
||||||
packOut.createDynamicRuleValidation (rs1.getInt("AD_Val_Rule_ID"), document);
|
|
||||||
|
|
||||||
createColumn(ctx, document, rs1.getInt("AD_Column_ID"));
|
createColumn(ctx, document, rs1.getInt("AD_Column_ID"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,4 +294,15 @@ public class TableElementHandler extends AbstractElementHandler {
|
||||||
atts.addAttribute("","","TableName","CDATA",(m_Table.getTableName () != null ? m_Table.getTableName ():""));
|
atts.addAttribute("","","TableName","CDATA",(m_Table.getTableName () != null ? m_Table.getTableName ():""));
|
||||||
return atts;
|
return atts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void packOut(PackOut packout, ResultSet header, ResultSet detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
|
||||||
|
{
|
||||||
|
if(recordId <= 0)
|
||||||
|
recordId = detail.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Table_ID);
|
||||||
|
|
||||||
|
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_AD_Table_ID, recordId);
|
||||||
|
|
||||||
|
this.create(packout.getCtx(), packOutDocument);
|
||||||
|
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Table_ID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
. * Product: Adempiere ERP & CRM Smart Business Solution *
|
||||||
* Copyright (C) 1999-2006 Adempiere, Inc. All Rights Reserved. *
|
* Copyright (C) 1999-2006 Adempiere, Inc. All Rights Reserved. *
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* This program is free software; you can redistribute it and/or modify it *
|
||||||
* under the terms version 2 of the GNU General Public License as published *
|
* under the terms version 2 of the GNU General Public License as published *
|
||||||
|
@ -16,6 +16,7 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.adempiere.pipo.handler;
|
package org.adempiere.pipo.handler;
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
@ -34,7 +35,9 @@ import org.xml.sax.Attributes;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import org.xml.sax.helpers.AttributesImpl;
|
import org.xml.sax.helpers.AttributesImpl;
|
||||||
|
|
||||||
public class TaskElementHandler extends AbstractElementHandler {
|
import java.sql.ResultSet;
|
||||||
|
|
||||||
|
public class TaskElementHandler extends AbstractElementHandler implements IPackOutHandler{
|
||||||
|
|
||||||
private List<Integer> tasks = new ArrayList<Integer>();
|
private List<Integer> tasks = new ArrayList<Integer>();
|
||||||
|
|
||||||
|
@ -48,16 +51,14 @@ public class TaskElementHandler extends AbstractElementHandler {
|
||||||
String name = atts.getValue("ADTaskNameID");
|
String name = atts.getValue("ADTaskNameID");
|
||||||
int id = get_ID(ctx, "AD_Task", name);
|
int id = get_ID(ctx, "AD_Task", name);
|
||||||
MTask m_Task = new MTask(ctx, id, getTrxName(ctx));
|
MTask m_Task = new MTask(ctx, id, getTrxName(ctx));
|
||||||
int AD_Backup_ID = -1;
|
|
||||||
String Object_Status = null;
|
String Object_Status = null;
|
||||||
if (id <= 0 && atts.getValue("AD_Task_ID") != null && Integer.parseInt(atts.getValue("AD_Task_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
if (id <= 0 && atts.getValue("AD_Task_ID") != null && Integer.parseInt(atts.getValue("AD_Task_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
||||||
m_Task.setAD_Task_ID(Integer.parseInt(atts.getValue("AD_Task_ID")));
|
m_Task.setAD_Task_ID(Integer.parseInt(atts.getValue("AD_Task_ID")));
|
||||||
if (id > 0) {
|
if (id > 0) {
|
||||||
AD_Backup_ID = copyRecord(ctx, "AD_Task", m_Task);
|
backupRecord(ctx, "AD_Task", m_Task);
|
||||||
Object_Status = "Update";
|
Object_Status = "Update";
|
||||||
} else {
|
} else {
|
||||||
Object_Status = "New";
|
Object_Status = "New";
|
||||||
AD_Backup_ID = 0;
|
|
||||||
}
|
}
|
||||||
m_Task.setAccessLevel(atts.getValue("AccessLevel"));
|
m_Task.setAccessLevel(atts.getValue("AccessLevel"));
|
||||||
m_Task.setDescription(getStringValue(atts,"Description"));
|
m_Task.setDescription(getStringValue(atts,"Description"));
|
||||||
|
@ -69,12 +70,12 @@ public class TaskElementHandler extends AbstractElementHandler {
|
||||||
m_Task.setOS_Command(getStringValue(atts,"OS_Command"));
|
m_Task.setOS_Command(getStringValue(atts,"OS_Command"));
|
||||||
if (m_Task.save(getTrxName(ctx)) == true) {
|
if (m_Task.save(getTrxName(ctx)) == true) {
|
||||||
record_log(ctx, 1, m_Task.getName(), "Task", m_Task.get_ID(),
|
record_log(ctx, 1, m_Task.getName(), "Task", m_Task.get_ID(),
|
||||||
AD_Backup_ID, Object_Status, "AD_Task",
|
Object_Status, "AD_Task",
|
||||||
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
||||||
"AD_Task"));
|
"AD_Task"));
|
||||||
} else {
|
} else {
|
||||||
record_log(ctx, 0, m_Task.getName(), "Task", m_Task.get_ID(),
|
record_log(ctx, 0, m_Task.getName(), "Task", m_Task.get_ID(),
|
||||||
AD_Backup_ID, Object_Status, "AD_Task",
|
Object_Status, "AD_Task",
|
||||||
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
||||||
"AD_Task"));
|
"AD_Task"));
|
||||||
throw new POSaveFailedException("Task");
|
throw new POSaveFailedException("Task");
|
||||||
|
@ -135,5 +136,15 @@ public class TaskElementHandler extends AbstractElementHandler {
|
||||||
.getOS_Command() != null ? m_Task.getOS_Command() : ""));
|
.getOS_Command() != null ? m_Task.getOS_Command() : ""));
|
||||||
return atts;
|
return atts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void packOut(PackOut packout, ResultSet header, ResultSet detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
|
||||||
|
{
|
||||||
|
if(recordId <= 0)
|
||||||
|
recordId = detail.getInt(X_AD_Task.COLUMNNAME_AD_Task_ID);
|
||||||
|
|
||||||
|
Env.setContext(packout.getCtx(), X_AD_Task.COLUMNNAME_AD_Task_ID, recordId);
|
||||||
|
|
||||||
|
this.create(packout.getCtx(), packOutDocument);
|
||||||
|
packout.getCtx().remove(X_AD_Task.COLUMNNAME_AD_Task_ID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ import org.adempiere.pipo.PackOut;
|
||||||
import org.adempiere.pipo.exception.DatabaseAccessException;
|
import org.adempiere.pipo.exception.DatabaseAccessException;
|
||||||
import org.adempiere.pipo.exception.POSaveFailedException;
|
import org.adempiere.pipo.exception.POSaveFailedException;
|
||||||
import org.compiere.model.MWindow;
|
import org.compiere.model.MWindow;
|
||||||
|
import org.compiere.model.X_AD_Package_Exp_Detail;
|
||||||
import org.compiere.model.X_AD_Preference;
|
import org.compiere.model.X_AD_Preference;
|
||||||
import org.compiere.model.X_AD_Tab;
|
import org.compiere.model.X_AD_Tab;
|
||||||
import org.compiere.model.X_AD_Window;
|
import org.compiere.model.X_AD_Window;
|
||||||
|
@ -41,7 +42,7 @@ import org.xml.sax.Attributes;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import org.xml.sax.helpers.AttributesImpl;
|
import org.xml.sax.helpers.AttributesImpl;
|
||||||
|
|
||||||
public class WindowElementHandler extends AbstractElementHandler {
|
public class WindowElementHandler extends AbstractElementHandler implements IPackOutHandler{
|
||||||
|
|
||||||
private TabElementHandler tabHandler = new TabElementHandler();
|
private TabElementHandler tabHandler = new TabElementHandler();
|
||||||
private PreferenceElementHandler preferenceHandler = new PreferenceElementHandler();
|
private PreferenceElementHandler preferenceHandler = new PreferenceElementHandler();
|
||||||
|
@ -65,13 +66,11 @@ public class WindowElementHandler extends AbstractElementHandler {
|
||||||
if (id <= 0 && atts.getValue("AD_Window_ID") != null && Integer.parseInt(atts.getValue("AD_Window_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
if (id <= 0 && atts.getValue("AD_Window_ID") != null && Integer.parseInt(atts.getValue("AD_Window_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
||||||
m_Window.setAD_Window_ID(Integer.parseInt(atts.getValue("AD_Window_ID")));
|
m_Window.setAD_Window_ID(Integer.parseInt(atts.getValue("AD_Window_ID")));
|
||||||
String Object_Status = null;
|
String Object_Status = null;
|
||||||
int AD_Backup_ID = -1;
|
|
||||||
if (id > 0) {
|
if (id > 0) {
|
||||||
AD_Backup_ID = copyRecord(ctx, "AD_Window", m_Window);
|
backupRecord(ctx, "AD_Window", m_Window);
|
||||||
Object_Status = "Update";
|
Object_Status = "Update";
|
||||||
} else {
|
} else {
|
||||||
Object_Status = "New";
|
Object_Status = "New";
|
||||||
AD_Backup_ID = 0;
|
|
||||||
}
|
}
|
||||||
m_Window.setName(name);
|
m_Window.setName(name);
|
||||||
|
|
||||||
|
@ -120,14 +119,14 @@ public class WindowElementHandler extends AbstractElementHandler {
|
||||||
m_Window.setWindowType(atts.getValue("WindowType"));
|
m_Window.setWindowType(atts.getValue("WindowType"));
|
||||||
if (m_Window.save(getTrxName(ctx)) == true) {
|
if (m_Window.save(getTrxName(ctx)) == true) {
|
||||||
record_log(ctx, 1, m_Window.getName(), "Window", m_Window
|
record_log(ctx, 1, m_Window.getName(), "Window", m_Window
|
||||||
.get_ID(), AD_Backup_ID, Object_Status, "AD_Window",
|
.get_ID(), Object_Status, "AD_Window",
|
||||||
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
||||||
"AD_Window"));
|
"AD_Window"));
|
||||||
element.recordId = m_Window.getAD_Window_ID();
|
element.recordId = m_Window.getAD_Window_ID();
|
||||||
windows.add(m_Window.getAD_Window_ID());
|
windows.add(m_Window.getAD_Window_ID());
|
||||||
} else {
|
} else {
|
||||||
record_log(ctx, 0, m_Window.getName(), "Window", m_Window
|
record_log(ctx, 0, m_Window.getName(), "Window", m_Window
|
||||||
.get_ID(), AD_Backup_ID, Object_Status, "AD_Window",
|
.get_ID(), Object_Status, "AD_Window",
|
||||||
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
||||||
"AD_Window"));
|
"AD_Window"));
|
||||||
throw new POSaveFailedException("Window");
|
throw new POSaveFailedException("Window");
|
||||||
|
@ -157,12 +156,9 @@ public class WindowElementHandler extends AbstractElementHandler {
|
||||||
try {
|
try {
|
||||||
ResultSet rs = pstmt.executeQuery();
|
ResultSet rs = pstmt.executeQuery();
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
String tableSql = "SELECT Name FROM AD_Table WHERE AD_Table_ID=?";
|
IPackOutHandler handler = packOut.getHandler("T");
|
||||||
int table_id = rs.getInt("AD_TABLE_ID");
|
handler.packOut(packOut,null,rs,document,null,0);
|
||||||
String name = rs.getString("NAME");
|
|
||||||
String tablename = DB.getSQLValueString(null, tableSql,
|
|
||||||
table_id);
|
|
||||||
packOut.createTable(rs.getInt("AD_Table_ID"), document);
|
|
||||||
createTab(ctx, document, rs.getInt("AD_Tab_ID"));
|
createTab(ctx, document, rs.getInt("AD_Tab_ID"));
|
||||||
}
|
}
|
||||||
rs.close();
|
rs.close();
|
||||||
|
@ -299,4 +295,15 @@ public class WindowElementHandler extends AbstractElementHandler {
|
||||||
.getWindowType() != null ? m_Window.getWindowType() : ""));
|
.getWindowType() != null ? m_Window.getWindowType() : ""));
|
||||||
return atts;
|
return atts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void packOut(PackOut packout, ResultSet header, ResultSet detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
|
||||||
|
{
|
||||||
|
if(recordId <= 0)
|
||||||
|
recordId = detail.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Window_ID);
|
||||||
|
|
||||||
|
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_AD_Window_ID, recordId);
|
||||||
|
|
||||||
|
this.create(packout.getCtx(), packOutDocument);
|
||||||
|
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Window_ID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ import org.xml.sax.Attributes;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import org.xml.sax.helpers.AttributesImpl;
|
import org.xml.sax.helpers.AttributesImpl;
|
||||||
|
|
||||||
public class WorkflowElementHandler extends AbstractElementHandler {
|
public class WorkflowElementHandler extends AbstractElementHandler implements IPackOutHandler{
|
||||||
|
|
||||||
private WorkflowNodeElementHandler nodeHandler = new WorkflowNodeElementHandler();
|
private WorkflowNodeElementHandler nodeHandler = new WorkflowNodeElementHandler();
|
||||||
private WorkflowNodeNextElementHandler nodeNextHandler = new WorkflowNodeNextElementHandler();
|
private WorkflowNodeNextElementHandler nodeNextHandler = new WorkflowNodeNextElementHandler();
|
||||||
|
@ -71,16 +71,14 @@ public class WorkflowElementHandler extends AbstractElementHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
MWorkflow m_Workflow = new MWorkflow(ctx, id, getTrxName(ctx));
|
MWorkflow m_Workflow = new MWorkflow(ctx, id, getTrxName(ctx));
|
||||||
int AD_Backup_ID = -1;
|
|
||||||
String Object_Status = null;
|
String Object_Status = null;
|
||||||
if (id <= 0 && atts.getValue("AD_Workflow_ID") != null && Integer.parseInt(atts.getValue("AD_Workflow_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
if (id <= 0 && atts.getValue("AD_Workflow_ID") != null && Integer.parseInt(atts.getValue("AD_Workflow_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
||||||
m_Workflow.setAD_Workflow_ID(Integer.parseInt(atts.getValue("AD_Workflow_ID")));
|
m_Workflow.setAD_Workflow_ID(Integer.parseInt(atts.getValue("AD_Workflow_ID")));
|
||||||
if (id > 0) {
|
if (id > 0) {
|
||||||
AD_Backup_ID = copyRecord(ctx, "AD_Workflow", m_Workflow);
|
backupRecord(ctx, "AD_Workflow", m_Workflow);
|
||||||
Object_Status = "Update";
|
Object_Status = "Update";
|
||||||
} else {
|
} else {
|
||||||
Object_Status = "New";
|
Object_Status = "New";
|
||||||
AD_Backup_ID = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String name = atts.getValue("ADWorkflowResponsibleNameID");
|
String name = atts.getValue("ADWorkflowResponsibleNameID");
|
||||||
|
@ -152,7 +150,7 @@ public class WorkflowElementHandler extends AbstractElementHandler {
|
||||||
if (m_Workflow.save(getTrxName(ctx)) == true) {
|
if (m_Workflow.save(getTrxName(ctx)) == true) {
|
||||||
log.info("m_Workflow save success");
|
log.info("m_Workflow save success");
|
||||||
record_log(ctx, 1, m_Workflow.getName(), "Workflow", m_Workflow
|
record_log(ctx, 1, m_Workflow.getName(), "Workflow", m_Workflow
|
||||||
.get_ID(), AD_Backup_ID, Object_Status, "AD_Workflow",
|
.get_ID(), Object_Status, "AD_Workflow",
|
||||||
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
||||||
"AD_Workflow"));
|
"AD_Workflow"));
|
||||||
workflows.add(m_Workflow.getAD_Workflow_ID());
|
workflows.add(m_Workflow.getAD_Workflow_ID());
|
||||||
|
@ -160,7 +158,7 @@ public class WorkflowElementHandler extends AbstractElementHandler {
|
||||||
} else {
|
} else {
|
||||||
log.info("m_Workflow save failure");
|
log.info("m_Workflow save failure");
|
||||||
record_log(ctx, 0, m_Workflow.getName(), "Workflow", m_Workflow
|
record_log(ctx, 0, m_Workflow.getName(), "Workflow", m_Workflow
|
||||||
.get_ID(), AD_Backup_ID, Object_Status, "AD_Workflow",
|
.get_ID(), Object_Status, "AD_Workflow",
|
||||||
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
||||||
"AD_Workflow"));
|
"AD_Workflow"));
|
||||||
throw new POSaveFailedException("MWorkflow");
|
throw new POSaveFailedException("MWorkflow");
|
||||||
|
@ -191,7 +189,7 @@ public class WorkflowElementHandler extends AbstractElementHandler {
|
||||||
if (m_Workflow.save(getTrxName(ctx)) == true) {
|
if (m_Workflow.save(getTrxName(ctx)) == true) {
|
||||||
log.info("m_Workflow update success");
|
log.info("m_Workflow update success");
|
||||||
record_log(ctx, 1, m_Workflow.getName(), "Workflow", m_Workflow
|
record_log(ctx, 1, m_Workflow.getName(), "Workflow", m_Workflow
|
||||||
.get_ID(), 0, "Update", "AD_Workflow",
|
.get_ID(), "Update", "AD_Workflow",
|
||||||
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
||||||
"AD_Workflow"));
|
"AD_Workflow"));
|
||||||
workflows.add(m_Workflow.getAD_Workflow_ID());
|
workflows.add(m_Workflow.getAD_Workflow_ID());
|
||||||
|
@ -199,7 +197,7 @@ public class WorkflowElementHandler extends AbstractElementHandler {
|
||||||
} else {
|
} else {
|
||||||
log.info("m_Workflow update fail");
|
log.info("m_Workflow update fail");
|
||||||
record_log(ctx, 0, m_Workflow.getName(), "Workflow", m_Workflow
|
record_log(ctx, 0, m_Workflow.getName(), "Workflow", m_Workflow
|
||||||
.get_ID(), 0, "Update", "AD_Workflow",
|
.get_ID(), "Update", "AD_Workflow",
|
||||||
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
||||||
"AD_Workflow"));
|
"AD_Workflow"));
|
||||||
throw new POSaveFailedException("MWorkflow");
|
throw new POSaveFailedException("MWorkflow");
|
||||||
|
@ -222,7 +220,7 @@ public class WorkflowElementHandler extends AbstractElementHandler {
|
||||||
if (m_Workflow.save(getTrxName(ctx)) == true) {
|
if (m_Workflow.save(getTrxName(ctx)) == true) {
|
||||||
log.info("m_Workflow update success");
|
log.info("m_Workflow update success");
|
||||||
record_log(ctx, 1, m_Workflow.getName(), "Workflow", m_Workflow
|
record_log(ctx, 1, m_Workflow.getName(), "Workflow", m_Workflow
|
||||||
.get_ID(), 0, "Update", "AD_Workflow",
|
.get_ID(), "Update", "AD_Workflow",
|
||||||
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
||||||
"AD_Workflow"));
|
"AD_Workflow"));
|
||||||
workflows.add(m_Workflow.getAD_Workflow_ID());
|
workflows.add(m_Workflow.getAD_Workflow_ID());
|
||||||
|
@ -230,7 +228,7 @@ public class WorkflowElementHandler extends AbstractElementHandler {
|
||||||
} else {
|
} else {
|
||||||
log.info("m_Workflow update fail");
|
log.info("m_Workflow update fail");
|
||||||
record_log(ctx, 0, m_Workflow.getName(), "Workflow", m_Workflow
|
record_log(ctx, 0, m_Workflow.getName(), "Workflow", m_Workflow
|
||||||
.get_ID(), 0, "Update", "AD_Workflow",
|
.get_ID(), "Update", "AD_Workflow",
|
||||||
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
||||||
"AD_Workflow"));
|
"AD_Workflow"));
|
||||||
throw new POSaveFailedException("MWorkflow");
|
throw new POSaveFailedException("MWorkflow");
|
||||||
|
@ -465,4 +463,16 @@ public class WorkflowElementHandler extends AbstractElementHandler {
|
||||||
// != null ? ""+m_Workflow.getSetupTime():""));
|
// != null ? ""+m_Workflow.getSetupTime():""));
|
||||||
return atts;
|
return atts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void packOut(PackOut packout, ResultSet header, ResultSet detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
|
||||||
|
{
|
||||||
|
if(recordId <= 0)
|
||||||
|
recordId = detail.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Workflow_ID);
|
||||||
|
|
||||||
|
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_AD_Workflow_ID, recordId);
|
||||||
|
|
||||||
|
this.create(packout.getCtx(), packOutDocument);
|
||||||
|
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Workflow_ID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,16 +81,14 @@ public class WorkflowNodeElementHandler extends AbstractElementHandler {
|
||||||
workflowId, workflowNodeName);
|
workflowId, workflowNodeName);
|
||||||
|
|
||||||
X_AD_WF_Node m_WFNode = new X_AD_WF_Node(ctx, id, getTrxName(ctx));
|
X_AD_WF_Node m_WFNode = new X_AD_WF_Node(ctx, id, getTrxName(ctx));
|
||||||
int AD_Backup_ID = -1;
|
|
||||||
String Object_Status = null;
|
String Object_Status = null;
|
||||||
if (id <= 0 && atts.getValue("AD_WF_Node_ID") != null && Integer.parseInt(atts.getValue("AD_WF_Node_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
if (id <= 0 && atts.getValue("AD_WF_Node_ID") != null && Integer.parseInt(atts.getValue("AD_WF_Node_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
||||||
m_WFNode.setAD_WF_Node_ID(Integer.parseInt(atts.getValue("AD_WF_Node_ID")));
|
m_WFNode.setAD_WF_Node_ID(Integer.parseInt(atts.getValue("AD_WF_Node_ID")));
|
||||||
if (id > 0) {
|
if (id > 0) {
|
||||||
AD_Backup_ID = copyRecord(ctx, "AD_WF_Node", m_WFNode);
|
backupRecord(ctx, "AD_WF_Node", m_WFNode);
|
||||||
Object_Status = "Update";
|
Object_Status = "Update";
|
||||||
} else {
|
} else {
|
||||||
Object_Status = "New";
|
Object_Status = "New";
|
||||||
AD_Backup_ID = 0;
|
|
||||||
}
|
}
|
||||||
m_WFNode.setValue(atts.getValue("Value"));
|
m_WFNode.setValue(atts.getValue("Value"));
|
||||||
m_WFNode.setName(workflowNodeName);
|
m_WFNode.setName(workflowNodeName);
|
||||||
|
@ -230,13 +228,13 @@ public class WorkflowNodeElementHandler extends AbstractElementHandler {
|
||||||
if (m_WFNode.save(getTrxName(ctx)) == true) {
|
if (m_WFNode.save(getTrxName(ctx)) == true) {
|
||||||
log.info("m_WFNode save success");
|
log.info("m_WFNode save success");
|
||||||
record_log(ctx, 1, m_WFNode.getName(), "WFNode", m_WFNode
|
record_log(ctx, 1, m_WFNode.getName(), "WFNode", m_WFNode
|
||||||
.get_ID(), AD_Backup_ID, Object_Status, "AD_WF_Node",
|
.get_ID(), Object_Status, "AD_WF_Node",
|
||||||
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
||||||
"AD_WF_Node"));
|
"AD_WF_Node"));
|
||||||
} else {
|
} else {
|
||||||
log.info("m_WFNode save failure");
|
log.info("m_WFNode save failure");
|
||||||
record_log(ctx, 0, m_WFNode.getName(), "WFNode", m_WFNode
|
record_log(ctx, 0, m_WFNode.getName(), "WFNode", m_WFNode
|
||||||
.get_ID(), AD_Backup_ID, Object_Status, "AD_WF_Node",
|
.get_ID(), Object_Status, "AD_WF_Node",
|
||||||
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
||||||
"AD_WF_Node"));
|
"AD_WF_Node"));
|
||||||
throw new POSaveFailedException("WorkflowNode");
|
throw new POSaveFailedException("WorkflowNode");
|
||||||
|
|
|
@ -92,17 +92,15 @@ public class WorkflowNodeNextConditionElementHandler extends
|
||||||
|
|
||||||
MWFNextCondition m_WFNodeNextCondition = new MWFNextCondition(ctx,
|
MWFNextCondition m_WFNodeNextCondition = new MWFNextCondition(ctx,
|
||||||
id, getTrxName(ctx));
|
id, getTrxName(ctx));
|
||||||
int AD_Backup_ID = -1;
|
|
||||||
String Object_Status = null;
|
String Object_Status = null;
|
||||||
if (id <= 0 && atts.getValue("AD_WF_NextCondition_ID") != null && Integer.parseInt(atts.getValue("AD_WF_NextCondition_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
if (id <= 0 && atts.getValue("AD_WF_NextCondition_ID") != null && Integer.parseInt(atts.getValue("AD_WF_NextCondition_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
||||||
m_WFNodeNextCondition.setAD_WF_NextCondition_ID(Integer.parseInt(atts.getValue("AD_WF_NextCondition_ID")));
|
m_WFNodeNextCondition.setAD_WF_NextCondition_ID(Integer.parseInt(atts.getValue("AD_WF_NextCondition_ID")));
|
||||||
if (id > 0) {
|
if (id > 0) {
|
||||||
AD_Backup_ID = copyRecord(ctx, "AD_WF_NextCondition",
|
backupRecord(ctx, "AD_WF_NextCondition",
|
||||||
m_WFNodeNextCondition);
|
m_WFNodeNextCondition);
|
||||||
Object_Status = "Update";
|
Object_Status = "Update";
|
||||||
} else {
|
} else {
|
||||||
Object_Status = "New";
|
Object_Status = "New";
|
||||||
AD_Backup_ID = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sqlB = new StringBuffer(
|
sqlB = new StringBuffer(
|
||||||
|
@ -139,7 +137,6 @@ public class WorkflowNodeNextConditionElementHandler extends
|
||||||
String.valueOf(m_WFNodeNextCondition.get_ID()),
|
String.valueOf(m_WFNodeNextCondition.get_ID()),
|
||||||
"WFNextCondition",
|
"WFNextCondition",
|
||||||
m_WFNodeNextCondition.get_ID(),
|
m_WFNodeNextCondition.get_ID(),
|
||||||
AD_Backup_ID,
|
|
||||||
Object_Status,
|
Object_Status,
|
||||||
"AD_WF_NextCondition",
|
"AD_WF_NextCondition",
|
||||||
get_IDWithColumn(ctx, "AD_Table",
|
get_IDWithColumn(ctx, "AD_Table",
|
||||||
|
@ -152,7 +149,6 @@ public class WorkflowNodeNextConditionElementHandler extends
|
||||||
String.valueOf(m_WFNodeNextCondition.get_ID()),
|
String.valueOf(m_WFNodeNextCondition.get_ID()),
|
||||||
"WFNextCondition",
|
"WFNextCondition",
|
||||||
m_WFNodeNextCondition.get_ID(),
|
m_WFNodeNextCondition.get_ID(),
|
||||||
AD_Backup_ID,
|
|
||||||
Object_Status,
|
Object_Status,
|
||||||
"AD_WF_NextCondition",
|
"AD_WF_NextCondition",
|
||||||
get_IDWithColumn(ctx, "AD_Table",
|
get_IDWithColumn(ctx, "AD_Table",
|
||||||
|
|
|
@ -24,7 +24,6 @@ import org.adempiere.pipo.AbstractElementHandler;
|
||||||
import org.adempiere.pipo.Element;
|
import org.adempiere.pipo.Element;
|
||||||
import org.adempiere.pipo.PackOut;
|
import org.adempiere.pipo.PackOut;
|
||||||
import org.adempiere.pipo.exception.POSaveFailedException;
|
import org.adempiere.pipo.exception.POSaveFailedException;
|
||||||
import org.compiere.model.X_AD_WF_NextCondition;
|
|
||||||
import org.compiere.model.X_AD_WF_NodeNext;
|
import org.compiere.model.X_AD_WF_NodeNext;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
@ -78,17 +77,15 @@ public class WorkflowNodeNextElementHandler extends AbstractElementHandler {
|
||||||
int id = DB.getSQLValue(getTrxName(ctx),sqlB.toString(),wfNodeId,wfNodeNextId);
|
int id = DB.getSQLValue(getTrxName(ctx),sqlB.toString(),wfNodeId,wfNodeNextId);
|
||||||
|
|
||||||
MWFNodeNext m_WFNodeNext = new MWFNodeNext(ctx, id, getTrxName(ctx));
|
MWFNodeNext m_WFNodeNext = new MWFNodeNext(ctx, id, getTrxName(ctx));
|
||||||
int AD_Backup_ID = -1;
|
|
||||||
String Object_Status = null;
|
String Object_Status = null;
|
||||||
if (id <= 0 && atts.getValue("AD_WF_NodeNext_ID") != null && Integer.parseInt(atts.getValue("AD_WF_NodeNext_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
if (id <= 0 && atts.getValue("AD_WF_NodeNext_ID") != null && Integer.parseInt(atts.getValue("AD_WF_NodeNext_ID")) <= PackOut.MAX_OFFICIAL_ID)
|
||||||
m_WFNodeNext.setAD_WF_NodeNext_ID(Integer.parseInt(atts.getValue("AD_WF_NodeNext_ID")));
|
m_WFNodeNext.setAD_WF_NodeNext_ID(Integer.parseInt(atts.getValue("AD_WF_NodeNext_ID")));
|
||||||
if (id > 0){
|
if (id > 0){
|
||||||
AD_Backup_ID = copyRecord(ctx, "AD_WF_NodeNext",m_WFNodeNext);
|
backupRecord(ctx, "AD_WF_NodeNext",m_WFNodeNext);
|
||||||
Object_Status = "Update";
|
Object_Status = "Update";
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Object_Status = "New";
|
Object_Status = "New";
|
||||||
AD_Backup_ID =0;
|
|
||||||
}
|
}
|
||||||
m_WFNodeNext.setAD_WF_Node_ID(wfNodeId);
|
m_WFNodeNext.setAD_WF_Node_ID(wfNodeId);
|
||||||
m_WFNodeNext.setAD_WF_Next_ID(wfNodeNextId);
|
m_WFNodeNext.setAD_WF_Next_ID(wfNodeNextId);
|
||||||
|
@ -99,12 +96,12 @@ public class WorkflowNodeNextElementHandler extends AbstractElementHandler {
|
||||||
log.info("about to execute m_WFNodeNext.save");
|
log.info("about to execute m_WFNodeNext.save");
|
||||||
if (m_WFNodeNext.save(getTrxName(ctx)) == true){
|
if (m_WFNodeNext.save(getTrxName(ctx)) == true){
|
||||||
log.info("m_WFNodeNext save success");
|
log.info("m_WFNodeNext save success");
|
||||||
record_log (ctx, 1, String.valueOf(m_WFNodeNext.get_ID()),"WFNodeNext", m_WFNodeNext.get_ID(),AD_Backup_ID, Object_Status,"AD_WF_NodeNext",
|
record_log (ctx, 1, String.valueOf(m_WFNodeNext.get_ID()),"WFNodeNext", m_WFNodeNext.get_ID(), Object_Status,"AD_WF_NodeNext",
|
||||||
get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_WF_NodeNext"));
|
get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_WF_NodeNext"));
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
log.info("m_WFNodeNext save failure");
|
log.info("m_WFNodeNext save failure");
|
||||||
record_log (ctx, 0, String.valueOf(m_WFNodeNext.get_ID()),"WFNodeNext", m_WFNodeNext.get_ID(),AD_Backup_ID, Object_Status,"AD_WF_NodeNext",
|
record_log (ctx, 0, String.valueOf(m_WFNodeNext.get_ID()),"WFNodeNext", m_WFNodeNext.get_ID(), Object_Status,"AD_WF_NodeNext",
|
||||||
get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_WF_NodeNext"));
|
get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_WF_NodeNext"));
|
||||||
throw new POSaveFailedException("WorkflowNodeNext");
|
throw new POSaveFailedException("WorkflowNodeNext");
|
||||||
}
|
}
|
||||||
|
@ -185,90 +182,5 @@ public class WorkflowNodeNextElementHandler extends AbstractElementHandler {
|
||||||
.valueOf(m_WF_NodeNext.isStdUserWorkflow()) : ""));
|
.valueOf(m_WF_NodeNext.isStdUserWorkflow()) : ""));
|
||||||
|
|
||||||
return atts;
|
return atts;
|
||||||
}
|
}
|
||||||
|
|
||||||
private AttributesImpl createWorkflowNodeNextConditionBinding(
|
|
||||||
AttributesImpl atts, X_AD_WF_NextCondition m_WF_NodeNextCondition) {
|
|
||||||
String sql = null;
|
|
||||||
String name = null;
|
|
||||||
atts.clear();
|
|
||||||
|
|
||||||
if (m_WF_NodeNextCondition.getAD_WF_NodeNext_ID() > 0) {
|
|
||||||
// FIXME: it appears nodes point back to themselves
|
|
||||||
// so a group by is necessary
|
|
||||||
sql = "SELECT AD_Workflow.Name FROM AD_Workflow, AD_WF_Node, AD_WF_NodeNext WHERE AD_Workflow.AD_Workflow_ID = AD_WF_Node.AD_Workflow_ID and AD_WF_Node.AD_WF_Node_ID = AD_WF_NodeNext.AD_WF_Node_ID and AD_WF_NodeNext.AD_WF_NodeNext_ID = ? group by AD_Workflow.Name";
|
|
||||||
name = DB.getSQLValueString(null, sql, m_WF_NodeNextCondition
|
|
||||||
.getAD_WF_NodeNext_ID());
|
|
||||||
atts.addAttribute("", "", "ADWorkflowNameID", "CDATA", name);
|
|
||||||
// FIXME: it appears nodes point back to themselves
|
|
||||||
// so a group by is necessary
|
|
||||||
sql = "SELECT AD_WF_Node.Name FROM AD_WF_Node, AD_WF_NodeNext WHERE AD_WF_Node.AD_WF_Node_ID = AD_WF_NodeNext.AD_WF_Node_ID and AD_WF_NodeNext.AD_WF_NodeNext_ID = ? group by AD_WF_Node.Name";
|
|
||||||
name = DB.getSQLValueString(null, sql, m_WF_NodeNextCondition
|
|
||||||
.getAD_WF_NodeNext_ID());
|
|
||||||
atts.addAttribute("", "", "ADWorkflowNodeNameID", "CDATA", name);
|
|
||||||
// FIXME: it appears nodes point back to themselves
|
|
||||||
// so a group by is necessary
|
|
||||||
sql = "SELECT AD_WF_Node.Name FROM AD_WF_Node, AD_WF_NodeNext, AD_WF_NextCondition WHERE AD_WF_Node.AD_WF_Node_ID = AD_WF_NodeNext.AD_WF_Next_ID and AD_WF_NodeNext.AD_WF_NodeNext_ID = ? group by AD_WF_Node.Name";
|
|
||||||
name = DB.getSQLValueString(null, sql, m_WF_NodeNextCondition
|
|
||||||
.getAD_WF_NodeNext_ID());
|
|
||||||
// log.log(Level.INFO,"node next name: ", name);
|
|
||||||
atts
|
|
||||||
.addAttribute("", "", "ADWorkflowNodeNextNameID", "CDATA",
|
|
||||||
name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_WF_NodeNextCondition.getAD_Column_ID() > 0) {
|
|
||||||
|
|
||||||
sql = "SELECT AD_Table.TableName FROM AD_Table, AD_Column, AD_WF_NextCondition WHERE AD_Column.AD_Table_ID=AD_Table.AD_Table_ID and AD_Column.AD_Column_ID = ?";
|
|
||||||
name = DB.getSQLValueString(null, sql, m_WF_NodeNextCondition
|
|
||||||
.getAD_Column_ID());
|
|
||||||
atts.addAttribute("", "", "ADTableNameID", "CDATA", name);
|
|
||||||
|
|
||||||
sql = "SELECT ColumnName FROM AD_Column WHERE AD_Column_ID=?";
|
|
||||||
name = DB.getSQLValueString(null, sql, m_WF_NodeNextCondition
|
|
||||||
.getAD_Column_ID());
|
|
||||||
atts.addAttribute("", "", "ADColumnNameID", "CDATA", name);
|
|
||||||
} else {
|
|
||||||
atts.addAttribute("", "", "ADTableNameID", "CDATA", name);
|
|
||||||
atts.addAttribute("", "", "ADColumnNameID", "CDATA", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME: don't know if I need org_id or not
|
|
||||||
// sql = "SELECT Name FROM AD_Org WHERE AD_Org_ID=?";
|
|
||||||
// name = DB.getSQLValueString(null,sql,org_id);
|
|
||||||
// atts.addAttribute("","","orgname","CDATA",name);
|
|
||||||
|
|
||||||
atts.addAttribute("", "", "isActive", "CDATA", (m_WF_NodeNextCondition
|
|
||||||
.isActive() == true ? "true" : "false"));
|
|
||||||
atts
|
|
||||||
.addAttribute(
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
"EntityType",
|
|
||||||
"CDATA",
|
|
||||||
(m_WF_NodeNextCondition.getEntityType() != null ? m_WF_NodeNextCondition
|
|
||||||
.getEntityType()
|
|
||||||
: ""));
|
|
||||||
atts.addAttribute("", "", "AndOr", "CDATA", (m_WF_NodeNextCondition
|
|
||||||
.getAndOr() != null ? m_WF_NodeNextCondition.getAndOr() : ""));
|
|
||||||
atts.addAttribute("", "", "Operation", "CDATA", (m_WF_NodeNextCondition
|
|
||||||
.getOperation() != null ? m_WF_NodeNextCondition.getOperation()
|
|
||||||
: ""));
|
|
||||||
atts.addAttribute("", "", "Value", "CDATA", (m_WF_NodeNextCondition
|
|
||||||
.getValue() != null ? m_WF_NodeNextCondition.getValue() : ""));
|
|
||||||
atts
|
|
||||||
.addAttribute(
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
"Value2",
|
|
||||||
"CDATA",
|
|
||||||
(m_WF_NodeNextCondition.getValue2() != null ? m_WF_NodeNextCondition
|
|
||||||
.getValue2()
|
|
||||||
: ""));
|
|
||||||
atts.addAttribute("", "", "SeqNo", "CDATA", (String
|
|
||||||
.valueOf(m_WF_NodeNextCondition.getSeqNo()) != null ? String
|
|
||||||
.valueOf(m_WF_NodeNextCondition.getSeqNo()) : ""));
|
|
||||||
|
|
||||||
return atts;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue