Fixed merge error

This commit is contained in:
Heng Sin Low 2010-07-07 03:33:38 +08:00
parent 44b82f5c33
commit f239d2116c
4 changed files with 134 additions and 144 deletions

View File

@ -1,26 +1,26 @@
/********************************************************************** /**********************************************************************
* This file is part of Adempiere ERP Bazaar * * This file is part of Adempiere ERP Bazaar *
* http://www.adempiere.org * * http://www.adempiere.org *
* * * *
* Copyright (C) Trifon Trifonov. * * Copyright (C) Trifon Trifonov. *
* Copyright (C) Contributors * * Copyright (C) Contributors *
* * * *
* This program is free software; you can redistribute it and/or * * This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License * * modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 * * as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. * * of the License, or (at your option) any later version. *
* * * *
* This program is distributed in the hope that it will be useful, * * This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of * * but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. * * GNU General Public License for more details. *
* * * *
* You should have received a copy of the GNU General Public License * * You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software * * along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. * * MA 02110-1301, USA. *
* * * *
* Contributors: * * Contributors: *
* - Trifon Trifonov (trifonnt@users.sourceforge.net) * * - Trifon Trifonov (trifonnt@users.sourceforge.net) *
* - Antonio Cañaveral, e-Evolution * * - Antonio Cañaveral, e-Evolution *
* * * *
@ -74,32 +74,32 @@ import org.w3c.dom.Text;
* *
*/ */
public class ExportHelper { public class ExportHelper {
/** Logger */ /** Logger */
private static CLogger log = CLogger.getCLogger(ExportHelper.class); private static CLogger log = CLogger.getCLogger(ExportHelper.class);
/** XML Document */ /** XML Document */
private Document outDocument = null; private Document outDocument = null;
/** Custom Date Format */ /** Custom Date Format */
private SimpleDateFormat m_customDateFormat = null; private SimpleDateFormat m_customDateFormat = null;
/** Client */ /** Client */
private int m_AD_Client_ID = -1; private int m_AD_Client_ID = -1;
/** Replication Strategy */ /** Replication Strategy */
MReplicationStrategy m_rplStrategy = null; MReplicationStrategy m_rplStrategy = null;
public ExportHelper(MClient client, MReplicationStrategy rplStrategy) { public ExportHelper(MClient client, MReplicationStrategy rplStrategy) {
m_AD_Client_ID = client.getAD_Client_ID(); m_AD_Client_ID = client.getAD_Client_ID();
m_rplStrategy = rplStrategy; m_rplStrategy = rplStrategy;
} }
public ExportHelper(Properties ctx , int AD_Client_ID) { public ExportHelper(Properties ctx , int AD_Client_ID) {
m_AD_Client_ID = AD_Client_ID; m_AD_Client_ID = AD_Client_ID;
} }
/** /**
* Process - Generate Export Format * Process - Generate Export Format
* @return info * @return info
@ -109,17 +109,17 @@ public class ExportHelper {
{ {
MClient client = MClient.get (po.getCtx(), m_AD_Client_ID); MClient client = MClient.get (po.getCtx(), m_AD_Client_ID);
log.info("Client = " + client.toString()); log.info("Client = " + client.toString());
log.info("po.getAD_Org_ID() = " + po.getAD_Org_ID()); log.info("po.getAD_Org_ID() = " + po.getAD_Org_ID());
log.info("po.get_TrxName() = " + po.get_TrxName()); log.info("po.get_TrxName() = " + po.get_TrxName());
if (po.get_TrxName() == null || po.get_TrxName().equals("")) { if (po.get_TrxName() == null || po.get_TrxName().equals("")) {
po.set_TrxName("exportRecord"); po.set_TrxName("exportRecord");
} }
log.info("Table = " + po.get_TableName()); log.info("Table = " + po.get_TableName());
if (po.get_KeyColumns().length < 1) { if (po.get_KeyColumns().length < 1) {
throw new Exception(Msg.getMsg (po.getCtx(), "ExportNoneColumnKeyNotSupported"));//TODO: Create Mesagge. throw new Exception(Msg.getMsg (po.getCtx(), "ExportNoneColumnKeyNotSupported"));//TODO: Create Mesagge.
} }
@ -135,9 +135,9 @@ public class ExportHelper {
MClient systemClient = MClient.get (po.getCtx(), 0); MClient systemClient = MClient.get (po.getCtx(), 0);
log.info(systemClient.toString()); log.info(systemClient.toString());
exportFormat = MEXPFormat.getFormatByAD_Client_IDAD_Table_IDAndVersion(po.getCtx(), 0, po.get_Table_ID(), version, po.get_TrxName()); exportFormat = MEXPFormat.getFormatByAD_Client_IDAD_Table_IDAndVersion(po.getCtx(), 0, po.get_Table_ID(), version, po.get_TrxName());
if (exportFormat == null || exportFormat.getEXP_Format_ID() == 0) { if (exportFormat == null || exportFormat.getEXP_Format_ID() == 0) {
throw new Exception(Msg.getMsg(po.getCtx(), "EXPFormatNotFound")); throw new Exception(Msg.getMsg(po.getCtx(), "EXPFormatNotFound"));
} }
} }
@ -146,10 +146,10 @@ public class ExportHelper {
HashMap<String, Integer> variableMap = new HashMap<String, Integer>(); HashMap<String, Integer> variableMap = new HashMap<String, Integer>();
Element rootElement = outDocument.createElement(exportFormat.getValue()); Element rootElement = outDocument.createElement(exportFormat.getValue());
if (exportFormat.getDescription() != null && !"".equals(exportFormat.getDescription())) if (exportFormat.getDescription() != null && !"".equals(exportFormat.getDescription()))
{ {
rootElement.appendChild(outDocument.createComment(exportFormat.getDescription())); rootElement.appendChild(outDocument.createComment(exportFormat.getDescription()));
} }
rootElement.setAttribute("AD_Client_Value", client.getValue()); rootElement.setAttribute("AD_Client_Value", client.getValue());
rootElement.setAttribute("Version", exportFormat.getVersion()); rootElement.setAttribute("Version", exportFormat.getVersion());
rootElement.setAttribute("ReplicationMode", ReplicationMode.toString()); rootElement.setAttribute("ReplicationMode", ReplicationMode.toString());
@ -157,22 +157,22 @@ public class ExportHelper {
rootElement.setAttribute("ReplicationEvent", ReplicationEvent.toString()); rootElement.setAttribute("ReplicationEvent", ReplicationEvent.toString());
outDocument.appendChild(rootElement); outDocument.appendChild(rootElement);
generateExportFormat(rootElement, exportFormat, po, po.get_ID(), variableMap); generateExportFormat(rootElement, exportFormat, po, po.get_ID(), variableMap);
MEXPProcessor mExportProcessor = null; MEXPProcessor mExportProcessor = null;
mExportProcessor = new MEXPProcessor (po.getCtx(), m_rplStrategy.getEXP_Processor_ID(), po.get_TrxName() ); mExportProcessor = new MEXPProcessor (po.getCtx(), m_rplStrategy.getEXP_Processor_ID(), po.get_TrxName() );
log.fine("ExportProcessor = " + mExportProcessor); log.fine("ExportProcessor = " + mExportProcessor);
int EXP_ProcessorType_ID = 0; int EXP_ProcessorType_ID = 0;
EXP_ProcessorType_ID = mExportProcessor.getEXP_Processor_Type_ID(); EXP_ProcessorType_ID = mExportProcessor.getEXP_Processor_Type_ID();
MEXPProcessorType expProcessor_Type = new MEXPProcessorType(po.getCtx(), EXP_ProcessorType_ID, po.get_TrxName() ); MEXPProcessorType expProcessor_Type = new MEXPProcessorType(po.getCtx(), EXP_ProcessorType_ID, po.get_TrxName() );
String javaClass = expProcessor_Type.getJavaClass(); String javaClass = expProcessor_Type.getJavaClass();
try { try {
Class clazz = Class.forName(javaClass); Class clazz = Class.forName(javaClass);
IExportProcessor exportProcessor = (IExportProcessor)clazz.newInstance(); IExportProcessor exportProcessor = (IExportProcessor)clazz.newInstance();
exportProcessor.process(po.getCtx(), mExportProcessor, outDocument, Trx.get( po.get_TrxName(), false )); exportProcessor.process(po.getCtx(), mExportProcessor, outDocument, Trx.get( po.get_TrxName(), false ));
} catch (Exception e) { } catch (Exception e) {
log.severe(e.toString()); log.severe(e.toString());
throw e; throw e;
@ -180,12 +180,12 @@ public class ExportHelper {
return outDocument.toString(); return outDocument.toString();
} }
/** /**
* Process - Generate Export Format * Process - Generate Export Format
* @param * @param
* *
* @return Document * @return Document
*/ */
public Document exportRecord (MEXPFormat exportFormat, String where , Integer ReplicationMode , String ReplicationType, Integer ReplicationEvent) throws Exception public Document exportRecord (MEXPFormat exportFormat, String where , Integer ReplicationMode , String ReplicationType, Integer ReplicationEvent) throws Exception
@ -193,30 +193,30 @@ public class ExportHelper {
MClient client = MClient.get (exportFormat.getCtx(), m_AD_Client_ID); MClient client = MClient.get (exportFormat.getCtx(), m_AD_Client_ID);
MTable table = MTable.get(exportFormat.getCtx(), exportFormat.getAD_Table_ID()); MTable table = MTable.get(exportFormat.getCtx(), exportFormat.getAD_Table_ID());
log.info("Table = " + table); log.info("Table = " + table);
Collection<PO> records = new Query(exportFormat.getCtx(),table.getTableName(), exportFormat.getWhereClause(), exportFormat.get_TrxName()) Collection<PO> records = new Query(exportFormat.getCtx(),table.getTableName(), exportFormat.getWhereClause(), exportFormat.get_TrxName())
.setOnlyActiveRecords(true) .setOnlyActiveRecords(true)
.list(); .list();
for (PO po : records) for (PO po : records)
{ {
log.info("Client = " + client.toString()); log.info("Client = " + client.toString());
log.finest("po.getAD_Org_ID() = " + po.getAD_Org_ID()); log.finest("po.getAD_Org_ID() = " + po.getAD_Org_ID());
log.finest("po.get_TrxName() = " + po.get_TrxName()); log.finest("po.get_TrxName() = " + po.get_TrxName());
if (po.get_TrxName() == null || po.get_TrxName().equals("")) { if (po.get_TrxName() == null || po.get_TrxName().equals("")) {
po.set_TrxName("exportRecord"); po.set_TrxName("exportRecord");
} }
if (po.get_KeyColumns().length < 1) { if (po.get_KeyColumns().length < 1) {
throw new Exception(Msg.getMsg (po.getCtx(), "ExportNoneColumnKeyNotSupported"));//TODO: Create Mesagge. throw new Exception(Msg.getMsg (po.getCtx(), "ExportNoneColumnKeyNotSupported"));//TODO: Create Mesagge.
} }
outDocument = createNewDocument();
HashMap<String, Integer> variableMap = new HashMap<String, Integer>(); outDocument = createNewDocument();
HashMap<String, Integer> variableMap = new HashMap<String, Integer>();
Element rootElement = outDocument.createElement(exportFormat.getValue()); Element rootElement = outDocument.createElement(exportFormat.getValue());
if (exportFormat.getDescription() != null && !"".equals(exportFormat.getDescription())) if (exportFormat.getDescription() != null && !"".equals(exportFormat.getDescription()))
{ {
rootElement.appendChild(outDocument.createComment(exportFormat.getDescription())); rootElement.appendChild(outDocument.createComment(exportFormat.getDescription()));
} }
@ -224,29 +224,29 @@ public class ExportHelper {
rootElement.setAttribute("Version", exportFormat.getVersion()); rootElement.setAttribute("Version", exportFormat.getVersion());
rootElement.setAttribute("ReplicationMode", ReplicationMode.toString()); rootElement.setAttribute("ReplicationMode", ReplicationMode.toString());
rootElement.setAttribute("ReplicationType", ReplicationType); rootElement.setAttribute("ReplicationType", ReplicationType);
rootElement.setAttribute("ReplicationEvent", ReplicationEvent.toString()); rootElement.setAttribute("ReplicationEvent", ReplicationEvent.toString());
outDocument.appendChild(rootElement); outDocument.appendChild(rootElement);
generateExportFormat(rootElement, exportFormat, po, po.get_ID(), variableMap); generateExportFormat(rootElement, exportFormat, po, po.get_ID(), variableMap);
}// finish record read }// finish record read
return outDocument; return outDocument;
} }
/* /*
* Trifon Generate Export Format process; RESULT = * Trifon Generate Export Format process; RESULT =
* <C_Invoice> * <C_Invoice>
* <DocumentNo>101</DocumentNo> * <DocumentNo>101</DocumentNo>
* </C_Invoice> * </C_Invoice>
*/ */
private void generateExportFormat(Element rootElement, MEXPFormat exportFormat, PO masterPO, int masterID, HashMap<String, Integer> variableMap) throws SQLException, Exception private void generateExportFormat(Element rootElement, MEXPFormat exportFormat, PO masterPO, int masterID, HashMap<String, Integer> variableMap) throws SQLException, Exception
{ {
Collection<MEXPFormatLine> formatLines = exportFormat.getFormatLines(); Collection<MEXPFormatLine> formatLines = exportFormat.getFormatLines();
@SuppressWarnings("unused") @SuppressWarnings("unused")
boolean elementHasValue = false; boolean elementHasValue = false;
//for (int i = 0; i < formatLines.length; i++) { //for (int i = 0; i < formatLines.length; i++) {
for (MEXPFormatLine formatLine : formatLines) for (MEXPFormatLine formatLine : formatLines)
{ {
if ( formatLine.getType().equals(X_EXP_FormatLine.TYPE_XMLElement) ) { if ( formatLine.getType().equals(X_EXP_FormatLine.TYPE_XMLElement) ) {
// process single XML Attribute // process single XML Attribute
// Create new element // Create new element
@ -263,13 +263,13 @@ public class ExportHelper {
log.info("This is Virtual Column!"); log.info("This is Virtual Column!");
} else { } } else { }
//log.info("["+column.getColumnName()+"]"); //log.info("["+column.getColumnName()+"]");
Object value = masterPO.get_Value(column.getColumnName()); Object value = masterPO.get_Value(column.getColumnName());
String valueString = null; String valueString = null;
if (value != null) { if (value != null) {
valueString = value.toString(); valueString = value.toString();
} else { } else {
// Could remove this exception and create empty XML Element when column do not have value. // Could remove this exception and create empty XML Element when column do not have value.
if (formatLine.isMandatory()) { if (formatLine.isMandatory()) {
//throw new Exception(Msg.getMsg (masterPO.getCtx(), "EXPFieldMandatory")); //throw new Exception(Msg.getMsg (masterPO.getCtx(), "EXPFieldMandatory"));
} }
@ -278,14 +278,14 @@ public class ExportHelper {
if (valueString != null) { if (valueString != null) {
if (formatLine.getDateFormat() != null && !"".equals(formatLine.getDateFormat())) { if (formatLine.getDateFormat() != null && !"".equals(formatLine.getDateFormat())) {
m_customDateFormat = new SimpleDateFormat( formatLine.getDateFormat() ); // "MM/dd/yyyy" m_customDateFormat = new SimpleDateFormat( formatLine.getDateFormat() ); // "MM/dd/yyyy"
valueString = m_customDateFormat.format(Timestamp.valueOf (valueString)); valueString = m_customDateFormat.format(Timestamp.valueOf (valueString));
newElement.setAttribute("DateFormat", m_customDateFormat.toPattern()); // Add "DateForamt attribute" newElement.setAttribute("DateFormat", m_customDateFormat.toPattern()); // Add "DateForamt attribute"
} else } else
{ {
newElement.setAttribute("DateFormat", valueString); newElement.setAttribute("DateFormat", valueString);
} }
} }
} else if (column.getAD_Reference_ID() == DisplayType.DateTime) { } else if (column.getAD_Reference_ID() == DisplayType.DateTime) {
if (valueString != null) { if (valueString != null) {
@ -294,7 +294,7 @@ public class ExportHelper {
valueString = m_customDateFormat.format(Timestamp.valueOf (valueString)); valueString = m_customDateFormat.format(Timestamp.valueOf (valueString));
newElement.setAttribute("DateFormat", m_customDateFormat.toPattern()); // Add "DateForamt attribute" newElement.setAttribute("DateFormat", m_customDateFormat.toPattern()); // Add "DateForamt attribute"
} else { } else {
newElement.setAttribute("DateFormat", valueString); newElement.setAttribute("DateFormat", valueString);
} }
} }
} }
@ -326,7 +326,7 @@ public class ExportHelper {
log.info("This is Virtual Column!"); log.info("This is Virtual Column!");
} else { } } else { }
//log.info("["+column.getColumnName()+"]"); //log.info("["+column.getColumnName()+"]");
Object value = masterPO.get_Value(column.getColumnName()); Object value = masterPO.get_Value(column.getColumnName());
String valueString = null; String valueString = null;
if (value != null) { if (value != null) {
@ -345,7 +345,7 @@ public class ExportHelper {
} else { } else {
valueString = m_dateFormat.format (Timestamp.valueOf (valueString)); valueString = m_dateFormat.format (Timestamp.valueOf (valueString));
} }
} }
} else if (column.getAD_Reference_ID() == DisplayType.DateTime) { } else if (column.getAD_Reference_ID() == DisplayType.DateTime) {
if (valueString != null) { if (valueString != null) {
@ -366,21 +366,21 @@ public class ExportHelper {
} else { } else {
// Empty field. // Empty field.
} }
} }
else if ( formatLine.getType().equals(X_EXP_FormatLine.TYPE_EmbeddedEXPFormat) ) else if ( formatLine.getType().equals(X_EXP_FormatLine.TYPE_EmbeddedEXPFormat) )
{ {
// process Embedded Export Format // process Embedded Export Format
int embeddedFormat_ID = formatLine.getEXP_EmbeddedFormat_ID(); int embeddedFormat_ID = formatLine.getEXP_EmbeddedFormat_ID();
//get from cache //get from cache
MEXPFormat embeddedFormat = MEXPFormat.get(masterPO.getCtx(), embeddedFormat_ID, masterPO.get_TrxName()); MEXPFormat embeddedFormat = MEXPFormat.get(masterPO.getCtx(), embeddedFormat_ID, masterPO.get_TrxName());
MTable tableEmbedded = MTable.get(masterPO.getCtx(), embeddedFormat.getAD_Table_ID()); MTable tableEmbedded = MTable.get(masterPO.getCtx(), embeddedFormat.getAD_Table_ID());
log.info("Table Embedded = " + tableEmbedded); log.info("Table Embedded = " + tableEmbedded);
final StringBuffer whereClause = new StringBuffer(masterPO.get_KeyColumns()[0] +"=?"); final StringBuffer whereClause = new StringBuffer(masterPO.get_KeyColumns()[0] +"=?");
if (embeddedFormat.getWhereClause() != null & !"".equals(embeddedFormat.getWhereClause())) if (embeddedFormat.getWhereClause() != null & !"".equals(embeddedFormat.getWhereClause()))
{ {
whereClause.append(" AND ").append(embeddedFormat.getWhereClause()); whereClause.append(" AND ").append(embeddedFormat.getWhereClause());
} }
@ -389,41 +389,42 @@ public class ExportHelper {
masterPO.get_TrxName()).setClient_ID().setParameters( masterPO.get_TrxName()).setClient_ID().setParameters(
new Object[] { masterID }).list(); new Object[] { masterID }).list();
for (PO instance : instances) for (PO instance : instances)
{ {
Element embeddedElement = outDocument.createElement(formatLine.getValue()); Element embeddedElement = outDocument.createElement(formatLine.getValue());
if (formatLine.getDescription() != null && !"".equals(formatLine.getDescription())) if (formatLine.getDescription() != null && !"".equals(formatLine.getDescription()))
{ {
embeddedElement.appendChild(outDocument.createComment(formatLine.getDescription())); embeddedElement.appendChild(outDocument.createComment(formatLine.getDescription()));
} }
generateExportFormat(embeddedElement, embeddedFormat, instance, instance.get_ID(), variableMap); generateExportFormat(embeddedElement, embeddedFormat, instance, instance.get_ID(), variableMap);
rootElement.appendChild(embeddedElement); rootElement.appendChild(embeddedElement);
} }
} }
else if ( formatLine.getType().equals(X_EXP_FormatLine.TYPE_ReferencedEXPFormat) ) else if ( formatLine.getType().equals(X_EXP_FormatLine.TYPE_ReferencedEXPFormat) )
{ {
// process Referenced Export Format // process Referenced Export Format
int embeddedFormat_ID = formatLine.getEXP_EmbeddedFormat_ID(); int embeddedFormat_ID = formatLine.getEXP_EmbeddedFormat_ID();
//get from cache //get from cache
MEXPFormat embeddedFormat = MEXPFormat.get(masterPO.getCtx(), embeddedFormat_ID, masterPO.get_TrxName()); MEXPFormat embeddedFormat = MEXPFormat.get(masterPO.getCtx(), embeddedFormat_ID, masterPO.get_TrxName());
MTable tableEmbedded = MTable.get(masterPO.getCtx(), embeddedFormat.getAD_Table_ID()); MTable tableEmbedded = MTable.get(masterPO.getCtx(), embeddedFormat.getAD_Table_ID());
log.info("Table Embedded = " + tableEmbedded); log.info("Table Embedded = " + tableEmbedded);
final StringBuffer whereClause = new StringBuffer(tableEmbedded.getTableName() + "_ID =?"); final StringBuffer whereClause = new StringBuffer(tableEmbedded.getTableName() + "_ID =?");
if (embeddedFormat.getWhereClause() != null & !"".equals(embeddedFormat.getWhereClause())) if (embeddedFormat.getWhereClause() != null & !"".equals(embeddedFormat.getWhereClause()))
{ {
whereClause.append(" AND ").append(embeddedFormat.getWhereClause()); whereClause.append(" AND ").append(embeddedFormat.getWhereClause());
}
String columnName = ""; String columnName = "";
if(formatLine.getAD_Reference_ID()== DisplayType.Table | formatLine.getAD_Reference_ID()==DisplayType.Search) if(formatLine.getAD_Reference_ID()== DisplayType.Table | formatLine.getAD_Reference_ID()==DisplayType.Search)
{ {
MColumn column = MColumn.get(masterPO.getCtx(), formatLine.getAD_Column_ID()); MColumn column = MColumn.get(masterPO.getCtx(), formatLine.getAD_Column_ID());
columnName = column.getColumnName(); columnName = column.getColumnName();
}
else else
{ {
columnName = tableEmbedded.getTableName() + "_ID"; columnName = tableEmbedded.getTableName() + "_ID";
@ -431,33 +432,33 @@ public class ExportHelper {
Object value = masterPO.get_Value(columnName); Object value = masterPO.get_Value(columnName);
if (value == null) if (value == null)
{ {
continue; continue;
} }
Collection<PO> instances = new Query(masterPO.getCtx(),tableEmbedded.getTableName(), whereClause.toString(),masterPO.get_TrxName()) Collection<PO> instances = new Query(masterPO.getCtx(),tableEmbedded.getTableName(), whereClause.toString(),masterPO.get_TrxName())
.setClient_ID() .setClient_ID()
.setParameters(value) .setParameters(value)
.list(); .list();
for (PO instance : instances) for (PO instance : instances)
{ {
Element embeddedElement = outDocument.createElement(formatLine.getValue()); Element embeddedElement = outDocument.createElement(formatLine.getValue());
if (formatLine.getDescription() != null && !"".equals(formatLine.getDescription())) if (formatLine.getDescription() != null && !"".equals(formatLine.getDescription()))
{ {
embeddedElement.appendChild(outDocument.createComment(formatLine.getDescription())); embeddedElement.appendChild(outDocument.createComment(formatLine.getDescription()));
} }
generateExportFormat(embeddedElement, embeddedFormat, instance, instance.get_ID(), variableMap); generateExportFormat(embeddedElement, embeddedFormat, instance, instance.get_ID(), variableMap);
rootElement.appendChild(embeddedElement); rootElement.appendChild(embeddedElement);
} }
} }
else { else {
throw new Exception(Msg.getMsg (masterPO.getCtx(), "EXPUnknownLineType")); throw new Exception(Msg.getMsg (masterPO.getCtx(), "EXPUnknownLineType"));
} }
} }
} }
/** /**
@ -479,20 +480,20 @@ public class ExportHelper {
/** /**
* Utility method which is responsible to create new XML Document * Utility method which is responsible to create new XML Document
* *
* @return Document * @return Document
* @throws ParserConfigurationException * @throws ParserConfigurationException
*/ */
// create new Document // create new Document
Document createNewDocument() throws ParserConfigurationException Document createNewDocument() throws ParserConfigurationException
{ {
Document result = null; Document result = null;
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
result = documentBuilder.newDocument(); result = documentBuilder.newDocument();
return result; return result;
} }
} }

View File

@ -104,16 +104,13 @@ Export-Package: com.keypoint,
org.jdesktop.swingx, org.jdesktop.swingx,
org.jdesktop.swingx.action, org.jdesktop.swingx.action,
org.jdesktop.swingx.auth, org.jdesktop.swingx.auth,
org.jdesktop.swingx.auth.resources,
org.jdesktop.swingx.autocomplete, org.jdesktop.swingx.autocomplete,
org.jdesktop.swingx.autocomplete.workarounds, org.jdesktop.swingx.autocomplete.workarounds,
org.jdesktop.swingx.border, org.jdesktop.swingx.border,
org.jdesktop.swingx.calendar, org.jdesktop.swingx.calendar,
org.jdesktop.swingx.calendar.resources,
org.jdesktop.swingx.color, org.jdesktop.swingx.color,
org.jdesktop.swingx.combobox, org.jdesktop.swingx.combobox,
org.jdesktop.swingx.decorator, org.jdesktop.swingx.decorator,
org.jdesktop.swingx.editors,
org.jdesktop.swingx.error, org.jdesktop.swingx.error,
org.jdesktop.swingx.event, org.jdesktop.swingx.event,
org.jdesktop.swingx.geom, org.jdesktop.swingx.geom,
@ -133,13 +130,10 @@ Export-Package: com.keypoint,
org.jdesktop.swingx.plaf.misc, org.jdesktop.swingx.plaf.misc,
org.jdesktop.swingx.plaf.motif, org.jdesktop.swingx.plaf.motif,
org.jdesktop.swingx.plaf.nimbus, org.jdesktop.swingx.plaf.nimbus,
org.jdesktop.swingx.plaf.resources,
org.jdesktop.swingx.plaf.windows, org.jdesktop.swingx.plaf.windows,
org.jdesktop.swingx.plaf.windows.resources, org.jdesktop.swingx.plaf.windows.resources,
org.jdesktop.swingx.renderer, org.jdesktop.swingx.renderer,
org.jdesktop.swingx.resources,
org.jdesktop.swingx.table, org.jdesktop.swingx.table,
org.jdesktop.swingx.table.resources,
org.jdesktop.swingx.tips, org.jdesktop.swingx.tips,
org.jdesktop.swingx.tree, org.jdesktop.swingx.tree,
org.jdesktop.swingx.treetable, org.jdesktop.swingx.treetable,

View File

@ -803,7 +803,7 @@ public class GridController extends CPanel
// Process Callout // Process Callout
GridField mField = m_mTab.getField(col); GridField mField = m_mTab.getField(col);
if (mField != null if (mField != null) {
List<IColumnCallout> callouts = Core.findCallout(m_mTab.getTableName(), mField.getColumnName()); List<IColumnCallout> callouts = Core.findCallout(m_mTab.getTableName(), mField.getColumnName());
if (mField.getCallout().length() > 0 || callouts.size()>0 || m_mTab.hasDependants(mField.getColumnName())) if (mField.getCallout().length() > 0 || callouts.size()>0 || m_mTab.hasDependants(mField.getColumnName()))
{ {

View File

@ -42,7 +42,7 @@ import org.compiere.util.Trx;
* *
* @author Jorg Janke * @author Jorg Janke
* @version $Id: ReportCtl.java,v 1.3 2006/10/08 07:05:08 comdivision Exp $ * @version $Id: ReportCtl.java,v 1.3 2006/10/08 07:05:08 comdivision Exp $
* *
* @author Teo Sarca, SC ARHIPAC SERVICE SRL * @author Teo Sarca, SC ARHIPAC SERVICE SRL
* <li>FR [ 1866739 ] ReportCtl: use printformat from the transient/serializable * <li>FR [ 1866739 ] ReportCtl: use printformat from the transient/serializable
*/ */
@ -60,7 +60,7 @@ public class ReportCtl
* @deprecated Please use {@link ServerReportCtl#PARAM_PRINT_INFO} * @deprecated Please use {@link ServerReportCtl#PARAM_PRINT_INFO}
*/ */
public static final String PARAM_PRINT_INFO = ServerReportCtl.PARAM_PRINT_INFO; public static final String PARAM_PRINT_INFO = ServerReportCtl.PARAM_PRINT_INFO;
/** /**
* Constructor - prevent instance * Constructor - prevent instance
*/ */
@ -68,12 +68,12 @@ public class ReportCtl
{ {
} // ReportCtrl } // ReportCtrl
/** Static Logger */ /** Static Logger */
private static CLogger s_log = CLogger.getCLogger (ReportCtl.class); private static CLogger s_log = CLogger.getCLogger (ReportCtl.class);
private static ReportViewerProvider viewerProvider = new SwingViewerProvider(); private static ReportViewerProvider viewerProvider = new SwingViewerProvider();
/** /**
* Create Report. * Create Report.
* Called from ProcessCtl. * Called from ProcessCtl.
@ -87,7 +87,7 @@ public class ReportCtl
{ {
return start(null, -1, pi, IsDirectPrint); return start(null, -1, pi, IsDirectPrint);
} }
/** /**
* Create Report. * Create Report.
* Called from ProcessCtl. * Called from ProcessCtl.
@ -104,7 +104,7 @@ public class ReportCtl
pi.setPrintPreview(!IsDirectPrint); pi.setPrintPreview(!IsDirectPrint);
return start(parent, WindowNo, pi); return start(parent, WindowNo, pi);
} }
/** /**
* Create Report. * Create Report.
* Called from ProcessCtl. * Called from ProcessCtl.
@ -170,7 +170,7 @@ public class ReportCtl
pi.setPrintPreview(!IsDirectPrint); pi.setPrintPreview(!IsDirectPrint);
return startStandardReport(pi); return startStandardReport(pi);
} }
/************************************************************************** /**************************************************************************
* Start Standard Report. * Start Standard Report.
* - Get Table Info & submit.<br> * - Get Table Info & submit.<br>
@ -211,7 +211,7 @@ public class ReportCtl
return false; return false;
} }
} }
createOutput(re, pi.isPrintPreview(), null); createOutput(re, pi.isPrintPreview(), null);
return true; return true;
} // startStandardReport } // startStandardReport
@ -244,7 +244,7 @@ public class ReportCtl
createOutput(re, pi.isPrintPreview(), null); createOutput(re, pi.isPrintPreview(), null);
return true; return true;
} // startFinReport } // startFinReport
/** /**
* Start Document Print for Type. * Start Document Print for Type.
* Called also directly from ProcessDialog, VInOutGen, VInvoiceGen, VPayPrint * Called also directly from ProcessDialog, VInOutGen, VInvoiceGen, VPayPrint
@ -257,7 +257,7 @@ public class ReportCtl
{ {
return startDocumentPrint(type, Record_ID, null, -1, IsDirectPrint); return startDocumentPrint(type, Record_ID, null, -1, IsDirectPrint);
} }
/** /**
* Start Document Print for Type with specified printer. Always direct print. * Start Document Print for Type with specified printer. Always direct print.
* @param type document type in ReportEngine * @param type document type in ReportEngine
@ -268,7 +268,7 @@ public class ReportCtl
* @param printerName Specified printer name * @param printerName Specified printer name
* @return true if success * @return true if success
*/ */
public static boolean startDocumentPrint(int type, MPrintFormat customPrintFormat, int Record_ID, ASyncProcess parent, int WindowNo, String printerName) public static boolean startDocumentPrint(int type, MPrintFormat customPrintFormat, int Record_ID, ASyncProcess parent, int WindowNo, String printerName)
{ {
return(startDocumentPrint(type, customPrintFormat, Record_ID, parent, WindowNo, true, printerName)); return(startDocumentPrint(type, customPrintFormat, Record_ID, parent, WindowNo, true, printerName));
} }
@ -284,7 +284,7 @@ public class ReportCtl
* @return true if success * @return true if success
*/ */
public static boolean startDocumentPrint(int type, int Record_ID, ASyncProcess parent, int WindowNo, public static boolean startDocumentPrint(int type, int Record_ID, ASyncProcess parent, int WindowNo,
boolean IsDirectPrint) boolean IsDirectPrint)
{ {
return(startDocumentPrint(type, null, Record_ID, parent, WindowNo, IsDirectPrint, null )); return(startDocumentPrint(type, null, Record_ID, parent, WindowNo, IsDirectPrint, null ));
} }
@ -298,7 +298,7 @@ public class ReportCtl
* @param printerName Specified printer name * @param printerName Specified printer name
* @return true if success * @return true if success
*/ */
public static boolean startDocumentPrint (int type, MPrintFormat customPrintFormat, int Record_ID, ASyncProcess parent, int WindowNo, public static boolean startDocumentPrint (int type, MPrintFormat customPrintFormat, int Record_ID, ASyncProcess parent, int WindowNo,
boolean IsDirectPrint, String printerName) boolean IsDirectPrint, String printerName)
{ {
ReportEngine re = ReportEngine.get (Env.getCtx(), type, Record_ID); ReportEngine re = ReportEngine.get (Env.getCtx(), type, Record_ID);
@ -310,7 +310,7 @@ public class ReportCtl
} }
else else
{ {
try try
{ {
ClassLoader loader = Thread.currentThread().getContextClassLoader(); ClassLoader loader = Thread.currentThread().getContextClassLoader();
if (loader == null) if (loader == null)
@ -318,7 +318,7 @@ public class ReportCtl
Class<?> clazz = loader.loadClass("org.adempiere.webui.window.FDialog"); Class<?> clazz = loader.loadClass("org.adempiere.webui.window.FDialog");
Method m = clazz.getMethod("error", Integer.TYPE, String.class); Method m = clazz.getMethod("error", Integer.TYPE, String.class);
m.invoke(null, 0, "NoDocPrintFormat"); m.invoke(null, 0, "NoDocPrintFormat");
} catch (Exception e) } catch (Exception e)
{ {
throw new AdempiereException(e); throw new AdempiereException(e);
} }
@ -329,19 +329,14 @@ public class ReportCtl
// Use custom print format if available // Use custom print format if available
re.setPrintFormat(customPrintFormat); re.setPrintFormat(customPrintFormat);
} }
if(re.getPrintFormat()!=null) if(re.getPrintFormat()!=null)
{ {
MPrintFormat format = re.getPrintFormat(); MPrintFormat format = re.getPrintFormat();
// We have a Jasper Print Format // We have a Jasper Print Format
// ============================== // ==============================
if(format.getJasperProcess_ID() > 0) if(format.getJasperProcess_ID() > 0)
if (info.isDocument()) {
ProcessInfoParameter pip = new ProcessInfoParameter("CURRENT_LANG", format.getLanguage(), null, null, null);
pi.setParameter(new ProcessInfoParameter[]{pip});
}
{ {
ServerReportCtl.runJasperProcess(Record_ID, re, IsDirectPrint, printerName); ServerReportCtl.runJasperProcess(Record_ID, re, IsDirectPrint, printerName);
} }
@ -358,7 +353,7 @@ public class ReportCtl
} }
return true; return true;
} // StartDocumentPrint } // StartDocumentPrint
/** /**
* Start Check Print. * Start Check Print.
* Find/Create * Find/Create
@ -368,14 +363,14 @@ public class ReportCtl
*/ */
public static boolean startCheckPrint (int C_Payment_ID, boolean IsDirectPrint) public static boolean startCheckPrint (int C_Payment_ID, boolean IsDirectPrint)
{ {
// afalcone - [ 1871567 ] Wrong value in Payment document // afalcone - [ 1871567 ] Wrong value in Payment document
boolean ok = MPaySelectionCheck.deleteGeneratedDraft(Env.getCtx(), C_Payment_ID, null); boolean ok = MPaySelectionCheck.deleteGeneratedDraft(Env.getCtx(), C_Payment_ID, null);
// //
int C_PaySelectionCheck_ID = 0; int C_PaySelectionCheck_ID = 0;
MPaySelectionCheck psc = MPaySelectionCheck.getOfPayment(Env.getCtx(), C_Payment_ID, null); MPaySelectionCheck psc = MPaySelectionCheck.getOfPayment(Env.getCtx(), C_Payment_ID, null);
if (psc != null) if (psc != null)
C_PaySelectionCheck_ID = psc.getC_PaySelectionCheck_ID(); C_PaySelectionCheck_ID = psc.getC_PaySelectionCheck_ID();
else else
@ -386,7 +381,7 @@ public class ReportCtl
} }
return startDocumentPrint (ReportEngine.CHECK, C_PaySelectionCheck_ID, null, -1, IsDirectPrint); return startDocumentPrint (ReportEngine.CHECK, C_PaySelectionCheck_ID, null, -1, IsDirectPrint);
} // startCheckPrint } // startCheckPrint
private static void createOutput(ReportEngine re, boolean printPreview, String printerName) private static void createOutput(ReportEngine re, boolean printPreview, String printerName)
{ {
if (printPreview) if (printPreview)
@ -398,24 +393,24 @@ public class ReportCtl
re.print(); re.print();
} }
} }
/** /**
* Launch viewer for report * Launch viewer for report
* @param re * @param re
*/ */
public static void preview(ReportEngine re) public static void preview(ReportEngine re)
{ {
ReportViewerProvider provider = getReportViewerProvider(); ReportViewerProvider provider = getReportViewerProvider();
provider.openViewer(re); provider.openViewer(re);
} }
public static void setReportViewerProvider(ReportViewerProvider provider) public static void setReportViewerProvider(ReportViewerProvider provider)
{ {
if (provider == null) if (provider == null)
throw new IllegalArgumentException("Cannot set report viewer provider to null"); throw new IllegalArgumentException("Cannot set report viewer provider to null");
viewerProvider = provider; viewerProvider = provider;
} }
public static ReportViewerProvider getReportViewerProvider() public static ReportViewerProvider getReportViewerProvider()
{ {
return viewerProvider; return viewerProvider;