IDEMPIERE-4723 - Clean up dead code (#1026)

This commit is contained in:
Diego Ruiz 2021-12-06 11:47:28 +01:00 committed by GitHub
parent b85fecbf74
commit a14ac5fbe2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 4 additions and 166 deletions

View File

@ -105,9 +105,7 @@ public class AccessSqlParser
{
if (m_sqlOriginal == null || m_sqlOriginal.length() == 0)
throw new IllegalArgumentException("No SQL");
//
// if (CLogMgt.isLevelFinest())
// log.fine(m_sqlOriginal);
getSelectStatements();
// analyse each select
for (int i = 0; i < m_sql.length; i++)
@ -151,15 +149,6 @@ public class AccessSqlParser
}
}
m_sql = sqlOut;
/** List & check **
for (int i = 0; i < m_sql.length; i++)
{
if (m_sql[i].indexOf("SELECT ",2) != -1)
log.log(Level.SEVERE, "#" + i + " Has embedded SQL - " + m_sql[i]);
else
log.fine("#" + i + " - " + m_sql[i]);
}
/** **/
} // getSelectStatements
/**
@ -262,7 +251,6 @@ public class AccessSqlParser
index = from.indexOf(ON);
}
// log.fine("getTableInfo - " + from);
StringTokenizer tableST = new StringTokenizer (from, ",");
while (tableST.hasMoreTokens())
{
@ -273,7 +261,6 @@ public class AccessSqlParser
tableInfo = new TableInfo(synST.nextToken(), synST.nextToken());
else
tableInfo = new TableInfo(tableString);
// log.fine("getTableInfo -- " + tableInfo);
list.add(tableInfo);
}
//

View File

@ -132,12 +132,6 @@ public class AttachmentFileSystem implements IAttachmentStore {
fos = new FileOutputStream(destFile);
out = fos.getChannel();
in.transferTo(0, in.size(), out);
/* IDEMPIERE-2864
if(entryFile.exists()){
if(!entryFile.delete()){
entryFile.deleteOnExit();
}
}*/
entryFile = destFile;
} catch (IOException e) {
@ -163,7 +157,6 @@ public class AttachmentFileSystem implements IAttachmentStore {
}
}
final Element entry = document.createElement("entry");
//entry.setAttribute("name", m_items.get(i).getName());
entry.setAttribute("name", attach.getEntryName(i));
String filePathToStore = entryFile.getAbsolutePath();
filePathToStore = filePathToStore.replaceFirst(attachmentPathRoot.replaceAll("\\\\","\\\\\\\\"), attach.ATTACHMENT_FOLDER_PLACEHOLDER);

View File

