IDEMPIERE-4723 - Clean up MIssue*/MJournal*/MLandedC*/MLanguage/MLdapProcessor/Mloc*/MLookip*/Mlot* classes code (#635)

This commit is contained in:
Diego Ruiz 2021-03-23 03:19:34 +01:00 committed by GitHub
parent c8fd9a8805
commit 7d1fec61fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 5 additions and 339 deletions

View File

@ -337,9 +337,6 @@ public class MIssue extends X_AD_Issue
MIssueProject.get(this); // sets also Asset
MIssueSystem.get(this);
MIssueUser.get(this);
//
// setR_IssueKnown_ID(0);
// setR_Request_ID(0);
return createAnswer();
} // process
@ -406,131 +403,9 @@ public class MIssue extends X_AD_Issue
*/
public String report()
{
//if (true)
return null;
/*StringBuilder parameter = new StringBuilder("?");
if (getRecord_ID() == 0) // don't report
return "ID=0";
if (getRecord_ID() == 1) // new
{
parameter.append("ISSUE=");
HashMap<String,String> htOut = get_HashMap();
try // deserializing in create
{
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
ObjectOutput oOut = new ObjectOutputStream(bOut);
oOut.writeObject(htOut);
oOut.flush();
String hexString = Secure.convertToHexString(bOut.toByteArray());
parameter.append(hexString);
}
catch (Exception e)
{
log.severe(e.getLocalizedMessage());
StringBuilder msgreturn = new StringBuilder("New-").append(e.getLocalizedMessage());
return msgreturn.toString();
}
}
else // existing
{
try
{
parameter.append("RECORDID=").append(getRecord_ID());
parameter.append("&DBADDRESS=").append(URLEncoder.encode(getDBAddress(), "UTF-8"));
parameter.append("&COMMENTS=").append(URLEncoder.encode(getComments(), "UTF-8"));
}
catch (Exception e)
{
log.severe(e.getLocalizedMessage());
StringBuilder msgreturn = new StringBuilder("Update-").append(e.getLocalizedMessage());
return msgreturn.toString();
}
}
InputStreamReader in = null;
String target = "http://dev1/wstore/issueReportServlet";
try // Send GET Request
{
StringBuilder urlString = new StringBuilder(target)
.append(parameter);
URL url = new URL (urlString.toString());
URLConnection uc = url.openConnection();
in = new InputStreamReader(uc.getInputStream());
}
catch (Exception e)
{
StringBuilder msg = new StringBuilder("Cannot connect to http://").append(target);
if (e instanceof FileNotFoundException || e instanceof ConnectException)
msg.append("\nServer temporarily down - Please try again later");
else
{
msg.append("\nCheck connection - ").append(e.getLocalizedMessage());
log.log(Level.FINE, msg.toString());
}
return msg.toString();
}
return readResponse(in);*/
} // report
/**
* Read Response
* @param in input stream
* @return error message
*/
/*private String readResponse(InputStreamReader in)
{
StringBuilder sb = new StringBuilder();
int Record_ID = 0;
String ResponseText = null;
String RequestDocumentNo = null;
try // Get Answer
{
int c;
while ((c = in.read()) != -1)
sb.append((char)c);
in.close();
log.fine(sb.toString());
String clear = URLDecoder.decode(sb.toString(), "UTF-8");
log.fine(clear);
// Interpret Data
StringTokenizer st = new StringTokenizer(clear, DELIMITER);
while (st.hasMoreElements())
{
String pair = st.nextToken();
try
{
int index = pair.indexOf('=');
if (pair.startsWith("RECORDID="))
{
String info = pair.substring(index+1);
Record_ID = Integer.parseInt(info);
}
else if (pair.startsWith("RESPONSE="))
ResponseText = pair.substring(index+1);
else if (pair.startsWith("DOCUMENTNO="))
RequestDocumentNo = pair.substring(index+1);
}
catch (Exception e)
{
log.warning(pair + " - " + e.getMessage());
}
}
}
catch (Exception ex)
{
log.log(Level.FINE, "", ex);
return "Reading-" + ex.getLocalizedMessage();
}
if (Record_ID != 0)
setRecord_ID(Record_ID);
if (ResponseText != null)
setResponseText(ResponseText);
if (RequestDocumentNo != null)
setRequestDocumentNo(RequestDocumentNo);
return null;
} // readResponse*/
/**
* String Representation
* @return info

View File

@ -122,17 +122,6 @@ public class MIssueProject extends X_R_IssueProject
public void setA_Asset_ID (MIssue issue)
{
int A_Asset_ID = 0;
/*String sql = "SELECT * FROM A_Asset a "
+ "WHERE EXISTS (SELECT * FROM A_Asset_Group ag " // Tracking Assets
+ "WHERE a.A_Asset_Group_ID=ag.A_Asset_Group_ID AND ag.IsTrackIssues='Y')"
+ " AND EXISTS (SELECT * FROM AD_User u "
+ "WHERE (a.C_BPartner_ID=u.C_BPartner_ID OR a.C_BPartnerSR_ID=u.C_BPartner_ID)"
+ " AND u.EMail=?)" // #1 EMail
+ " AND (SerNo IS NULL OR SerNo=?)"; // #2 Name*/
super.setA_Asset_ID (A_Asset_ID);
} // setA_Asset_ID

