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


Java Env.parseContext方法代码示例

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


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

示例1: getXMLValue

import org.compiere.util.Env; //导入方法依赖的package包/类
private Object getXMLValue(final String xPathExpression, final Node rootNode, final I_EXP_FormatLine formatLine) throws XPathExpressionException
{
	final String value = XMLHelper.getString(xPathExpression, rootNode);
	if (!Check.isEmpty(value))
	{
		return value;
	}

	// Default value

	String defaultValue = null;

	final String defaultValueExpr = formatLine.getDefaultValue();
	if (!Check.isEmpty(defaultValueExpr, true))
	{
		defaultValue = Env.parseContext(ctx, 0, defaultValueExpr, false, true); // onlyWindow=false, ignoreUnparsable=true
	}

	return defaultValue;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:21,代码来源:ImportHelper.java

示例2: onR_MailText_ID

import org.compiere.util.Env; //导入方法依赖的package包/类
@CalloutMethod(columnNames = I_R_Request.COLUMNNAME_R_MailText_ID)
public void onR_MailText_ID(final I_R_Request request, final ICalloutField calloutField)
{
	final int R_MailText_ID = request.getR_MailText_ID();
	if (R_MailText_ID <= 0)
	{
		return;
	}

	final Properties ctx = calloutField.getCtx();
	final IMailTextBuilder mailTextBuilder = Services.get(IMailBL.class)
			.newMailTextBuilder(InterfaceWrapperHelper.create(ctx, R_MailText_ID, I_R_MailText.class, ITrx.TRXNAME_None));

	final int userId = request.getAD_User_ID();
	if (userId > 0)
	{
		mailTextBuilder.setAD_User(userId);
	}
	final int bpartnerId = request.getC_BPartner_ID();
	if (bpartnerId > 0)
	{
		mailTextBuilder.setC_BPartner(bpartnerId);
	}

	String txt = mailTextBuilder.getMailText();
	txt = Env.parseContext(ctx, calloutField.getWindowNo(), txt, false, true);
	request.setResult(txt);
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:29,代码来源:R_Request.java

示例3: onR_StandardResponse_ID

import org.compiere.util.Env; //导入方法依赖的package包/类
@CalloutMethod(columnNames = I_R_Request.COLUMNNAME_R_StandardResponse_ID)
public void onR_StandardResponse_ID(final I_R_Request request, final ICalloutField calloutField)
{
	final I_R_StandardResponse standardResponse = request.getR_StandardResponse();
	if (standardResponse == null)
	{
		return;
	}

	String txt = standardResponse.getResponseText();
	txt = Env.parseContext(calloutField.getCtx(), calloutField.getWindowNo(), txt, false, true);
	request.setResult(txt);
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:14,代码来源:R_Request.java

示例4: getOrderByClause

import org.compiere.util.Env; //导入方法依赖的package包/类
/**
 * Get Order By Clause
 *
 * @param onlyCurrentRows only current rows
 * @return Order By Clause
 */
private String getOrderByClause(final boolean onlyCurrentRows)
{
	// First Prio: Tab Order By
	if (m_vo.OrderByClause.length() > 0)
	{
		final Properties ctx = getCtx();
		final String orderBy = Env.parseContext(ctx, m_vo.WindowNo, m_vo.OrderByClause, false, false);
		return orderBy;
	}

	// Second Prio: Fields (save it)
	m_vo.OrderByClause = "";
	for (int i = 0; i < 3; i++)
	{
		final String order = m_OrderBys[i];
		if (order != null && order.length() > 0)
		{
			if (m_vo.OrderByClause.length() > 0)
			{
				m_vo.OrderByClause += ",";
			}
			m_vo.OrderByClause += order;
		}
	}
	if (m_vo.OrderByClause.length() > 0)
	{
		return m_vo.OrderByClause;
	}

	// Third Prio: onlyCurrentRows
	m_vo.OrderByClause = "Created";
	if (onlyCurrentRows && !isDetail())
	{
		m_vo.OrderByClause += " DESC";
	}
	return m_vo.OrderByClause;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:44,代码来源:GridTab.java

示例5: getSQLSelect

import org.compiere.util.Env; //导入方法依赖的package包/类
@Override
protected String getSQLSelect()
{
	final String sqlOrig = super.getSQLSelect();
	final String sql = Env.parseContext(getCtx(), getWindowNo(), sqlOrig, false);
	if (!Check.isEmpty(sql))
	{
		return sql;
	}
	return sqlOrig;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:12,代码来源:InfoSimple.java

示例6: refresh

import org.compiere.util.Env; //导入方法依赖的package包/类
public void refresh(final int M_Product_ID)
{
	final String sql = Env.parseContext(getCtx(), getWindowNo(),
			m_sqlDimensions,
			false,             // onlyWindow,
			false // ignoreUnparsable
	);
	if (Check.isEmpty(sql, true))
	{
		dimensionsTbl.clear();
		return;
	}

	log.trace(sql);
	PreparedStatement pstmt = null;
	ResultSet rs = null;
	try
	{
		pstmt = DB.prepareStatement(sql, ITrx.TRXNAME_None);
		pstmt.setInt(1, M_Product_ID);
		rs = pstmt.executeQuery();
		dimensionsTbl.loadTable(rs);
	}
	catch (final Exception e)
	{
		log.warn(sql, e);
	}
	finally
	{
		DB.close(rs, pstmt);
		rs = null;
		pstmt = null;
	}

	if (dimensionsTbl.getRowCount() > 0)
	{
		dimensionsTbl.setSelectedRows(Collections.singletonList(0));
	}
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:40,代码来源:MRPInfoWindowAttribGroups.java

示例7: createSelectWhereClauseSql

import org.compiere.util.Env; //导入方法依赖的package包/类
private String createSelectWhereClauseSql()
{
	final StringBuilder where = new StringBuilder("");
	//	WHERE
	if (m_whereClause.length() > 0)
	{
		where.append("(");
		if (m_whereClause.indexOf('@') == -1)
		{
			where.append(m_whereClause);
		}
		else    //  replace variables
		{
			String context = Env.parseContext(m_ctx, m_WindowNo, m_whereClause, false);
			if(context != null && context.trim().length() > 0)
			{
				where.append(context);
			}
			else
			{
				log.warn("Failed to parse where clause. whereClause="+m_whereClause);
				where.append(" 1 = 2 ");
			}
		}
		where.append(")");
	}

	// metas: cg: task 04771 : start
	// make sure that the new records are put it in the where clause
	final String whereNewCreated = getNewRecordsWhereClause();
	if (!Check.isEmpty(whereNewCreated, true))
	{
		if (where.length() > 0)
		{
			where.insert(0, "( ");
			where.append(" OR (");
			where.append(whereNewCreated);
			where.append(" ) ) ");
		}
	}
	// metas: cg: task 04771 : end
	
	if (m_onlyCurrentRows && m_TabNo == 0)
	{
		if (where.length() > 0)
		{
			where.append(" AND ");
		}
		
		//	Show only unprocessed or the one updated within x days
		// metas: 03922: filter by Processed only if column exists
		if (findColumn("Processed") >= 0)
		{
			where.append("(Processed='N' OR Updated>now()-1)");
		}
		else
		{
			where.append("Updated>now()-1");
		}
	}

	if (where.length() <= 0)
	{
		where.append("1=1");
	}
	
	return where.toString();
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:69,代码来源:GridTable.java

示例8: getSQLWhere

import org.compiere.util.Env; //导入方法依赖的package包/类
/**
 * Get where clause constructed from query fields
 *
 * @param params
 * @return
 */
protected String getSQLWhere(final List<Object> params)
{
	final StringBuilder where = new StringBuilder(); // clause form by query fields

	final List<Object> criteriasParams = new ArrayList<Object>();
	final String criteriasWhereClause = getCriteriasSQLWhere(criteriasParams);

	where.append(criteriasWhereClause);
	params.addAll(criteriasParams);

	final StringBuilder whereClause = new StringBuilder(); // general clause
	if (!Check.isEmpty(infoWindow.getOtherClause()) && where.length() > 0)
	{
		whereClause.append(" AND ");
	}

	// category id
	if (treeSelectedNode != null && treeSelectedNode.getNode_ID() != 0)
	{
		// need to iterate category and all subcategories
		if (where.length() > 0)
		{
			where.append(" AND ");
		}
		where.append(" ( ");
		where.append(" ").append(getTableName()).append(".");
		where.append(adInfoWindowBL.getTreeColumnName(infoWindow));
		where.append(" IN (");

		for (final int id : getSubtreeIds(treeSelectedNode))
		{
			where.append(id);
			where.append(',');
		}
		// remote the last ','
		where.setLength(where.length() - 1);
		where.append(")");
		where.append(" ) ");
	}
	//
	if (where.length() > 0)
	{
		whereClause.append(" ( ").append(where).append(" ) ");
	}
	
	final int p_WindowNo = getWindowNo();
	return Env.parseContext(ctx, p_WindowNo, whereClause.toString(), false);
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:55,代码来源:InfoSimple.java

示例9: getWhereClause

import org.compiere.util.Env; //导入方法依赖的package包/类
/**
 * Get Where Clause
 *
 * @return where clause or ""
 */
private static String getWhereClause(final Lookup lookup)
{
	// final Lookup lookup = getLookup();
	if (lookup == null)
	{
		return "";
	}

	String whereClause = "";

	if (lookup.getZoomQuery() != null)
	{
		whereClause = lookup.getZoomQuery().getWhereClause();
	}
	String validation = lookup.getValidation();
	if (validation == null)
	{
		validation = "";
	}
	if (whereClause.length() == 0)
	{
		whereClause = validation;
	}
	else if (validation.length() > 0)
	{
		whereClause += " AND (" + validation + ")";
	}
	// log.trace("ZoomQuery=" + (m_lookup.getZoomQuery()==null ? "" : m_lookup.getZoomQuery().getWhereClause())
	// + ", Validation=" + m_lookup.getValidation());
	if (whereClause.indexOf('@') != -1)
	{
		String validated = Env.parseContext(Env.getCtx(), lookup.getWindowNo(), whereClause, false);
		if (validated.length() == 0)
		{
			log.error(lookup + " - Cannot Parse=" + whereClause);
		}
		else
		{
			log.debug(lookup + " - Parsed: " + validated);
			return validated;
		}
	}
	return whereClause;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:50,代码来源:VLookup.java

示例10: getCtx

import org.compiere.util.Env; //导入方法依赖的package包/类
@OverridingMethodsMustInvokeSuper
/* package */void init(final boolean modal,
		final int WindowNo,
		final String tableName,
		final String keyColumn,
		final boolean multiSelection,
		final String whereClause)
{
	// metas: end
	log.info("WinNo=" + p_WindowNo + " " + whereClause);

	final Properties ctx = getCtx();

	// WindowNo
	if (WindowNo <= 0)
	{
		final Window window = getWindow();
		p_WindowNo = Env.createWindowNo(window);
		AEnv.addToWindowManager(window);
		localWindowNo = true;
	}
	else
	{
		if (!modal)
		{
			new AdempiereException("Posible window leak because modal=false and WindowNo is provided. This window won't be added to window manager.")
					.throwIfDeveloperModeOrLogWarningElse(log);
		}
		p_WindowNo = WindowNo;
		localWindowNo = false;
	}

	p_tableName = tableName;
	p_keyColumn = keyColumn;
	p_multiSelection = multiSelection;
	if (whereClause == null || whereClause.indexOf('@') == -1)
	{
		p_whereClause = whereClause;
	}
	else
	{
		p_whereClause = Env.parseContext(ctx, p_WindowNo, whereClause, false, false);
		if (p_whereClause.length() == 0)
		{
			log.error("Cannot parse context= " + whereClause);
		}
	}

	try
	{
		jbInit();
	}
	catch (final Exception ex)
	{
		log.error("Info", ex);
	}
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:58,代码来源:Info.java

示例11: refresh

import org.compiere.util.Env; //导入方法依赖的package包/类
/**
 * Reloads the table with the given filter criteria.
 * 
 * @param M_Product_ID
 * @param attributeValues attribute values that belong to the {@link I_DIM_Dimension_Spec} with the internal name 
 * {@value #DIM_SPEC_INTERNALNAME_MRP_PRODUCT_INFO_ASI_VALUES}.
 */
public void refresh(final int M_Product_ID, final String... attributeValues)
{
	final StringBuilder sql = new StringBuilder(m_sqlStock);

	if (attributeValues.length > 0)
	{
		sql.append("AND ( false ");
		for (int i = 0; i < attributeValues.length; i++)
		{
			if ("DIM_EMPTY".equals(attributeValues[i]))
			{
				// match everything that is not matched by any other attribute value define by the spec
				sql.append(" OR ('DIM_EMPTY'=? AND ");
				sql.append(" NOT EXISTS (select 1 from \"de.metas.dimension\".DIM_Dimension_Spec_Attribute_AllValues dim2 where dim2.InternalName='"
						+ DIM_SPEC_INTERNALNAME_MRP_PRODUCT_INFO_ASI_VALUES
						+ "' and ASIKeyName ILIKE '%'||dim2.ValueName||'%') )");
			}
			else
			{
				// the normal case
				sql.append(" OR ASIKeyName ILIKE '%'||?||'%'");
			}

		}
		sql.append(")");
	}
	sql.append(SQL_ORDER_BY);

	final String sqlFinal = Env.parseContext(getCtx(), getWindowNo(),
			sql.toString(),
			false, // onlyWindow,
			false // ignoreUnparsable
			);
	if (Check.isEmpty(sqlFinal, true))
	{
		stockTbl.clear();
		return;
	}

	log.trace(sqlFinal);
	PreparedStatement pstmt = null;
	ResultSet rs = null;
	try
	{

		pstmt = DB.prepareStatement(sqlFinal, ITrx.TRXNAME_None);
		pstmt.setInt(1, M_Product_ID);
		for (int i = 0; i < attributeValues.length; i++)
		{
			pstmt.setString(i + 2, attributeValues[i]);
		}
		rs = pstmt.executeQuery();
		stockTbl.loadTable(rs);
		// rs = pstmt.executeQuery(); // why do we exiecute it again??
	}
	catch (final Exception e)
	{
		log.warn(sqlFinal, e);
	}
	finally
	{
		DB.close(rs, pstmt);
		rs = null;
		pstmt = null;
	}
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:74,代码来源:MRPInfoWindowAttribs.java


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