本文整理汇总了Java中org.compiere.model.PO.get_TableName方法的典型用法代码示例。如果您正苦于以下问题:Java PO.get_TableName方法的具体用法?Java PO.get_TableName怎么用?Java PO.get_TableName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.compiere.model.PO
的用法示例。
在下文中一共展示了PO.get_TableName方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLinkColumnName
import org.compiere.model.PO; //导入方法依赖的package包/类
private String getLinkColumnName(final PO masterPO, final MTable tableEmbedded)
{
final String[] keyColumns = masterPO.get_KeyColumns();
if (keyColumns == null || keyColumns.length == 0)
{
throw new AdempiereException("No key columns found for " + masterPO);
}
if (keyColumns.length == 1)
{
return keyColumns[0];
}
final Properties ctx = masterPO.getCtx();
final String masterTableName = masterPO.get_TableName();
final IAppDictionaryBL appDictBL = Services.get(IAppDictionaryBL.class);
for (final String keyColumn : keyColumns)
{
final MTable table = appDictBL.getReferencedTable(ctx, masterTableName, keyColumn);
if (table != null && table.getAD_Table_ID() == tableEmbedded.getAD_Table_ID())
{
return keyColumn;
}
}
throw new AdempiereException("No relevant link column found on " + masterPO + " for " + tableEmbedded);
}
示例2: createMViewSegment
import org.compiere.model.PO; //导入方法依赖的package包/类
private MViewPartition createMViewSegment(MViewMetadata mdata, PO sourcePO)
{
final String sourceTableName;
final String sourceWhere;
if (sourcePO != null)
{
sourceTableName = sourcePO.get_TableName();
String where = mdata.getRelationWhereClause(sourceTableName, mdata.getTargetTableName());
if (Check.isEmpty(where, true))
{
sourceWhere = null;
}
else
{
sourceWhere = "(" + where + ") AND (" + sourcePO.get_WhereClause(true) + ")";
}
return new MViewPartition(sourceTableName, sourceWhere);
}
else
{
return null;
}
}
示例3: isSourceChanged
import org.compiere.model.PO; //导入方法依赖的package包/类
@Override
public boolean isSourceChanged(MViewMetadata mdata, PO sourcePO, int changeType)
{
final String sourceTableName = sourcePO.get_TableName();
final Set<String> sourceColumns = mdata.getSourceColumns(sourceTableName);
if (sourceColumns == null || sourceColumns.isEmpty())
return false;
if (changeType == ModelValidator.TYPE_AFTER_NEW || changeType == ModelValidator.TYPE_AFTER_DELETE)
{
return true;
}
for (String sourceColumn : sourceColumns)
{
if (sourcePO.is_ValueChanged(sourceColumn))
{
return true;
}
}
return false;
}
示例4: openFor
import org.compiere.model.PO; //导入方法依赖的package包/类
public GridWindowHelper openFor(Object poModel)
{
Assert.assertNull("Another window already opened - " + gridWindow, gridWindow);
logger.info("PO=" + poModel);
final PO po = InterfaceWrapperHelper.getPO(poModel);
final String tableName = po.get_TableName();
String keyColumn = po.get_KeyColumns()[0];
final int recordId = po.get_ID();
// figure out whether we has IsSOTrx=Y
final boolean soTrx;
if (po.get_ColumnIndex("IsSOTrx") > -1)
{
soTrx = po.get_ValueAsBoolean("IsSOTrx");
}
else
{
soTrx = true;
}
currentGridTab = loadWindow(tableName, soTrx);
final MQuery query = MQuery.getEqualQuery(keyColumn, recordId);
logger.info("Query=" + query);
currentGridTab.setQuery(query);
currentGridTab.query(false);
Assert.assertEquals("Invalid row count - " + currentGridTab, 1, currentGridTab.getRowCount());
currentGridTab.setCurrentRow(0);
Assert.assertEquals("Wrong record selected on " + currentGridTab, recordId, currentGridTab.getValue(keyColumn));
return this;
}
示例5: getVars
import org.compiere.model.PO; //导入方法依赖的package包/类
private static Set<MADBoilerPlateVar> getVars(PO po, int timing)
{
int AD_Client_ID = Env.getAD_Client_ID(po.getCtx());
String tableName = po.get_TableName();
int C_DocType_ID = getC_DocType_ID(po);
String evalTime = getEvalTime(timing);
ArrayKey key = new ArrayKey(AD_Client_ID, tableName, C_DocType_ID, evalTime);
Set<MADBoilerPlateVar> vars = s_cacheVars.get(key);
if (vars == null)
vars = new TreeSet<MADBoilerPlateVar>();
return vars;
}
示例6: refreshFromSource
import org.compiere.model.PO; //导入方法依赖的package包/类
private void refreshFromSource(PO sourcePO, int changeType)
{
final String sourceTableName = sourcePO.get_TableName();
final ITableMViewBL mviewBL = Services.get(ITableMViewBL.class);
for (I_AD_Table_MView mview : mviewBL.fetchAll(Env.getCtx()))
{
MViewMetadata mdata = mviewBL.getMetadata(mview);
if (mdata == null)
{
mview.setIsValid(false);
InterfaceWrapperHelper.save(mview);
log.info("No metadata found for " + mview + " [SKIP]");
continue;
}
if (!mdata.getSourceTables().contains(sourceTableName))
{
// not relevant PO for this MView
continue;
}
if (!mviewBL.isSourceChanged(mdata, sourcePO, changeType))
{
// no relevant changes for this view
continue;
}
refreshFromSource(mdata, sourcePO, new RefreshMode[] { RefreshMode.Partial });
}
}
示例7: deleteLog
import org.compiere.model.PO; //导入方法依赖的package包/类
private void deleteLog(PO po)
{
if (po == null)
return;
String msg = "Deleted["
+ po.get_TableName()
+ "=" + po.get_ID()
+ "]: " + getPOSummary(po);
po.deleteEx(false);
addLog(msg);
}
示例8: getDocument
import org.compiere.model.PO; //导入方法依赖的package包/类
@Override
protected IDocument getDocument(final Object documentObj, final boolean throwEx)
{
if (documentObj == null)
{
if (throwEx)
{
throw new AdempiereException("document is null");
}
return null;
}
//
if (documentObj instanceof IDocument)
{
return (IDocument)documentObj;
}
//
final PO po = InterfaceWrapperHelper.getPO(documentObj);
if (po == null)
{
if (throwEx)
{
throw new AdempiereException("Cannot extract " + PO.class + " from " + documentObj);
}
return null;
}
if (po instanceof IDocument)
{
return (IDocument)po;
}
//
final String tableName = po.get_TableName();
final DocumentHandlerProvider handlerProvider = getDocActionHandlerProviderByTableNameOrNull(tableName);
if (handlerProvider != null)
{
final DocumentHandler handler = handlerProvider.provideForDocument(po);
return DocumentWrapper.wrapModelUsingHandler(po, handler);
}
if (throwEx)
{
throw new AdempiereException("Cannot extract " + IDocument.class + " from " + documentObj);
}
return null;
}
示例9: addToCache
import org.compiere.model.PO; //导入方法依赖的package包/类
@Override
public void addToCache(final PO po)
{
// Don't cache null objects
if (po == null)
{
return;
}
// Don't cache new objects
if (po.is_new())
{
return;
}
//
// Do we cache for this model's table?
final String tableName = po.get_TableName();
final ITableCacheConfig cacheConfig = getTableCacheConfig(tableName);
// No cache config => we don't do caching
if (cacheConfig == null || !cacheConfig.isEnabled())
{
return;
}
//
// Do we cache for model's transaction?
final String trxName = po.get_TrxName();
final ITrx trx = trxManager.getTrxOrNull(trxName);
if (!isTrxLevelEnabled(cacheConfig, trx))
{
return;
}
lock.lock();
try
{
addToCache0(cacheConfig, trx, po);
//
// Our model's transaction is not null (i.e. it's in transaction)
// and for this table out-of-transaction caching is also enabled
// TODO: shall we do this only for "Master Data" tables?
// => create a copy in out-of-transaction cache too
final boolean inTransaction = trxManager.getTrxOrNull(trxName) != null;
if (inTransaction
&& isTrxLevelEnabled(cacheConfig, ITrx.TRX_None))
{
final PO poNoTrxCopy = copyPO(po, ITrx.TRXNAME_None);
if (poNoTrxCopy != null)
{
addToCache0(cacheConfig, ITrx.TRX_None, poNoTrxCopy);
}
}
}
finally
{
lock.unlock();
}
}
示例10: testStart
import org.compiere.model.PO; //导入方法依赖的package包/类
/**
* Test Start condition
* @param wf workflow
* @param document document
* @return true if WF should be started
*/
private boolean testStart (MWorkflow wf, PO document)
{
boolean retValue = false;
String logic = wf.getDocValueLogic();
logic = logic.substring(4); // "SQL="
//
String tableName = document.get_TableName();
String[] keyColumns = document.get_KeyColumns();
if (keyColumns.length != 1)
{
log.error("Tables with more then one key column not supported - "
+ tableName + " = " + keyColumns.length);
return false;
}
String keyColumn = keyColumns[0];
StringBuffer sql = new StringBuffer("SELECT ")
.append(keyColumn).append(" FROM ").append(tableName)
.append(" WHERE AD_Client_ID=? AND ") // #1
.append(keyColumn).append("=? AND ") // #2
.append(logic)
// Duplicate Open Workflow test
.append(" AND NOT EXISTS (SELECT * FROM AD_WF_Process wfp ")
.append("WHERE wfp.AD_Table_ID=? AND wfp.Record_ID=") // #3
.append(tableName).append(".").append(keyColumn)
.append(" AND wfp.AD_Workflow_ID=?") // #4
.append(" AND SUBSTR(wfp.WFState,1,1)='O')");
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement (sql.toString(), document.get_TrxName());
pstmt.setInt (1, wf.getAD_Client_ID());
pstmt.setInt (2, document.get_ID());
pstmt.setInt (3, document.get_Table_ID());
pstmt.setInt (4, wf.getAD_Workflow_ID());
rs = pstmt.executeQuery ();
if (rs.next ())
retValue = true;
}
catch (Exception e)
{
log.error("Logic=" + logic
+ " - SQL=" + sql.toString(), e);
}
finally
{
DB.close(rs, pstmt);
rs = null;
pstmt = null;
}
return retValue;
}