View File

@ -69,21 +69,10 @@ public class MJournal extends X_GL_Journal implements DocAction
super (ctx, GL_Journal_ID, trxName);
if (GL_Journal_ID == 0)
{
// setGL_Journal_ID (0); // PK
// setC_AcctSchema_ID (0);
// setC_Currency_ID (0);
// setC_DocType_ID (0);
// setC_Period_ID (0);
//
setCurrencyRate (Env.ONE);
// setC_ConversionType_ID(0);
// setDateAcct (new Timestamp(System.currentTimeMillis()));
setDateDoc (new Timestamp(System.currentTimeMillis()));
// setDescription (null);
setDocAction (DOCACTION_Complete);
setDocStatus (DOCSTATUS_Drafted);
// setDocumentNo (null);
// setGL_Category_ID (0);
setPostingType (POSTINGTYPE_Actual);
setTotalCr (Env.ZERO);
setTotalDr (Env.ZERO);
@ -145,10 +134,6 @@ public class MJournal extends X_GL_Journal implements DocAction
setC_Currency_ID(original.getC_Currency_ID());
setC_ConversionType_ID(original.getC_ConversionType_ID());
setCurrencyRate(original.getCurrencyRate());
// setDateDoc(original.getDateDoc());
// setDateAcct(original.getDateAcct());
// setC_Period_ID(original.getC_Period_ID());
} // MJournal
@ -1011,10 +996,7 @@ public class MJournal extends X_GL_Journal implements DocAction
*/
public File createPDF (File file)
{
// ReportEngine re = ReportEngine.get (getCtx(), ReportEngine.INVOICE, getC_Invoice_ID());
// if (re == null)
return null;
// return re.getPDF(file);
return null;
} // createPDF

View File

@ -103,10 +103,6 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
super (ctx, GL_JournalBatch_ID, trxName);
if (GL_JournalBatch_ID == 0)
{
// setGL_JournalBatch_ID (0); PK
// setDescription (null);
// setDocumentNo (null);
// setC_DocType_ID (0);
setPostingType (POSTINGTYPE_Actual);
setDocAction (DOCACTION_Complete);
setDocStatus (DOCSTATUS_Drafted);
@ -138,9 +134,6 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
{
this (original.getCtx(), 0, original.get_TrxName());
setClientOrg(original);
//
// setC_AcctSchema_ID(original.getC_AcctSchema_ID());
// setGL_Budget_ID(original.getGL_Budget_ID());
setGL_Category_ID(original.getGL_Category_ID());
setPostingType(original.getPostingType());
setDescription(original.getDescription());
@ -148,12 +141,6 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
setControlAmt(original.getControlAmt());
//
setC_Currency_ID(original.getC_Currency_ID());
// setC_ConversionType_ID(original.getC_ConversionType_ID());
// setCurrencyRate(original.getCurrencyRate());
// setDateDoc(original.getDateDoc());
// setDateAcct(original.getDateAcct());
// setC_Period_ID(original.getC_Period_ID());
} // MJournal
@ -877,10 +864,7 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
*/
public File createPDF (File file)
{
// ReportEngine re = ReportEngine.get (getCtx(), ReportEngine.INVOICE, getC_Invoice_ID());
// if (re == null)
return null;
// return re.getPDF(file);
return null;
} // createPDF

View File

@ -53,17 +53,12 @@ public class MJournalLine extends X_GL_JournalLine
super (ctx, GL_JournalLine_ID, trxName);
if (GL_JournalLine_ID == 0)
{
// setGL_JournalLine_ID (0); // PK
// setGL_Journal_ID (0); // Parent
// setC_Currency_ID (0);
// setC_ValidCombination_ID (0);
setLine (0);
setAmtAcctCr (Env.ZERO);
setAmtAcctDr (Env.ZERO);
setAmtSourceCr (Env.ZERO);
setAmtSourceDr (Env.ZERO);
setCurrencyRate (Env.ONE);
// setC_ConversionType_ID (0);
setDateAcct (new Timestamp(System.currentTimeMillis()));
setIsGenerated (true);
}

View File

@ -92,8 +92,6 @@ public class MLandedCost extends X_C_LandedCost
super (ctx, C_LandedCost_ID, trxName);
if (C_LandedCost_ID == 0)
{
// setC_InvoiceLine_ID (0);
// setM_CostElement_ID (0);
setLandedCostDistribution (LANDEDCOSTDISTRIBUTION_Quantity); // Q
}
} // MLandedCost

