Package com.vst.model

Examples of com.vst.model.ConstructionType


    private void prepareConstructionTypesForView(HttpServletRequest request, HttpServletResponse response){
      List constructionTypes = constructionTypeManager.getConstructionTypes(null);
        List constructionTypeDTOList = new ArrayList();
        for (int i = 0; i < constructionTypes.size(); i++) {
            ConstructionType constructionType = (ConstructionType) constructionTypes.get(i);
            ConstructionTypeDTO constructionTypeDTO = new ConstructionTypeDTO(constructionType);
            constructionTypeDTOList.add(constructionTypeDTO);
            List defectZoneList = constructionType.getDefectZones();
            List defectZoneDTOList = new ArrayList();
            for (int j = 0; j < defectZoneList.size(); j++) {
                DefectZoneDTO defectZoneDTO = new DefectZoneDTO((DefectZone) defectZoneList.get(j));
                defectZoneDTOList.add(defectZoneDTO);
                List defectCategoryDTOList = new ArrayList();
View Full Code Here


        request = newGet("/editConstructionType.html");
        request.addParameter("constructionTypeId", "1");

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

        ConstructionType constructionType = (ConstructionType) mv.getModel().get(c.getCommandName());
        assertNotNull(constructionType);
        request = newPost("/editConstructionType.html");
        super.objectToRequestParameters(constructionType, request);

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

            return new ModelAndView("defectTypeForm", "defectType", defectType);
        }


        if (request.getParameter("addConstructionType") != null) {
            defectType.getConstructionTypes().add(new ConstructionType());
            return new ModelAndView("defectTypeForm", "defectType", defectType);
        }
        if (request.getParameter("deleteConstructionType") != null) {
            defectType.getConstructionTypes().remove(defectType.getConstructionTypeNumber());
            return new ModelAndView("defectTypeForm", "defectType", defectType);
View Full Code Here

            throws Exception {
        request.setAttribute("materialList", materialManager.getMaterials(null));
        request.setAttribute("defectZoneList", defectZoneManager.getDefectZones(null));
        if (!isFormSubmission(request)) {
            String constructionTypeId = request.getParameter("constructionTypeId");
            ConstructionType constructionType = null;
            if (!StringUtils.isEmpty(constructionTypeId)) {
                constructionType = constructionTypeManager.getConstructionType(constructionTypeId);
                constructionTypeManager.evict(constructionType);
            } else {
                constructionType = new ConstructionType();
            }
            if (request.getParameter("edited") != null) {
                request.setAttribute("addition", "?edited=1");
                constructionType.setEdited(true);
            }
            constructionType.setDocLocation(request.getParameter("docLocation"));

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

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

        ConstructionType constructionType = (ConstructionType) command;
        boolean isNew = (constructionType.getConstructionTypeId() == null);
        Locale locale = request.getLocale();

        if (request.getParameter("delete") != null) {
            constructionTypeManager.removeConstructionType(constructionType.getConstructionTypeId().toString());

            saveMessage(request, getText("constructionType.deleted", locale));
        } else {


            Integer materialId = constructionType.getMaterial().getMaterialId();
            if (!materialId.equals(new Integer(-1))) {
                constructionType.setMaterial(materialManager.getMaterial(materialId.toString()));
            }

            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()));
                }

            }
            constructionType.setDefectZones(defectZoneListToBase);

            constructionTypeManager.saveConstructionType(constructionType);

            String key = (isNew) ? "constructionType.added" : "constructionType.updated";
            saveMessage(request, getText(key, locale));

            if (constructionType.isEdited()) {
                return new ModelAndView("redirect:updating.html?id=" + constructionType.getConstructionTypeId() + "&fieldId=" + request.getParameter("fieldId"));
            }
            return new ModelAndView("redirect:" + constructionType.getDocLocation());
        }
        return new ModelAndView("redirect:" + constructionType.getDocLocation());

    }
View Full Code Here

    public ModelAndView processFormSubmission(HttpServletRequest request,
                                              HttpServletResponse response,
                                              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);
        }


        return super.processFormSubmission(request,
View Full Code Here

        .fillExampleNumbers(objectConstructions);
    request.getSession().setAttribute(Constants.OBJECTCONSTRUCTION_LIST,
        objectConstructions);
    commonMav.addObject(Constants.OBJECTCONSTRUCTION_LIST,
        objectConstructions);
    ConstructionType constructionType = new ConstructionType();
    // populate object with request parameters
    BeanUtils.populate(constructionType, request.getParameterMap());
    // BeanUtils.populate(constructionType, request.getParameterMap());
    List constructionTypes = new ArrayList();
    constructionTypes = constructionTypeManager
View Full Code Here

            if (question.getQuestionType().getQuestionTypeId().equals(new Integer(0))) {
                List constructionTypeList = new ArrayList();
                List constructionTypeListFromForm = question.getConstructionTypes();
                for (int i = 0; i < constructionTypeListFromForm.size(); i++) {
                    ConstructionType constructionType = (ConstructionType) constructionTypeListFromForm.get(i);
                    constructionTypeList.add(constructionTypeManager.getConstructionType(constructionType.getConstructionTypeId().toString()));
                }
                question.setConstructionTypes(constructionTypeList);
            }

View Full Code Here

                                              BindException errors)
            throws Exception {
        Question question = (Question) command;
        //System.out.println("QuestiontypeId=="+question.getQuestionTypeId());
        if (request.getParameter("addConstructionType") != null) {
            question.getConstructionTypes().add(new ConstructionType());
            return new ModelAndView("questionForm", "question", question);
        }
        if (request.getParameter("deleteConstructionType") != null) {
            question.getConstructionTypes().remove(question.getConstructionNumber());
            return new ModelAndView("questionForm", "question", question);
View Full Code Here

    }

    private List<?> prepareConstructionTypeListForView(HttpServletRequest request,
            HttpServletResponse response) throws IllegalAccessException, InvocationTargetException{
     
      ConstructionType constructionType = new ConstructionType();
        // populate object with request parameters
        BeanUtils.populate(constructionType, request.getParameterMap());
        List constructionTypes = constructionTypeManager.getConstructionTypes(constructionType);
        return constructionTypes;
    }
View Full Code Here

TOP

Related Classes of com.vst.model.ConstructionType

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.