当前位置: 首页>>代码示例>>Java>>正文


Java PO.get_TrxName方法代码示例

本文整理汇总了Java中org.compiere.model.PO.get_TrxName方法的典型用法代码示例。如果您正苦于以下问题:Java PO.get_TrxName方法的具体用法?Java PO.get_TrxName怎么用?Java PO.get_TrxName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.compiere.model.PO的用法示例。


在下文中一共展示了PO.get_TrxName方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: retrievePaymentTerm

import org.compiere.model.PO; //导入方法依赖的package包/类
@Cached
private MPaymentTerm retrievePaymentTerm(final PO poToMatch) {

	final Integer paymentTermId = (Integer) poToMatch
			.get_Value(I_C_Order.COLUMNNAME_C_PaymentTerm_ID);
	if (paymentTermId == null) {
		throw new IllegalArgumentException(poToMatch
				+ " lacks a value for "
				+ I_C_Order.COLUMNNAME_C_PaymentTerm_ID);
	}

	final MPaymentTerm paymentTerm = new MPaymentTerm(poToMatch
			.getCtx(), paymentTermId, poToMatch.get_TrxName());

	return paymentTerm;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:17,代码来源:ImportBankstatementCtrl.java

示例2: newConversionRate

import org.compiere.model.PO; //导入方法依赖的package包/类
private static X_C_Conversion_Rate newConversionRate(PO po,
		int C_ConversionType_ID,
		int C_Currency_ID, int C_Currency_ID_To,
		BigDecimal MultiplyRate, Timestamp ValidFrom)
{
	final BigDecimal divideRate = MultiplyRate != null && MultiplyRate.signum() != 0 ? BigDecimal.ONE.divide(MultiplyRate, 12, RoundingMode.HALF_UP) : BigDecimal.ZERO;
	
	final X_C_Conversion_Rate conversionRate = new X_C_Conversion_Rate(po.getCtx(), 0, po.get_TrxName());
	conversionRate.setAD_Org_ID(po.getAD_Org_ID());
	conversionRate.setC_ConversionType_ID(C_ConversionType_ID);
	conversionRate.setC_Currency_ID(C_Currency_ID);
	conversionRate.setC_Currency_ID_To(C_Currency_ID_To);
	//
	conversionRate.setMultiplyRate(MultiplyRate);
	conversionRate.setDivideRate(divideRate);
	conversionRate.setValidFrom(ValidFrom);
	return conversionRate;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:19,代码来源:ImportConversionRate.java

示例3: getTrxName

import org.compiere.model.PO; //导入方法依赖的package包/类
public static String getTrxName(final Object model)
{
	final PO po = getStrictPO(model);
	if (po != null)
	{
		return po.get_TrxName();
	}

	// Notify developer that (s)he is using wrong models
	if (Services.get(IDeveloperModeBL.class).isEnabled())
	{
		final AdempiereException e = new AdempiereException("Cannot get trxName from model " + model + " because is not supported. Returning 'null'.");
		log.warn(e.getLocalizedMessage(), e);
	}

	return null;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:18,代码来源:POWrapper.java

示例4: createMigrationStep

import org.compiere.model.PO; //导入方法依赖的package包/类
protected I_AD_MigrationStep createMigrationStep(final IMigrationLoggerContext migrationCtx, final PO contextPO)
{
	String entityType = null;
	final Properties ctx;
	final String trxName;
	if (contextPO != null)
	{
		final int idxEntityType = contextPO.get_ColumnIndex("EntityType");
		if (idxEntityType >= 0)
		{
			entityType = contextPO.get_ValueAsString("EntityType");
		}

		ctx = contextPO.getCtx();
		trxName = contextPO.get_TrxName();
	}
	else
	{
		ctx = Env.getCtx();
		trxName = null;
	}

	final I_AD_Migration migration = getCreateMigration(migrationCtx, entityType);

	final I_AD_MigrationStep migrationStep = InterfaceWrapperHelper.create(ctx, I_AD_MigrationStep.class, trxName);
	migrationStep.setAD_Migration(migration);

	return migrationStep;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:30,代码来源:MigrationLogger.java

示例5: isExpired

import org.compiere.model.PO; //导入方法依赖的package包/类
/**
 * 
 * @param ctx
 * @param tableName
 * @param recordId
 * @param trxName
 * @param po
 * @return true if given PO is expired
 */
private boolean isExpired(final Properties ctx, final String tableName, final int recordId, final ITrx trx, final PO po)
{
	// Check if our cached PO was deleted
	final int poRecordId = po.get_ID();
	if (poRecordId < 0)
	{
		return true;
	}

	// Check if PO has the same trxName as we required
	final String poTrxName = po.get_TrxName();
	if (!trxManager.isSameTrxName(trx, poTrxName))
	{
		return true;
	}

	// Check if PO has the same ID as we required
	if (recordId != poRecordId)
	{
		return true;
	}

	// Check if PO has the same Context as we required
	final Properties poCtx = po.getCtx();
	if (!CacheCtxParamDescriptor.isSameCtx(poCtx, ctx)) // gh #1036
	{
		return true;
	}

	//
	// We assume our PO is not expired
	return false;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:43,代码来源:ModelCacheService.java

示例6: recordGenericExpectations

import org.compiere.model.PO; //导入方法依赖的package包/类
public static void recordGenericExpectations(final PO poMock, final int id) {

		new Expectations() 
		{{
			poMock.getCtx(); minTimes = 0; result = POTest.CTX;
			poMock.get_TrxName(); minTimes = 0; result = POTest.TRX_NAME;
			poMock.get_ID(); minTimes = 0; result = id;
			poMock.getAD_Client_ID(); minTimes = 0; result = AD_CLIENT_ID;
			poMock.getAD_Org_ID(); minTimes = 0; result = AD_Org_ID;
		}};
	}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:12,代码来源:POTest.java

示例7: linkReferenceNo

import org.compiere.model.PO; //导入方法依赖的package包/类
@Override
public void linkReferenceNo(final PO po, final IReferenceNoGeneratorInstance instance)
{
	final IReferenceNoDAO dao = Services.get(IReferenceNoDAO.class);

	final Properties localCtx = Env.deriveCtx(po.getCtx());
	Env.setContext(localCtx, "#AD_Client_ID", po.getAD_Client_ID());
	Env.setContext(localCtx, "#AD_Org_ID", po.getAD_Org_ID());

	final String trxName = po.get_TrxName();
	final int tableId = po.get_Table_ID();
	final int recordId = po.get_ID();

	final String referenceNoStr = instance.generateReferenceNo(po);
	if (IReferenceNoGenerator.REFERENCENO_None == referenceNoStr)
	{
		logger.debug("Instance {} did not generate any referenceNo for '{}'. Skip.", new Object[] { instance, po });
		return;
	}

	final I_C_ReferenceNo referenceNo = dao.getCreateReferenceNo(localCtx, instance.getType(), referenceNoStr, trxName);
	dao.getCreateReferenceNoDoc(referenceNo, tableId, recordId);

	
	// 04153 : mark the reference numbers with 'referenceNoStr' created by the system with isManual = N
	if(referenceNo != null)
	{
		referenceNo.setIsManual(false);
		InterfaceWrapperHelper.save(referenceNo); // make sure the flag is saved
	}

	if (logger.isDebugEnabled())
	{
		logger.debug("Created reference " + referenceNoStr + " for " + po);
	}
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:37,代码来源:ReferenceNoBL.java

示例8: unlinkReferenceNo

import org.compiere.model.PO; //导入方法依赖的package包/类
@Override
public void unlinkReferenceNo(final PO po, final IReferenceNoGeneratorInstance instance)
{
	final IReferenceNoDAO dao = Services.get(IReferenceNoDAO.class);

	final Properties ctx = po.getCtx();
	final String trxName = po.get_TrxName();
	final int tableId = po.get_Table_ID();
	final int recordId = po.get_ID();
	final int referenceNoTypeId = instance.getType().getC_ReferenceNo_Type_ID();

	final List<I_C_ReferenceNo_Doc> assignments = dao.retrieveDocAssignments(ctx, referenceNoTypeId, tableId, recordId, trxName);
	dao.removeDocAssignments(assignments);
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:15,代码来源:ReferenceNoBL.java

示例9: retrieveFacts

import org.compiere.model.PO; //导入方法依赖的package包/类
/**
 * Returns all facts that belong to the given po
 * 
 * @param po
 * @return
 */
public static List<I_C_AdvCommissionFact> retrieveFacts(final PO po, final int commissionTermId)
{
	final Properties ctx = po.getCtx();
	final String trxName = po.get_TrxName();

	final int tableId = po.get_Table_ID();
	final int recordId = po.get_ID();

	return retrieveFacts(ctx, tableId, recordId, commissionTermId, trxName);
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:17,代码来源:MCAdvCommissionFact.java

示例10: chatInfoForPO

import org.compiere.model.PO; //导入方法依赖的package包/类
private void chatInfoForPO(final Object model, final String info)
{
	final PO po = InterfaceWrapperHelper.getPO(model);

	final MChat chat = new MChat(po.getCtx(), po.get_Table_ID(), po.get_ID(), null, po.get_TrxName());
	chat.saveEx();
	final MChatEntry entry = new MChatEntry(chat, getClass().getSimpleName() + " - " + info);
	entry.saveEx();
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:10,代码来源:CommissionFactRecordAllocationLine.java

示例11: 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();
	}
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:61,代码来源:ModelCacheService.java

示例12: 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;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:63,代码来源:ExportHelper.java

示例13: createOrUpdate

import org.compiere.model.PO; //导入方法依赖的package包/类
public static MCAdvCommissionFactCand createOrUpdate(final PO po, final MCAdvCommissionRelevantPO relevantPO)
{
	Check.assume(relevantPO != null, "Param 'relevantPO' is not null");

	final String whereClause =
			I_C_AdvCommissionFactCand.COLUMNNAME_AD_Table_ID + "=? AND "
					+ I_C_AdvCommissionFactCand.COLUMNNAME_Record_ID + "=? AND "
					+ I_C_AdvCommissionFactCand.COLUMNNAME_C_AdvCommissionRelevantPO_ID + "=? AND "
					+ I_C_AdvCommissionFactCand.COLUMNNAME_TrxName + "=?";

	final Object[] parameters = {
			po.get_Table_ID(),
			po.get_ID(),
			relevantPO.get_ID(),
			po.get_TrxName()
	};

	final List<MCAdvCommissionFactCand> existingCands =
			new Query(po.getCtx(), I_C_AdvCommissionFactCand.Table_Name, whereClause, po.get_TrxName())
					.setParameters(parameters)
					.list();

	Check.assume(existingCands.size() <= 1, "There is max 1 existing candidate; existingCands=" + existingCands);

	if (existingCands.isEmpty())
	{
		final MCAdvCommissionFactCand newCand = new MCAdvCommissionFactCand(po, relevantPO);
		newCand.saveEx();
		return newCand;
	}

	final MCAdvCommissionFactCand existingCand = existingCands.get(0);

	existingCand.setSeqNo(relevantPO.getSeqNo());
	existingCand.setInfo(relevantPO.isInfo());
	existingCand.setIsSubsequentProcessingDone(false);
	existingCand.setIsImmediateProcessingDone(false);
	existingCand.saveEx();

	return existingCand;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:42,代码来源:MCAdvCommissionFactCand.java


注:本文中的org.compiere.model.PO.get_TrxName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。