View File

@ -93,7 +93,6 @@ public class MLandedCostAllocation extends X_C_LandedCostAllocation
super (ctx, C_LandedCostAllocation_ID, trxName);
if (C_LandedCostAllocation_ID == 0)
{
// setM_CostElement_ID(0);
setAmt (Env.ZERO);
setQty (Env.ZERO);
setBase (Env.ZERO);

View File

@ -104,10 +104,6 @@ public class MLanguage extends X_AD_Language
}
} // maintain
// /** Logger */
// private static CLogger s_log = CLogger.getCLogger (MLanguage.class);
/**************************************************************************
* Standard Constructor
* @param ctx context
@ -466,8 +462,6 @@ public class MLanguage extends X_AD_Language
.append(" WHERE ").append(keyColumn).append(" NOT IN (SELECT ").append(keyColumn)
.append(" FROM ").append(tableName)
.append(" WHERE AD_Language='").append(getAD_Language()).append("')");
// + " WHERE (" + keyColumn + ",'" + getAD_Language()+ "') NOT IN (SELECT "
// + keyColumn + ",AD_Language FROM " + tableName + ")";
int no = DB.executeUpdateEx(insert.toString(), null, get_TrxName());
// IDEMPIERE-99 Language Maintenance does not create UUIDs
MTable table = MTable.get(getCtx(), tableName);
@ -492,28 +486,6 @@ public class MLanguage extends X_AD_Language
System.out.println(MLanguage.get(Env.getCtx(), "de_DE"));
System.out.println(MLanguage.get(Env.getCtx(), "en_US"));
/**
Locale[] locales = Locale.getAvailableLocales();
for (int i = 0; i < locales.length; i++)
{
Locale loc = locales[i];
if (loc.getVariant() != null && loc.getVariant().length() != 0)
continue;
if (loc.getCountry() != null && loc.getCountry().length() != 0)
continue;
System.out.println(loc.toString()
+ " - " + loc.getDisplayName()
+ " + " + loc.getCountry()
+ " + " + loc.getLanguage()
);
MLanguage lang = new MLanguage (Env.getCtx(), loc.toString(),
loc.getDisplayName(), loc.getCountry(), loc.getLanguage());
lang.saveEx();
System.out.println(lang);
}
/**/
} // main
} // MLanguage

View File

@ -45,8 +45,6 @@ public class MLdapProcessorLog extends X_AD_LdapProcessorLog implements Adempier
super (ctx, AD_LdapProcessorLog_ID, trxName);
if (AD_LdapProcessorLog_ID == 0)
{
// setAD_LdapProcessorLog_ID (0);
// setAD_LdapProcessor_ID (0);
setIsError (false);
}
} // MLdapProcessorLog

View File

@ -630,8 +630,6 @@ public class MLocation extends X_C_Location implements Comparator<Object>, Immut
retStr.append(", ").append(getAddress5());
// City, Region, Postal
retStr.append(", ").append(parseCRP (getCountry()));
// Add Country would come here
// retStr.append(", ").append(getCountry());
}
return retStr.toString();
} // toString
@ -672,7 +670,6 @@ public class MLocation extends X_C_Location implements Comparator<Object>, Immut
retStr.append("\n").append(getAddress5());
// City, Region, Postal
retStr.append("\n").append(parseCRP (getCountry()));
// Add Country would come here
}
return retStr.toString();
} // toStringCR

View File

