Examples of ObjectPhoto


Examples of com.vst.model.ObjectPhoto

            String objectPhotoId = request.getParameter("id");
            ResourceBundle bundle = ResourceBundle.getBundle("ApplicationResources");
            boolean hasFatalError = false;
            try {
                BuildingObject buildingObject = buildingObjectManager.getBuildingObject(objectId);
                ObjectPhoto objectPhoto = objectPhotoManager.getObjectPhoto(objectPhotoId);
                buildingObject.getPhotoes().remove(objectPhoto);
                objectPhotoManager.removeObjectPhoto(objectPhotoId);
                buildingObjectManager.saveBuildingObject(buildingObject);
                request.setAttribute("message", bundle.getString("objectPhoto.deleted"));


            } catch (Exception e) {
                hasFatalError = true;
            }
            if (hasFatalError) {
                request.setAttribute("errormessage", bundle.getString("commonMistake"));
            }
        }


        List objectPhotos = objectPhotoManager.getObjectPhotos(objectId);

        //retrieving all photoes to the hard drive
        for (int i = 0; i < objectPhotos.size(); i++) {
            ObjectPhoto objectPhoto = (ObjectPhoto) objectPhotos.get(i);
            File file = new File(com.vst.util.FileHelper.getCurrentPath(request) + objectPhoto.getWayToPhoto());
            if (file.exists()) {
                file.delete();
            }
            file.createNewFile();
            FileOutputStream fileOutputStream = new FileOutputStream(FileHelper.getCurrentPath(request) + objectPhoto.getWayToPhoto());
            Blob blob = objectPhoto.getPhotoBlob();
            byte[] bufer = new byte[62000];
            InputStream inputStream = blob.getBinaryStream();
            while (inputStream.read(bufer) != -1) {
                fileOutputStream.write(bufer);
            }
View Full Code Here

Examples of com.vst.model.ObjectPhoto

        }
        BuildingObject buildingObject = (BuildingObject) command;
        //добавляем роазличные критерии для специалиста
        if (request.getParameter("addPhoto") != null || request.getParameter("deletePhoto") != null) {
            if (request.getParameter("addPhoto") != null) {
                buildingObject.getPhotoes().add(new ObjectPhoto());
            }
            if (request.getParameter("deletePhoto") != null) {

                buildingObject.getPhotoes().remove(buildingObject.getPhotoNum());
            }
View Full Code Here

Examples of com.vst.model.ObjectPhoto

    public void setObjectPhotoDao(ObjectPhotoDao dao) {
        this.dao = dao;
    }

    public void testAddObjectPhoto() throws Exception {
        ObjectPhoto objectPhoto = new ObjectPhoto();

        // set required fields

        dao.saveObjectPhoto(objectPhoto);

        // verify a primary key was assigned
        assertNotNull(objectPhoto.getPhotoId());

        // verify set fields are same after save
    }
View Full Code Here

Examples of com.vst.model.ObjectPhoto

        // verify set fields are same after save
    }

    public void testGetObjectPhoto() throws Exception {
        ObjectPhoto objectPhoto = dao.getObjectPhoto(objectPhotoId);
        assertNotNull(objectPhoto);
    }
View Full Code Here

Examples of com.vst.model.ObjectPhoto

    }



    public void testSaveObjectPhoto() throws Exception {
        ObjectPhoto objectPhoto = dao.getObjectPhoto(objectPhotoId);

        // update required fields

        dao.saveObjectPhoto(objectPhoto);
View Full Code Here

Examples of com.vst.model.ObjectPhoto

    /**
     * @see com.vst.dao.ObjectPhotoDao#getObjectPhoto(Integer photoId)
     */
    public ObjectPhoto getObjectPhoto(final Integer photoId) {
        ObjectPhoto objectPhoto = (ObjectPhoto) getObject(photoId);
        return objectPhoto;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.