1
NodeRefからFileオブジェクトを返す簡単な方法はありますか?私はノードを一時ファイルに変換していますが、動作しますが、実用的ではないようです。ここに私のコードです:AlfrescoのNodeRefからjava.io.Fileオブジェクトを返します
public File getTempCopyAsFile() throws IOException{
File tempFile = TempFileProvider.createTempFile("temp_"+this.getDocName(), this.getDocExtension());
try (InputStream is = this.getReader().getContentInputStream()){
FileUtils.copyInputStreamToFile(is, tempFile);
}
return tempFile;
}
public ContentReader getReader() {
return contentService.getReader(nodeRef, ContentModel.PROP_CONTENT);
}
public String getName() {
return (String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
}
public String getDocExtension() {
return "." + FilenameUtils.getExtension(this.getName());
}
public String getDocName() {
return FilenameUtils.removeExtension(this.getName());
}
これは私がやっていることです。 – newzad
いいえ、そうではありません。あなたは入力ストリームを使いこなしています。Alfrescoにストリームを直接あなたに送ることができます。 – Gagravarr