/** * String representation * * @return String */ public String toString() { StringBuilder sb = new StringBuilder("DocLine=["); sb.append(p_po.get_ID()); if (getDescription() != null) sb.append(",").append(getDescription()); if (getM_Product_ID() != 0) sb.append(",M_Product_ID=").append(getM_Product_ID()); sb.append(",Qty=").append(m_qty).append(",Amt=").append(getAmtSource()).append("]"); return sb.toString(); } // toString
public ProcessHelper setPO(Object o) { PO po = InterfaceWrapperHelper.getStrictPO(o); if (po != null) { setTableId(po.get_Table_ID()); setRecordId(po.get_ID()); return this; } GridTab gridTab = GridTabWrapper.getGridTab(o); if (gridTab != null) { setTableId(gridTab.get_TableName()); setRecordId(gridTab.getKeyID(gridTab.getCurrentRow())); return this; } fail("Object " + o + " is not supported in setPO"); return this; }
/** * Loads the PO from database. In case some errors were encountered, they will be logged and * <code>null</code> will be returned. * * @param ctx * @param tableName * @param Record_ID * @param trxName * @return PO or null */ private final PO retrievePO( final Properties ctx, final String tableName, int Record_ID, String trxName) { final POInfo poInfo = POInfo.getPOInfo(tableName); if (Record_ID > 0 && poInfo.getKeyColumnName() == null) { log.warn("(id) - Multi-Key " + tableName); return null; } final Class<?> clazz = tableModelClassLoader.getClass(tableName); if (clazz == null) { log.info("Using GenericPO for {}", tableName); final GenericPO po = new GenericPO(tableName, ctx, Record_ID, trxName); return po; } boolean errorLogged = false; try { final Constructor<?> constructor = tableModelClassLoader.getIDConstructor(clazz); final PO po = (PO) constructor.newInstance(ctx, Record_ID, trxName); if (po != null && po.get_ID() != Record_ID && Record_ID > 0) { return null; } return po; } catch (Exception e) { final Throwable cause = e.getCause() == null ? e : e.getCause(); log.error("(id) - Table=" + tableName + ",Class=" + clazz, cause); MetasfreshLastError.saveError(log, "Error", cause); errorLogged = true; } if (!errorLogged) { log.error("(id) - Not found - Table=" + tableName + ", Record_ID=" + Record_ID); } return null; } // getPO
/** * Get Line ID * * @return id */ public int get_ID() { return p_po.get_ID(); } // get_ID