Fixed merge error
This commit is contained in:
parent
44b82f5c33
commit
f239d2116c
|
@ -1,26 +1,26 @@
|
|||
/**********************************************************************
|
||||
* This file is part of Adempiere ERP Bazaar *
|
||||
* http://www.adempiere.org *
|
||||
* *
|
||||
* Copyright (C) Trifon Trifonov. *
|
||||
* Copyright (C) Contributors *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License *
|
||||
* as published by the Free Software Foundation; either version 2 *
|
||||
* of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the Free Software *
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
|
||||
* MA 02110-1301, USA. *
|
||||
* *
|
||||
* Contributors: *
|
||||
* This file is part of Adempiere ERP Bazaar *
|
||||
* http://www.adempiere.org *
|
||||
* *
|
||||
* Copyright (C) Trifon Trifonov. *
|
||||
* Copyright (C) Contributors *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License *
|
||||
* as published by the Free Software Foundation; either version 2 *
|
||||
* of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the Free Software *
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
|
||||
* MA 02110-1301, USA. *
|
||||
* *
|
||||
* Contributors: *
|
||||
* - Trifon Trifonov (trifonnt@users.sourceforge.net) *
|
||||
* - Antonio Cañaveral, e-Evolution *
|
||||
* *
|
||||
|
@ -74,32 +74,32 @@ import org.w3c.dom.Text;
|
|||
*
|
||||
*/
|
||||
public class ExportHelper {
|
||||
|
||||
|
||||
/** Logger */
|
||||
private static CLogger log = CLogger.getCLogger(ExportHelper.class);
|
||||
|
||||
|
||||
/** XML Document */
|
||||
private Document outDocument = null;
|
||||
|
||||
private Document outDocument = null;
|
||||
|
||||
/** Custom Date Format */
|
||||
private SimpleDateFormat m_customDateFormat = null;
|
||||
|
||||
|
||||
/** Client */
|
||||
private int m_AD_Client_ID = -1;
|
||||
|
||||
|
||||
/** Replication Strategy */
|
||||
MReplicationStrategy m_rplStrategy = null;
|
||||
|
||||
|
||||
|
||||
|
||||
public ExportHelper(MClient client, MReplicationStrategy rplStrategy) {
|
||||
m_AD_Client_ID = client.getAD_Client_ID();
|
||||
m_rplStrategy = rplStrategy;
|
||||
}
|
||||
|
||||
|
||||
public ExportHelper(Properties ctx , int AD_Client_ID) {
|
||||
m_AD_Client_ID = AD_Client_ID;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Process - Generate Export Format
|
||||
* @return info
|
||||
|
@ -109,17 +109,17 @@ public class ExportHelper {
|
|||
{
|
||||
MClient client = MClient.get (po.getCtx(), m_AD_Client_ID);
|
||||
log.info("Client = " + client.toString());
|
||||
|
||||
|
||||
log.info("po.getAD_Org_ID() = " + po.getAD_Org_ID());
|
||||
|
||||
|
||||
log.info("po.get_TrxName() = " + po.get_TrxName());
|
||||
if (po.get_TrxName() == null || po.get_TrxName().equals("")) {
|
||||
po.set_TrxName("exportRecord");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
log.info("Table = " + po.get_TableName());
|
||||
|
||||
|
||||
if (po.get_KeyColumns().length < 1) {
|
||||
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);
|
||||
log.info(systemClient.toString());
|
||||
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) {
|
||||
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>();
|
||||
|
||||
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.setAttribute("AD_Client_Value", client.getValue());
|
||||
rootElement.setAttribute("Version", exportFormat.getVersion());
|
||||
rootElement.setAttribute("ReplicationMode", ReplicationMode.toString());
|
||||
|
@ -157,22 +157,22 @@ public class ExportHelper {
|
|||
rootElement.setAttribute("ReplicationEvent", ReplicationEvent.toString());
|
||||
outDocument.appendChild(rootElement);
|
||||
generateExportFormat(rootElement, exportFormat, po, po.get_ID(), variableMap);
|
||||
|
||||
|
||||
MEXPProcessor mExportProcessor = null;
|
||||
mExportProcessor = new MEXPProcessor (po.getCtx(), m_rplStrategy.getEXP_Processor_ID(), po.get_TrxName() );
|
||||
log.fine("ExportProcessor = " + mExportProcessor);
|
||||
int EXP_ProcessorType_ID = 0;
|
||||
EXP_ProcessorType_ID = mExportProcessor.getEXP_Processor_Type_ID();
|
||||
MEXPProcessorType expProcessor_Type = new MEXPProcessorType(po.getCtx(), EXP_ProcessorType_ID, po.get_TrxName() );
|
||||
|
||||
|
||||
|
||||
|
||||
String javaClass = expProcessor_Type.getJavaClass();
|
||||
try {
|
||||
Class clazz = Class.forName(javaClass);
|
||||
IExportProcessor exportProcessor = (IExportProcessor)clazz.newInstance();
|
||||
|
||||
|
||||
exportProcessor.process(po.getCtx(), mExportProcessor, outDocument, Trx.get( po.get_TrxName(), false ));
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
log.severe(e.toString());
|
||||
throw e;
|
||||
|
@ -180,12 +180,12 @@ public class ExportHelper {
|
|||
|
||||
return outDocument.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Process - Generate Export Format
|
||||
* @param
|
||||
*
|
||||
* @param
|
||||
*
|
||||
* @return Document
|
||||
*/
|
||||
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);
|
||||
MTable table = MTable.get(exportFormat.getCtx(), exportFormat.getAD_Table_ID());
|
||||
log.info("Table = " + table);
|
||||
|
||||
|
||||
Collection<PO> records = new Query(exportFormat.getCtx(),table.getTableName(), exportFormat.getWhereClause(), exportFormat.get_TrxName())
|
||||
.setOnlyActiveRecords(true)
|
||||
.list();
|
||||
|
||||
|
||||
for (PO po : records)
|
||||
{
|
||||
{
|
||||
log.info("Client = " + client.toString());
|
||||
log.finest("po.getAD_Org_ID() = " + po.getAD_Org_ID());
|
||||
log.finest("po.get_TrxName() = " + po.get_TrxName());
|
||||
if (po.get_TrxName() == null || po.get_TrxName().equals("")) {
|
||||
po.set_TrxName("exportRecord");
|
||||
}
|
||||
|
||||
|
||||
if (po.get_KeyColumns().length < 1) {
|
||||
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());
|
||||
if (exportFormat.getDescription() != null && !"".equals(exportFormat.getDescription()))
|
||||
if (exportFormat.getDescription() != null && !"".equals(exportFormat.getDescription()))
|
||||
{
|
||||
rootElement.appendChild(outDocument.createComment(exportFormat.getDescription()));
|
||||
}
|
||||
|
@ -224,29 +224,29 @@ public class ExportHelper {
|
|||
rootElement.setAttribute("Version", exportFormat.getVersion());
|
||||
rootElement.setAttribute("ReplicationMode", ReplicationMode.toString());
|
||||
rootElement.setAttribute("ReplicationType", ReplicationType);
|
||||
rootElement.setAttribute("ReplicationEvent", ReplicationEvent.toString());
|
||||
rootElement.setAttribute("ReplicationEvent", ReplicationEvent.toString());
|
||||
outDocument.appendChild(rootElement);
|
||||
generateExportFormat(rootElement, exportFormat, po, po.get_ID(), variableMap);
|
||||
generateExportFormat(rootElement, exportFormat, po, po.get_ID(), variableMap);
|
||||
}// finish record read
|
||||
return outDocument;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Trifon Generate Export Format process; RESULT =
|
||||
* Trifon Generate Export Format process; RESULT =
|
||||
* <C_Invoice>
|
||||
* <DocumentNo>101</DocumentNo>
|
||||
* </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();
|
||||
@SuppressWarnings("unused")
|
||||
boolean elementHasValue = false;
|
||||
|
||||
|
||||
//for (int i = 0; i < formatLines.length; i++) {
|
||||
for (MEXPFormatLine formatLine : formatLines)
|
||||
{
|
||||
{
|
||||
if ( formatLine.getType().equals(X_EXP_FormatLine.TYPE_XMLElement) ) {
|
||||
// process single XML Attribute
|
||||
// Create new element
|
||||
|
@ -263,13 +263,13 @@ public class ExportHelper {
|
|||
log.info("This is Virtual Column!");
|
||||
} else { }
|
||||
//log.info("["+column.getColumnName()+"]");
|
||||
|
||||
|
||||
Object value = masterPO.get_Value(column.getColumnName());
|
||||
String valueString = null;
|
||||
if (value != null) {
|
||||
valueString = value.toString();
|
||||
} 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()) {
|
||||
//throw new Exception(Msg.getMsg (masterPO.getCtx(), "EXPFieldMandatory"));
|
||||
}
|
||||
|
@ -278,14 +278,14 @@ public class ExportHelper {
|
|||
if (valueString != null) {
|
||||
if (formatLine.getDateFormat() != null && !"".equals(formatLine.getDateFormat())) {
|
||||
m_customDateFormat = new SimpleDateFormat( formatLine.getDateFormat() ); // "MM/dd/yyyy"
|
||||
|
||||
|
||||
valueString = m_customDateFormat.format(Timestamp.valueOf (valueString));
|
||||
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) {
|
||||
if (valueString != null) {
|
||||
|
@ -294,7 +294,7 @@ public class ExportHelper {
|
|||
valueString = m_customDateFormat.format(Timestamp.valueOf (valueString));
|
||||
newElement.setAttribute("DateFormat", m_customDateFormat.toPattern()); // Add "DateForamt attribute"
|
||||
} else {
|
||||
newElement.setAttribute("DateFormat", valueString);
|
||||
newElement.setAttribute("DateFormat", valueString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -326,7 +326,7 @@ public class ExportHelper {
|
|||
log.info("This is Virtual Column!");
|
||||
} else { }
|
||||
//log.info("["+column.getColumnName()+"]");
|
||||
|
||||
|
||||
Object value = masterPO.get_Value(column.getColumnName());
|
||||
String valueString = null;
|
||||
if (value != null) {
|
||||
|
@ -345,7 +345,7 @@ public class ExportHelper {
|
|||
} else {
|
||||
valueString = m_dateFormat.format (Timestamp.valueOf (valueString));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
} else if (column.getAD_Reference_ID() == DisplayType.DateTime) {
|
||||
if (valueString != null) {
|
||||
|
@ -366,21 +366,21 @@ public class ExportHelper {
|
|||
} else {
|
||||
// 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
|
||||
|
||||
|
||||
int embeddedFormat_ID = formatLine.getEXP_EmbeddedFormat_ID();
|
||||
//get from cache
|
||||
MEXPFormat embeddedFormat = MEXPFormat.get(masterPO.getCtx(), embeddedFormat_ID, masterPO.get_TrxName());
|
||||
|
||||
|
||||
MTable tableEmbedded = MTable.get(masterPO.getCtx(), embeddedFormat.getAD_Table_ID());
|
||||
log.info("Table Embedded = " + tableEmbedded);
|
||||
|
||||
|
||||
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());
|
||||
}
|
||||
|
@ -389,41 +389,42 @@ public class ExportHelper {
|
|||
masterPO.get_TrxName()).setClient_ID().setParameters(
|
||||
new Object[] { masterID }).list();
|
||||
|
||||
for (PO instance : instances)
|
||||
{
|
||||
for (PO instance : instances)
|
||||
{
|
||||
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()));
|
||||
}
|
||||
|
||||
|
||||
generateExportFormat(embeddedElement, embeddedFormat, instance, instance.get_ID(), variableMap);
|
||||
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
|
||||
|
||||
|
||||
int embeddedFormat_ID = formatLine.getEXP_EmbeddedFormat_ID();
|
||||
//get from cache
|
||||
MEXPFormat embeddedFormat = MEXPFormat.get(masterPO.getCtx(), embeddedFormat_ID, masterPO.get_TrxName());
|
||||
|
||||
|
||||
MTable tableEmbedded = MTable.get(masterPO.getCtx(), embeddedFormat.getAD_Table_ID());
|
||||
log.info("Table Embedded = " + tableEmbedded);
|
||||
|
||||
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());
|
||||
|
||||
}
|
||||
String columnName = "";
|
||||
if(formatLine.getAD_Reference_ID()== DisplayType.Table | formatLine.getAD_Reference_ID()==DisplayType.Search)
|
||||
{
|
||||
MColumn column = MColumn.get(masterPO.getCtx(), formatLine.getAD_Column_ID());
|
||||
columnName = column.getColumnName();
|
||||
}
|
||||
else
|
||||
{
|
||||
columnName = tableEmbedded.getTableName() + "_ID";
|
||||
|
@ -431,33 +432,33 @@ public class ExportHelper {
|
|||
|
||||
Object value = masterPO.get_Value(columnName);
|
||||
if (value == null)
|
||||
{
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Collection<PO> instances = new Query(masterPO.getCtx(),tableEmbedded.getTableName(), whereClause.toString(),masterPO.get_TrxName())
|
||||
.setClient_ID()
|
||||
.setParameters(value)
|
||||
.list();
|
||||
|
||||
for (PO instance : instances)
|
||||
{
|
||||
{
|
||||
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()));
|
||||
}
|
||||
|
||||
|
||||
generateExportFormat(embeddedElement, embeddedFormat, instance, instance.get_ID(), variableMap);
|
||||
rootElement.appendChild(embeddedElement);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
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
|
||||
*
|
||||
*
|
||||
* @return Document
|
||||
* @throws ParserConfigurationException
|
||||
*/
|
||||
// create new Document
|
||||
Document createNewDocument() throws ParserConfigurationException
|
||||
Document createNewDocument() throws ParserConfigurationException
|
||||
{
|
||||
Document result = null;
|
||||
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
|
||||
|
||||
|
||||
result = documentBuilder.newDocument();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -104,16 +104,13 @@ Export-Package: com.keypoint,
|
|||
org.jdesktop.swingx,
|
||||
org.jdesktop.swingx.action,
|
||||
org.jdesktop.swingx.auth,
|
||||
org.jdesktop.swingx.auth.resources,
|
||||
org.jdesktop.swingx.autocomplete,
|
||||
org.jdesktop.swingx.autocomplete.workarounds,
|
||||
org.jdesktop.swingx.border,
|
||||
org.jdesktop.swingx.calendar,
|
||||
org.jdesktop.swingx.calendar.resources,
|
||||
org.jdesktop.swingx.color,
|
||||
org.jdesktop.swingx.combobox,
|
||||
org.jdesktop.swingx.decorator,
|
||||
org.jdesktop.swingx.editors,
|
||||
org.jdesktop.swingx.error,
|
||||
org.jdesktop.swingx.event,
|
||||
org.jdesktop.swingx.geom,
|
||||
|
@ -133,13 +130,10 @@ Export-Package: com.keypoint,
|
|||
org.jdesktop.swingx.plaf.misc,
|
||||
org.jdesktop.swingx.plaf.motif,
|
||||
org.jdesktop.swingx.plaf.nimbus,
|
||||
org.jdesktop.swingx.plaf.resources,
|
||||
org.jdesktop.swingx.plaf.windows,
|
||||
org.jdesktop.swingx.plaf.windows.resources,
|
||||
org.jdesktop.swingx.renderer,
|
||||
org.jdesktop.swingx.resources,
|
||||
org.jdesktop.swingx.table,
|
||||
org.jdesktop.swingx.table.resources,
|
||||
org.jdesktop.swingx.tips,
|
||||
org.jdesktop.swingx.tree,
|
||||
org.jdesktop.swingx.treetable,
|
||||
|
|
|
@ -803,7 +803,7 @@ public class GridController extends CPanel
|
|||
|
||||
// Process Callout
|
||||
GridField mField = m_mTab.getField(col);
|
||||
if (mField != null
|
||||
if (mField != null) {
|
||||
List<IColumnCallout> callouts = Core.findCallout(m_mTab.getTableName(), mField.getColumnName());
|
||||
if (mField.getCallout().length() > 0 || callouts.size()>0 || m_mTab.hasDependants(mField.getColumnName()))
|
||||
{
|
||||
|
|
|
@ -42,7 +42,7 @@ import org.compiere.util.Trx;
|
|||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: ReportCtl.java,v 1.3 2006/10/08 07:05:08 comdivision Exp $
|
||||
*
|
||||
*
|
||||
* @author Teo Sarca, SC ARHIPAC SERVICE SRL
|
||||
* <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}
|
||||
*/
|
||||
public static final String PARAM_PRINT_INFO = ServerReportCtl.PARAM_PRINT_INFO;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor - prevent instance
|
||||
*/
|
||||
|
@ -68,12 +68,12 @@ public class ReportCtl
|
|||
{
|
||||
} // ReportCtrl
|
||||
|
||||
|
||||
|
||||
/** Static Logger */
|
||||
private static CLogger s_log = CLogger.getCLogger (ReportCtl.class);
|
||||
|
||||
private static ReportViewerProvider viewerProvider = new SwingViewerProvider();
|
||||
|
||||
|
||||
private static ReportViewerProvider viewerProvider = new SwingViewerProvider();
|
||||
|
||||
/**
|
||||
* Create Report.
|
||||
* Called from ProcessCtl.
|
||||
|
@ -87,7 +87,7 @@ public class ReportCtl
|
|||
{
|
||||
return start(null, -1, pi, IsDirectPrint);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create Report.
|
||||
* Called from ProcessCtl.
|
||||
|
@ -104,7 +104,7 @@ public class ReportCtl
|
|||
pi.setPrintPreview(!IsDirectPrint);
|
||||
return start(parent, WindowNo, pi);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create Report.
|
||||
* Called from ProcessCtl.
|
||||
|
@ -170,7 +170,7 @@ public class ReportCtl
|
|||
pi.setPrintPreview(!IsDirectPrint);
|
||||
return startStandardReport(pi);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Start Standard Report.
|
||||
* - Get Table Info & submit.<br>
|
||||
|
@ -211,7 +211,7 @@ public class ReportCtl
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
createOutput(re, pi.isPrintPreview(), null);
|
||||
return true;
|
||||
} // startStandardReport
|
||||
|
@ -244,7 +244,7 @@ public class ReportCtl
|
|||
createOutput(re, pi.isPrintPreview(), null);
|
||||
return true;
|
||||
} // startFinReport
|
||||
|
||||
|
||||
/**
|
||||
* Start Document Print for Type.
|
||||
* Called also directly from ProcessDialog, VInOutGen, VInvoiceGen, VPayPrint
|
||||
|
@ -257,7 +257,7 @@ public class ReportCtl
|
|||
{
|
||||
return startDocumentPrint(type, Record_ID, null, -1, IsDirectPrint);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Start Document Print for Type with specified printer. Always direct print.
|
||||
* @param type document type in ReportEngine
|
||||
|
@ -268,7 +268,7 @@ public class ReportCtl
|
|||
* @param printerName Specified printer name
|
||||
* @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));
|
||||
}
|
||||
|
@ -284,7 +284,7 @@ public class ReportCtl
|
|||
* @return true if success
|
||||
*/
|
||||
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 ));
|
||||
}
|
||||
|
@ -298,7 +298,7 @@ public class ReportCtl
|
|||
* @param printerName Specified printer name
|
||||
* @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)
|
||||
{
|
||||
ReportEngine re = ReportEngine.get (Env.getCtx(), type, Record_ID);
|
||||
|
@ -310,7 +310,7 @@ public class ReportCtl
|
|||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
try
|
||||
{
|
||||
ClassLoader loader = Thread.currentThread().getContextClassLoader();
|
||||
if (loader == null)
|
||||
|
@ -318,7 +318,7 @@ public class ReportCtl
|
|||
Class<?> clazz = loader.loadClass("org.adempiere.webui.window.FDialog");
|
||||
Method m = clazz.getMethod("error", Integer.TYPE, String.class);
|
||||
m.invoke(null, 0, "NoDocPrintFormat");
|
||||
} catch (Exception e)
|
||||
} catch (Exception e)
|
||||
{
|
||||
throw new AdempiereException(e);
|
||||
}
|
||||
|
@ -329,19 +329,14 @@ public class ReportCtl
|
|||
// Use custom print format if available
|
||||
re.setPrintFormat(customPrintFormat);
|
||||
}
|
||||
|
||||
|
||||
if(re.getPrintFormat()!=null)
|
||||
{
|
||||
MPrintFormat format = re.getPrintFormat();
|
||||
|
||||
|
||||
// We have a Jasper Print Format
|
||||
// ==============================
|
||||
if(format.getJasperProcess_ID() > 0)
|
||||
if (info.isDocument()) {
|
||||
ProcessInfoParameter pip = new ProcessInfoParameter("CURRENT_LANG", format.getLanguage(), null, null, null);
|
||||
pi.setParameter(new ProcessInfoParameter[]{pip});
|
||||
}
|
||||
|
||||
if(format.getJasperProcess_ID() > 0)
|
||||
{
|
||||
ServerReportCtl.runJasperProcess(Record_ID, re, IsDirectPrint, printerName);
|
||||
}
|
||||
|
@ -358,7 +353,7 @@ public class ReportCtl
|
|||
}
|
||||
return true;
|
||||
} // StartDocumentPrint
|
||||
|
||||
|
||||
/**
|
||||
* Start Check Print.
|
||||
* Find/Create
|
||||
|
@ -368,14 +363,14 @@ public class ReportCtl
|
|||
*/
|
||||
public static boolean startCheckPrint (int C_Payment_ID, boolean IsDirectPrint)
|
||||
{
|
||||
|
||||
|
||||
// afalcone - [ 1871567 ] Wrong value in Payment document
|
||||
boolean ok = MPaySelectionCheck.deleteGeneratedDraft(Env.getCtx(), C_Payment_ID, null);
|
||||
//
|
||||
|
||||
|
||||
int C_PaySelectionCheck_ID = 0;
|
||||
MPaySelectionCheck psc = MPaySelectionCheck.getOfPayment(Env.getCtx(), C_Payment_ID, null);
|
||||
|
||||
|
||||
if (psc != null)
|
||||
C_PaySelectionCheck_ID = psc.getC_PaySelectionCheck_ID();
|
||||
else
|
||||
|
@ -386,7 +381,7 @@ public class ReportCtl
|
|||
}
|
||||
return startDocumentPrint (ReportEngine.CHECK, C_PaySelectionCheck_ID, null, -1, IsDirectPrint);
|
||||
} // startCheckPrint
|
||||
|
||||
|
||||
private static void createOutput(ReportEngine re, boolean printPreview, String printerName)
|
||||
{
|
||||
if (printPreview)
|
||||
|
@ -398,24 +393,24 @@ public class ReportCtl
|
|||
re.print();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Launch viewer for report
|
||||
* @param re
|
||||
*/
|
||||
public static void preview(ReportEngine re)
|
||||
public static void preview(ReportEngine re)
|
||||
{
|
||||
ReportViewerProvider provider = getReportViewerProvider();
|
||||
provider.openViewer(re);
|
||||
}
|
||||
|
||||
|
||||
public static void setReportViewerProvider(ReportViewerProvider provider)
|
||||
{
|
||||
if (provider == null)
|
||||
throw new IllegalArgumentException("Cannot set report viewer provider to null");
|
||||
viewerProvider = provider;
|
||||
}
|
||||
|
||||
|
||||
public static ReportViewerProvider getReportViewerProvider()
|
||||
{
|
||||
return viewerProvider;
|
||||
|
|
Loading…
Reference in New Issue