Package com.vst.model

Examples of com.vst.model.PipeLineElement


        ModelAndView mav = new ModelAndView(getSuccessView());
        PipeLineElementDefect pipeLineElementDefect = (PipeLineElementDefect) command;

        Integer elementId = Integer.valueOf(request.getSession().getAttribute("pipeElementId").toString());
        PipeLineElement pipeLineElement = pipeLineElementManager.getPipeLineElementById(elementId);
        pipeLineElementDefect.setDangerCategory(dangerCategoryManager.getDangerCategory(String.valueOf(pipeLineElementDefect.getDangerCategory().getDangerCategoryId())));
        pipeLineElementDefect.setDefectType(defectTypeManager.getDefectType(String.valueOf(pipeLineElementDefect.getDefectType().getDefectTypeId())));
        if (pipeLineElementDefect.getDefectVarity().getVarityId()!=null && pipeLineElementDefect.getDefectVarity().getVarityId().longValue()!=-1){
            pipeLineElementDefect.setDefectVarity(defectVarityManager.getDefectVarity(String.valueOf(pipeLineElementDefect.getDefectVarity().getVarityId())));            
        }


        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;

        CommonsMultipartFile ffile = (CommonsMultipartFile) multipartRequest.getFile("firstPhoto.file");
        CommonsMultipartFile sfile = (CommonsMultipartFile) multipartRequest.getFile("secondPhoto.file");

        if (pipeLineElementDefect.getDefectId() != null) {
            pipeLineElementDefect = pipeLineElementDefectManager.getPipeLineElementDefectById(pipeLineElementDefect.getDefectId());
            Photo photo = photoManager.getByIdPhoto(pipeLineElementDefect.getFirstPhoto().getPhotoId());
            photoManager.update(photo, ffile, FileHelper.getCurrentPath(request));
            photo = photoManager.getByIdPhoto(pipeLineElementDefect.getSecondPhoto().getPhotoId());
            photoManager.update(photo, sfile, FileHelper.getCurrentPath(request));
            pipeLineElementDefectManager.update(pipeLineElementDefect);
            return new ModelAndView("redirect:/pipeLineElementDefectList.html?objectId=" + request.getParameter("objectId") + "&detailType=" + request.getParameter("detailType") + "&pipeElementId=" + elementId);
        } else {

            if (ffile != null && ffile.getSize() > 0) {
                Photo photo = photoManager.insertPhoto(ffile, FileHelper.getCurrentPath(request));
                pipeLineElementDefect.setFirstPhoto(photo);
            } else {
                Photo photo = new Photo();
                photo.setWayToPhoto("no photo");
                photoManager.insert(photo);
                pipeLineElementDefect.setFirstPhoto(photo);
            }
            if (sfile != null && sfile.getSize() > 0) {
                Photo photo = photoManager.insertPhoto(sfile, FileHelper.getCurrentPath(request));
                pipeLineElementDefect.setSecondPhoto(photo);
            } else {
                Photo photo = new Photo();
                photo.setWayToPhoto("no photo");
                photoManager.insert(photo);
                pipeLineElementDefect.setSecondPhoto(photo);
            }
          
            pipeLineElementDefectManager.insert(pipeLineElementDefect);

            pipeLineElement.getPipeLineElementDefectList().add(pipeLineElementDefect);

            pipeLineElementManager.update(pipeLineElement);

           mav.addObject("result", new Integer(1));
        }
View Full Code Here


    public List getPipeListByDetailId(Integer id) {
        List list=pipeLineElementDao.getAllPipeLineElement();
        List resultList=new ArrayList() ;
        for (int i=0; i<list.size(); i++){
            PipeLineElement pipeLineElement=(PipeLineElement)list.get(i);
            if (pipeLineElement.getDetail().getDetailId().equals(id)){
                resultList.add(pipeLineElement);
            }
        }
        return resultList;
    }
View Full Code Here

TOP

Related Classes of com.vst.model.PipeLineElement

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.