@ -248,14 +248,8 @@ public class MLocator extends X_M_Locator implements ImmutablePOSupport
super (ctx, M_Locator_ID, trxName);
if (M_Locator_ID == 0)
{
// setM_Locator_ID (0); // PK
// setM_Warehouse_ID (0); // Parent
setIsDefault (false);
setPriorityNo (50);
// setValue (null);
// setX (null);
// setY (null);
// setZ (null);
}
} // MLocator
@ -367,66 +361,6 @@ public class MLocator extends X_M_Locator implements ImmutablePOSupport
// This implies that every time you create a new product you must create initial inventory zero for all locators where the product can be stored.
// A good enhancement could be a new table to indicate when a locator is exclusive for some products, but I consider current approach not working.
return true;
/*
// Default Locator
if (M_Product_ID == 0 || isDefault())
return true;
int count = 0;
PreparedStatement pstmt = null;
// Already Stored
String sql = "SELECT COUNT(*) FROM M_Storage s WHERE s.M_Locator_ID=? AND s.M_Product_ID=?";
try
{
pstmt = DB.prepareStatement (sql, null);
pstmt.setInt (1, getM_Locator_ID());
pstmt.setInt (2, M_Product_ID);
ResultSet rs = pstmt.executeQuery ();
if (rs.next ())
count = rs.getInt(1);
rs.close ();
pstmt.close ();
pstmt = null;
}
catch (Exception e)
{
log.log (Level.SEVERE, sql, e);
}
// Default Product Locator
if (count == 0)
{
sql = "SELECT COUNT(*) FROM M_Product s WHERE s.M_Locator_ID=? AND s.M_Product_ID=?";
try
{
pstmt = DB.prepareStatement (sql, null);
pstmt.setInt (1, getM_Locator_ID());
pstmt.setInt (2, M_Product_ID);
ResultSet rs = pstmt.executeQuery ();
if (rs.next ())
count = rs.getInt(1);
rs.close ();
pstmt.close ();
pstmt = null;
}
catch (Exception e)
{
log.log (Level.SEVERE, sql, e);
}
}
try
{
if (pstmt != null)
pstmt.close ();
pstmt = null;
}
catch (Exception e)
{
pstmt = null;
}
return count != 0;
*/
} // isCanStoreProduct
@Override

View File

@ -258,7 +258,6 @@ public final class MLocatorLookup extends Lookup implements Serializable
*/
public MLocator getMLocator (Object keyValue, String trxName)
{
// log.fine( "MLocatorLookup.getDirect " + keyValue.getClass() + "=" + keyValue);
int M_Locator_ID = -1;
try
{
@ -369,7 +368,6 @@ public final class MLocatorLookup extends Lookup implements Serializable
*/
public void run()
{
// log.config("MLocatorLookup Loader.run " + m_AD_Column_ID);
// Set Info - see VLocator.actionText
int local_only_warehouse_id = getOnly_Warehouse_ID(); // [ 1674891 ] MLocatorLookup - weird error
int local_only_product_id = getOnly_Product_ID();
@ -495,12 +493,6 @@ public final class MLocatorLookup extends Lookup implements Serializable
list.add(loc);
}
/** Sort Data
MLocator l = new MLocator (m_ctx, 0);
if (!mandatory)
list.add (l);
Collections.sort (list, l);
**/
return list;
} // getArray

View File

@ -90,12 +90,7 @@ public final class MLookup extends Lookup implements Serializable
m_hasInactive = true; // creates focus listener for dynamic loading
return; // required when parent needs to be selected (e.g. price from product)
}
//
//m_loader = new MLoader();
// if (TabNo != 0)
// m_loader.setPriority(Thread.NORM_PRIORITY - 1);
//m_loader.start();
//m_loader.run(); // test sync call
} // MLookup
/** Inactive Marker Start */
@ -373,7 +368,6 @@ public final class MLookup extends Lookup implements Serializable
{
if (m_info == null)
return false;
//return m_info.IsValidated;
return isValidated(m_info);
} // isValidated
@ -433,13 +427,10 @@ public final class MLookup extends Lookup implements Serializable
loadData (loadParent);
// already validation included
//if (m_info.IsValidated)
boolean validated = this.isValidated(m_info);
if (validated)
return new ArrayList<Object>(m_lookup.values());
//if (!m_info.IsValidated && onlyValidated)
if (!validated && onlyValidated)
{
loadData (loadParent);
@ -1177,7 +1168,6 @@ public final class MLookup extends Lookup implements Serializable
m_lookup.put(value, p);
vnpCache.add(p);
}
// if (log.isLoggable(Level.FINE)) log.fine( m_info.KeyColumn + ": " + name);
}
}
catch (SQLException e)
@ -1191,7 +1181,6 @@ public final class MLookup extends Lookup implements Serializable
int size = m_lookup.size();
if (log.isLoggable(Level.FINER)) log.finer(m_info.KeyColumn
+ " (" + m_info.Column_ID + "):"
// + " ID=" + m_info.AD_Column_ID + " " +
+ " - Loader complete #" + size + " - all=" + m_allLoaded
+ " - ms=" + String.valueOf(System.currentTimeMillis()-m_startTime)
+ " (" + String.valueOf(System.currentTimeMillis()-startTime) + ")");

