Package in.partake.model.dto

Examples of in.partake.model.dto.UserThumbnail


    }

    @Override
    public UserThumbnail create(long pkNumber, String pkSalt, int objNumber) {
        UUID id = new UUID(pkNumber, pkSalt.hashCode());
        return new UserThumbnail(id.toString(), "userId", "image/png", new byte[] { 0, 1, (byte) objNumber } , new DateTime(0L));
    }
View Full Code Here


    }

    @Override
    public List<UserThumbnail> createSamples() {
        List<UserThumbnail> array = new ArrayList<UserThumbnail>();
        array.add(new UserThumbnail("id", "userId", "image/png", new byte[] { 0, 1, 2 }, new DateTime(0L)));
        array.add(new UserThumbnail("id1", "userId", "image/png", new byte[] { 0, 1, 2 }, new DateTime(0L)));
        array.add(new UserThumbnail("id", "userId1", "image/png", new byte[] { 0, 1, 2 }, new DateTime(0L)));
        array.add(new UserThumbnail("id", "userId", "image/jpeg", new byte[] { 0, 1, 2 }, new DateTime(0L)));
        array.add(new UserThumbnail("id", "userId", "image/png", new byte[] { 0, 1, 3 }, new DateTime(0L)));
        array.add(new UserThumbnail("id", "userId", "image/png", new byte[] { 0, 1, 2 }, new DateTime(1L)));
        return array;
    }
View Full Code Here

    @Override
    public void createFixtures(PartakeConnection con, IPartakeDAOs daos) throws DAOException {
        IUserThumbnailAccess dao = daos.getThumbnailAccess();
        dao.truncate(con);

        dao.put(con, new UserThumbnail(DEFAULT_IMAGE_ID, DEFAULT_USER_ID, "byte/octet-stream", defaultImageContent, new DateTime(0L)));
    }
View Full Code Here

    }

    public Result doExecute() throws DAOException, PartakeException {
        checkIdParameterIsValid(imageId, UserErrorCode.INVALID_NOTFOUND, UserErrorCode.INVALID_NOTFOUND);

        UserThumbnail data = new ThumbnailAccess(imageId).execute();
        if (data != null)
            return render(data.getData(), data.getType(), "inline");

        // If not found, we will generate a thumbnail.
        UserThumbnail created = new ThumbnailTransaction(imageId).execute();
        if (created != null)
            return render(created.getData(), created.getType(), "inline");

        return renderNotFound();
    }
View Full Code Here

        this.imageId = imageId;
    }

    @Override
    protected UserThumbnail doExecute(PartakeConnection con, IPartakeDAOs daos) throws DAOException, PartakeException {
        UserThumbnail thumbnail = daos.getThumbnailAccess().find(con, imageId);
        if (thumbnail != null)
            return thumbnail;

        return null;
    }
View Full Code Here

            ByteArrayOutputStream os = new ByteArrayOutputStream();
            ImageIO.write(converted, "png", os);
            os.close();

            UserThumbnail thumbnail = new UserThumbnail(image.getId(), image.getUserId(), "image/png", os.toByteArray(), TimeUtil.getCurrentDateTime());
            daos.getThumbnailAccess().put(con, thumbnail);

            return thumbnail;
        } catch (IOException e) {
            throw new PartakeException(ServerErrorCode.ERROR_IO);
View Full Code Here

        } catch (JsonMappingException e) {
            throw new IllegalArgumentException(e);
        } catch (IOException e) {
            throw new DAOException(e);
        }
        UserThumbnail thumbnailData = new UserThumbnail(obj);
        thumbnailData.setData(entity.getOpt());

        return thumbnailData.freeze();
    }
View Full Code Here

TOP

Related Classes of in.partake.model.dto.UserThumbnail

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.