Package com.vst.model

Examples of com.vst.model.DefectZone


    /**
     * @see com.vst.dao.DefectZoneDao#getDefectZone(Integer defectZoneId)
     */
    public DefectZone getDefectZone(final Integer defectZoneId) {
        DefectZone defectZone = (DefectZone) getObject(defectZoneId);
        return defectZone;
    }
View Full Code Here


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

        DefectZone defectZone = new DefectZone();
        // populate object with request parameters
        BeanUtils.populate(defectZone, request.getParameterMap());

        List defectZones = defectZoneManager.getDefectZones(defectZone);
View Full Code Here

        request = newGet("/editDefectZone.html");
        request.addParameter("defectZoneId", "1");

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

        DefectZone defectZone = (DefectZone) mv.getModel().get(c.getCommandName());
        assertNotNull(defectZone);
        request = newPost("/editDefectZone.html");
        super.objectToRequestParameters(defectZone, request);

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

            }

            List defectZoneListFromForm = constructionType.getDefectZones();
            List defectZoneListToBase = new ArrayList();
            for (int i = 0; i < defectZoneListFromForm.size(); i++) {
                DefectZone defectZone = (DefectZone) defectZoneListFromForm.get(i);
                Integer defectZoneId = defectZone.getDefectZoneId();
                if (!defectZoneId.equals(new Integer(-1))) {
                    defectZoneListToBase.add(defectZoneManager.getDefectZone(defectZoneId.toString()));
                }

            }
View Full Code Here

                                              Object command,
                                              BindException errors)
            throws Exception {
        ConstructionType constructionType = (ConstructionType) command;
        if (request.getParameter("addDefectZone") != null) {
            constructionType.getDefectZones().add(new DefectZone());
            return new ModelAndView("constructionTypeForm", "constructionType", constructionType);
        }
        if (request.getParameter("deleteDefectZone") != null) {
            constructionType.getDefectZones().remove(constructionType.getDefectZoneNumber());
            return new ModelAndView("constructionTypeForm", "constructionType", constructionType);
View Full Code Here

            throws Exception {
        request.setAttribute("authentificationElementList", authentificationElementManager.getAuthentificationElements(null));

        if (!isFormSubmission(request)) {
            String defectZoneId = request.getParameter("defectZoneId");
            DefectZone defectZone = null;

            if (!StringUtils.isEmpty(defectZoneId)) {
                defectZone = defectZoneManager.getDefectZone(defectZoneId);
                defectZoneManager.evict(defectZone);
            } else {
                defectZone = new DefectZone();
            }
            if (request.getParameter("edited") != null) {
                request.setAttribute("addition", "?edited=1");
                defectZone.setEdited(true);
            }
            defectZone.setDocLocation(request.getParameter("docLocation"));

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

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

        DefectZone defectZone = (DefectZone) command;
        boolean isNew = (defectZone.getDefectZoneId() == null);
        Locale locale = request.getLocale();

        if (request.getParameter("delete") != null) {
            defectZoneManager.removeDefectZone(defectZone.getDefectZoneId().toString());

            saveMessage(request, getText("defectZone.deleted", locale));
        } else {
            List defectZoneAutentifications = new ArrayList();
            List defectZoneAutentificationsFromForm = defectZone.getAuthentificationElements();
            for (int i = 0; i < defectZoneAutentificationsFromForm.size(); i++) {
                AuthentificationElement authentificationElement = (AuthentificationElement) defectZoneAutentificationsFromForm.get(i);


                defectZoneAutentifications.add(authentificationElementManager.getAuthentificationElement(authentificationElement.getAuthentificationId().toString()));
            }

            defectZone.setAuthentificationElements(defectZoneAutentifications);
            defectZoneManager.saveDefectZone(defectZone);

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

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

    public ModelAndView processFormSubmission(HttpServletRequest request,
                                              HttpServletResponse response,
                                              Object command,
                                              BindException errors)
            throws Exception {
        DefectZone defectZone = (DefectZone) command;
        if (request.getParameter("addElement") != null) {
            defectZone.getAuthentificationElements().add(new AuthentificationElement());
            return new ModelAndView("defectZoneForm", "defectZone", defectZone);
        }
        if (request.getParameter("deleteElement") != null) {
            defectZone.getAuthentificationElements().remove(defectZone.getAuthentificationNumber());
            return new ModelAndView("defectZoneForm", "defectZone", defectZone);
        }

        return super.processFormSubmission(request,
                response,
View Full Code Here

    public void setDefectZoneDao(DefectZoneDao dao) {
        this.dao = dao;
    }

    public void testAddDefectZone() throws Exception {
        DefectZone defectZone = new DefectZone();

        // set required fields

        dao.saveDefectZone(defectZone);

        // verify a primary key was assigned
        assertNotNull(defectZone.getDefectZoneId());

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

        // verify set fields are same after save
    }

    public void testGetDefectZone() throws Exception {
        DefectZone defectZone = dao.getDefectZone(defectZoneId);
        assertNotNull(defectZone);
    }
View Full Code Here

TOP

Related Classes of com.vst.model.DefectZone

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.