@ -117,7 +117,6 @@ public class GridField
*/
protected void dispose()
{
// log.fine( "GridField.dispose = " + m_vo.ColumnName);
m_propertyChangeListeners = null;
if (m_lookup != null)
m_lookup.dispose();
@ -252,8 +251,6 @@ public class GridField
retValue = true;
else if (m_vo.IsKey)
retValue = false;
// else if (m_vo.ColumnName.equals("CreatedBy") || m_vo.ColumnName.equals("UpdatedBy"))
// retValue = false;
else {
//http://jira.idempiere.com/browse/IDEMPIERE-694
if (LookupFactoryHelper.isLookup(m_vo))
@ -756,7 +753,6 @@ public class GridField
if (m_vo.DefaultValue != null && m_vo.DefaultValue.startsWith("@SQL="))
{
String sql = m_vo.DefaultValue.substring(5); // w/o tag
//sql = Env.parseContext(m_vo.ctx, m_vo.WindowNo, sql, false, true); // replace variables
//hengsin, capture unparseable error to avoid subsequent sql exception
sql = Env.parseContext(m_vo.ctx, m_vo.WindowNo, sql, false, false); // replace variables
if (sql.equals(""))
@ -952,12 +948,6 @@ public class GridField
if (log.isLoggable(Level.FINE)) log.fine("[YesNo=N] " + m_vo.ColumnName);
return "N";
}
// lookups with one value
// if (DisplayType.isLookup(m_vo.displayType) && m_lookup.getSize() == 1)
// {
// /** @todo default if only one lookup value */
// }
// IDs remain null
if (m_vo.ColumnName.endsWith("_ID"))
{
if (log.isLoggable(Level.FINE)) log.fine("[ID=null] " + m_vo.ColumnName);
@ -1818,13 +1808,7 @@ public class GridField
*/
public boolean isLongField()
{
// if (m_vo.displayType == DisplayType.String
// || m_vo.displayType == DisplayType.Text
// || m_vo.displayType == DisplayType.Memo
// || m_vo.displayType == DisplayType.TextLong
// || m_vo.displayType == DisplayType.Image)
return (m_vo.DisplayLength >= MAXDISPLAY_LENGTH/2);
// return false;
} // isLongField
/**
@ -1844,7 +1828,6 @@ public class GridField
*/
public void setValue ()
{
// log.fine(ColumnName + "=" + newValue);
if (m_valueNoFire) // set the old value
m_oldValue = m_value;
m_value = null;
@ -1853,7 +1836,6 @@ public class GridField
// Does not fire, if same value
m_propertyChangeListeners.firePropertyChange(PROPERTY, m_oldValue, m_value);
// m_propertyChangeListeners.firePropertyChange(PROPERTY, s_oldValue, null);
} // setValue
/**
@ -1864,7 +1846,6 @@ public class GridField
*/
public void setValueAndUpdateContext ()
{
// log.fine(ColumnName + "=" + newValue);
if (m_valueNoFire) // set the old value
m_oldValue = m_value;
m_value = null;
@ -1876,7 +1857,6 @@ public class GridField
// Does not fire, if same value
m_propertyChangeListeners.firePropertyChange(PROPERTY, m_oldValue, m_value);
// m_propertyChangeListeners.firePropertyChange(PROPERTY, s_oldValue, null);
} // setValue
/**
@ -1889,7 +1869,6 @@ public class GridField
*/
public void setValue (Object newValue, boolean inserting)
{
// log.fine(ColumnName + "=" + newValue);
if (m_valueNoFire) // set the old value
m_oldValue = m_value;
m_value = newValue;

View File

@ -233,8 +233,6 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
public static final String CTX_IsLookupOnlySelection = "_TabInfo_IsLookupOnlySelection";
public static final String CTX_IsAllowAdvancedLookup = "_TabInfo_IsAllowAdvancedLookup";
//private HashMap<Integer,Integer> m_PostIts = null;
/**************************************************************************
* Tab loader for Tabs > 0
*/
@ -342,7 +340,6 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
//
if (m_vo.isInitFields())
m_vo.getFields().clear();
//m_vo.Fields = null;
m_vo = null;
if (m_loader != null)
{
@ -377,11 +374,6 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
GridField field = new GridField (voF);
field.setGridTab(this);
String columnName = field.getColumnName();
//FR [ 1757088 ] - this create Bug [ 1866793 ]
/*
if(this.isReadOnly()) {
voF.IsReadOnly = true;
}*/
// Record Info
if (field.isKey()) {
setKeyColumnName(columnName);
@ -588,7 +580,6 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
{
// Setup Events
m_mTable.addDataStatusListener(this);
// m_mTable.addTableModelListener(this);
} // enableEvents
/**
@ -687,14 +678,10 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
// Check validity
if (value.length() == 0)
{
//log.severe ("No value for link column " + lc);
//parent is new, can't retrieve detail
m_parentNeedSave = true;
if (where.length() != 0)
where.append(" AND ");
// where.append(lc).append(" is null ");
// as opened by this fix [ 1881480 ] Navigation problem between tabs
// it's safer to avoid retrieving details at all if there is no parent value
where.append (" 2=3");
}
else
@ -851,7 +838,6 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
// Column NOT in Tab - create EXISTS subquery
String tableName = null;
String tabKeyColumn = getKeyColumnName();
// Column=SalesRep_ID, Key=AD_User_ID, Query=SalesRep_ID=101
sql = "SELECT t.TableName "
+ "FROM AD_Column c"
@ -1168,23 +1154,6 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
log.warning ("Insert Not allowed in TabNo=" + m_vo.TabNo);
return false;
}
// Prevent New Where Main Record is processed
// but not apply for TabLevel=0 - teo_sarca [ 1673902 ]
// hengsin: together with readonly logic, the following validation create confusing situation for user.
// i.e, if readonly logic enable the new button on toolbar, it will just does nothing due to the validation below.
// better let everything decide using just the tab's readonly logic instead.
/*
if (m_vo.TabLevel > 0 && m_vo.TabNo > 0)
{
boolean processed = isProcessed();
// boolean active = "Y".equals(Env.getContext(m_vo.ctx, m_vo.WindowNo, "IsActive"));
if (processed)
{
log.warning ("Not allowed in TabNo=" + m_vo.TabNo + " -> Processed=" + processed);
return false;
}
if (log.isLoggable(Level.FINEST)) log.finest("Processed=" + processed);
}*/
//hengsin, don't create new when parent is empty
if (isDetail() && m_parentNeedSave)
@ -1449,32 +1418,6 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
return m_parents;
} // getParentColumnNames
/**
* Get Tree ID of this tab
* @return ID
*/
/*private int getTreeID()
{
if (log.isLoggable(Level.FINE)) log.fine(m_vo.TableName);
String SQL = "SELECT * FROM AD_ClientInfo WHERE AD_Client="
+ Env.getContext(m_vo.ctx, m_vo.WindowNo, "AD_Client_ID")
+ " ORDER BY AD_Org DESC";
//
if (m_vo.TableName.equals("AD_Menu"))
return 10; // MM
else if (m_vo.TableName.equals("C_ElementValue"))
return 20; // EV
else if (m_vo.TableName.equals("M_Product"))
return 30; // PR
else if (m_vo.TableName.equals("C_BPartner"))
return 40; // BP
else if (m_vo.TableName.equals("AD_Org"))
return 50; // OO
else if (m_vo.TableName.equals("C_Project"))
return 60; // PJ
return 0;
} // getTreeID*/
/**
* Returns true if this is a detail record
* @return true if not parent tab
@ -2405,7 +2348,6 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
m_lastDataStatusEventTime = System.currentTimeMillis();
m_lastDataStatusEvent = m_DataStatusEvent;
m_DataStatusEvent = null;
// log.fine("dataStatusChanged #" + m_vo.TabNo + "- fini", e.toString());
} // dataStatusChanged
/**
@ -2431,7 +2373,6 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
// Distribute/fire it
for (int i = 0; i < listeners.length; i++)
listeners[i].dataStatusChanged(e);
// log.fine("fini - " + e.toString());
} // fireDataStatusChanged
/**
@ -2643,10 +2584,6 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
}
else
{ // no rows - set to a reasonable value - not updateable
// Object value = null;
// if (mField.isKey() || mField.isParent() || mField.getColumnName().equals(m_linkColumnName))
// value = mField.getDefault();
// CarlosRuiz - globalqss [ 1881480 ] Navigation problem between tabs
// the implementation of linking with window context variables is very weak
// you must be careful when defining a column in a detail tab with a field
@ -3202,15 +3139,6 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
return m_mTable.getValueAt(row, col);
} // getValue
/*
public boolean isNeedToSaveParent()
{
if (isDetail())
return m_parentNeedSave;
else
return false;
}*/
/**
* toString
* @return String representation

View File

@ -79,16 +79,7 @@ public class GridTabVO implements Evaluatee, Serializable
{
vo.Fields = new ArrayList<GridFieldVO>(); // dummy
}
/*
else
{
createFields (vo);
if (vo.Fields == null || vo.Fields.size() == 0)
{
CLogger.get().log(Level.SEVERE, "No Fields");
return null;
}
}*/
return vo;
} // create
@ -104,7 +95,7 @@ public class GridTabVO implements Evaluatee, Serializable
boolean showTrl = "Y".equals(Env.getContext(vo.ctx, Env.SHOW_TRANSLATION));
boolean showAcct = "Y".equals(Env.getContext(vo.ctx, Env.SHOW_ACCOUNTING));
boolean showAdvanced = "Y".equals(Env.getContext(vo.ctx, Env.SHOW_ADVANCED));
// CLogger.get().warning("ShowTrl=" + showTrl + ", showAcct=" + showAcct);
try
{
vo.AD_Tab_ID = rs.getInt("AD_Tab_ID");

View File

@ -415,9 +415,6 @@ public class GridTable extends AbstractTableModel
m_SQL_Count += where.toString();
if (m_withAccessControl)
{
// boolean ro = MRole.SQL_RO;
// if (!m_readOnly)
// ro = MRole.SQL_RW;
m_SQL = MRole.getDefault(m_ctx, false).addAccessSQL(m_SQL,
m_tableName, MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO);
m_SQL_Count = MRole.getDefault(m_ctx, false).addAccessSQL(m_SQL_Count,
@ -580,7 +577,6 @@ public class GridTable extends AbstractTableModel
if (identifier.equalsIgnoreCase(field.getColumnName()))
return field;
}
// log.log(Level.WARNING, "Not found: '" + identifier + "'");
return null;
} // getField
@ -1027,7 +1023,6 @@ public class GridTable extends AbstractTableModel
*/
public int getKeyID (int row)
{
// Log.info("MTable.getKeyID - row=" + row + ", keyColIdx=" + m_indexKeyColumn);
if (m_indexKeyColumn != -1)
{
try
@ -1089,10 +1084,8 @@ public class GridTable extends AbstractTableModel
*/
public Object getValueAt (int row, int col)
{
// log.config( "MTable.getValueAt r=" + row + " c=" + col);
if (!m_open || row < 0 || col < 0 || row >= m_rowCount)
{
// log.fine( "Out of bounds - Open=" + m_open + ", RowCount=" + m_rowCount);
return null;
}
@ -1101,7 +1094,6 @@ public class GridTable extends AbstractTableModel
// empty buffer
if (row >= m_sort.size())
{
// log.fine( "Empty buffer");
return null;
}
@ -1110,7 +1102,6 @@ public class GridTable extends AbstractTableModel
// out of bounds
if (rowData == null || col > rowData.length)
{
// log.fine( "No data or Column out of bounds");
return null;
}
return rowData[col];
@ -1284,8 +1275,6 @@ public class GridTable extends AbstractTableModel
m_changed = changed;
if (!changed)
m_rowChanged = -1;
//if (changed)
// fireDataStatusIEvent("", "");
} // setChanged
/**
@ -1360,14 +1349,6 @@ public class GridTable extends AbstractTableModel
Object[] rowData = getDataAtRow(row);
m_rowChanged = row;
/** Selection
if (col == 0)
{
rowData[col] = value;
m_buffer.set(sort.index, rowData);
return;
} **/
// save original value - shallow copy
if (m_rowData == null)
{
@ -1575,9 +1556,6 @@ public class GridTable extends AbstractTableModel
catch (PropertyVetoException pve)
{
log.warning(pve.getMessage());
//[ 2696732 ] Save changes dialog's cancel button shouldn't reset status
//https://sourceforge.net/tracker/index.php?func=detail&aid=2696732&group_id=176962&atid=879332
//dataIgnore();
return SAVE_ABORT;
}
@ -1725,7 +1703,6 @@ public class GridTable extends AbstractTableModel
continue;
}
String columnName = field.getColumnName ();
// log.fine(columnName + "= " + m_rowData[col] + " <> DB: " + rowDataDB[col] + " -> " + rowData[col]);
// RowID, Virtual Column
if (field.getDisplayType () == DisplayType.RowID
@ -2281,8 +2258,7 @@ public class GridTable extends AbstractTableModel
+ (dbValue==null ? "" : "(" + dbValue.getClass().getName() + ")")
+ " -> New: " + value
+ (value==null ? "" : "(" + value.getClass().getName() + ")");
// CLogMgt.setLevel(Level.FINEST);
// po.dump();
dataRefresh(m_rowChanged);
fireDataStatusEEvent("SaveErrorDataChanged", msg, true);
return SAVE_ERROR;
@ -2618,10 +2594,6 @@ public class GridTable extends AbstractTableModel
return false;
}
/** @todo No TableLevel */
// || !Access.canViewInsert(m_ctx, m_WindowNo, tableLevel, true, true))
// fireDataStatusEvent(Log.retrieveError());
// see if we need to save
dataSave(-2, false);
@ -3114,11 +3086,6 @@ public class GridTable extends AbstractTableModel
*/
public boolean isCellEditable (int row, int col)
{
// log.fine( "MTable.isCellEditable - Row=" + row + ", Col=" + col);
// Make Rows selectable
// if (col == 0)
// return true;
// Entire Table not editable
if (m_readOnly)
return false;
@ -3149,7 +3116,6 @@ public class GridTable extends AbstractTableModel
*/
public boolean isRowEditable (int row)
{
// log.fine( "MTable.isRowEditable - Row=" + row);
// Entire Table not editable or no row
if (m_readOnly || row < 0)
return false;
@ -3470,7 +3436,6 @@ public class GridTable extends AbstractTableModel
*/
protected void fireDataStatusEEvent (String AD_Message, String info, boolean isError)
{
// org.compiere.util.Trace.printStack();
//
DataStatusEvent e = createDSE();
if (info != null && info.startsWith("DBExecuteError:")) {
@ -3661,7 +3626,6 @@ public class GridTable extends AbstractTableModel
*/
private void close()
{
//log.config( "MTable Loader.close");
DB.close(m_rs, m_pstmt);
m_rs = null;
m_pstmt = null;

View File

@ -449,8 +449,6 @@ public class GridWindow implements Serializable
WebDoc doc = null;
doc = WebDoc.create (false, title.toString(), javaClient);
// body.addElement("&copy;&nbsp;Adempiere &nbsp; ");
// body.addElement(new a("http://www.adempiere.org/help/", "Online Help"));
td center = doc.addPopupCenter(false);
// Window
if (getDescription().length() != 0)

View File

@ -544,8 +544,6 @@ public class GridWorkbench implements Serializable
public int WindowNo = -1;
/** Window Midel */
public GridWindow mWindow = null;
// public MFrame mFrame = null;
// public MProcess mProcess = null;
} // WBWindow
} // Workbench