View File

@ -72,7 +72,6 @@ public class MLookupCache
//
StringBuilder sb = new StringBuilder();
sb.append(info.WindowNo).append(":")
// .append(info.Column_ID)
.append(info.KeyColumn)
.append(info.AD_Reference_Value_ID)
.append(info.Query)
@ -103,9 +102,6 @@ public class MLookupCache
return false;
}
// Copy Asynchronously to speed things up
// if (cache.size() > ?) copyAsync
// copy cache
// we can use iterator, as the lookup loading is complete (i.e. no additional entries)
Iterator<Object> iterator = cache.keySet().iterator();

View File

@ -256,36 +256,14 @@ public class MLookupFactory
else
{
/*
local_validationCode = Env.parseContext (ctx, WindowNo, info.ValidationCode, true);
if (local_validationCode.length() == 0) // returns "" if not all variables were parsed
info.IsValidated = false;
else
info.IsValidated = true;
*/
info.IsValidated = false;
}
/*
// Add Local Validation
if (local_validationCode.length() != 0)
{
//jz handle no posOrder case
if (posOrder > 0)
info.Query = info.Query.substring(0, posOrder)
+ (hasWhere ? " AND " : " WHERE ") + local_validationCode
+ info.Query.substring(posOrder);
else
info.Query = info.Query
+ (hasWhere ? " AND " : " WHERE ") + local_validationCode;
}*/
// Add Security
if (needToAddSecurity)
info.Query = MRole.getDefault(ctx, false).addAccessSQL(info.Query,
info.TableName, MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO);
//
// s_log.finest("Query: " + info.Query);
// s_log.finest("Direct: " + info.QueryDirect);
return info;
} // getLookupInfo
@ -429,12 +407,11 @@ public class MLookupFactory
String KeyColumn = null, DisplayColumn = null, TableName = null, WhereClause = null, OrderByClause = null;
String displayColumnSQL = null;
boolean IsTranslated = false, isValueDisplayed = false;
//boolean isSOTrx = !"N".equals(Env.getContext(ctx, WindowNo, "IsSOTrx"));
int ZoomWindow = 0;
int ZoomWindowPO = 0;
int overrideZoomWindow = 0;
int infoWindowId = 0;
//int AD_Table_ID = 0;
boolean loaded = false;
PreparedStatement pstmt = null;
@ -455,7 +432,6 @@ public class MLookupFactory
OrderByClause = rs.getString(7);
ZoomWindow = rs.getInt(8);
ZoomWindowPO = rs.getInt(9);
//AD_Table_ID = rs.getInt(10);
displayColumnSQL = rs.getString(11);
if (displayColumnSQL != null && displayColumnSQL.length() > 0 && (displayColumnSQL.startsWith("@SQL=") || displayColumnSQL.startsWith("@SQLFIND=")))
displayColumnSQL = "NULL";
@ -777,7 +753,6 @@ public class MLookupFactory
String KeyColumn = MQuery.getZoomColumnName(ColumnName);
String TableName = MQuery.getZoomTableName(ColumnName);
//boolean isSOTrx = !"N".equals(Env.getContext(ctx, WindowNo, "IsSOTrx"));
int ZoomWindow = 0;
int ZoomWindowPO = 0;

View File

@ -127,13 +127,6 @@ public class MLot extends X_M_Lot
public MLot (Properties ctx, int M_Lot_ID, String trxName)
{
super (ctx, M_Lot_ID, trxName);
/** if (M_Lot_ID == 0)
{
setM_Lot_ID (0);
setM_Product_ID (0);
setName (null);
}
**/
} // MLot
/**

View File

@ -43,11 +43,9 @@ public class MLotCtl extends X_M_LotCtl
super (ctx, M_LotCtl_ID, trxName);
if (M_LotCtl_ID == 0)
{
// setM_LotCtl_ID (0);
setStartNo (1);
setCurrentNext (1);
setIncrementNo (1);
// setName (null);
}
} // MLotCtl