Search in sources :

Example 1 with BlobEntry

use of com.pratilipi.data.type.BlobEntry in project pratilipi by Pratilipi.

the class EventDataUtil method getEventBanner.

public static BlobEntry getEventBanner(Long eventId, Integer width) throws UnexpectedServerException {
    String fileName = BANNER_FOLDER + "/" + eventId;
    BlobEntry blobEntry = DataAccessorFactory.getBlobAccessor().getBlob(fileName);
    if (width != null)
        blobEntry.setData(ImageUtil.resize(blobEntry.getData(), width));
    return blobEntry;
}
Also used : BlobEntry(com.pratilipi.data.type.BlobEntry)

Example 2 with BlobEntry

use of com.pratilipi.data.type.BlobEntry in project pratilipi by Pratilipi.

the class AuthorImageApi method post.

@Post
public GenericResponse post(PostRequest request) throws InvalidArgumentException, InsufficientAccessException, UnexpectedServerException {
    BlobEntry blobEntry = DataAccessorFactory.getBlobAccessor().newBlob(request.getName());
    blobEntry.setData(request.getData());
    blobEntry.setMimeType(request.getMimeType());
    blobEntry.setMetaName(request.getName());
    String profileImageUrl = AuthorDataUtil.saveAuthorImage(request.authorId, blobEntry);
    return new Response(profileImageUrl);
}
Also used : GenericFileDownloadResponse(com.pratilipi.api.shared.GenericFileDownloadResponse) GenericResponse(com.pratilipi.api.shared.GenericResponse) BlobEntry(com.pratilipi.data.type.BlobEntry) Post(com.pratilipi.api.annotation.Post)

Example 3 with BlobEntry

use of com.pratilipi.data.type.BlobEntry in project pratilipi by Pratilipi.

the class PratilipiContentImageApi method post.

@Post
public PostResponse post(PostRequest request) throws InvalidArgumentException, InsufficientAccessException, UnexpectedServerException {
    BlobEntry blobEntry = DataAccessorFactory.getBlobAccessor().newBlob(request.getName());
    blobEntry.setData(request.getData());
    blobEntry.setMimeType(request.getMimeType());
    blobEntry.setMetaName(request.getName());
    String imageName = PratilipiDocUtil.saveContentImage(request.pratilipiId, blobEntry);
    return new PostResponse(imageName);
}
Also used : BlobEntry(com.pratilipi.data.type.BlobEntry) Post(com.pratilipi.api.annotation.Post)

Example 4 with BlobEntry

use of com.pratilipi.data.type.BlobEntry in project pratilipi by Pratilipi.

the class PratilipiCoverApi method post.

@Post
public PostResponse post(PostRequest request) throws InvalidArgumentException, InsufficientAccessException, UnexpectedServerException {
    BlobEntry blobEntry = DataAccessorFactory.getBlobAccessor().newBlob(request.getName());
    blobEntry.setData(request.getData());
    blobEntry.setMimeType(request.getMimeType());
    blobEntry.setMetaName(request.getName());
    String coverImageUrl = PratilipiDataUtil.savePratilipiCover(request.pratilipiId, blobEntry);
    return new PostResponse(coverImageUrl);
}
Also used : BlobEntry(com.pratilipi.data.type.BlobEntry) Post(com.pratilipi.api.annotation.Post)

Example 5 with BlobEntry

use of com.pratilipi.data.type.BlobEntry in project pratilipi by Pratilipi.

the class EventBannerApi method post.

@Post
public GenericResponse post(PostRequest request) throws InsufficientAccessException, UnexpectedServerException {
    BlobEntry blobEntry = DataAccessorFactory.getBlobAccessor().newBlob(request.getName());
    blobEntry.setData(request.getData());
    blobEntry.setMimeType(request.getMimeType());
    EventDataUtil.saveEventBanner(request.eventId, blobEntry);
    return new GenericResponse();
}
Also used : GenericResponse(com.pratilipi.api.shared.GenericResponse) BlobEntry(com.pratilipi.data.type.BlobEntry) Post(com.pratilipi.api.annotation.Post)

Aggregations

BlobEntry (com.pratilipi.data.type.BlobEntry)30 BlobAccessor (com.pratilipi.data.BlobAccessor)12 DataAccessor (com.pratilipi.data.DataAccessor)8 Pratilipi (com.pratilipi.data.type.Pratilipi)7 GenericResponse (com.pratilipi.api.shared.GenericResponse)6 UnexpectedServerException (com.pratilipi.common.exception.UnexpectedServerException)6 UserPratilipi (com.pratilipi.data.type.UserPratilipi)6 SimpleDateFormat (java.text.SimpleDateFormat)6 JsonObject (com.google.gson.JsonObject)5 Post (com.pratilipi.api.annotation.Post)5 UnsupportedEncodingException (java.io.UnsupportedEncodingException)5 DateFormat (java.text.DateFormat)5 Date (java.util.Date)5 Gson (com.google.gson.Gson)4 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)4 GsonBuilder (com.google.gson.GsonBuilder)3 Get (com.pratilipi.api.annotation.Get)3 InsufficientAccessException (com.pratilipi.common.exception.InsufficientAccessException)3 GenericFileDownloadResponse (com.pratilipi.api.shared.GenericFileDownloadResponse)2