Example usage for org.springframework.data.mongodb.gridfs GridFsResource getId

List of usage examples for org.springframework.data.mongodb.gridfs GridFsResource getId

Introduction

In this page you can find the example usage for org.springframework.data.mongodb.gridfs GridFsResource getId.

Prototype

public Object getId() 

Source Link

Document

Returns the Resource 's id.

Usage

From source file:piecework.util.ContentUtility.java

public static ContentResource toContent(GridFsResource resource) throws IOException {
    String resourceId = resource.getId().toString();

    return new BasicContentResource.Builder().contentId(resourceId).contentType(resource.getContentType())
            .filename(resource.getFilename()).location(resource.getFilename())
            .inputStream(resource.getInputStream()).lastModified(resource.lastModified())
            .length(Long.valueOf(resource.contentLength())).build();
}