revert 9811
This commit is contained in:
parent
69d3b96908
commit
76678eab36
|
@ -16,7 +16,6 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
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;
|
||||||
|
@ -30,15 +29,12 @@ 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;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
public class AdElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
public class AdElementHandler extends AbstractElementHandler implements IPackOutHandler {
|
|
||||||
|
|
||||||
private List<Integer> processedElements = new ArrayList<Integer>();
|
private List<Integer> processedElements = new ArrayList<Integer>();
|
||||||
|
|
||||||
|
@ -48,6 +44,7 @@ public class AdElementHandler extends AbstractElementHandler implements IPackOut
|
||||||
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;
|
||||||
|
@ -65,7 +62,7 @@ public class AdElementHandler extends AbstractElementHandler implements IPackOut
|
||||||
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) {
|
||||||
backupRecord(ctx, AD_ELEMENT, m_AdElement);
|
AD_Backup_ID = copyRecord(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;
|
||||||
|
@ -73,6 +70,7 @@ public class AdElementHandler extends AbstractElementHandler implements IPackOut
|
||||||
}
|
}
|
||||||
} 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);
|
||||||
|
@ -94,7 +92,7 @@ public class AdElementHandler extends AbstractElementHandler implements IPackOut
|
||||||
|
|
||||||
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(), Object_Status,
|
m_AdElement.get_ID(), AD_Backup_ID, Object_Status,
|
||||||
AD_ELEMENT, get_IDWithColumn(ctx, "AD_Table",
|
AD_ELEMENT, get_IDWithColumn(ctx, "AD_Table",
|
||||||
"TableName", AD_ELEMENT));
|
"TableName", AD_ELEMENT));
|
||||||
|
|
||||||
|
@ -104,7 +102,7 @@ public class AdElementHandler extends AbstractElementHandler implements IPackOut
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
record_log(ctx, 0, m_AdElement.getName(), "Element",
|
record_log(ctx, 0, m_AdElement.getName(), "Element",
|
||||||
m_AdElement.get_ID(), Object_Status,
|
m_AdElement.get_ID(), AD_Backup_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");
|
||||||
|
@ -117,7 +115,7 @@ public class AdElementHandler extends AbstractElementHandler implements IPackOut
|
||||||
public void endElement(Properties ctx, Element element) throws SAXException {
|
public void endElement(Properties ctx, Element element) throws SAXException {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void create(Properties ctx, TransformerHandler document)
|
public void create(Properties ctx, TransformerHandler document)
|
||||||
throws SAXException {
|
throws SAXException {
|
||||||
|
|
||||||
|
|
||||||
|
@ -138,14 +136,8 @@ public class AdElementHandler extends AbstractElementHandler implements IPackOut
|
||||||
|
|
||||||
PackOut packOut = (PackOut)ctx.get("PackOutProcess");
|
PackOut packOut = (PackOut)ctx.get("PackOutProcess");
|
||||||
|
|
||||||
|
packOut.createTranslations(X_AD_Element.Table_Name,
|
||||||
try{
|
m_AdElement.get_ID(), document);
|
||||||
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");
|
||||||
}
|
}
|
||||||
|
@ -174,15 +166,4 @@ public class AdElementHandler extends AbstractElementHandler implements IPackOut
|
||||||
|
|
||||||
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,7 +25,6 @@ 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;
|
||||||
|
@ -34,23 +33,19 @@ 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.model.X_AD_Package_Imp_Backup;
|
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 CodeSnipitElementHandler extends AbstractElementHandler {
|
||||||
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";
|
||||||
|
@ -63,8 +58,10 @@ public class CodeSnipitElementHandler extends AbstractElementHandler implements
|
||||||
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;
|
||||||
|
@ -128,29 +125,42 @@ public class CodeSnipitElementHandler extends AbstractElementHandler implements
|
||||||
|
|
||||||
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 {
|
||||||
record_log (ctx, 1, sourceName,"codesnipit", 0, Object_Status,sourceName,0);
|
idDetail = record_log (ctx, 1, sourceName,"codesnipit", 0,0, Object_Status,sourceName,0);
|
||||||
} catch (SAXException e) {
|
} catch (SAXException e) {
|
||||||
log.info ("setfile:"+e);
|
log.info ("setfile:"+e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
try {
|
try {
|
||||||
record_log (ctx, 0, sourceName,"codesnipit", 0, Object_Status,sourceName,0);
|
idDetail = record_log (ctx, 0, sourceName,"codesnipit", 0,0, Object_Status,sourceName,0);
|
||||||
} catch (SAXException e) {
|
} catch (SAXException e) {
|
||||||
log.info ("setfile:"+e);
|
log.info ("setfile:"+e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Record in transaction file
|
//Record in transaction file
|
||||||
X_AD_Package_Imp_Backup backup = new X_AD_Package_Imp_Backup(ctx, 0, getTrxName(ctx));
|
StringBuffer sqlB = new StringBuffer ("Insert INTO AD_Package_Imp_Backup")
|
||||||
backup.setAD_Org_ID(Env.getAD_Org_ID(ctx));
|
.append( "(AD_Client_ID, AD_Org_ID, CreatedBy, UpdatedBy, " )
|
||||||
backup.setAD_Package_Imp_ID(getPackageImpId(ctx));
|
.append( "AD_PACKAGE_IMP_BACKUP_ID, AD_PACKAGE_IMP_DETAIL_ID, AD_PACKAGE_IMP_ID," )
|
||||||
backup.setAD_Package_Imp_Org_Dir(targetDirectoryModified+sourceName );
|
.append( " AD_PACKAGE_IMP_ORG_DIR, AD_PACKAGE_IMP_BCK_DIR)" )
|
||||||
backup.setAD_Package_Imp_Bck_Dir(packagePath+File.separator+"backup"+File.separator+fileDate+"_"+sourceName);
|
.append( "VALUES(" )
|
||||||
backup.saveEx();
|
.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));
|
||||||
|
if (no == -1)
|
||||||
|
log.info("Insert to import backup failed");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -228,19 +238,4 @@ public class CodeSnipitElementHandler extends AbstractElementHandler implements
|
||||||
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,12 +85,14 @@ 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) {
|
||||||
backupRecord(ctx, "AD_Column", m_Column);
|
AD_Backup_ID = copyRecord(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);
|
||||||
|
|
||||||
|
@ -175,12 +177,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(), "New",
|
.getAD_Element_ID(), AD_Backup_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(), "New",
|
.getAD_Element_ID(), AD_Backup_ID, "New",
|
||||||
"AD_Element", get_IDWithColumn(ctx, "AD_Table",
|
"AD_Element", get_IDWithColumn(ctx, "AD_Table",
|
||||||
"TableName", "AD_Element"));
|
"TableName", "AD_Element"));
|
||||||
}
|
}
|
||||||
|
@ -231,13 +233,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(), Object_Status, "AD_Column",
|
.get_ID(), AD_Backup_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(), Object_Status, "AD_Column",
|
.get_ID(), AD_Backup_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.");
|
||||||
|
@ -250,13 +252,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(), Object_Status, atts.getValue(
|
m_Column.get_ID(), 0, 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(), Object_Status, atts.getValue(
|
m_Column.get_ID(), 0, 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()));
|
||||||
|
@ -388,12 +390,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(ctx, atts, m_Column);
|
createColumnBinding(atts, m_Column);
|
||||||
document.startElement("", "", "column", atts);
|
document.startElement("", "", "column", atts);
|
||||||
document.endElement("", "", "column");
|
document.endElement("", "", "column");
|
||||||
}
|
}
|
||||||
|
|
||||||
private AttributesImpl createColumnBinding(Properties ctx, AttributesImpl atts,
|
private AttributesImpl createColumnBinding(AttributesImpl atts,
|
||||||
X_AD_Column m_Column) {
|
X_AD_Column m_Column) {
|
||||||
String sql = null;
|
String sql = null;
|
||||||
String name = null;
|
String name = null;
|
||||||
|
@ -433,7 +435,8 @@ 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) {
|
||||||
name = MTable.getTableName(ctx, m_Column.getAD_Table_ID());
|
sql = "SELECT TableName FROM AD_Table WHERE AD_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,19 +13,17 @@ 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;
|
||||||
|
|
||||||
import org.compiere.model.X_AD_Element;
|
public class CommonTranslationHandler extends AbstractElementHandler implements ElementHandler{
|
||||||
|
|
||||||
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";
|
||||||
|
|
||||||
|
|
||||||
|
@ -315,16 +313,4 @@ 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,7 +33,6 @@ 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;
|
||||||
|
@ -51,9 +50,10 @@ import org.xml.sax.helpers.AttributesImpl;
|
||||||
* @author Low Heng Sin
|
* @author Low Heng Sin
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class DataElementHandler extends AbstractElementHandler implements IPackOutHandler {
|
public class DataElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
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,11 +112,12 @@ public class DataElementHandler extends AbstractElementHandler implements IPackO
|
||||||
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");
|
||||||
backupRecord(ctx,d_tablename,genericPO);
|
AD_Backup_ID = copyRecord(ctx,d_tablename,genericPO);
|
||||||
objectStatus = "Update";
|
objectStatus = "Update";
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
objectStatus = "New";
|
objectStatus = "New";
|
||||||
|
AD_Backup_ID =0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// keyXname and lookupkeyXname.
|
// keyXname and lookupkeyXname.
|
||||||
|
@ -219,9 +220,9 @@ public class DataElementHandler extends AbstractElementHandler implements IPackO
|
||||||
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(),objectStatus,d_tablename,get_IDWithColumn(ctx, "AD_Table", "TableName", d_tablename));
|
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));
|
||||||
else {
|
else {
|
||||||
record_log (ctx, 0, genericPO.get_TableName(),"Data", genericPO.get_ID(),objectStatus,d_tablename,get_IDWithColumn(ctx, "AD_Table", "TableName", d_tablename));
|
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));
|
||||||
throw new POSaveFailedException("GenericPO");
|
throw new POSaveFailedException("GenericPO");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -406,12 +407,4 @@ public class DataElementHandler extends AbstractElementHandler implements IPackO
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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,7 +20,6 @@ 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;
|
||||||
|
@ -29,10 +28,9 @@ 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.model.X_AD_Package_Imp_Backup;
|
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;
|
||||||
|
@ -40,20 +38,9 @@ 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"));
|
||||||
|
@ -68,6 +55,7 @@ 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.
|
||||||
|
|
||||||
|
@ -150,27 +138,41 @@ 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 {
|
||||||
record_log (ctx, 1, fileName,"file", 0, Object_Status,fileName,0);
|
idDetail = record_log (ctx, 1, fileName,"file", 0,0, Object_Status,fileName,0);
|
||||||
} catch (SAXException e) {
|
} catch (SAXException e) {
|
||||||
log.info ("setfile:"+e);
|
log.info ("setfile:"+e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
try {
|
try {
|
||||||
record_log (ctx, 0, fileName,"file", 0, Object_Status,fileName,0);
|
idDetail = record_log (ctx, 0, fileName,"file", 0,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
|
||||||
X_AD_Package_Imp_Backup backup = new X_AD_Package_Imp_Backup(ctx, 0, getTrxName(ctx));
|
StringBuffer sqlB = new StringBuffer ("Insert INTO AD_Package_Imp_Backup" )
|
||||||
backup.setAD_Org_ID(Env.getAD_Org_ID(ctx));
|
.append( "(AD_Client_ID, AD_Org_ID, CreatedBy, UpdatedBy, " )
|
||||||
backup.setAD_Package_Imp_Org_Dir(fullTargetPath+fileName);
|
.append( "AD_PACKAGE_IMP_BACKUP_ID, AD_PACKAGE_IMP_DETAIL_ID, AD_PACKAGE_IMP_ID," )
|
||||||
backup.setAD_Package_Imp_Bck_Dir(packagePath+File.separator+"backup"+File.separator+fileDate+"_"+fileName);
|
.append( " AD_PACKAGE_IMP_ORG_DIR, AD_PACKAGE_IMP_BCK_DIR)" )
|
||||||
backup.setAD_Package_Imp_ID(getPackageImpId(ctx));
|
.append( "VALUES(" )
|
||||||
backup.saveEx();
|
.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( ", '" + 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");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -193,16 +195,4 @@ public class DistFileElementHandler extends AbstractElementHandler {
|
||||||
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 implements IPackOutHandler {
|
public class DynValRuleElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
private List<Integer> rules = new ArrayList<Integer>();
|
private List<Integer> rules = new ArrayList<Integer>();
|
||||||
|
|
||||||
|
@ -53,13 +53,15 @@ public class DynValRuleElementHandler extends AbstractElementHandler implements
|
||||||
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){
|
||||||
backupRecord(ctx, "AD_Val_Rule",m_ValRule);
|
AD_Backup_ID = copyRecord(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"));
|
||||||
|
@ -68,10 +70,10 @@ public class DynValRuleElementHandler extends AbstractElementHandler implements
|
||||||
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(),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(),AD_Backup_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(),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(),AD_Backup_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 {
|
||||||
|
@ -83,7 +85,7 @@ public class DynValRuleElementHandler extends AbstractElementHandler implements
|
||||||
public void endElement(Properties ctx, Element element) throws SAXException {
|
public void endElement(Properties ctx, Element element) throws SAXException {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void create(Properties ctx, TransformerHandler document)
|
public 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))
|
||||||
|
@ -134,17 +136,4 @@ public class DynValRuleElementHandler extends AbstractElementHandler implements
|
||||||
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,12 +105,14 @@ 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) {
|
||||||
backupRecord(ctx, "AD_Field", m_Field);
|
AD_Backup_ID = copyRecord(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);
|
||||||
|
@ -159,13 +161,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(), Object_Status, "AD_Field",
|
.get_ID(), AD_Backup_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(), Object_Status, "AD_Field",
|
.get_ID(), AD_Backup_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.");
|
||||||
|
@ -192,35 +194,20 @@ public class FieldElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
PackOut packOut = (PackOut)ctx.get("PackOutProcess");
|
PackOut packOut = (PackOut)ctx.get("PackOutProcess");
|
||||||
|
|
||||||
try
|
if(m_Field.getAD_FieldGroup_ID() > 0){
|
||||||
{
|
packOut.createFieldGroupElement(m_Field.getAD_FieldGroup_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)
|
|
||||||
{
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
IPackOutHandler handler = packOut.getHandler("V");
|
|
||||||
handler.packOut(packOut,null,null,document,null,m_Field.getAD_Val_Rule_ID());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
|
||||||
{
|
if(m_Field.getAD_Reference_ID() > 0) {
|
||||||
log.info(e.toString());
|
packOut.createReference(m_Field.getAD_Reference_ID(), document);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_Field.getAD_Reference_Value_ID() > 0) {
|
||||||
|
packOut.createReference(m_Field.getAD_Reference_Value_ID(), document);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_Field.getAD_Val_Rule_ID() > 0) {
|
||||||
|
packOut.createDynamicRuleValidation(m_Field.getAD_Val_Rule_ID(), document);
|
||||||
}
|
}
|
||||||
|
|
||||||
document.startElement("", "", "field", atts);
|
document.startElement("", "", "field", atts);
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
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;
|
||||||
|
@ -35,10 +34,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;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
public class FieldGroupElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
public class FieldGroupElementHandler extends AbstractElementHandler implements IPackOutHandler{
|
|
||||||
|
|
||||||
|
|
||||||
private List<Integer> processedFieldGroups = new ArrayList<Integer>();
|
private List<Integer> processedFieldGroups = new ArrayList<Integer>();
|
||||||
|
|
||||||
|
@ -46,6 +42,7 @@ public class FieldGroupElementHandler extends AbstractElementHandler implements
|
||||||
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;
|
||||||
|
@ -63,7 +60,7 @@ public class FieldGroupElementHandler extends AbstractElementHandler implements
|
||||||
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) {
|
||||||
backupRecord(ctx, X_AD_FieldGroup.Table_Name, fieldGroup);
|
AD_Backup_ID = copyRecord(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;
|
||||||
|
@ -71,6 +68,7 @@ public class FieldGroupElementHandler extends AbstractElementHandler implements
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Object_Status = "New";
|
Object_Status = "New";
|
||||||
|
AD_Backup_ID = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
PoFiller pf = new PoFiller(fieldGroup, atts);
|
PoFiller pf = new PoFiller(fieldGroup, atts);
|
||||||
|
@ -83,7 +81,7 @@ public class FieldGroupElementHandler extends AbstractElementHandler implements
|
||||||
|
|
||||||
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(), Object_Status,
|
fieldGroup.get_ID(), AD_Backup_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));
|
||||||
|
|
||||||
|
@ -93,7 +91,7 @@ public class FieldGroupElementHandler extends AbstractElementHandler implements
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
record_log(ctx, 0, fieldGroup.getName(), "FieldGroup",
|
record_log(ctx, 0, fieldGroup.getName(), "FieldGroup",
|
||||||
fieldGroup.get_ID(), Object_Status,
|
fieldGroup.get_ID(), AD_Backup_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");
|
||||||
|
@ -106,7 +104,7 @@ public class FieldGroupElementHandler extends AbstractElementHandler implements
|
||||||
public void endElement(Properties ctx, Element element) throws SAXException {
|
public void endElement(Properties ctx, Element element) throws SAXException {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void create(Properties ctx, TransformerHandler document)
|
public void create(Properties ctx, TransformerHandler document)
|
||||||
throws SAXException {
|
throws SAXException {
|
||||||
|
|
||||||
|
|
||||||
|
@ -127,13 +125,9 @@ public class FieldGroupElementHandler extends AbstractElementHandler implements
|
||||||
|
|
||||||
PackOut packOut = (PackOut)ctx.get("PackOutProcess");
|
PackOut packOut = (PackOut)ctx.get("PackOutProcess");
|
||||||
|
|
||||||
try{
|
packOut.createTranslations(X_AD_FieldGroup.Table_Name,
|
||||||
new CommonTranslationHandler().packOut(packOut,null,null,document,null,fieldGroup.get_ID());
|
fieldGroup.get_ID(), document);
|
||||||
}
|
|
||||||
catch(Exception e)
|
|
||||||
{
|
|
||||||
log.info(e.toString());
|
|
||||||
}
|
|
||||||
document.endElement("", "", "fieldgroup");
|
document.endElement("", "", "fieldgroup");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,15 +146,4 @@ public class FieldGroupElementHandler extends AbstractElementHandler implements
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,94 +0,0 @@
|
||||||
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,7 +16,6 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
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,15 +28,13 @@ 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 implements IPackOutHandler {
|
public class FormElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
private List<Integer> forms = new ArrayList<Integer>();
|
private List<Integer> forms = new ArrayList<Integer>();
|
||||||
|
|
||||||
|
@ -51,15 +48,17 @@ public class FormElementHandler extends AbstractElementHandler implements IPackO
|
||||||
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){
|
||||||
backupRecord(ctx, "AD_Form",m_Form);
|
AD_Backup_ID = copyRecord(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());
|
||||||
|
@ -71,10 +70,10 @@ public class FormElementHandler extends AbstractElementHandler implements IPackO
|
||||||
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(), Object_Status,"AD_Form",get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_Form"));
|
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"));
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
record_log (ctx, 0, m_Form.getName(),"Form", m_Form.get_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(),AD_Backup_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 {
|
||||||
|
@ -85,7 +84,7 @@ public class FormElementHandler extends AbstractElementHandler implements IPackO
|
||||||
public void endElement(Properties ctx, Element element) throws SAXException {
|
public void endElement(Properties ctx, Element element) throws SAXException {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void create(Properties ctx, TransformerHandler document)
|
public 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;
|
||||||
|
@ -127,15 +126,4 @@ public class FormElementHandler extends AbstractElementHandler implements IPackO
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
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 implements IPackOutHandler {
|
public class ImpFormatElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
private ImpFormatRowElementHandler rowHandler = new ImpFormatRowElementHandler();
|
private ImpFormatRowElementHandler rowHandler = new ImpFormatRowElementHandler();
|
||||||
|
|
||||||
|
@ -48,6 +48,7 @@ public class ImpFormatElementHandler extends AbstractElementHandler implements
|
||||||
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"));
|
||||||
|
@ -58,10 +59,11 @@ public class ImpFormatElementHandler extends AbstractElementHandler implements
|
||||||
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) {
|
||||||
backupRecord(ctx, "AD_ImpFormat", m_ImpFormat);
|
AD_Backup_ID = copyRecord(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");
|
||||||
|
@ -85,12 +87,12 @@ public class ImpFormatElementHandler extends AbstractElementHandler implements
|
||||||
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(), Object_Status, "AD_ImpFormat",
|
.get_ID(), AD_Backup_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(), Object_Status, "AD_ImpFormat",
|
.get_ID(), AD_Backup_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.");
|
||||||
|
@ -100,7 +102,7 @@ public class ImpFormatElementHandler extends AbstractElementHandler implements
|
||||||
public void endElement(Properties ctx, Element element) throws SAXException {
|
public void endElement(Properties ctx, Element element) throws SAXException {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void create(Properties ctx, TransformerHandler document)
|
public 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);
|
||||||
|
@ -177,14 +179,4 @@ public class ImpFormatElementHandler extends AbstractElementHandler implements
|
||||||
.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,11 +73,12 @@ 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){
|
||||||
backupRecord(ctx, "AD_ImpFormat",m_ImpFormat_row);
|
AD_Backup_ID = copyRecord(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);
|
||||||
|
@ -95,10 +96,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(),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(),AD_Backup_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(),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(),AD_Backup_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,19 +28,18 @@ 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 implements IPackOutHandler {
|
public class MenuElementHandler 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("ADMenuNameID"));
|
log.info(elementValue + " " + atts.getValue("ADMenuNameID"));
|
||||||
|
@ -58,13 +57,13 @@ public class MenuElementHandler extends AbstractElementHandler implements IPackO
|
||||||
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) {
|
||||||
backupRecord(ctx, "AD_Menu", m_Menu);
|
AD_Backup_ID = copyRecord(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) {
|
||||||
|
@ -143,7 +142,7 @@ public class MenuElementHandler extends AbstractElementHandler implements IPackO
|
||||||
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(), Object_Status, "AD_Menu",
|
.get_ID(), AD_Backup_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) {
|
||||||
|
@ -152,7 +151,7 @@ public class MenuElementHandler extends AbstractElementHandler implements IPackO
|
||||||
} 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(), Object_Status, "AD_Menu",
|
.get_ID(), AD_Backup_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) {
|
||||||
|
@ -388,29 +387,25 @@ public class MenuElementHandler extends AbstractElementHandler implements IPackO
|
||||||
|| 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(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Window_ID)>0)
|
if (rs.getInt("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);
|
|
||||||
}
|
}
|
||||||
else if (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Process_ID)>0)
|
// Call CreateProcess.
|
||||||
{
|
else if (rs.getInt("AD_PROCESS_ID") > 0) {
|
||||||
IPackOutHandler handler = packOut.getHandler("P");
|
packOut.createProcess(rs.getInt("AD_PROCESS_ID"), document);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
else if (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Form_ID) > 0)
|
// Call CreateTask.
|
||||||
{
|
else if (rs.getInt("AD_TASK_ID") > 0) {
|
||||||
IPackOutHandler handler = packOut.getHandler("X");
|
packOut.createTask(rs.getInt("AD_TASK_ID"), document);
|
||||||
handler.packOut(packOut,null,rs,document,null,0);
|
|
||||||
}
|
}
|
||||||
else if (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Workflow_ID) > 0)
|
// Call CreateForm.
|
||||||
{
|
else if (rs.getInt("AD_FORM_ID") > 0) {
|
||||||
IPackOutHandler handler = packOut.getHandler("F");
|
packOut.createForm(rs.getInt("AD_FORM_ID"), document);
|
||||||
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 {
|
||||||
|
@ -445,10 +440,9 @@ public class MenuElementHandler extends AbstractElementHandler implements IPackO
|
||||||
|
|
||||||
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 {
|
||||||
rs = pstmt.executeQuery();
|
ResultSet 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"),
|
||||||
|
@ -462,30 +456,26 @@ public class MenuElementHandler extends AbstractElementHandler implements IPackO
|
||||||
|| 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(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Window_ID)>0)
|
if (rs.getInt("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);
|
|
||||||
}
|
}
|
||||||
else if (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Process_ID)>0)
|
// Call CreateProcess.
|
||||||
{
|
else if (rs.getInt("AD_PROCESS_ID") > 0) {
|
||||||
IPackOutHandler handler = packOut.getHandler("P");
|
packOut.createProcess(rs.getInt("AD_PROCESS_ID"),
|
||||||
handler.packOut(packOut,null,rs,document,null,0);
|
document);
|
||||||
}
|
}
|
||||||
else if (rs.getInt(X_AD_Task.COLUMNNAME_AD_Task_ID)>0)
|
// Call CreateTask.
|
||||||
{
|
else if (rs.getInt("AD_TASK_ID") > 0) {
|
||||||
IPackOutHandler handler = packOut.getHandler("K");
|
packOut.createTask(rs.getInt("AD_TASK_ID"), document);
|
||||||
handler.packOut(packOut,null,rs,document,null,0);
|
|
||||||
}
|
}
|
||||||
else if (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Form_ID) > 0)
|
// Call CreateForm.
|
||||||
{
|
else if (rs.getInt("AD_FORM_ID") > 0) {
|
||||||
IPackOutHandler handler = packOut.getHandler("X");
|
packOut.createForm(rs.getInt("AD_FORM_ID"), document);
|
||||||
handler.packOut(packOut,null,rs,document,null,0);
|
|
||||||
}
|
}
|
||||||
else if (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Workflow_ID) > 0)
|
// Call CreateWorkflow
|
||||||
{
|
else if (rs.getInt("AD_Workflow_ID") > 0) {
|
||||||
IPackOutHandler handler = packOut.getHandler("F");
|
packOut.createWorkflow(rs.getInt("AD_Workflow_ID"),
|
||||||
handler.packOut(packOut,null,rs,document,null,0);
|
document);
|
||||||
}
|
}
|
||||||
// Call CreateModule because entry is a summary menu
|
// Call CreateModule because entry is a summary menu
|
||||||
} else {
|
} else {
|
||||||
|
@ -493,29 +483,18 @@ public class MenuElementHandler extends AbstractElementHandler implements IPackO
|
||||||
}
|
}
|
||||||
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 {
|
||||||
DB.close(rs, pstmt);
|
try {
|
||||||
|
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 implements IPackOutHandler{
|
public class MessageElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
private List<Integer> messages = new ArrayList<Integer>();
|
private List<Integer> messages = new ArrayList<Integer>();
|
||||||
|
|
||||||
|
@ -52,15 +52,17 @@ public class MessageElementHandler extends AbstractElementHandler implements IPa
|
||||||
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){
|
||||||
backupRecord(ctx, "AD_Message",m_Message);
|
AD_Backup_ID = copyRecord(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"));
|
||||||
|
@ -69,10 +71,10 @@ public class MessageElementHandler extends AbstractElementHandler implements IPa
|
||||||
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(),Object_Status,"AD_Message",get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_Message"));
|
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"));
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
record_log (ctx, 0, m_Message.getValue(),"Message", m_Message.get_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(),AD_Backup_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 {
|
||||||
|
@ -134,15 +136,4 @@ public class MessageElementHandler extends AbstractElementHandler implements IPa
|
||||||
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,14 +53,16 @@ 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) {
|
||||||
backupRecord(ctx, "AD_Preference", m_Preference);
|
AD_Backup_ID = copyRecord(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);
|
||||||
|
@ -68,12 +70,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(), Object_Status,
|
m_Preference.get_ID(), AD_Backup_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(), Object_Status,
|
m_Preference.get_ID(), AD_Backup_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 implements IPackOutHandler {
|
public class PrintFormatElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
private PrintFormatItemElementHandler itemHandler = new PrintFormatItemElementHandler();
|
private PrintFormatItemElementHandler itemHandler = new PrintFormatItemElementHandler();
|
||||||
|
|
||||||
|
@ -51,6 +51,7 @@ public class PrintFormatElementHandler extends AbstractElementHandler implements
|
||||||
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"));
|
||||||
|
@ -62,10 +63,11 @@ public class PrintFormatElementHandler extends AbstractElementHandler implements
|
||||||
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) {
|
||||||
backupRecord(ctx, "AD_PrintFormat", m_PrintFormat);
|
AD_Backup_ID = copyRecord(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");
|
||||||
|
@ -87,12 +89,12 @@ public class PrintFormatElementHandler extends AbstractElementHandler implements
|
||||||
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(), "New", "AD_Table",
|
m_Table.get_ID(), 0, "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(), "New", "AD_Table",
|
m_Table.get_ID(), 0, "New", "AD_Table",
|
||||||
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
||||||
"AD_Table"));
|
"AD_Table"));
|
||||||
}
|
}
|
||||||
|
@ -163,13 +165,13 @@ public class PrintFormatElementHandler extends AbstractElementHandler implements
|
||||||
.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(), Object_Status,
|
m_PrintFormat.get_ID(), AD_Backup_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(), Object_Status,
|
m_PrintFormat.get_ID(), AD_Backup_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");
|
||||||
|
@ -347,16 +349,4 @@ public class PrintFormatElementHandler extends AbstractElementHandler implements
|
||||||
.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,6 +37,7 @@ 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"));
|
||||||
|
@ -55,11 +56,12 @@ 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) {
|
||||||
backupRecord(ctx, "AD_PrintFormatItem",
|
AD_Backup_ID = copyRecord(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");
|
||||||
|
@ -230,12 +232,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(), Object_Status,
|
m_PrintFormatItem.get_ID(), AD_Backup_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(), Object_Status,
|
m_PrintFormatItem.get_ID(), AD_Backup_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,7 +31,6 @@ 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;
|
||||||
|
@ -40,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 ProcessElementHandler extends AbstractElementHandler implements IPackOutHandler{
|
public class ProcessElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
private ProcessParaElementHandler paraHandler = new ProcessParaElementHandler();
|
private ProcessParaElementHandler paraHandler = new ProcessParaElementHandler();
|
||||||
|
|
||||||
|
@ -60,10 +59,11 @@ public class ProcessElementHandler extends AbstractElementHandler implements IPa
|
||||||
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));
|
||||||
backupRecord(ctx, "AD_Process", m_Process);
|
AD_Backup_ID = copyRecord(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,6 +71,7 @@ public class ProcessElementHandler extends AbstractElementHandler implements IPa
|
||||||
"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")));
|
||||||
|
@ -145,13 +146,13 @@ public class ProcessElementHandler extends AbstractElementHandler implements IPa
|
||||||
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(), Object_Status, "AD_Process",
|
.get_ID(), AD_Backup_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(), Object_Status, "AD_Process",
|
.get_ID(), AD_Backup_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");
|
||||||
|
@ -185,20 +186,19 @@ public class ProcessElementHandler extends AbstractElementHandler implements IPa
|
||||||
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(),
|
||||||
IPackOutHandler handler = packOut.getHandler("R");
|
document);
|
||||||
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) {
|
||||||
{
|
|
||||||
IPackOutHandler handler = packOut.getHandler("PFT");
|
packOut.createPrintFormat(m_Process.getAD_PrintFormat_ID(),
|
||||||
handler.packOut(packOut,null,null,document,null,m_Process.getAD_PrintFormat_ID());
|
document);
|
||||||
}
|
}
|
||||||
if (m_Process.getAD_Workflow_ID() > 0) {
|
if (m_Process.getAD_Workflow_ID() > 0) {
|
||||||
IPackOutHandler handler = packOut.getHandler("F");
|
|
||||||
handler.packOut(packOut,null,null,document,null,m_Process.getAD_Workflow_ID());
|
packOut.createWorkflow(m_Process.getAD_Workflow_ID(),
|
||||||
|
document);
|
||||||
}
|
}
|
||||||
createProcessBinding(atts, m_Process);
|
createProcessBinding(atts, m_Process);
|
||||||
document.startElement("", "", "process", atts);
|
document.startElement("", "", "process", atts);
|
||||||
|
@ -210,24 +210,15 @@ public class ProcessElementHandler extends AbstractElementHandler implements IPa
|
||||||
try {
|
try {
|
||||||
ResultSet rsP = pstmtP.executeQuery();
|
ResultSet rsP = pstmtP.executeQuery();
|
||||||
while (rsP.next()) {
|
while (rsP.next()) {
|
||||||
|
if (rsP.getInt("AD_Reference_ID") > 0)
|
||||||
if (rsP.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Reference_ID)>0)
|
packOut.createReference(rsP
|
||||||
{
|
.getInt("AD_Reference_ID"), document);
|
||||||
IPackOutHandler handler = packOut.getHandler("REF");
|
if (rsP.getInt("AD_Reference_Value_ID") > 0)
|
||||||
handler.packOut(packOut,null,rsP,document,null,0);
|
packOut.createReference(rsP
|
||||||
}
|
.getInt("AD_Reference_Value_ID"),
|
||||||
|
document);
|
||||||
if (rsP.getInt("AD_Reference_Value_ID")>0)
|
if (rsP.getInt("AD_Val_Rule_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"));
|
||||||
|
@ -353,15 +344,4 @@ public class ProcessElementHandler extends AbstractElementHandler implements IPa
|
||||||
(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,15 +76,17 @@ 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) {
|
||||||
backupRecord(ctx, "AD_Process_Para",
|
AD_Backup_ID = copyRecord(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"));
|
||||||
|
|
||||||
|
@ -112,12 +114,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(), "New",
|
.getAD_Element_ID(), AD_Backup_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(), "New",
|
.getAD_Element_ID(), AD_Backup_ID, "New",
|
||||||
"AD_Element", get_IDWithColumn(ctx, "AD_Table",
|
"AD_Element", get_IDWithColumn(ctx, "AD_Table",
|
||||||
"TableName", "AD_Element"));
|
"TableName", "AD_Element"));
|
||||||
}
|
}
|
||||||
|
@ -183,12 +185,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(), Object_Status,
|
m_Process_para.get_ID(), AD_Backup_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(), Object_Status,
|
m_Process_para.get_ID(), AD_Backup_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,7 +31,6 @@ 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;
|
||||||
|
@ -41,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 ReferenceElementHandler extends AbstractElementHandler implements IPackOutHandler{
|
public class ReferenceElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
private ReferenceListElementHandler listHandler = new ReferenceListElementHandler();
|
private ReferenceListElementHandler listHandler = new ReferenceListElementHandler();
|
||||||
private ReferenceTableElementHandler tableHandler = new ReferenceTableElementHandler();
|
private ReferenceTableElementHandler tableHandler = new ReferenceTableElementHandler();
|
||||||
|
@ -51,6 +50,7 @@ public class ReferenceElementHandler extends AbstractElementHandler implements I
|
||||||
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 implements I
|
||||||
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) {
|
||||||
backupRecord(ctx, "AD_Reference", m_Reference);
|
AD_Backup_ID = copyRecord(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,6 +75,7 @@ public class ReferenceElementHandler extends AbstractElementHandler implements I
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Object_Status = "New";
|
Object_Status = "New";
|
||||||
|
AD_Backup_ID = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Reference.setDescription(getStringValue(atts,"Description"));
|
m_Reference.setDescription(getStringValue(atts,"Description"));
|
||||||
|
@ -88,14 +89,14 @@ public class ReferenceElementHandler extends AbstractElementHandler implements I
|
||||||
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(), Object_Status,
|
m_Reference.get_ID(), AD_Backup_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(), Object_Status,
|
m_Reference.get_ID(), AD_Backup_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");
|
||||||
|
@ -275,14 +276,4 @@ public class ReferenceElementHandler extends AbstractElementHandler implements I
|
||||||
: ""));
|
: ""));
|
||||||
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,6 +36,7 @@ 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"));
|
||||||
|
@ -63,10 +64,11 @@ 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) {
|
||||||
backupRecord(ctx, "AD_Ref_List", m_Ref_List);
|
AD_Backup_ID = copyRecord(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);
|
||||||
|
@ -79,12 +81,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(), Object_Status,
|
m_Ref_List.get_ID(), AD_Backup_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(), Object_Status,
|
m_Ref_List.get_ID(), AD_Backup_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,6 +42,8 @@ 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;
|
||||||
|
@ -77,11 +79,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(), "New", "AD_Table", get_IDWithColumn(
|
.get_ID(), 0, "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(), "New", "AD_Table", get_IDWithColumn(
|
.get_ID(), 0, "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
|
||||||
|
@ -100,11 +102,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(), "New", "AD_Column", get_IDWithColumn(
|
.get_ID(), 0, "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(), "New", "AD_Column", get_IDWithColumn(
|
.get_ID(), 0, "New", "AD_Column", get_IDWithColumn(
|
||||||
ctx, "AD_Table", "TableName", "AD_Column"));
|
ctx, "AD_Table", "TableName", "AD_Column"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -121,11 +123,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(), "New", "AD_Column", get_IDWithColumn(
|
.get_ID(), 0, "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(), "New", "AD_Column", get_IDWithColumn(
|
.get_ID(), 0, "New", "AD_Column", get_IDWithColumn(
|
||||||
ctx, "AD_Table", "TableName", "AD_Column"));
|
ctx, "AD_Table", "TableName", "AD_Column"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,12 +156,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, "Update", "AD_Ref_Table",
|
"Reference Table", AD_Reference_ID, 0, "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, "Update", "AD_Ref_Table",
|
"Reference Table", AD_Reference_ID, 0, "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");
|
||||||
|
@ -183,12 +185,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, "New", "AD_Ref_Table",
|
"Reference Table", AD_Reference_ID, 0, "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, "New", "AD_Ref_Table",
|
"Reference Table", AD_Reference_ID, 0, "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,6 +36,7 @@ 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;
|
||||||
|
@ -83,11 +84,12 @@ 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) {
|
||||||
backupRecord(ctx, "AD_Reportview_Col",
|
AD_Backup_ID = copyRecord(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(
|
||||||
|
@ -108,13 +110,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(),
|
||||||
Object_Status, "AD_Reportview_Col",
|
AD_Backup_ID, 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(),
|
||||||
Object_Status, "AD_Reportview_Col",
|
AD_Backup_ID, 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,7 +32,6 @@ 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;
|
||||||
|
@ -41,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 ReportViewElementHandler extends AbstractElementHandler implements IPackOutHandler{
|
public class ReportViewElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
private ReportViewColElementHandler columnHandler = new ReportViewColElementHandler();
|
private ReportViewColElementHandler columnHandler = new ReportViewColElementHandler();
|
||||||
|
|
||||||
|
@ -50,9 +49,11 @@ public class ReportViewElementHandler extends AbstractElementHandler implements
|
||||||
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);
|
||||||
|
@ -61,10 +62,11 @@ public class ReportViewElementHandler extends AbstractElementHandler implements
|
||||||
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) {
|
||||||
backupRecord(ctx, "AD_Reportview", m_Reportview);
|
AD_Backup_ID = copyRecord(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);
|
||||||
|
@ -76,12 +78,12 @@ public class ReportViewElementHandler extends AbstractElementHandler implements
|
||||||
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(), "New", "AD_Table",
|
m_Table.get_ID(), 0, "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(), "New", "AD_Table",
|
m_Table.get_ID(), 0, "New", "AD_Table",
|
||||||
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
get_IDWithColumn(ctx, "AD_Table", "TableName",
|
||||||
"AD_Table"));
|
"AD_Table"));
|
||||||
}
|
}
|
||||||
|
@ -98,13 +100,13 @@ public class ReportViewElementHandler extends AbstractElementHandler implements
|
||||||
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(), Object_Status,
|
m_Reportview.get_ID(), AD_Backup_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(), Object_Status,
|
m_Reportview.get_ID(), AD_Backup_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");
|
||||||
|
@ -144,11 +146,10 @@ public class ReportViewElementHandler extends AbstractElementHandler implements
|
||||||
ResultSet rs1 = pstmt1.executeQuery();
|
ResultSet rs1 = pstmt1.executeQuery();
|
||||||
while (rs1.next()) {
|
while (rs1.next()) {
|
||||||
// Export Table if neccessary
|
// Export Table if neccessary
|
||||||
IPackOutHandler tableHandler = packOut.getHandler("T");
|
packOut.createTable(rs1.getInt("AD_Table_ID"),
|
||||||
tableHandler.packOut(packOut,null,rs1,document,null,0);
|
document);
|
||||||
IPackOutHandler pftHandler = packOut.getHandler("PFT");
|
packOut.createPrintFormat(rs1
|
||||||
pftHandler.packOut(packOut,null,rs1,document,null,0);
|
.getInt("AD_Printformat_ID"), document);
|
||||||
|
|
||||||
}
|
}
|
||||||
rs1.close();
|
rs1.close();
|
||||||
pstmt1.close();
|
pstmt1.close();
|
||||||
|
@ -263,15 +264,4 @@ public class ReportViewElementHandler extends AbstractElementHandler implements
|
||||||
.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 implements IPackOutHandler{
|
public class RoleElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
private List<Integer> roles = new ArrayList<Integer>();
|
private List<Integer> roles = new ArrayList<Integer>();
|
||||||
|
|
||||||
|
@ -69,13 +69,16 @@ public class RoleElementHandler extends AbstractElementHandler implements IPackO
|
||||||
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);
|
||||||
|
@ -185,12 +188,12 @@ public class RoleElementHandler extends AbstractElementHandler implements IPackO
|
||||||
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(),
|
||||||
Object_Status, "AD_Role", get_IDWithColumn(
|
AD_Backup_ID, 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(),
|
||||||
Object_Status, "AD_Role", get_IDWithColumn(
|
AD_Backup_ID, 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");
|
||||||
}
|
}
|
||||||
|
@ -514,15 +517,4 @@ public class RoleElementHandler extends AbstractElementHandler implements IPackO
|
||||||
|
|
||||||
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,7 +18,6 @@ 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;
|
||||||
|
@ -27,7 +26,6 @@ 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;
|
||||||
|
@ -35,10 +33,12 @@ 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 implements IPackOutHandler{
|
public class SQLStatementElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
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;
|
||||||
|
@ -50,7 +50,7 @@ public class SQLStatementElementHandler extends AbstractElementHandler implement
|
||||||
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") + " ReturnValue="+n);
|
log.info("Executed SQL Statement: "+ atts.getValue("statement"));
|
||||||
}
|
}
|
||||||
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 implement
|
||||||
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") + " ReturnValue="+n);
|
log.info("Executed SQL Statement for PostgreSQL: "+ atts.getValue("statement"));
|
||||||
// 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,13 +106,4 @@ public class SQLStatementElementHandler extends AbstractElementHandler implement
|
||||||
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,13 +81,15 @@ 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){
|
||||||
backupRecord(ctx, "AD_Tab",m_Tab);
|
AD_Backup_ID = copyRecord(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);
|
||||||
|
@ -168,10 +170,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(),Object_Status,"AD_Tab",get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_Tab"));
|
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"));
|
||||||
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(),Object_Status,"AD_Tab",get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_Tab"));
|
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"));
|
||||||
throw new POSaveFailedException("Tab");
|
throw new POSaveFailedException("Tab");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -226,15 +228,7 @@ public class TabElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
if(m_Tab.getAD_Process_ID() > 0 )
|
if(m_Tab.getAD_Process_ID() > 0 )
|
||||||
{
|
{
|
||||||
try
|
packOut.createProcess(m_Tab.getAD_Process_ID(), document);
|
||||||
{
|
|
||||||
IPackOutHandler handler = packOut.getHandler("P");
|
|
||||||
handler.packOut(packOut,null,null,document,null,m_Tab.getAD_Process_ID());
|
|
||||||
}
|
|
||||||
catch(Exception e)
|
|
||||||
{
|
|
||||||
log.info(e.toString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -333,4 +327,5 @@ 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 implements IPackOutHandler{
|
public class TableElementHandler extends AbstractElementHandler {
|
||||||
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,13 +68,15 @@ public class TableElementHandler extends AbstractElementHandler implements IPack
|
||||||
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){
|
||||||
backupRecord(ctx, "AD_Table",m_Table);
|
AD_Backup_ID = copyRecord(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");
|
||||||
|
@ -107,13 +109,13 @@ public class TableElementHandler extends AbstractElementHandler implements IPack
|
||||||
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(),Object_Status,"AD_Table",get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_Table"));
|
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"));
|
||||||
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(),Object_Status,"AD_Table",get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_Table"));
|
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"));
|
||||||
throw new POSaveFailedException("Table");
|
throw new POSaveFailedException("Table");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -160,32 +162,20 @@ public class TableElementHandler extends AbstractElementHandler implements IPack
|
||||||
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);
|
|
||||||
|
|
||||||
if (rs1.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Reference_ID)>0)
|
packOut.createAdElement(rs1.getInt("AD_Element_ID"), document);
|
||||||
{
|
|
||||||
handler = packOut.getHandler("REF");
|
if (rs1.getInt("AD_Reference_ID")>0)
|
||||||
handler.packOut(packOut,null,rs1,document,null,0);
|
packOut.createReference (rs1.getInt("AD_Reference_ID"), document);
|
||||||
}
|
|
||||||
|
|
||||||
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(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Process_ID)>0)
|
if (rs1.getInt("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)
|
if (rs1.getInt("AD_Val_Rule_ID")>0)
|
||||||
{
|
packOut.createDynamicRuleValidation (rs1.getInt("AD_Val_Rule_ID"), document);
|
||||||
handler = packOut.getHandler("V");
|
|
||||||
handler.packOut(packOut,rs,rs1,document,null,0);
|
|
||||||
}
|
|
||||||
|
|
||||||
createColumn(ctx, document, rs1.getInt("AD_Column_ID"));
|
createColumn(ctx, document, rs1.getInt("AD_Column_ID"));
|
||||||
}
|
}
|
||||||
|
@ -294,15 +284,4 @@ public class TableElementHandler extends AbstractElementHandler implements IPack
|
||||||
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,7 +16,6 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
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;
|
||||||
|
@ -35,9 +34,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;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
public class TaskElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
public class TaskElementHandler extends AbstractElementHandler implements IPackOutHandler{
|
|
||||||
|
|
||||||
private List<Integer> tasks = new ArrayList<Integer>();
|
private List<Integer> tasks = new ArrayList<Integer>();
|
||||||
|
|
||||||
|
@ -51,14 +48,16 @@ public class TaskElementHandler extends AbstractElementHandler implements IPackO
|
||||||
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) {
|
||||||
backupRecord(ctx, "AD_Task", m_Task);
|
AD_Backup_ID = copyRecord(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"));
|
||||||
|
@ -70,12 +69,12 @@ public class TaskElementHandler extends AbstractElementHandler implements IPackO
|
||||||
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(),
|
||||||
Object_Status, "AD_Task",
|
AD_Backup_ID, 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(),
|
||||||
Object_Status, "AD_Task",
|
AD_Backup_ID, 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");
|
||||||
|
@ -137,14 +136,4 @@ public class TaskElementHandler extends AbstractElementHandler implements IPackO
|
||||||
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,7 +32,6 @@ 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;
|
||||||
|
@ -42,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 WindowElementHandler extends AbstractElementHandler implements IPackOutHandler{
|
public class WindowElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
private TabElementHandler tabHandler = new TabElementHandler();
|
private TabElementHandler tabHandler = new TabElementHandler();
|
||||||
private PreferenceElementHandler preferenceHandler = new PreferenceElementHandler();
|
private PreferenceElementHandler preferenceHandler = new PreferenceElementHandler();
|
||||||
|
@ -66,11 +65,13 @@ public class WindowElementHandler extends AbstractElementHandler implements IPac
|
||||||
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) {
|
||||||
backupRecord(ctx, "AD_Window", m_Window);
|
AD_Backup_ID = copyRecord(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);
|
||||||
|
|
||||||
|
@ -119,14 +120,14 @@ public class WindowElementHandler extends AbstractElementHandler implements IPac
|
||||||
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(), Object_Status, "AD_Window",
|
.get_ID(), AD_Backup_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(), Object_Status, "AD_Window",
|
.get_ID(), AD_Backup_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");
|
||||||
|
@ -156,9 +157,12 @@ public class WindowElementHandler extends AbstractElementHandler implements IPac
|
||||||
try {
|
try {
|
||||||
ResultSet rs = pstmt.executeQuery();
|
ResultSet rs = pstmt.executeQuery();
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
IPackOutHandler handler = packOut.getHandler("T");
|
String tableSql = "SELECT Name FROM AD_Table WHERE AD_Table_ID=?";
|
||||||
handler.packOut(packOut,null,rs,document,null,0);
|
int table_id = rs.getInt("AD_TABLE_ID");
|
||||||
|
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();
|
||||||
|
@ -295,15 +299,4 @@ public class WindowElementHandler extends AbstractElementHandler implements IPac
|
||||||
.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 implements IPackOutHandler{
|
public class WorkflowElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
private WorkflowNodeElementHandler nodeHandler = new WorkflowNodeElementHandler();
|
private WorkflowNodeElementHandler nodeHandler = new WorkflowNodeElementHandler();
|
||||||
private WorkflowNodeNextElementHandler nodeNextHandler = new WorkflowNodeNextElementHandler();
|
private WorkflowNodeNextElementHandler nodeNextHandler = new WorkflowNodeNextElementHandler();
|
||||||
|
@ -71,14 +71,16 @@ public class WorkflowElementHandler extends AbstractElementHandler implements IP
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
||||||
backupRecord(ctx, "AD_Workflow", m_Workflow);
|
AD_Backup_ID = copyRecord(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");
|
||||||
|
@ -150,7 +152,7 @@ public class WorkflowElementHandler extends AbstractElementHandler implements IP
|
||||||
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(), Object_Status, "AD_Workflow",
|
.get_ID(), AD_Backup_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());
|
||||||
|
@ -158,7 +160,7 @@ public class WorkflowElementHandler extends AbstractElementHandler implements IP
|
||||||
} 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(), Object_Status, "AD_Workflow",
|
.get_ID(), AD_Backup_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");
|
||||||
|
@ -189,7 +191,7 @@ public class WorkflowElementHandler extends AbstractElementHandler implements IP
|
||||||
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(), "Update", "AD_Workflow",
|
.get_ID(), 0, "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());
|
||||||
|
@ -197,7 +199,7 @@ public class WorkflowElementHandler extends AbstractElementHandler implements IP
|
||||||
} 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(), "Update", "AD_Workflow",
|
.get_ID(), 0, "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");
|
||||||
|
@ -220,7 +222,7 @@ public class WorkflowElementHandler extends AbstractElementHandler implements IP
|
||||||
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(), "Update", "AD_Workflow",
|
.get_ID(), 0, "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());
|
||||||
|
@ -228,7 +230,7 @@ public class WorkflowElementHandler extends AbstractElementHandler implements IP
|
||||||
} 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(), "Update", "AD_Workflow",
|
.get_ID(), 0, "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");
|
||||||
|
@ -463,16 +465,4 @@ public class WorkflowElementHandler extends AbstractElementHandler implements IP
|
||||||
// != 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,14 +81,16 @@ 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) {
|
||||||
backupRecord(ctx, "AD_WF_Node", m_WFNode);
|
AD_Backup_ID = copyRecord(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);
|
||||||
|
@ -228,13 +230,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(), Object_Status, "AD_WF_Node",
|
.get_ID(), AD_Backup_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(), Object_Status, "AD_WF_Node",
|
.get_ID(), AD_Backup_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,15 +92,17 @@ 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) {
|
||||||
backupRecord(ctx, "AD_WF_NextCondition",
|
AD_Backup_ID = copyRecord(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(
|
||||||
|
@ -137,6 +139,7 @@ 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",
|
||||||
|
@ -149,6 +152,7 @@ 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,6 +24,7 @@ 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;
|
||||||
|
@ -77,15 +78,17 @@ 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){
|
||||||
backupRecord(ctx, "AD_WF_NodeNext",m_WFNodeNext);
|
AD_Backup_ID = copyRecord(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);
|
||||||
|
@ -96,12 +99,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(), Object_Status,"AD_WF_NodeNext",
|
record_log (ctx, 1, String.valueOf(m_WFNodeNext.get_ID()),"WFNodeNext", m_WFNodeNext.get_ID(),AD_Backup_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(), Object_Status,"AD_WF_NodeNext",
|
record_log (ctx, 0, String.valueOf(m_WFNodeNext.get_ID()),"WFNodeNext", m_WFNodeNext.get_ID(),AD_Backup_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");
|
||||||
}
|
}
|
||||||
|
@ -183,4 +186,89 @@ public class WorkflowNodeNextElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
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