Package com.vst.model

Examples of com.vst.model.Material


    public boolean isUniqueDefectType(DefectType defectType) {
        List materialList = defectType.getMaterials();
        String joinMaterialQuery = "";
        String conditionMaterialQuery = "";
        for (int i = 0; i < materialList.size(); i++) {
            Material material = (Material) materialList.get(i);
            joinMaterialQuery += " inner join fetch defectType.materials as materials" + i + " ";
            conditionMaterialQuery += " AND materials" + i + ".materialId=" + material.getMaterialId() + " ";
        }

        List varityList = defectType.getVarities();
        String joinVarityQuery = "";
        String conditionVarityQuery = "";
View Full Code Here


           return Material.class.isAssignableFrom(candidate);
       }

       public void validate(Object obj, Errors errors) {

           Material material=(Material)obj;



           //checking if the material is unique
           if(!materialManager.isUniqueMaterial(material)){
View Full Code Here

        materialManager = null;
    }

    public void testGetMaterials() throws Exception {
        List results = new ArrayList();
        Material material = new Material();
        results.add(material);

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

    }

    public void testGetMaterial() throws Exception {
        // set expected behavior on dao
        materialDao.expects(once()).method("getMaterial")
            .will(returnValue(new Material()));
        Material material = materialManager.getMaterial(materialId);
        assertTrue(material != null);
        materialDao.verify();
    }
View Full Code Here

        assertTrue(material != null);
        materialDao.verify();
    }

    public void testSaveMaterial() throws Exception {
        Material material = new Material();

        // set expected behavior on dao
        materialDao.expects(once()).method("saveMaterial")
            .with(same(material)).isVoid();
View Full Code Here

        materialManager.saveMaterial(material);
        materialDao.verify();
    }

    public void testAddAndRemoveMaterial() throws Exception {
        Material material = new Material();

        // set required fields

        // set expected behavior on dao
        materialDao.expects(once()).method("saveMaterial")
            .with(same(material)).isVoid();
        materialManager.saveMaterial(material);
        materialDao.verify();

        // reset expectations
        materialDao.reset();

        materialDao.expects(once()).method("removeMaterial").with(eq(new Long(materialId)));
        materialManager.removeMaterial(materialId);
        materialDao.verify();

        // reset expectations
        materialDao.reset();
        // remove
        Exception ex = new ObjectRetrievalFailureException(Material.class, material.getMaterialId());
        materialDao.expects(once()).method("removeMaterial").isVoid();
        materialDao.expects(once()).method("getMaterial").will(throwException(ex));
        materialManager.removeMaterial(materialId);
        try {
            materialManager.getMaterial(materialId);
View Full Code Here

        DefectType defectType = (DefectType) obj;

        //checking defect materials
        List materialList = defectType.getMaterials();
        for (int i = 0; i < materialList.size(); i++) {
            Material material = (Material) materialList.get(i);
            if (material.getMaterialId().equals(new Long(-1))) {
                errors.rejectValue("materials[" + i + "]", "defectType.noMaterial");
            }
        }

        //checking defect varities
View Full Code Here

              (Integer) cols[0],
              (String) cols[1], new ConstructionType());
          oc.setObjectId((Integer) cols[2]);
//          oc.setConstructionExamples(new ArrayList<ConstructionExample>());
          coMap.put(oc.getTypeId(), oc);
          Material m = new Material();
          m.setMaterialId((Integer) cols[3]);
          m.setMaterialName((String) cols[4]);

          ConstructionType ct = oc.getConstructionType();
          ct.setConstructionTypeId((Integer) cols[5]);
          ct.setName((String) cols[6]);
View Full Code Here

    /**
     * @see com.vst.dao.MaterialDao#getMaterial(Integer materialId)
     */
    public Material getMaterial(final Integer materialId) {
        Material material = (Material) getObject(materialId);
        return material;
    }
View Full Code Here

TOP

Related Classes of com.vst.model.Material

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.