Package at.riemers.zero.base.model

Examples of at.riemers.zero.base.model.ImageMetaInfo


            @RequestParam(value = "x", required = false) Integer x,
            @RequestParam(value = "y", required = false) Integer y,
            HttpSession session, HttpServletRequest request) throws Exception {


        ImageMetaInfo imageInfo = null;

        if (x != null && y != null) {
            try {
                imageInfo = imageInfoDao.findBySource(id, "x=" + x + ",y=" + y);
                if (imageInfo != null) {
                    log.debug("thumb found");
                }
            } catch (HibernateException hex) {
                log.debug("search image", hex);
            }
        }


        if (imageInfo == null) {
            imageInfo = imageInfoDao.findById(id);
            if (x != null && y != null) {
                ImageResizer resizer = new ImageResizer();
                ImageMetaInfo thumb = new ImageMetaInfo();
                thumb.setFileName("th_" + imageInfo.getFileName());
                long start = System.currentTimeMillis();
                thumb.setImage(new Image());
                thumb.getImage().setImageBuf(resizer.resize2(imageInfo.getImage().getImageBuf(), x, y));
                log.debug("... " + (System.currentTimeMillis() - start) / 1000);
                thumb.setResolution("x=" + x + ",y=" + y);
                thumb.setSource(imageInfo);
                imageInfoDao.makePersistent(thumb);
                imageInfo = thumb;
            }
        }
View Full Code Here


   
    }

    public ImageMetaInfo findBySource(String sourceId, String resolution) {

        ImageMetaInfo source = new ImageMetaInfo();
        source.setId(sourceId);
        Criteria c = createCriteria()
                .add(Restrictions.eq("source", source)).add(Restrictions.eq("resolution", resolution));

        List<ImageMetaInfo> list = c.list();
        if (list.isEmpty()) return null;
View Full Code Here

        deleteSources(entity);
        super.makeTransient(entity);
    }

    public void deleteSources(ImageMetaInfo entity) {
        ImageMetaInfo source = new ImageMetaInfo();
        source.setId(entity.getId());
        List<ImageMetaInfo> list = (List<ImageMetaInfo>) createCriteria()
                .add(Restrictions.eq("source", source)).list();
        for (ImageMetaInfo i : list) {
            if (i != null && i.getId() != null) {
                makeTransient(i);
View Full Code Here

TOP

Related Classes of at.riemers.zero.base.model.ImageMetaInfo

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.