Java Code Examples for net.sf.jasperreports.engine.JRParameter#getValueClassName()

The following examples show how to use net.sf.jasperreports.engine.JRParameter#getValueClassName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JRBaseParameter.java    From jasperreports with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 *
 */
protected JRBaseParameter(JRParameter parameter, JRBaseObjectFactory factory)
{
	factory.put(parameter, this);
	
	name = parameter.getName();
	description = parameter.getDescription();
	valueClassName = parameter.getValueClassName();
	nestedTypeName = parameter.getNestedTypeName();
	isSystemDefined = parameter.isSystemDefined();
	isForPrompting = parameter.isForPrompting();
	evaluationTime = parameter.getEvaluationTime();

	defaultValueExpression = factory.getExpression(parameter.getDefaultValueExpression());
	
	propertiesMap = parameter.getPropertiesMap().cloneProperties();
}
 
Example 2
Source File: JRVerifier.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 *
 */
private void verifyParameters(JRDesignDataset dataset)
{
	JRParameter[] parameters = dataset.getParameters();
	if (parameters != null && parameters.length > 0)
	{
		for(int index = 0; index < parameters.length; index++)
		{
			JRParameter parameter = parameters[index];

			Object errorSource = parameter;
			if (parameter.isSystemDefined())
			{
				errorSource = jasperDesign;
			}

			if (parameter.getName() == null || parameter.getName().trim().length() == 0)
			{
				addBrokenRule("Parameter name missing.", errorSource);
			}

			if (parameter.getValueClassName() == null)
			{
				addBrokenRule("Class not set for parameter : " + parameter.getName(), errorSource);
			}
		}
	}
}
 
Example 3
Source File: JRVerifier.java    From jasperreports with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 *
 */
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 :
					{
					}
				}
			}
		}
	}
}