List of usage examples for com.mongodb.gridfs GridFSFile getMD5
@Deprecated
public String getMD5()
From source file:org.craftercms.commons.mongo.FileInfo.java
License:Open Source License
FileInfo(final GridFSFile savedFile, final boolean withInputStream) { this.md5 = savedFile.getMD5(); this.fileId = (ObjectId) savedFile.getId(); this.contentType = savedFile.getContentType(); this.fileSize = FileUtils.readableFileSize(savedFile.getLength()); this.storeName = savedFile.getFilename(); this.savedDate = savedFile.getUploadDate(); this.fileSizeBytes = savedFile.getLength(); if (withInputStream && savedFile instanceof GridFSDBFile) { this.inputStream = ((GridFSDBFile) savedFile).getInputStream(); }/*from ww w.j a va2 s . c o m*/ attributes = new HashMap<>(); }
From source file:org.eclipse.hawkbit.artifact.repository.ArtifactStore.java
License:Open Source License
/** * Maps a single {@link GridFSFile} to {@link DbArtifact}. * * @param tenant/*from w w w . j ava2s. c o m*/ * the tenant * @param dbFile * the mongoDB gridFs file. * @return a mapped artifact from the given dbFile */ private static GridFsArtifact map(final GridFSFile fsFile) { if (fsFile == null) { return null; } final GridFsArtifact artifact = new GridFsArtifact(fsFile); artifact.setArtifactId(fsFile.getId().toString()); artifact.setSize(fsFile.getLength()); artifact.setContentType(fsFile.getContentType()); artifact.setHashes(new DbArtifactHash(fsFile.getFilename(), fsFile.getMD5())); return artifact; }