本文整理汇总了Java中org.compiere.model.PO.set_TrxName方法的典型用法代码示例。如果您正苦于以下问题:Java PO.set_TrxName方法的具体用法?Java PO.set_TrxName怎么用?Java PO.set_TrxName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.compiere.model.PO
的用法示例。
在下文中一共展示了PO.set_TrxName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: copyPO
import org.compiere.model.PO; //导入方法依赖的package包/类
/**
* Creates a copy of orginal PO, having given <code>trxName</code>.
*
* @param originalPO
* @param trxName
* @return
* <ul>
* <li>copy of <code>originalPO</code>;
* <li>if original PO is null, null will be returned;
* <li>if there is an error while cloning given PO, null will be returned but an warning will be logged (just to not stop the current execution)
* </ul>
*/
private final PO copyPO(final PO originalPO, final String trxName)
{
if (originalPO == null)
{
return null;
}
PO poToReturn;
try
{
final PO poNoTrxCopy = originalPO.copy();
poNoTrxCopy.set_TrxName(trxName);
poToReturn = poNoTrxCopy;
}
catch (Exception e)
{
logger.warn("Cannot create a copy of " + originalPO + ". Returning null.", e);
poToReturn = null;
}
return poToReturn;
}
示例2: setTrxName
import org.compiere.model.PO; //导入方法依赖的package包/类
public static void setTrxName(final Object model, final String trxName)
{
if (model == null)
{
throw new IllegalArgumentException("model is null");
}
final PO po = getStrictPO(model);
if (po == null)
{
throw new ModelClassNotSupportedException(model);
}
po.set_TrxName(trxName);
}
示例3: exportRecord
import org.compiere.model.PO; //导入方法依赖的package包/类
/**
* Export a limited number of POs for the given format and where clause.
*
* @param exportFormat
* @param where
* @param ReplicationMode
* @param ReplicationType
* @param ReplicationEvent
* @param limit limit the number of exported records. This makes sense when we want to export only a few sample records for the given format.
* @return
* @throws Exception
*/
public Document exportRecord(final MEXPFormat exportFormat, final String where, final Integer ReplicationMode, final String ReplicationType, final Integer ReplicationEvent,
final IReplicationAccessContext racCtx)
throws Exception
{
final I_AD_Client client = Services.get(IClientDAO.class).retriveClient(exportFormat.getCtx(), m_AD_Client_ID);
final MTable table = MTable.get(exportFormat.getCtx(), exportFormat.getAD_Table_ID());
log.info("Table = " + table);
// metas: begin: build where clause
final StringBuffer whereClause = new StringBuffer("1=1");
if (!Check.isEmpty(exportFormat.getWhereClause(), true))
{
whereClause.append(" AND (").append(exportFormat.getWhereClause()).append(")");
}
if (!Check.isEmpty(where))
{
whereClause.append(" AND (").append(where).append(")");
}
// metas: end
final Collection<PO> records = new Query(exportFormat.getCtx(), table.getTableName(), whereClause.toString(), exportFormat.get_TrxName())
.setOnlyActiveRecords(true)
.setApplyAccessFilter(racCtx.isApplyAccessFilter())
.setLimit(racCtx.getLimit())
.list();
for (final PO po : records)
{
log.info("Client = " + client.toString());
log.trace("po.getAD_Org_ID() = " + po.getAD_Org_ID());
log.trace("po.get_TrxName() = " + po.get_TrxName());
if (po.get_TrxName() == null || po.get_TrxName().equals(""))
{
po.set_TrxName("exportRecord");
}
if (po.get_KeyColumns().length < 1)
{
throw new Exception(Services.get(IMsgBL.class).getMsg(po.getCtx(), "ExportNoneColumnKeyNotSupported")); // TODO: Create Mesagge.
}
outDocument = createNewDocument();
final HashMap<String, Integer> variableMap = new HashMap<String, Integer>();
final Element rootElement = generateRootElement(exportFormat, outDocument, ReplicationMode, ReplicationType, ReplicationEvent, client);
generateExportFormat(outDocument, rootElement, exportFormat, po, variableMap, racCtx);
} // finish record read
return outDocument;
}