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


Java RepositoryUtil类代码示例

本文整理汇总了Java中net.sf.jasperreports.repo.RepositoryUtil的典型用法代码示例。如果您正苦于以下问题:Java RepositoryUtil类的具体用法?Java RepositoryUtil怎么用?Java RepositoryUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getContributors

import net.sf.jasperreports.repo.RepositoryUtil; //导入依赖的package包/类
@Override
public List<ParameterContributor> getContributors(ParameterContributorContext context) throws JRException
{
	List<ParameterContributor> contributors = new ArrayList<ParameterContributor>();

	String dataAdapterUri = JRPropertiesUtil.getInstance(context.getJasperReportsContext()).getProperty(context.getDataset(), PROPERTY_DATA_ADAPTER_LOCATION); 
	if (dataAdapterUri != null)
	{
		DataAdapterResource dataAdapterResource = RepositoryUtil.getInstance(context.getJasperReportsContext()).getResourceFromLocation(dataAdapterUri, DataAdapterResource.class);
		ParameterContributor dataAdapterService = DataAdapterServiceUtil.getInstance(context).getService(dataAdapterResource.getDataAdapter());
		
		return Collections.singletonList(dataAdapterService);
	}

	return contributors;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:17,代码来源:DataAdapterParameterContributorFactory.java

示例2: parseJson

import net.sf.jasperreports.repo.RepositoryUtil; //导入依赖的package包/类
public static JsonNode parseJson(JasperReportsContext jasperReportsContext, String location) throws JRException {
	RepositoryUtil repository = RepositoryUtil.getInstance(jasperReportsContext);
	InputStream stream = repository.getInputStreamFromLocation(location);
	try {
		return parseJson(stream);
	} finally {
		if (stream != null) {
			try {
				stream.close();
			} catch (IOException e) {
				if (log.isWarnEnabled()) {
					log.warn("Failed to close input stream for location " + location, e);
				}
			}
		}			
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:18,代码来源:JsonUtil.java

示例3: getImageData

import net.sf.jasperreports.repo.RepositoryUtil; //导入依赖的package包/类
@Override
public byte[] getImageData(JasperReportsContext jasperReportsContext)
		throws JRException
{
	if (imageData == null)
	{
		imageData = RepositoryUtil.getInstance(jasperReportsContext).getBytesFromLocation(imageLocation);
		
		if(imageData != null) 
		{
			imageTypeValue = JRTypeSniffer.getImageTypeValue(imageData);
		}
	}

	return imageData;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:17,代码来源:JRImageRenderer.java

示例4: getNonLazyRenderable

import net.sf.jasperreports.repo.RepositoryUtil; //导入依赖的package包/类
/**
 *
 */
public Renderable getNonLazyRenderable(String resourceLocation, OnErrorTypeEnum onErrorType) throws JRException
{
	byte[] data;

	try
	{
		data = RepositoryUtil.getInstance(jasperReportsContext).getBytesFromLocation(resourceLocation);
	}
	catch (Exception e)
	{
		if (log.isDebugEnabled())
		{
			log.debug("handled image error with type " + onErrorType + " for location " + resourceLocation, e);
		}
		
		return handleImageError(e, onErrorType); 
	}
	
	return SimpleDataRenderer.getInstance(data);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:24,代码来源:RendererUtil.java

示例5: getFromJasper

import net.sf.jasperreports.repo.RepositoryUtil; //导入依赖的package包/类
private JRBaseReport getFromJasper(String path) {
	InputStream in = null;
	JRBaseReport jd = null;
	try {
		in = RepositoryUtil.getInstance(dto.getjConfig()).getInputStreamFromLocation(path);
		if (in != null) {
			Object obj = JRLoader.loadObject(in);
			if (obj instanceof JasperReport)
				jd = (JasperReport) obj;
		}
	} catch (Exception e) {
		// e.printStackTrace();
	} finally {
		FileUtils.closeStream(in);
	}
	return jd;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:18,代码来源:RVPropertyPage.java

示例6: getFromJRXML

import net.sf.jasperreports.repo.RepositoryUtil; //导入依赖的package包/类
private JRBaseReport getFromJRXML(String path) {
	InputStream in = null;
	JRBaseReport jd = null;
	try {
		in = RepositoryUtil.getInstance(dto.getjConfig()).getInputStreamFromLocation(path);
		if (in != null) {
			InputSource is = new InputSource(new InputStreamReader(in, "UTF-8"));
			jd = new JRXmlLoader(dto.getjConfig(), JasperReportsConfiguration.getJRXMLDigester()).loadXML(is);
		}
	} catch (Exception e) {
		// e.printStackTrace();
	} finally {
		FileUtils.closeStream(in);
	}
	return jd;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:17,代码来源:RVPropertyPage.java

示例7: validate

import net.sf.jasperreports.repo.RepositoryUtil; //导入依赖的package包/类
public IStatus validate(Object value) {
	IStatus s = Status.OK_STATUS;
	if (value != null && !((String) value).isEmpty()) {
		File f = new File((String) value);
		if (!f.exists() || !f.isFile()) {
			if (jrContext != null) {
				InputStream is = null;
				try {
					System.out.println(jrContext);
					is = RepositoryUtil.getInstance(jrContext).getInputStreamFromLocation((String) value);
					if (is == null)
						s = ERROR_STATUS;
				} catch (Exception e) {
					s = ERROR_STATUS;
				} finally {
					FileUtils.closeStream(is);
				}
			} else
				s = ERROR_STATUS;
		}
	}
	return s;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:24,代码来源:NotEmptyFileValidator.java

示例8: getImage

import net.sf.jasperreports.repo.RepositoryUtil; //导入依赖的package包/类
@Override
public Image getImage(JasperReportsContext jasperReportsContext)
{
	try
	{
		return
			JRImageLoader.getInstance(jasperReportsContext).loadAwtImageFromBytes(
				RepositoryUtil.getInstance(jasperReportsContext).getBytesFromLocation(file)
				);
	}
	catch (JRException e)
	{
		throw new JRRuntimeException(e);
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:16,代码来源:FileImageProvider.java

示例9: getRenderable

import net.sf.jasperreports.repo.RepositoryUtil; //导入依赖的package包/类
/**
 * @deprecated Replaced by {@link ResourceRenderer#getInstance(String, boolean)} and {@link RendererUtil#getNonLazyRenderable(String, OnErrorTypeEnum)}.
 */
public Renderable getRenderable(String imageLocation, OnErrorTypeEnum onErrorType, boolean isLazy) throws JRException
{
	if (imageLocation == null)
	{
		return null;
	}

	if (isLazy)
	{
		return new JRImageRenderer(imageLocation);
	}

	Renderable result;
	try
	{
		byte[] data = RepositoryUtil.getInstance(jasperReportsContext).getBytesFromLocation(imageLocation);
		result = new JRImageRenderer(data);
	}
	catch (Exception e)
	{
		result = handleImageError(e, onErrorType);
		
		if (log.isDebugEnabled())
		{
			log.debug("handled image error with type " + onErrorType + " for location " + imageLocation, e);
		}
	}
	return result;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:33,代码来源:RenderableUtil.java

示例10: JRCsvDataSource

import net.sf.jasperreports.repo.RepositoryUtil; //导入依赖的package包/类
/**
 * Creates a datasource instance that reads CSV data from a given location, using the default encoding.
 * @param jasperReportsContext the JasperReportsContext
 * @param location a String representing CSV data source
 */
public JRCsvDataSource(JasperReportsContext jasperReportsContext, String location) throws JRException
{
	this(RepositoryUtil.getInstance(jasperReportsContext).getInputStreamFromLocation(location));
	
	toClose = true;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:12,代码来源:JRCsvDataSource.java

示例11: JRXmlDataSource

import net.sf.jasperreports.repo.RepositoryUtil; //导入依赖的package包/类
public JRXmlDataSource(
		JasperReportsContext jasperReportsContext, 
		String uri, 
		String selectExpression,
		boolean isNamespaceAware
		) throws JRException 
{
	this(
		jasperReportsContext, 
		RepositoryUtil.getInstance(jasperReportsContext).getInputStreamFromLocation(uri), 
		selectExpression,
		isNamespaceAware
		);
	this.closeInputStream = true;//FIXME close the stream immediately
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:16,代码来源:JRXmlDataSource.java

示例12: ensureData

import net.sf.jasperreports.repo.RepositoryUtil; //导入依赖的package包/类
protected synchronized void ensureData(JasperReportsContext jasperReportsContext) throws JRException
{
	if (svgText == null
			&& svgData == null && svgDataLocation != null)
	{
		svgData = RepositoryUtil.getInstance(jasperReportsContext).getBytesFromLocation(svgDataLocation);
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:9,代码来源:BatikRenderer.java

示例13: readSwf

import net.sf.jasperreports.repo.RepositoryUtil; //导入依赖的package包/类
protected byte[] readSwf() throws JRException
{
	return RepositoryUtil.getInstance(DefaultJasperReportsContext.getInstance()).getBytesFromLocation("openflashchart/open-flash-chart.swf");
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:5,代码来源:ChartPdfHandler.java

示例14: contributeParameters

import net.sf.jasperreports.repo.RepositoryUtil; //导入依赖的package包/类
@Override
public void contributeParameters(Map<String, Object> parameters) throws JRException 
{
	RemoteXmlDataAdapter remoteXmlDataAdapter = getRemoteXmlDataAdapter();
	if (remoteXmlDataAdapter != null)
	{
		if (remoteXmlDataAdapter.isUseConnection()) 
		{
			String fileName = remoteXmlDataAdapter.getFileName();
			if (fileName.toLowerCase().startsWith("https://") ||
				fileName.toLowerCase().startsWith("http://") ||
				fileName.toLowerCase().startsWith("file:")) {
				
				// JRXPathQueryExecuterFactory.XML_URL not available.
				// Once this is available, remove XML_URL from this class.
				parameters.put(XML_URL, fileName);
			}
			else 
			{
				InputStream dataStream = RepositoryUtil.getInstance(getJasperReportsContext()).getInputStreamFromLocation(remoteXmlDataAdapter.getFileName());
				try
				{
					Document document = JRXmlUtils.parse(dataStream, remoteXmlDataAdapter.isNamespaceAware());
					parameters.put(JRXPathQueryExecuterFactory.PARAMETER_XML_DATA_DOCUMENT, document);
				}
				finally
				{
					try
					{
						dataStream.close();
					}
					catch (IOException e)
					{
						log.warn("Failed to close input stream for " + remoteXmlDataAdapter.getFileName());
					}
				}
			}
			
			Locale locale = remoteXmlDataAdapter.getLocale();
			if (locale != null) {
				parameters.put(JRXPathQueryExecuterFactory.XML_LOCALE, locale);
			}

			TimeZone timeZone = remoteXmlDataAdapter.getTimeZone();
			if (timeZone != null) {
				parameters.put(JRXPathQueryExecuterFactory.XML_TIME_ZONE, timeZone);
			}
			
			String datePattern = remoteXmlDataAdapter.getDatePattern();
			if (datePattern != null && datePattern.trim().length()>0) {
				parameters.put(JRXPathQueryExecuterFactory.XML_DATE_PATTERN, datePattern);
			}

			String numberPattern = remoteXmlDataAdapter.getNumberPattern();
			if (numberPattern != null && numberPattern.trim().length()>0) {
				parameters.put(JRXPathQueryExecuterFactory.XML_NUMBER_PATTERN, numberPattern);
			}
		}
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:61,代码来源:RemoteXmlDataAdapterService.java

示例15: RepositoryDataLocationService

import net.sf.jasperreports.repo.RepositoryUtil; //导入依赖的package包/类
public RepositoryDataLocationService(ParameterContributorContext context, RepositoryDataLocation dataLocation)
{
	this.repository = RepositoryUtil.getInstance(context.getJasperReportsContext());
	this.dataLocation = dataLocation;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:6,代码来源:RepositoryDataLocationService.java


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