Package com.vst.model

Examples of com.vst.model.ObjectConstruction


        String objectConstructionId = request.getParameter("objectConstructionId");
        List waysToEskiz = new ArrayList();
        Map wayMap;
        boolean noPhoto = true;
        if (objectConstructionId != null) {
            ObjectConstruction objectConstruction = objectConstructionManager.getObjectConstruction(objectConstructionId);
            List constructionExampleList = objectConstruction.getConstructionExamples();
            for (int i = 0; i < constructionExampleList.size(); i++) {
                ConstructionExample constructionExample = (ConstructionExample) constructionExampleList.get(i);
                if (constructionExample.getWayToDefectEsckiz() != null && !"".equals(constructionExample.getWayToDefectEsckiz()) && constructionExample.getDefectEsckizBlob() != null) {
                    noPhoto = false;
                    File file = new File(FileHelper.getCurrentPath(request) + constructionExample.getWayToDefectEsckiz());
View Full Code Here


    return ObjectConstruction.class.isAssignableFrom(candidate);
  }

  public void validate(Object obj, Errors errors) {

    ObjectConstruction objectConstruction = (ObjectConstruction) obj;

    // checking if the ibject type is correct
    if (objectConstruction.getConstructionType().getConstructionTypeId()
        .equals(-1)) {
      errors.rejectValue("constructionType.constructionTypeId",
          "objectConstruction.noConstructionType");
    }
View Full Code Here

        objectConstructionManager = null;
    }

    public void testGetObjectConstructions() throws Exception {
        List results = new ArrayList();
        ObjectConstruction objectConstruction = new ObjectConstruction();
        results.add(objectConstruction);

        // set expected behavior on dao
        objectConstructionDao.expects(once()).method("getObjectConstructions")
            .will(returnValue(results));
View Full Code Here

    }

    public void testGetObjectConstruction() throws Exception {
        // set expected behavior on dao
        objectConstructionDao.expects(once()).method("getObjectConstruction")
            .will(returnValue(new ObjectConstruction()));
        ObjectConstruction objectConstruction = objectConstructionManager.getObjectConstruction(objectConstructionId);
        assertTrue(objectConstruction != null);
        objectConstructionDao.verify();
    }
View Full Code Here

        assertTrue(objectConstruction != null);
        objectConstructionDao.verify();
    }

    public void testSaveObjectConstruction() throws Exception {
        ObjectConstruction objectConstruction = new ObjectConstruction();

        // set expected behavior on dao
        objectConstructionDao.expects(once()).method("saveObjectConstruction")
            .with(same(objectConstruction)).isVoid();
View Full Code Here

        objectConstructionManager.saveObjectConstruction(objectConstruction);
        objectConstructionDao.verify();
    }

    public void testAddAndRemoveObjectConstruction() throws Exception {
        ObjectConstruction objectConstruction = new ObjectConstruction();

        // set required fields

        // set expected behavior on dao
        objectConstructionDao.expects(once()).method("saveObjectConstruction")
            .with(same(objectConstruction)).isVoid();
        objectConstructionManager.saveObjectConstruction(objectConstruction);
        objectConstructionDao.verify();

        // reset expectations
        objectConstructionDao.reset();

        objectConstructionDao.expects(once()).method("removeObjectConstruction").with(eq(new Long(objectConstructionId)));
        objectConstructionManager.removeObjectConstruction(objectConstructionId);
        objectConstructionDao.verify();

        // reset expectations
        objectConstructionDao.reset();
        // remove
        Exception ex = new ObjectRetrievalFailureException(ObjectConstruction.class, objectConstruction.getTypeId());
        objectConstructionDao.expects(once()).method("removeObjectConstruction").isVoid();
        objectConstructionDao.expects(once()).method("getObjectConstruction").will(throwException(ex));
        objectConstructionManager.removeObjectConstruction(objectConstructionId);
        try {
            objectConstructionManager.getObjectConstruction(objectConstructionId);
View Full Code Here

    public void setObjectConstructionDao(ObjectConstructionDao dao) {
        this.dao = dao;
    }

    public void testAddObjectConstruction() throws Exception {
        ObjectConstruction objectConstruction = new ObjectConstruction();

        // set required fields

        dao.saveObjectConstruction(objectConstruction);

        // verify a primary key was assigned
        assertNotNull(objectConstruction.getTypeId());

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

        // verify set fields are same after save
    }

    public void testGetObjectConstruction() throws Exception {
        ObjectConstruction objectConstruction = dao.getObjectConstruction(objectConstructionId);
        assertNotNull(objectConstruction);
    }
View Full Code Here

    }



    public void testSaveObjectConstruction() throws Exception {
        ObjectConstruction objectConstruction = dao.getObjectConstruction(objectConstructionId);

        // update required fields

        dao.saveObjectConstruction(objectConstruction);
View Full Code Here

            }

            //checking esciz
            if (constructionExample.getWayToDefectEsckiz() == null || constructionExample.getWayToDefectEsckiz().equals("")) {
                //retrieving esciz from object construction
                ObjectConstruction objectConstruction = objectConstructionManager.getObjectConstruction(constructionExample.getObjectConstructionId().toString());
                //esciz for defects
                if (objectConstruction.getEsckizBlob() != null && objectConstruction.getWayToEsckiz() != null && !objectConstruction.getWayToEsckiz().equals("")) {
                    String wayToDefectEskiz = ImageUtil.getUniqueJPEGFile(request);
                    constructionExample.setWayToDefectEsckiz(wayToDefectEskiz);
                    objectConstruction.getEsckizBlob();
                    File file = new File(FileHelper.getCurrentPath(request) + wayToDefectEskiz);
                    file.createNewFile();
                    FileOutputStream fileOutputStream = new FileOutputStream(FileHelper.getCurrentPath(request) + wayToDefectEskiz);
                    Blob blob = objectConstruction.getEsckizBlob();
                    byte[] bufer = new byte[62000];
                    InputStream inputStream = blob.getBinaryStream();
                    while (inputStream.read(bufer) != -1) {
                        fileOutputStream.write(bufer);
                    }
                    inputStream.close();
                    fileOutputStream.close();

                    //esciz for power points
                    String wayToPowerEskiz = ImageUtil.getUniqueJPEGFile(request);
                    constructionExample.setWayToPowerEsckiz(wayToPowerEskiz);
                    objectConstruction.getEsckizBlob();
                    file = new File(FileHelper.getCurrentPath(request) + wayToPowerEskiz);
                    if (file.exists()) {
                        file.delete();
                    }
                    file.createNewFile();
                    fileOutputStream = new FileOutputStream(FileHelper.getCurrentPath(request) + wayToPowerEskiz);
                    blob = objectConstruction.getEsckizBlob();
                    byte[] powerBufer = new byte[62000];
                    inputStream = blob.getBinaryStream();
                    while (inputStream.read(powerBufer) != -1) {
                        fileOutputStream.write(powerBufer);
                    }
View Full Code Here

TOP

Related Classes of com.vst.model.ObjectConstruction

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.