Package org.opencustomer.db.vo.crm

Examples of org.opencustomer.db.vo.crm.CompanyVO


    public void createEntity(ActionMessages errors, LoadForm form, Hashtable<String, Object> attributes, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
        UserVO activeUser = (UserVO) request.getSession().getAttribute(Globals.USER_KEY);
        if (log.isDebugEnabled())
            log.debug("new company");
       
        CompanyVO company = new CompanyVO();
        company.setAssignedUser(activeUser);
       
        company.setAccessUser(EntityAccess.Access.WRITE_SYSTEM);
        company.setOwnerUser(activeUser.getId());
        company.setAccessGroup(EntityAccess.Access.NONE);
        company.setOwnerGroup(activeUser.getProfile().getDefaultUsergroup().getId());
        company.setAccessGlobal(EntityAccess.Access.WRITE_SYSTEM);
       
        attributes.put("company", company);
    }
View Full Code Here


    @Override
    public void loadEntity(ActionMessages errors, LoadForm form, Hashtable<String, Object> attributes, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
        if (log.isDebugEnabled())
            log.debug("load company (ID:" + form.getId() + ")");

        CompanyVO company = null;
        try {
            company = new CompanyDAO().getById(form.getId());

            Hibernate.initialize(company.getAddresses());
            Hibernate.initialize(company.getPersons());
            Hibernate.initialize(company.getSector());
            Hibernate.initialize(company.getLegalForm());
            Hibernate.initialize(company.getCompanyType());
            Hibernate.initialize(company.getCompanyState());
            Hibernate.initialize(company.getCategory());
            Hibernate.initialize(company.getRating());
        } catch (HibernateException e) {
            log.error("could not load company", e);
            errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("default.error.invalidEntity", new Integer(form.getId())));
        }
       
View Full Code Here

    private static Logger log = Logger.getLogger(PageStandardAction.class);

    @Override
    public void writeForm(PageStandardForm form, ActionMessages errors, HttpServletRequest request)
    {
        CompanyVO company = (CompanyVO)getPanel().getAttribute("company");

        form.setCompanyName(company.getCompanyName());
        form.setUrl(company.getUrl());
        form.setPhone(company.getPhone());
        form.setFax(company.getFax());
        form.setEmail(company.getEmail());
        form.setComment(company.getComment());
        if (company.getStaffCount() != null)
            form.setStaffCount(company.getStaffCount().toString());

        if (company.getSector() != null)
            form.setSectorId(company.getSector().getId());
        if (company.getLegalForm() != null)
            form.setLegalFormId(company.getLegalForm().getId());
        if (company.getCompanyState() != null)
            form.setCompanyStateId(company.getCompanyState().getId());
        if (company.getCompanyType() != null)
            form.setCompanyTypeId(company.getCompanyType().getId());
        if (company.getCategory() != null)
            form.setCategoryId(company.getCategory().getId());
        if (company.getRating() != null)
            form.setRatingId(company.getRating().getId());
    }
