Package com.vst.model

Examples of com.vst.model.Material


        request = newGet("/editMaterial.html");
        request.addParameter("materialId", "1");

        mv = c.handleRequest(request, new MockHttpServletResponse());

        Material material = (Material) mv.getModel().get(c.getCommandName());
        assertNotNull(material);
        request = newPost("/editMaterial.html");
        super.objectToRequestParameters(material, request);

        // update the form's fields and add it back to the request
View Full Code Here


    protected Object formBackingObject(HttpServletRequest request)
            throws Exception {
        if (!isFormSubmission(request)) {
            String materialId = request.getParameter("materialId");
            Material material = null;

            if (!StringUtils.isEmpty(materialId)) {
                material = materialManager.getMaterial(materialId);
                materialManager.evict(material);
            } else {
                material = new Material();
            }
            if (request.getParameter("edited") != null) {
                request.setAttribute("addition", "?edited=1");
                material.setEdited(true);
            }
            material.setDocLocation(request.getParameter("docLocation"));

            return material;
        }
        return super.formBackingObject(request);
    }
View Full Code Here

            throws Exception {
        if (log.isDebugEnabled()) {
            log.debug("entering 'onSubmit' method...");
        }

        Material material = (Material) command;
        boolean isNew = (material.getMaterialId() == null);
        Locale locale = request.getLocale();

        if (request.getParameter("delete") != null) {
            materialManager.removeMaterial(material.getMaterialId().toString());

            saveMessage(request, getText("material.deleted", locale));
        } else {
            materialManager.saveMaterial(material);

            String key = (isNew) ? "material.added" : "material.updated";
            saveMessage(request, getText(key, locale));
            if (material.isEdited()) {
                return new ModelAndView("redirect:updating.html?id=" + material.getMaterialId() + "&fieldId=" + request.getParameter("fieldId"));
            }
        }

        return new ModelAndView("redirect:" + material.getDocLocation());
    }
View Full Code Here

            if (hasFatalError) {
                request.setAttribute("errormessage", bundle.getString("commonMistake"));
            }
        }

        Material material = new Material();
        // populate object with request parameters
        BeanUtils.populate(material, request.getParameterMap());

        List materials = materialManager.getMaterials(material);
View Full Code Here

            defectType.setVarities(defectVarities);

            List defectMaterials = new ArrayList();
            List defectMaterialsFromForm = defectType.getMaterials();
            for (int i = 0; i < defectMaterialsFromForm.size(); i++) {
                Material defectMaterial = (Material) defectMaterialsFromForm.get(i);
                defectTypeManager.evict(defectMaterial);
                defectMaterials.add(materialManager.getMaterial(defectMaterial.getMaterialId().toString()));

            }
            defectType.setMaterials(defectMaterials);

            defectTypeManager.saveDefectType(defectType);
View Full Code Here

                                              Object command,
                                              BindException errors)
            throws Exception {
        DefectType defectType = (DefectType) command;
        if (request.getParameter("addMaterial") != null) {
            defectType.getMaterials().add(new Material());
            return new ModelAndView("defectTypeForm", "defectType", defectType);
        }
        if (request.getParameter("deleteMaterial") != null) {
            defectType.getMaterials().remove(defectType.getMaterialNumber());
            return new ModelAndView("defectTypeForm", "defectType", defectType);
View Full Code Here

    public void setMaterialDao(MaterialDao dao) {
        this.dao = dao;
    }

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

        // set required fields

        dao.saveMaterial(material);

        // verify a primary key was assigned
        assertNotNull(material.getMaterialId());

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

        // verify set fields are same after save
    }

    public void testGetMaterial() throws Exception {
        Material material = dao.getMaterial(materialId);
        assertNotNull(material);
    }
View Full Code Here

        Material material = dao.getMaterial(materialId);
        assertNotNull(material);
    }

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

        List results = dao.getMaterials(material);
        assertTrue(results.size() > 0);
    }
View Full Code Here

        List results = dao.getMaterials(material);
        assertTrue(results.size() > 0);
    }

    public void testSaveMaterial() throws Exception {
        Material material = dao.getMaterial(materialId);

        // update required fields

        dao.saveMaterial(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.