IDEMPIERE-2771 Improve 2pack tracing for errors

This commit is contained in:
Carlos Ruiz 2015-08-20 14:38:59 -05:00
parent e010e5c461
commit 536a21a514
5 changed files with 39 additions and 11 deletions

View File

@ -835,7 +835,7 @@ public class MColumn extends X_AD_Column
@Override @Override
public I_AD_Table getAD_Table() throws RuntimeException { public I_AD_Table getAD_Table() throws RuntimeException {
MTable table = MTable.get(getCtx(), getAD_Table_ID()); MTable table = MTable.get(getCtx(), getAD_Table_ID(), get_TrxName());
return table; return table;
} }

View File

@ -55,7 +55,7 @@ public class MTable extends X_AD_Table
/** /**
* *
*/ */
private static final long serialVersionUID = -1776819186412187384L; private static final long serialVersionUID = -8757836873040013402L;
public final static int MAX_OFFICIAL_ID = 999999; public final static int MAX_OFFICIAL_ID = 999999;
@ -66,13 +66,27 @@ public class MTable extends X_AD_Table
* @return MTable * @return MTable
*/ */
public static MTable get (Properties ctx, int AD_Table_ID) public static MTable get (Properties ctx, int AD_Table_ID)
{
return get(ctx, AD_Table_ID, null);
} // get
/**
* Get Table from Cache
* @param ctx context
* @param AD_Table_ID id
* @param trxName transaction
* @return MTable
*/
public static MTable get (Properties ctx, int AD_Table_ID, String trxName)
{ {
Integer key = Integer.valueOf(AD_Table_ID); Integer key = Integer.valueOf(AD_Table_ID);
MTable retValue = s_cache.get (key); MTable retValue = s_cache.get (key);
if (retValue != null && retValue.getCtx() == ctx) { if (retValue != null && retValue.getCtx() == ctx) {
if (trxName != null)
retValue.set_TrxName(trxName);
return retValue; return retValue;
} }
retValue = new MTable (ctx, AD_Table_ID, null); retValue = new MTable (ctx, AD_Table_ID, trxName);
if (retValue.get_ID () != 0) { if (retValue.get_ID () != 0) {
s_cache.put (key, retValue); s_cache.put (key, retValue);
} }

View File

@ -73,7 +73,7 @@ public final class EMail implements Serializable
/** /**
* *
*/ */
private static final long serialVersionUID = 8117458371229316972L; private static final long serialVersionUID = -2489441683920482601L;
//use in server bean //use in server bean
public final static String HTML_MAIL_MARKER = "ContentType=text/html;"; public final static String HTML_MAIL_MARKER = "ContentType=text/html;";
@ -221,6 +221,8 @@ public final class EMail implements Serializable
/** Send result Message */ /** Send result Message */
private String m_sentMsg = null; private String m_sentMsg = null;
private List<ValueNamePair> additionalHeaders = new ArrayList<ValueNamePair>();
/** Mail Sent OK Status */ /** Mail Sent OK Status */
public static final String SENT_OK = "OK"; public static final String SENT_OK = "OK";
@ -344,6 +346,11 @@ public final class EMail implements Serializable
// Bounce only header // Bounce only header
m_msg.setReturnOption (SMTPMessage.RETURN_HDRS); m_msg.setReturnOption (SMTPMessage.RETURN_HDRS);
// m_msg.setHeader("X-Mailer", "msgsend"); // m_msg.setHeader("X-Mailer", "msgsend");
if (additionalHeaders.size() > 0) {
for (ValueNamePair vnp : additionalHeaders) {
m_msg.setHeader(vnp.getName(), vnp.getValue());
}
}
// //
setContent(); setContent();
m_msg.saveChanges(); m_msg.saveChanges();
@ -1202,11 +1209,7 @@ public final class EMail implements Serializable
} // main } // main
public void setHeader(String name, String value) { public void setHeader(String name, String value) {
try { additionalHeaders.add(new ValueNamePair(value, name));
m_msg.setHeader(name, value);
} catch (MessagingException e) {
log.log(Level.WARNING, m_msg.toString(), e);
}
} }
} // EMail } // EMail

View File

@ -410,7 +410,15 @@ public class PackInHandler extends DefaultHandler {
DatabaseMetaData md = conn.getMetaData(); DatabaseMetaData md = conn.getMetaData();
String catalog = DB.getDatabase().getCatalog(); String catalog = DB.getDatabase().getCatalog();
String schema = DB.getDatabase().getSchema(); String schema = DB.getDatabase().getSchema();
MTable table = MTable.get(m_ctx.ctx, column.getAD_Table_ID()); MTable table = MTable.get(m_ctx.ctx, column.getAD_Table_ID(), m_ctx.trx.getTrxName());
if (table.get_ID() != column.getAD_Table_ID()) {
// table not found
log.warning("Table " + column.getAD_Table_ID() + " not found");
continue;
}
if (table.isView()) {
continue;
}
String tableName = table.getTableName(); String tableName = table.getTableName();
String fkConstraintSql = MColumn.getForeignKeyConstraintSql(md, catalog, schema, tableName, table, column, false); String fkConstraintSql = MColumn.getForeignKeyConstraintSql(md, catalog, schema, tableName, table, column, false);

View File

@ -148,8 +148,11 @@ public class PackInNotifier {
EMail email = client.createEMail(null, to, subject.toString(), message.toString()); EMail email = client.createEMail(null, to, subject.toString(), message.toString());
if (email != null) if (email != null)
{ {
if (!packIn.isSuccess()) if (!packIn.isSuccess()) {
email.setHeader("X-Priority", "1"); email.setHeader("X-Priority", "1");
email.setHeader("Priority","Urgent");
email.setHeader("Importance","high");
}
while (st.hasMoreTokens()) while (st.hasMoreTokens())
email.addTo(st.nextToken()); email.addTo(st.nextToken());
status = email.send(); status = email.send();