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


Java Env.getAD_Client_ID方法代码示例

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


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

示例1: toInfoString

import org.compiere.util.Env; //导入方法依赖的package包/类
private String toInfoString(final Properties ctx)
{
	final String threadName = (String)ctx.get(CTXNAME_ThreadName);
	final String threadId = (String)ctx.get(CTXNAME_ThreadId);
	final int adClientId = Env.getAD_Client_ID(ctx);
	final int adOrgId = Env.getAD_Org_ID(ctx);
	final int adUserId = Env.getAD_User_ID(ctx);
	final int adRoleId = Env.getAD_Role_ID(ctx);
	final int adSessionId = Env.getAD_Session_ID(ctx);

	return "Thread=" + threadName + "(" + threadId + ")"
			//
			+ "\n"
			+ ", Client/Org=" + adClientId + "/" + adOrgId
			+ ", User/Role=" + adUserId + "/" + adRoleId
			+ ", SessionId=" + adSessionId
			//
			+ "\n"
			+ ", id=" + System.identityHashCode(ctx)
			+ ", " + ctx.getClass()
			//
			+ "\n"
			+ ", " + ctx.toString();
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:25,代码来源:TraceContextProviderListener.java

示例2: setupContext_AD_Client_IfNotSet

import org.compiere.util.Env; //导入方法依赖的package包/类
public void setupContext_AD_Client_IfNotSet()
{
	final Properties ctx = Env.getCtx();

	// Do nothing if already set
	if (Env.getAD_Client_ID(ctx) > 0)
	{
		return;
	}

	final IContextAware contextProvider = PlainContextAware.newOutOfTrx(ctx);
	final I_AD_Client adClient = InterfaceWrapperHelper.newInstance(I_AD_Client.class, contextProvider);
	adClient.setValue("Test");
	adClient.setName("Test");
	adClient.setAD_Language(AD_LANGUAGE);
	InterfaceWrapperHelper.save(adClient);

	Env.setContext(ctx, Env.CTXNAME_AD_Client_ID, adClient.getAD_Client_ID());
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:20,代码来源:AdempiereTestHelper.java

示例3: retrieveFirstUserRolesPermissionsForUserWithOrgAccess

import org.compiere.util.Env; //导入方法依赖的package包/类
@Override
public Optional<IUserRolePermissions> retrieveFirstUserRolesPermissionsForUserWithOrgAccess(final Properties ctx, final int adUserId, final int adOrgId)
{
	final boolean rw = false; // readonly access is fine for us
	final int adClientId = Env.getAD_Client_ID(ctx);
	final Date date = Env.getDate(ctx);

	for (final I_AD_Role role : Services.get(IRoleDAO.class).retrieveRolesForUser(ctx, adUserId))
	{
		final int adRoleId = role.getAD_Role_ID();
		final IUserRolePermissions permissions = retrieveUserRolePermissions(adRoleId, adUserId, adClientId, date);
		if (permissions.isOrgAccess(adOrgId, rw))
		{
			return Optional.of(permissions);
		}
	}

	return Optional.absent();
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:20,代码来源:UserRolePermissionsDAO.java

示例4: prepare

import org.compiere.util.Env; //导入方法依赖的package包/类
/**
 *  Prepare - e.g., get Parameters.
 */
protected void prepare()
{
	log.info("");
	m_ctx = Env.getCtx();
	ProcessInfoParameter[] para = getParametersAsArray();
	for (int i = 0; i < para.length; i++)
	{
		String name = para[i].getParameterName();
		if (name.equals("C_BankStatementLoader_ID"))
			m_C_BankStmtLoader_ID = ((BigDecimal)para[i].getParameter()).intValue();
		else if (name.equals("FileName"))
			fileName = (String)para[i].getParameter();
		else
			log.error("Unknown Parameter: " + name);
	}
	m_AD_Client_ID = Env.getAD_Client_ID(m_ctx);
	log.info("AD_Client_ID=" + m_AD_Client_ID);
	m_AD_Org_ID = Env.getAD_Org_ID(m_ctx);
	log.info("AD_Org_ID=" + m_AD_Org_ID);
	log.info("C_BankStatementLoader_ID=" + m_C_BankStmtLoader_ID);
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:25,代码来源:LoadBankStatement.java

示例5: evaluate

import org.compiere.util.Env; //导入方法依赖的package包/类
@Override
public String evaluate(final Evaluatee ctx, final OnVariableNotFound onVariableNotFound) throws ExpressionEvaluationException
{
	Integer adClientId = ctx.get_ValueAsInt(PARAMETER_AD_Client_ID, null);
	if (adClientId == null || adClientId < 0)
	{
		adClientId = Env.getAD_Client_ID(Env.getCtx());
	}

	Integer adOrgId = ctx.get_ValueAsInt(PARAMETER_AD_Org_ID, null);
	if (adOrgId == null || adOrgId < 0)
	{
		adOrgId = Env.getAD_Org_ID(Env.getCtx());
	}

	final IDocumentNoBuilderFactory documentNoFactory = Services.get(IDocumentNoBuilderFactory.class);
	final String value = documentNoFactory.forTableName(tableName, adClientId, adOrgId)
			.setFailOnError(onVariableNotFound == OnVariableNotFound.Fail)
			.setUsePreliminaryDocumentNo(true)
			.build();

	if (value == null && onVariableNotFound == OnVariableNotFound.Fail)
	{
		throw new AdempiereException("No auto value sequence found for " + tableName + ", AD_Client_ID=" + adClientId + ", AD_Org_ID=" + adOrgId);
	}

	return value;
}
 
开发者ID:metasfresh,项目名称:metasfresh-webui-api,代码行数:29,代码来源:AutoSequenceDefaultValueExpression.java

示例6: isAvailableStockQueryActivatedInSysConfig

import org.compiere.util.Env; //导入方法依赖的package包/类
private boolean isAvailableStockQueryActivatedInSysConfig()
{
	final ISysConfigBL sysConfigBL = Services.get(ISysConfigBL.class);
	final int clientId = Env.getAD_Client_ID(Env.getCtx());
	final int orgId = Env.getAD_Org_ID(Env.getCtx());

	final boolean stockQueryActivated = sysConfigBL.getBooleanValue(
			SYSCONFIG_PRODUCT_LOOKUP_DESCRIPTOR_QUERY_AVAILABLE_STOCK,
			false, clientId, orgId);
	return stockQueryActivated;
}
 
开发者ID:metasfresh,项目名称:metasfresh-webui-api,代码行数:12,代码来源:ProductLookupDescriptor.java

示例7: addStorageAttributeKeysToQueryBuilder

import org.compiere.util.Env; //导入方法依赖的package包/类
private void addStorageAttributeKeysToQueryBuilder(@NonNull final StockQueryBuilder stockQueryBuilder)
{
	final ISysConfigBL sysConfigBL = Services.get(ISysConfigBL.class);
	final int clientId = Env.getAD_Client_ID(Env.getCtx());
	final int orgId = Env.getAD_Org_ID(Env.getCtx());

	final String storageAttributesKeys = sysConfigBL.getValue(
			SYSCONFIG_PRODUCT_LOOKUP_DESCRIPTOR_STORAGE_ATTRIBUTES_KEYS,
			AttributesKey.ALL.getAsString(),
			clientId, orgId);

	final Splitter splitter = Splitter
			.on(",")
			.trimResults(CharMatcher.whitespace())
			.omitEmptyStrings();
	for (final String storageAttributesKey : splitter.splitToList(storageAttributesKeys))
	{
		if ("<ALL_STORAGE_ATTRIBUTES_KEYS>".equals(storageAttributesKey))
		{
			stockQueryBuilder.storageAttributesKey(AttributesKey.ALL);
		}
		else if ("<OTHER_STORAGE_ATTRIBUTES_KEYS>".equals(storageAttributesKey))
		{
			stockQueryBuilder.storageAttributesKey(AttributesKey.OTHER);
		}
		else
		{
			stockQueryBuilder.storageAttributesKey(AttributesKey.ofString(storageAttributesKey));
		}
	}
}
 
开发者ID:metasfresh,项目名称:metasfresh-webui-api,代码行数:32,代码来源:ProductLookupDescriptor.java

示例8: prepare

import org.compiere.util.Env; //导入方法依赖的package包/类
/**
	 * 	Get Parameters
	 */
	protected void prepare ()
	{
		
		p_Record_ID = getRecord_ID();
		if (p_AD_Client_ID == 0)
			p_AD_Client_ID = Env.getAD_Client_ID(getCtx());
		AD_Table_ID = getTable_ID();
		
		// C_Invoice; AD_Table_ID = 318
		StringBuffer sb = new StringBuffer ("AD_Table_ID=").append(AD_Table_ID);
		sb.append("; Record_ID=").append(getRecord_ID());
		//	Parameter
		ProcessInfoParameter[] para = getParametersAsArray();
		for (int i = 0; i < para.length; i++)
		{
			String name = para[i].getParameterName();
			if (para[i].getParameter() == null)
				;
			else if (name.equals("AD_Table_ID"))
				p_AD_Table_ID = para[i].getParameterAsInt();
			else
				log.error("Unknown Parameter: " + name);
		}
		
		// TODO - we can get Language from Business Partner
//		m_dateTimeFormat = DisplayType.getDateFormat(DisplayType.DateTime, Env.getLanguage(getCtx()));
//		m_dateFormat 	 = DisplayType.getDateFormat(DisplayType.Date, Env.getLanguage(getCtx()));
		//
		log.info(sb.toString());
	}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:34,代码来源:Export.java

示例9: getElements

import org.compiere.util.Env; //导入方法依赖的package包/类
/**
 * Get All Cost Elements for current AD_Client_ID
 *
 * @param ctx context
 * @param trxName transaction
 * @return array cost elements
 */
public static MCostElement[] getElements(Properties ctx, String trxName)
{
	int AD_Client_ID = Env.getAD_Client_ID(ctx);
	int AD_Org_ID = 0; // Org is always ZERO - see beforeSave

	String whereClause = "AD_Client_ID = ? AND AD_Org_ID = ?";
	List<MCostElement> list = new Query(ctx, Table_Name, whereClause, trxName)
			.setParameters(new Object[] { AD_Client_ID, AD_Org_ID })
			.list();
	MCostElement[] retValue = new MCostElement[list.size()];
	list.toArray(retValue);
	return retValue;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:21,代码来源:MCostElement.java

示例10: isDisabled

import org.compiere.util.Env; //导入方法依赖的package包/类
protected boolean isDisabled()
{
	final ISysConfigBL sysconfigBL = Services.get(ISysConfigBL.class);
	final int adClientId = Env.getAD_Client_ID(Env.getCtx());
	final boolean disabled = sysconfigBL.getBooleanValue(SYSCONFIG_TRX_CONSTRAINTS_DISABLED, DEFAULT_TRX_CONSTRAINTS_DISABLED, adClientId);
	return disabled;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:8,代码来源:TrxConstraintsBL.java

示例11: setRate

import org.compiere.util.Env; //导入方法依赖的package包/类
/**
 * Creates/Updates an {@link I_C_Conversion_Rate} using given parameters and following defaults:
 * <ul>
 * <li>ValidFrom: 1970-01-01
 * <li>ConversionType: default
 * <li>Client/Org: from {@link Env#getCtx()}
 * </ul>
 *
 * @param currencyFrom
 * @param currencyTo
 * @param rate
 */
public void setRate(final I_C_Currency currencyFrom, final I_C_Currency currencyTo, final BigDecimal rate)
{
	final Properties ctx = Env.getCtx();
	final int adClientId = Env.getAD_Client_ID(ctx);
	final int adOrgId = Env.getAD_Org_ID(ctx);
	final Date date = TimeUtil.getDay(1970, 1, 1);
	final I_C_ConversionType conversionType = retrieveDefaultConversionType(ctx, adClientId, adOrgId, date);
	final ICurrencyConversionContext conversionCtx = CurrencyConversionContext.builder()
			.setAD_Client_ID(adClientId)
			.setAD_Org_ID(adOrgId)
			.setC_ConversionType_ID(conversionType.getC_ConversionType_ID())
			.setConversionDate(date)
			.build();

	I_C_Conversion_Rate conversionRate = retrieveRateQuery(conversionCtx, currencyFrom.getC_Currency_ID(), currencyTo.getC_Currency_ID())
			.create()
			.first();
	if (conversionRate == null)
	{
		conversionRate = InterfaceWrapperHelper.create(ctx, I_C_Conversion_Rate.class, ITrx.TRXNAME_None);
		conversionRate.setAD_Org_ID(adOrgId);
		conversionRate.setC_ConversionType(conversionType);
		conversionRate.setC_Currency(currencyFrom);
		conversionRate.setC_Currency_ID_To(currencyTo.getC_Currency_ID());
		// FIXME: this one is not working due a bug in POJOWrapper or because it's not respecting the standard naming conventions (i.e. C_Currency_To_ID)
		// conversionRate.setC_Currency_To(currencyTo);
		conversionRate.setValidFrom(TimeUtil.asTimestamp(date));
	}

	conversionRate.setMultiplyRate(rate);
	conversionRate.setDivideRate(null); // not used

	InterfaceWrapperHelper.save(conversionRate);
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:47,代码来源:PlainCurrencyDAO.java

示例12: retrieveForShipmentRun

import org.compiere.util.Env; //导入方法依赖的package包/类
@Override
public List<OlAndSched> retrieveForShipmentRun(
		final boolean includeUncompleted,
		final String trxName)
{
	final Object[] param = new Object[] { Env.getAD_Client_ID(Env.getCtx()), includeUncompleted ? 1 : 0 };

	final IDatabaseBL db = Services.get(IDatabaseBL.class);

	final List<X_M_ShipmentSchedule> schedules = db.retrieveList(SQL_SCHED, param, X_M_ShipmentSchedule.class, trxName);

	final Map<Integer, MOrderLine> orderLines = db.retrieveMap(SQL_OL_SCHED, param, MOrderLine.class, trxName);

	return mkResult(schedules, orderLines);
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:16,代码来源:ShipmentSchedulePA.java

示例13: setIsAllocated

import org.compiere.util.Env; //导入方法依赖的package包/类
/**
 * Set Allocated Flag for payments
 *
 * @param ctx context
 * @param C_BPartner_ID if 0 all
 * @param trxName trx
 */
public static void setIsAllocated(Properties ctx, int C_BPartner_ID, String trxName)
{
	int counter = 0;
	String sql = "SELECT * FROM C_Payment "
			+ "WHERE IsAllocated='N' AND DocStatus IN ('CO','CL')";
	if (C_BPartner_ID > 1)
		sql += " AND C_BPartner_ID=?";
	else
		sql += " AND AD_Client_ID=" + Env.getAD_Client_ID(ctx);
	PreparedStatement pstmt = null;
	ResultSet rs = null;
	try
	{
		pstmt = DB.prepareStatement(sql, trxName);
		if (C_BPartner_ID > 1)
			pstmt.setInt(1, C_BPartner_ID);
		rs = pstmt.executeQuery();
		while (rs.next())
		{
			MPayment pay = new MPayment(ctx, rs, trxName);
			if (pay.testAllocation())
				if (pay.save())
					counter++;
		}
	}
	catch (Exception e)
	{
		s_log.error(sql, e);
	}
	finally
	{
		DB.close(rs, pstmt);
		rs = null;
		pstmt = null;
	}
	s_log.info("#" + counter);
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:45,代码来源:MPayment.java

示例14: isAvailable

import org.compiere.util.Env; //导入方法依赖的package包/类
@Override
public boolean isAvailable()
{
	final int adClientId = Env.getAD_Client_ID(Env.getCtx());
	if (!MSysConfig.getBooleanValue("UI_EnableBPartnerContextMenu", true, adClientId))
	{
		return false;
	}

	final VEditor editor = getEditor();
	final GridField gridField = editor.getField();
	if (gridField == null)
	{
		return false;
	}
	
	if (!gridField.isLookup())
	{
		return false;
	}
	
	final Lookup lookup = gridField.getLookup();
	if (lookup == null)
	{
		// No Lookup???
		log.warn("No lookup found for " + gridField + " even if is marked as Lookup");
		return false;
	}
	
	final String tableName = lookup.getTableName();
	if (!I_C_BPartner.Table_Name.equals(tableName))
	{
		return false;
	}

	return true;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:38,代码来源:BPartnerNewUpdateContextEditorAction.java

示例15: getDefault

import org.compiere.util.Env; //导入方法依赖的package包/类
/**
 * Get Default Price List for Client (cached)
 *
 * @param ctx context
 * @param IsSOPriceList SO or PO
 * @return PriceList or null
 */
public static MPriceList getDefault(Properties ctx, boolean IsSOPriceList)
{
	int AD_Client_ID = Env.getAD_Client_ID(ctx);
	MPriceList retValue = null;
	// Search for it in cache
	Iterator<MPriceList> it = s_cache.values().iterator();
	while (it.hasNext())
	{
		retValue = it.next();
		if (retValue.isDefault()
				&& retValue.getAD_Client_ID() == AD_Client_ID
				&& retValue.isSOPriceList() == IsSOPriceList)
		{
			return retValue;
		}
	}

	// Get from DB
	final String whereClause = "AD_Client_ID=? AND IsDefault=? AND IsSOPriceList=?";
	retValue = new Query(ctx, Table_Name, whereClause, null)
			.setParameters(new Object[] { AD_Client_ID, "Y", IsSOPriceList ? "Y" : "N" })
			.setOrderBy("M_PriceList_ID")
			.first();

	// Return value
	if (retValue != null)
	{
		s_cache.put(retValue.get_ID(), retValue);
	}
	return retValue;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:39,代码来源:MPriceList.java


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