本文整理了Java中org.nuxeo.common.utils.FileUtils.getResourceFileFromContext()
方法的一些代码示例,展示了FileUtils.getResourceFileFromContext()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.getResourceFileFromContext()
方法的具体详情如下:
包路径:org.nuxeo.common.utils.FileUtils
类名称:FileUtils
方法名:getResourceFileFromContext
暂无
代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-content-template-manager
@Override
public File getFile(String path) {
return FileUtils.getResourceFileFromContext(path);
}
},
代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-thumbnail
protected Blob getDefaultThumbnail(DocumentModel doc) {
if (doc == null) {
return null;
}
TypeInfo docType = doc.getAdapter(TypeInfo.class);
String iconPath = docType.getBigIcon();
if (iconPath == null) {
iconPath = docType.getIcon();
}
if (iconPath == null) {
return null;
}
try {
File iconFile = FileUtils.getResourceFileFromContext("nuxeo.war" + File.separator + iconPath);
if (iconFile.exists()) {
MimetypeRegistry mimetypeRegistry = Framework.getService(MimetypeRegistry.class);
String mimeType = mimetypeRegistry.getMimetypeFromFile(iconFile);
if (mimeType == null) {
mimeType = mimetypeRegistry.getMimetypeFromFilename(iconPath);
}
return Blobs.createBlob(iconFile, mimeType);
}
} catch (IOException e) {
log.warn(String.format("Could not fetch the thumbnail blob from icon path '%s'", iconPath), e);
}
return null;
}
代码示例来源:origin: org.nuxeo.ecm.automation/nuxeo-automation-test
@Override
public void populate(CoreSession session) {
super.populate(session);
DocumentModel doc = session.createDocumentModel("/", "testBlob", "File");
doc.setPropertyValue("file:content", (Serializable) Blobs.createBlob("one"));
session.createDocument(doc);
File docFile = FileUtils.getResourceFileFromContext("hello.doc");
DocumentModel doc2 = session.createDocumentModel("/", "testBlob2", "File");
doc2.setPropertyValue("file:content", new FileBlob(docFile));
session.createDocument(doc2);
TransactionHelper.commitOrRollbackTransaction();
TransactionHelper.startTransaction();
}
}
代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-video-core
@Override
public Blob getThumbnail(DocumentModel doc, CoreSession session) {
if (!doc.hasFacet(VIDEO_FACET)) {
throw new NuxeoException("Document is not a video");
}
// Choose the nuxeo default thumbnail of the picture views (screenshots
// of the video taken during creation)
PictureResourceAdapter picResAdapter = doc.getAdapter(PictureResourceAdapter.class);
Blob thumbnailView = picResAdapter.getPictureFromTitle("Small");
if (thumbnailView == null) {
// try Thumbnail view
thumbnailView = picResAdapter.getPictureFromTitle("Thumbnail");
if (thumbnailView == null) {
TypeInfo docType = doc.getAdapter(TypeInfo.class);
try {
return Blobs.createBlob(FileUtils.getResourceFileFromContext("nuxeo.war" + File.separator
+ docType.getBigIcon()));
} catch (IOException e) {
throw new NuxeoException(e);
}
}
}
return thumbnailView;
}
代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-imaging-core
@Override
public Blob getThumbnail(DocumentModel doc, CoreSession session) {
if (!doc.hasFacet("Picture")) {
throw new NuxeoException("Document is not a picture");
}
// Choose the nuxeo default thumbnail of the picture views if exists
MultiviewPicture mViewPicture = doc.getAdapter(MultiviewPicture.class);
PictureView thumbnailView = mViewPicture.getView("Small");
if (thumbnailView == null || thumbnailView.getBlob() == null) {
// try thumbnail view
thumbnailView = mViewPicture.getView("Thumbnail");
if (thumbnailView == null || thumbnailView.getBlob() == null) {
TypeInfo docType = doc.getAdapter(TypeInfo.class);
try {
return Blobs.createBlob(FileUtils.getResourceFileFromContext("nuxeo.war" + File.separator
+ docType.getBigIcon()));
} catch (IOException e) {
throw new NuxeoException(e);
}
}
}
return thumbnailView.getBlob();
}
内容来源于网络,如有侵权,请联系作者删除!