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


Java JRQueryChunk.getType方法代码示例

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


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

示例1: JRBaseQueryChunk

import net.sf.jasperreports.engine.JRQueryChunk; //导入方法依赖的package包/类
/**
 *
 */
protected JRBaseQueryChunk(JRQueryChunk queryChunk, JRBaseObjectFactory factory)
{
	factory.put(queryChunk, this);
	
	type = queryChunk.getType();
	text = queryChunk.getText();
	tokenSeparator = queryChunk.getTokenSeparator();
	
	String[] chunkTokens = queryChunk.getTokens();
	if (chunkTokens == null)
	{
		tokens = null;
	}
	else
	{
		tokens = new String[chunkTokens.length];
		System.arraycopy(chunkTokens, 0, tokens, 0, chunkTokens.length);
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:23,代码来源:JRBaseQueryChunk.java

示例2: appendQueryChunk

import net.sf.jasperreports.engine.JRQueryChunk; //导入方法依赖的package包/类
protected void appendQueryChunk(StringBuffer sbuffer, JRQueryChunk chunk)
{
	switch (chunk.getType())
	{
		case JRQueryChunk.TYPE_PARAMETER_CLAUSE :
		{
			appendParameterClauseChunk(sbuffer, chunk.getText());
			break;
		}
		case JRQueryChunk.TYPE_PARAMETER :
		{
			appendParameterChunk(sbuffer, chunk.getText());
			break;
		}
		case JRQueryChunk.TYPE_CLAUSE_TOKENS :
		{
			appendClauseChunk(sbuffer, chunk.getTokens());
			break;
		}
		case JRQueryChunk.TYPE_TEXT :
		default :
		{
			appendTextChunk(sbuffer, chunk.getText());
			break;
		}
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:28,代码来源:JRAbstractQueryExecuter.java

示例3: parseQuery

import net.sf.jasperreports.engine.JRQueryChunk; //导入方法依赖的package包/类
/**
  *
  */
private void parseQuery() {
    queryString = "";
    parameterNames = new ArrayList();

    if( query != null ) {
        JRQueryChunk[] chunks = query.getChunks();
        if( chunks != null && chunks.length > 0 ) {
            StringBuffer sbuffer = new StringBuffer();
            JRQueryChunk chunk = null;
            for( int i = 0; i < chunks.length; i++ ) {
                chunk = chunks[i];
                switch( chunk.getType() ) {
                case JRQueryChunk.TYPE_PARAMETER_CLAUSE: {
                    String parameterName = chunk.getText();
                    Object parameterValue = parameterValues.get( parameterName );
                    sbuffer.append( String.valueOf( parameterValue ) );
                    // parameterNames.add(parameterName);
                    break;
                }
                case JRQueryChunk.TYPE_PARAMETER: {
                    sbuffer.append( "?" );
                    parameterNames.add( chunk.getText() );
                    break;
                }
                case JRQueryChunk.TYPE_TEXT:
                default: {
                    sbuffer.append( chunk.getText() );
                    break;
                }
                }
            }

            queryString = sbuffer.toString();
        }
    }
}
 
开发者ID:mtpettyp,项目名称:openreports,代码行数:40,代码来源:JRQueryExecuter.java

示例4: asText

import net.sf.jasperreports.engine.JRQueryChunk; //导入方法依赖的package包/类
/**
 * (Re)creates the query text from a list of chunks.
 * 
 * @param chunks the chunks
 * @return the recreated query text
 */
public String asText(JRQueryChunk[] chunks)
{
	String text = "";
	
	if (chunks != null && chunks.length > 0)
	{
		StringBuilder sb = new StringBuilder();

		for(int i = 0; i < chunks.length; i++)
		{
			JRQueryChunk queryChunk = chunks[i];
			switch(queryChunk.getType())
			{
				case JRQueryChunk.TYPE_PARAMETER :
				{
					sb.append("$P{");
					sb.append( queryChunk.getText() );
					sb.append("}");
					break;
				}
				case JRQueryChunk.TYPE_PARAMETER_CLAUSE :
				{
					sb.append("$P!{");
					sb.append( queryChunk.getText() );
					sb.append("}");
					break;
				}
				case JRQueryChunk.TYPE_CLAUSE_TOKENS :
				{
					sb.append("$X{");
					sb.append(queryChunk.getText());
					sb.append("}");
					break;
				}
				case JRQueryChunk.TYPE_TEXT :
				default :
				{
					sb.append( queryChunk.getText() );
					break;
				}
			}
		}

		text = sb.toString();
	}
	
	return text;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:55,代码来源:JRQueryParser.java

示例5: verifyQuery

import net.sf.jasperreports.engine.JRQueryChunk; //导入方法依赖的package包/类
/**
 *
 */
private void verifyQuery(JRDesignDataset dataset)
{
	JRQuery query = dataset.getQuery();
	if (query != null)
	{
		String language = query.getLanguage();
		QueryExecuterFactory queryExecuterFactory = null;
		if (language == null || language.length() == 0)
		{
			addBrokenRule("Query language not set.", query);
		}
		else
		{
			try
			{
				queryExecuterFactory = JRQueryExecuterUtils.getInstance(jasperReportsContext).getExecuterFactory(query.getLanguage());
			}
			catch (JRException e1)
			{
				addBrokenRule("Query executer factory for " + language + " cannot be created.", query);
			}
		}


		JRQueryChunk[] chunks = query.getChunks();
		if (chunks != null && chunks.length > 0)
		{
			Map<String, JRParameter> parametersMap = dataset.getParametersMap();

			for(int j = 0; j < chunks.length; j++)
			{
				JRQueryChunk queryChunk = chunks[j];
				switch (queryChunk.getType())
				{
					case JRQueryChunk.TYPE_PARAMETER :
					{
						JRParameter parameter = parametersMap.get(queryChunk.getText());
						if ( parameter == null )
						{
							addBrokenRule("Query parameter not found : " + queryChunk.getText(), query);
						}
						else if (queryExecuterFactory != null)
						{
							String parameterType = null;
							try
							{
								parameterType = parameter.getValueClassName();
							}
							catch (JRRuntimeException e)
							{
								// ignore, already added when the parameter got verified
							}
							if (parameterType != null && !queryExecuterFactory.supportsQueryParameterType(parameterType))
							{
								addBrokenRule("Parameter type not supported in query : " + queryChunk.getText() + " class " + parameterType, query);
							}
						}

						break;
					}
					case JRQueryChunk.TYPE_PARAMETER_CLAUSE :
					{
						if (!parametersMap.containsKey(queryChunk.getText()))
						{
							addBrokenRule("Query parameter not found : " + queryChunk.getText(), query);
						}
						break;
					}
					case JRQueryChunk.TYPE_TEXT :
					default :
					{
					}
				}
			}
		}
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:81,代码来源:JRVerifier.java

示例6: cascadingDependencies

import net.sf.jasperreports.engine.JRQueryChunk; //导入方法依赖的package包/类
private void cascadingDependencies(ResourceDescriptor ic, Set<String> icNames) {
	List<ResourceDescriptor> children = ic.getChildren();
	for (ResourceDescriptor sub_ic : children) {
		if (!InputControlsManager.isRDQuery(sub_ic))
			continue;
		String queryString = sub_ic.getSql();
		String lang = sub_ic.getResourceProperty(ResourceDescriptor.PROP_QUERY_LANGUAGE).getValue();
		if (!Misc.isNullOrEmpty(queryString)) {
			List<String> parameters = new ArrayList<String>();
			JRDesignQuery query = new JRDesignQuery();
			query.setText(queryString);
			if (lang != null)
				query.setLanguage(lang);
			for (JRQueryChunk chunk : query.getChunks()) {
				switch (chunk.getType()) {
				case JRQueryChunk.TYPE_TEXT:
					break;
				case JRQueryChunk.TYPE_PARAMETER_CLAUSE:
				case JRQueryChunk.TYPE_PARAMETER:
					String paramName = chunk.getText().trim();
					if (!parameters.contains(paramName) && icNames.contains(paramName))
						parameters.add(paramName);
					break;
				case JRQueryChunk.TYPE_CLAUSE_TOKENS:
					String[] tokens = chunk.getTokens();
					if (tokens.length > 2) {
						for (String t : tokens) {
							t = t.trim();
							if (!parameters.contains(t) && icNames.contains(t))
								parameters.add(t);
						}
					}
					break;
				}
			}
			if (!parameters.isEmpty())
				ic.setMasterInputControls(parameters);
		}
		break;
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:42,代码来源:SoapConnection.java


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