Package in.partake.model.dao.access

Examples of in.partake.model.dao.access.IUserImageAccess


        return array;
    }

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

        // IMAGE_OWNED_BY_DEFAULT_USER_ID contains DEFAULT_IMAGE_ID.
        dao.put(con, new UserImage(EVENT_FOREIMAGE_ID, EVENT_OWNER_ID, "byte/octet-stream", defaultImageContent, TimeUtil.getCurrentDateTime()));
        dao.put(con, new UserImage(EVENT_BACKIMAGE_ID, EVENT_OWNER_ID, "byte/octet-stream", defaultImageContent, TimeUtil.getCurrentDateTime()));
        dao.put(con, new UserImage(IMAGE_OWNER_IMAGE_ID, IMAGE_OWNER_ID, "byte/octet-stream", defaultImageContent, TimeUtil.getCurrentDateTime()));
        for (int i = 0; i < IMAGE_OWNED_BY_DEFAULT_USER_ID.length; ++i)
            dao.put(con, new UserImage(IMAGE_OWNED_BY_DEFAULT_USER_ID[i], DEFAULT_USER_ID, "byte/octet-stream", defaultImageContent, new DateTime(IMAGE_OWNED_BY_DEFAULT_USER_ID.length - i)));
    }
View Full Code Here


    }

    // TODO: We should not load image in memory here. However, sending image from DB directly will cause
    // another problem, e.g. DoS.
    public List<String> doExecute(PartakeConnection con, IPartakeDAOs daos) throws DAOException, PartakeException {
        IUserImageAccess dao = daos.getImageAccess();

        byte[] foreImageByteArray;
        try {
            foreImageByteArray = Util.getContentOfFile(file);
        } catch (IOException e) {
            throw new PartakeException(ServerErrorCode.ERROR_IO);
        }

        String imageId = dao.getFreshId(con);
        UserImage imageEmbryo = new UserImage(imageId, user.getId(), contentType, foreImageByteArray, TimeUtil.getCurrentDateTime());
        dao.put(con, imageEmbryo);

        if (limit == 1)
            return Collections.singletonList(imageId);
        else
            return dao.findIdsByUserId(con, user.getId(), 0, limit);
    }
View Full Code Here

TOP

Related Classes of in.partake.model.dao.access.IUserImageAccess

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.