protected String getSuffix( final String filename ) { final String suffix = IOUtils.getInstance().getFileExtension( filename ); if ( suffix.length() == 0 ) { return ""; //$NON-NLS-1$ } return suffix.substring( 1 ); } }
@Override protected void execute() throws Exception { FileObject targetDirectory = targetFile.getParent(); FileObjectRepository targetRepository = new FileObjectRepository( targetDirectory ); targetRoot = targetRepository.getRoot(); suffix = getSuffix( targetPath ); Path p = Paths.get( targetFile.getName().getPath() ); filename = IOUtils.getInstance().stripFileExtension( p.getFileName().toString() ); ReportProcessor reportProcessor = createReportProcessor( null ); try { reportProcessor.processReport(); } finally { reportProcessor.close(); } }
@Override protected void execute() throws Exception { FileObject targetDirectory = targetFile.getParent(); FileObjectRepository targetRepository = new FileObjectRepository( targetDirectory ); targetRoot = targetRepository.getRoot(); suffix = getSuffix( targetPath ); filename = IOUtils.getInstance().stripFileExtension( targetFile.getName().toString() ); ReportProcessor reportProcessor = createReportProcessor( null ); try { reportProcessor.processReport(); } finally { reportProcessor.close(); } }
private String getSuffix( final String filename ) { final String suffix = IOUtils.getInstance().getFileExtension( filename ); if ( suffix.length() == 0 ) { return ""; //$NON-NLS-1$ } return suffix.substring( 1 ); }
private String getSuffix( final String filename ) { final String suffix = IOUtils.getInstance().getFileExtension( filename ); if ( suffix.length() == 0 ) { return ""; //$NON-NLS-1$ } return suffix.substring( 1 ); }
private static String getSuffix( final String filename ) { final String suffix = IOUtils.getInstance().getFileExtension( filename ); if ( suffix.length() == 0 ) { return ""; } return suffix.substring( 1 ); }
private String computePath( final BundleWriterState state ) { final String absolutePathWithDummy = IOUtils.getInstance().getAbsolutePath( "dummy", state.getFileName() ); final String absolutePath = absolutePathWithDummy.substring( 0, absolutePathWithDummy.length() - "dummy".length() ); if ( absolutePath.endsWith( "/" ) ) { return absolutePath.substring( 0, absolutePath.length() - 1 ); } return absolutePath; } }
private String extractFilename( final ResourceData resourceData ) { final String filename = (String) resourceData.getAttribute( ResourceData.FILENAME ); if ( filename == null ) { return "image"; } final String pureFileName = IOUtils.getInstance().getFileName( filename ); return IOUtils.getInstance().stripFileExtension( pureFileName ); }
private Object evaluate( final Expression ex ) throws IOException, SQLException { final Object retval = ex.getValue(); if ( retval instanceof Clob ) { return IOUtils.getInstance().readClob( (Clob) retval ); } if ( retval instanceof Blob ) { return IOUtils.getInstance().readBlob( (Blob) retval ); } return retval; } }
private Object evaluate( final Expression ex ) throws IOException, SQLException { final Object retval = ex.getValue(); if ( retval instanceof Clob ) { return IOUtils.getInstance().readClob( (Clob) retval ); } if ( retval instanceof Blob ) { return IOUtils.getInstance().readBlob( (Blob) retval ); } return retval; }
public URLResourceData( final ResourceKey key ) { if ( key == null ) { throw new NullPointerException(); } this.modificationDate = -1; this.key = key; this.url = (URL) key.getIdentifier(); // for the ease of implementation, we take the file name from the URL. // Feel free to add a 'Content-Disposition' parser with all details :) this.filename = IOUtils.getInstance().getFileName( url ); }
public BundleWriterState( final BundleWriterState parent, final AbstractReportDefinition report, final String bundleFileName ) { if ( report == null ) { throw new NullPointerException(); } if ( parent == null ) { throw new NullPointerException(); } if ( bundleFileName == null ) { throw new NullPointerException(); } this.masterReport = parent.masterReport; this.globalBundle = parent.globalBundle; this.bundleWriter = parent.bundleWriter; this.report = report; this.bundleFileName = IOUtils.getInstance().getAbsolutePath( bundleFileName, parent.getFileName() ); }
private String computeStringValue( final Object retval ) throws EvaluationException { if ( retval instanceof Clob ) { try { return IOUtils.getInstance().readClob( (Clob) retval ); } catch ( Exception e ) { return null; } } if ( retval instanceof String ) { return (String) retval; } if ( retval != null ) { return unwrap( retval, new StringBuilder() ).toString(); } return null; }
/** * Queries the mime-type for a given filename. Some repositories store mime-type information along with the content * data, while others might resort to heuristics based on the filename or actual data stored in the item. * * @param filename the content item for which Mime-Data should be queried. * @return the mime-type never null. */ public String getMimeType( final String filename ) { if ( filename == null ) { return defaultMimeType; } final String extension = IOUtils.getInstance().getFileExtension( filename ).toLowerCase(); return configuration.getConfigProperty( SUFFIX_KEY_PREFIX + extension, "application/octet-stream" ); }
public ZipReadContentLocation( ZipReadRepository repository, ZipReadContentLocation parent, ZipEntry zipEntry ) { if ( repository == null ) { throw new NullPointerException(); } if ( parent == null ) { throw new NullPointerException(); } if ( zipEntry == null ) { throw new NullPointerException(); } this.repository = repository; this.parent = parent; this.comment = zipEntry.getComment(); this.size = zipEntry.getSize(); this.time = zipEntry.getTime(); this.entries = new HashMap(); this.entryName = IOUtils.getInstance().getFileName( zipEntry.getName() ); this.name = RepositoryUtilities.buildName( this, "/" ) + '/'; }
public ZipContentLocation( ZipRepository repository, ZipContentLocation parent, ZipEntry zipEntry ) { if ( repository == null ) { throw new NullPointerException(); } if ( parent == null ) { throw new NullPointerException(); } if ( zipEntry == null ) { throw new NullPointerException(); } this.repository = repository; this.parent = parent; this.entryName = IOUtils.getInstance().getFileName( zipEntry.getName() ); this.comment = zipEntry.getComment(); this.size = zipEntry.getSize(); this.time = zipEntry.getTime(); this.entries = new HashMap(); this.name = RepositoryUtilities.buildName( this, "/" ) + '/'; }
public void writeContent( final ZipEntry entry, final InputStream in, final int method, final int compression ) throws IOException { zipOutputStream.setMethod( method ); zipOutputStream.setLevel( compression ); zipOutputStream.putNextEntry( entry ); IOUtils.getInstance().copyStreams( in, zipOutputStream ); zipOutputStream.closeEntry(); } }
/** * Copies the given reader to the character stream. This method should be used for large chunks of data. * * @param reader the reader providing the text. * @throws IOException if there is a problem writing to the character stream. */ public void writeStream( final Reader reader ) throws IOException { IOUtils.getInstance().copyWriter( reader, writer ); support.setLineEmpty( false ); }
/** * Queries the mime-type for a given content-item. Some repositories store mime-type information along with the * content data, while others might resort to heuristics based on the filename or actual data stored in the item. * * @param item the content item for which Mime-Data should be queried. * @return the mime-type never null. */ public String getMimeType( final ContentItem item ) { final String name = item.getName(); if ( name == null ) { return defaultMimeType; } final String extension = IOUtils.getInstance().getFileExtension( name ).toLowerCase(); return configuration.getConfigProperty( SUFFIX_KEY_PREFIX + extension, "application/octet-stream" ); }
protected void run( final File file, final File gold, final ReportProcessingMode mode ) throws Exception { final MasterReport originalReport = parseReport( file ); final MasterReport tunedReport = tuneForTesting( originalReport ); MasterReport report = postProcess( tunedReport, file ); if ( mode == ReportProcessingMode.legacy ) { report = tuneForLegacyMode( report ); } else if ( mode == ReportProcessingMode.migration ) { report = tuneForMigrationMode( report ); } else { report = tuneForCurrentMode( report ); } final String fileName = IOUtils.getInstance().stripFileExtension( file.getName() ); handleXmlContent( executePageable( report ), new File( gold, fileName + "-page.xml" ) ); handleXmlContent( executeTableStream( report ), new File( gold, fileName + "-table-stream.xml" ) ); handleXmlContent( executeTableFlow( report ), new File( gold, fileName + "-table-flow.xml" ) ); handleXmlContent( executeTablePage( report ), new File( gold, fileName + "-table-page.xml" ) ); }