View Full Code Here

    }
   
    @Override
    public void readForm(PageStandardForm form, ActionMessages errors, HttpServletRequest request)
    {
        CompanyVO company = (CompanyVO) getPanel().getAttribute("company");

        if (log.isDebugEnabled())
            log.debug("save button pressed");

        company.setCompanyName(form.getCompanyName());
        company.setUrl(form.getUrl());
        company.setPhone(form.getPhone());
        company.setFax(form.getFax());
        company.setEmail(form.getEmail());
        company.setComment(form.getComment());
        if (form.getStaffCount() != null)
            company.setStaffCount(new Integer(form.getStaffCount()));
        else
            company.setStaffCount(null);

        try
        {
            if(form.getSectorId() > 0) {
                if(isEntityChanged(form.getSectorId(), company.getSector()))
                    company.setSector(new SectorDAO().getById(form.getSectorId()));
            } else {
                company.setSector(null);
            }
           
            if(form.getLegalFormId() > 0) {
                if(isEntityChanged(form.getLegalFormId(), company.getLegalForm()))
                    company.setLegalForm(new LegalFormDAO().getById(form.getLegalFormId()));
            } else {
                company.setLegalForm(null);
            }
           
            if(form.getCompanyTypeId() > 0) {
                if(isEntityChanged(form.getCompanyTypeId(), company.getCompanyType()))
                    company.setCompanyType(new CompanyTypeDAO().getById(form.getCompanyTypeId()));
            } else {
                company.setCompanyType(null);
            }
           
            if(form.getCompanyStateId() > 0) {
                if(isEntityChanged(form.getCompanyStateId(), company.getCompanyState()))
                    company.setCompanyState(new CompanyStateDAO().getById(form.getCompanyStateId()));
            } else {
                company.setCompanyState(null);
            }
           
            if(form.getCategoryId() > 0) {
                if(isEntityChanged(form.getCategoryId(), company.getCategory()))
                    company.setCategory(new CategoryDAO().getById(form.getCategoryId()));
            } else {
                company.setCategory(null);
            }
           
            if(form.getRatingId() > 0) {
                if(isEntityChanged(form.getRatingId(), company.getRating()))
                    company.setRating(new RatingDAO().getById(form.getRatingId()));
            } else {
                company.setRating(null);
            }

        }
        catch (HibernateException e)
        {
View Full Code Here

        writeForm(form, errors, request);
    }

    @Override
    protected void writeForm(PageOverviewForm form, ActionMessages errors, HttpServletRequest request) {
        CompanyVO company = (CompanyVO)getPanel().getEntity();
       
        AddressVO mainAddress   = null;
        AddressVO postalAddress = null;
       
        for(AddressVO address : company.getAddresses()) {
            if(AddressVO.Type.MAIN.equals(address.getType())) {
                mainAddress = address;
            } else if(AddressVO.Type.POSTAL.equals(address.getType())) {
                postalAddress = address;
            }
View Full Code Here

    private static Logger log = Logger.getLogger(PageInfoAction.class);

    @Override
    public void writeForm(PageInfoForm form, ActionMessages errors, HttpServletRequest request)
    {
        CompanyVO companyVO = (CompanyVO) getPanel().getAttribute("company");

        form.setInfo(companyVO.getInfo());
    }
View Full Code Here

    }
   
    @Override
    public void readForm(PageInfoForm form, ActionMessages errors, HttpServletRequest request)
    {
        CompanyVO company = (CompanyVO) getPanel().getAttribute("company");

        company.setInfo(form.getInfo());
    }
View Full Code Here

   
    @Override
    protected void saveEntity(EditPanel panel, ActionMessages errors, HttpServletRequest request) {
        UserVO user = (UserVO) request.getSession().getAttribute(Globals.USER_KEY);

        CompanyVO company = (CompanyVO) panel.getEntity();

        try {
            // speicher die Firma
            if (company.getId() == null)
                new CompanyDAO().insert(company);
            else
                new CompanyDAO().update(company);
        } catch (HibernateException e) {
            log.error("problems saving company (id:" + company.getId() + ")", e);
            errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("default.error.rollback"));
        }
    }
View Full Code Here

            return null;
    }

    @Override
    protected boolean validateData(EditPanel panel, ActionMessages errors, HttpServletRequest request) {
        CompanyVO company = (CompanyVO) panel.getEntity();

        // Abfangen der m�glichen Fehler
        if (company.getCompanyName() == null) {
            errors.add("companyName", new ActionMessage("default.error.missingInput", MessageUtil.message(request, "entity.crm.company.companyName")));
        } else {
            try {
                CompanyDAO dao = new CompanyDAO();

                CompanyVO namedCompany = dao.getByName(company.getCompanyName());
                if (namedCompany != null && !namedCompany.getId().equals(company.getId()))
                    errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("module.crm.company.error.nameExists"));

                HibernateContext.getSession().evict(namedCompany);
            } catch (HibernateException e) {
                log.error("could not read company for name: " + company.getCompanyName());
View Full Code Here

    protected static final int STATUS_JUMPPERSON = 10;

    @Override
    protected void writeForm(PagePersonForm form, ActionMessages errors, HttpServletRequest request)
    {
        CompanyVO company = (CompanyVO)getPanel().getEntity();
       
        if(company.getId() != null) {
            getPanel().setAttribute("persons", new PersonDAO().getForCompany(company));
        }
    }
View Full Code Here

TOP

Related Classes of org.opencustomer.db.vo.crm.CompanyVO

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.