Package com.vst.model

Examples of com.vst.model.EquipmentInspection


    }

    protected Object formBackingObject(HttpServletRequest request) throws Exception {

        if (!isFormSubmission(request)) {
            EquipmentInspection equipmentInspection = new EquipmentInspection();
            if (request.getParameter("equipment") != null) {
                Integer id = Integer.valueOf(request.getParameter("equipment"));
                equipmentInspection = equipmentInspectionManager.getById(id);
            }
View Full Code Here


                                 Object command,
                                 BindException errors) throws IOException, SQLException {

        ModelAndView mav = new ModelAndView(getSuccessView());

        EquipmentInspection equipmentInspection = (EquipmentInspection) command;
        if (equipmentInspection.getReviewPeriod() != null) {
            Date d = equipmentInspection.getReviewPeriod();
            String dateForLook = StringUtil.formatDate(d);
            equipmentInspection.setDateForLook(dateForLook);
        }


        if (equipmentInspection.getEquipmentId() != null) {

            equipmentInspectionManager.update(equipmentInspection);
            return new ModelAndView("redirect:/equipmentInspectionList.html");
        } else {

            equipmentInspectionManager.saveEquipmentInspection(equipmentInspection);
            mav.addObject("result", new Integer(1));
        }

        mav.addObject("equipment", new EquipmentInspection());
        return mav;
    }
View Full Code Here

    }

    public boolean exist(EquipmentInspection equipmentInspection) {
        List list=equipmentInspectionDao.getList();
        for (int i=0; i<list.size(); i++){
            EquipmentInspection equipment=(EquipmentInspection)list.get(i);
            if (equipment.getType().equals(equipmentInspection.getType()) && equipment.getMark().equals(equipmentInspection.getMark())){
                return true;
            }
        }
        return false;
    }
View Full Code Here

    public ModelAndView handleRequest(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
        ModelAndView modelAndView = new ModelAndView("equipmentInspectionList");

        if (httpServletRequest.getParameter("delete") != null) {
            Integer deleteId = Integer.valueOf(httpServletRequest.getParameter("delete"));
            EquipmentInspection equipmentInspection = equipmentInspectionManager.getById(deleteId);
            equipmentInspectionManager.delete(equipmentInspection);
        }


        Integer page = new Integer(0);
View Full Code Here

    public boolean supports(Class aClass) {
        return EquipmentInspection.class.isAssignableFrom(aClass);
    }

    public void validate(Object o, Errors errors) {
        EquipmentInspection equipmentInspection = (EquipmentInspection) o;
        if (equipmentInspection.getType().trim().equals("") || equipmentInspection.getMark().trim().equals("")) {

            if (equipmentInspection.getType().trim().equals("")) {
                errors.rejectValue("type", "equipmentInspection.type.error");
            }
            if (equipmentInspection.getMark().trim().equals("")) {
                errors.rejectValue("mark", "equipmentInspection.mark.error");
            }
            if (equipmentInspection.getFactoryNumber().trim().equals("")) {
                errors.rejectValue("factoryNumber", "equipmentInspection.number.error");
            }

        } else {
            if (equipmentInspectionManager.exist(equipmentInspection) && equipmentInspection.getEquipmentId() == null) {
                errors.rejectValue("equipmentId", "equipmentInspection.error");
            }
        }

    }
View Full Code Here

TOP

Related Classes of com.vst.model.EquipmentInspection

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.