Package com.vst.model

Examples of com.vst.model.CompanyLicense


    }

    protected Object formBackingObject(HttpServletRequest request) throws Exception {

        if (!isFormSubmission(request)) {
            CompanyLicense companyLicense = new CompanyLicense();
            // companyLicense.setPhoto(new Photo());
            if (request.getParameter("companyId") != null) {
                Integer id = Integer.valueOf(request.getParameter("companyId"));
                Integer photoId = companyLicenseManager.getById(id).getPhoto().getPhotoId();
                companyLicense.setLicenseId(id);
                companyLicense.setPhoto(photoManager.getByIdPhoto(photoId));
            }

            return companyLicense;
        }
View Full Code Here


                                 Object command,
                                 BindException errors) throws Exception {

        ModelAndView mav = new ModelAndView(getSuccessView());

        CompanyLicense companyLicense = (CompanyLicense) command;

        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;

        CommonsMultipartFile file = (CommonsMultipartFile) multipartRequest.getFile("photo.file");


        if (companyLicense.getLicenseId() != null) {
            String comment = companyLicense.getPhoto().getComment();
            companyLicense = companyLicenseManager.getById(companyLicense.getLicenseId());
            Photo photo = photoManager.getByIdPhoto(companyLicense.getPhoto().getPhotoId());
            photo.setComment(comment);            
            photoManager.update(photo, file, FileHelper.getCurrentPath(request),400,400);
            companyLicenseManager.update(companyLicense);
            return new ModelAndView("redirect:/companyLicenseList.html");

        } else {
            if (file.getSize() > 0) {
                Photo photo = photoManager.insertPhoto(file, FileHelper.getCurrentPath(request),400,400);
                photo.setComment(companyLicense.getPhoto().getComment());
                companyLicense.setPhoto(photo);
            }
            companyLicenseManager.insert(companyLicense);
            mav.addObject("result", new Integer(1));
        }
        CompanyLicense com = new CompanyLicense();
        //  com.setPhoto(new Photo());
        mav.addObject("companyLicense", com);
        return mav;
    }
View Full Code Here

        this.companyLicenseManager = companyLicenseManager;
    }

    private void doDeleteLicenceInfo(HttpServletRequest request, HttpServletResponse response){
        Integer id = Integer.valueOf(request.getParameter("delete"));
        CompanyLicense companyLicense = companyLicenseManager.getById(id);
        Integer photoId = companyLicense.getPhoto().getPhotoId();
        companyLicenseManager.delete(companyLicense);
        photoManager.delete(photoManager.getByIdPhoto(photoId));
    }
View Full Code Here

      Integer page = processPageParam(request);

      if (companyLicenseManager.getList(page) != null) {
            list = companyLicenseManager.getList(page);
            for (int i = 0; i < list.size(); i++) {
                CompanyLicense companyLicense = (CompanyLicense) list.get(i);

                Photo photo = photoManager.getByIdPhoto(companyLicense.getPhoto().getPhotoId());
                photoManager.prepareForOpen(photo, FileHelper.getCurrentPath(request));
                companyLicense.setPhoto(photo);
            }
        }
      return list;
    }
View Full Code Here

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

    public void validate(Object o, Errors errors) {
        CompanyLicense companyLicense = (CompanyLicense) o;
        if ((companyLicense.getPhoto() == null || companyLicense.getPhoto().getFile().length == 0) && companyLicense.getLicenseId() == null) {
            errors.rejectValue("photo", "companyLicense.error");
        }
    }
View Full Code Here

TOP

Related Classes of com.vst.model.CompanyLicense

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.