Package org.opencustomer.db.vo.crm

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


        PersonVO person = (PersonVO) getPanel().getEntity();

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

        AddressVO mainAddress = getAddress(person, AddressVO.Type.MAIN);
        mainAddress.setName(form.getMainAddressName());
        mainAddress.setStreet(form.getMainAddressStreet());
        mainAddress.setZip(form.getMainAddressZip());
        mainAddress.setCity(form.getMainAddressCity());
       
        manageAddress(person, mainAddress);
       
        AddressVO postalAddress = getAddress(person, AddressVO.Type.POSTAL);
        postalAddress.setName(form.getPostalAddressName());
        postalAddress.setStreet(form.getPostalAddressStreet());
        postalAddress.setPostbox(form.getPostalAddressPostbox());
        postalAddress.setZip(form.getPostalAddressZip());
        postalAddress.setCity(form.getPostalAddressCity());
       
        manageAddress(person, postalAddress);
    }
View Full Code Here


        return isEmpty;
    }

    private AddressVO getAddress(PersonVO person, AddressVO.Type type)
    {
        AddressVO foundValue = null;

        for (AddressVO address : person.getAddresses())
        {
            if (type.equals(address.getType()))
            {
                if (log.isDebugEnabled())
                    log.debug("address found for " + type);

                foundValue = address;
                break;
            }
        }

        if (foundValue == null)
        {
            if (log.isDebugEnabled())
                log.debug("create address for " + type);

            foundValue = new AddressVO();
            foundValue.setType(type);
            foundValue.setPerson(person);
        }

        return foundValue;
    }
View Full Code Here

    @Override
    protected void writeForm(PageOverviewForm form, ActionMessages errors, HttpServletRequest request) {
        PersonVO person = (PersonVO)getPanel().getEntity();
       
        AddressVO mainAddress   = null;
        AddressVO postalAddress = null;
       
        // get person addresses
        for(AddressVO address : person.getAddresses()) {
            if(AddressVO.Type.MAIN.equals(address.getType()) && mainAddress == null) {
                mainAddress = address;
            } else if(AddressVO.Type.POSTAL.equals(address.getType()) && postalAddress == null) {
                postalAddress = address;
            }
        }

        // get company addresses
        if(person.getCompany() != null && Hibernate.isInitialized(person.getCompany().getAddresses())) {
            for(AddressVO address : person.getCompany().getAddresses()) {
                if(AddressVO.Type.MAIN.equals(address.getType()) && mainAddress == null) {
                    mainAddress = address;
                } else if(AddressVO.Type.POSTAL.equals(address.getType()) && postalAddress == null) {
                    postalAddress = address;
                }
            }
        }
       
        if(mainAddress != null) {
            getPanel().setAttribute("mainAddress", mainAddress);
            if(mainAddress.getCompany() != null)
                getPanel().setAttribute("mainAddressCompany", Boolean.TRUE);
            else
                getPanel().removeAttribute("mainAddressCompany");
        } else {
            getPanel().removeAttribute("mainAddress");
            getPanel().removeAttribute("mainAddressCompany");
        }
       
        if(postalAddress != null) {
            getPanel().setAttribute("postalAddress", postalAddress);
            if(postalAddress.getCompany() != null)
                getPanel().setAttribute("postalAddressCompany", Boolean.TRUE);
            else
                getPanel().removeAttribute("postalAddressCompany");
        } else {
            getPanel().removeAttribute("postalAddress");
View Full Code Here

    @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())) {
View Full Code Here

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

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

        AddressVO mainAddress = getAddress(company, AddressVO.Type.MAIN);
        mainAddress.setName(form.getMainAddressName());
        mainAddress.setStreet(form.getMainAddressStreet());
        mainAddress.setZip(form.getMainAddressZip());
        mainAddress.setCity(form.getMainAddressCity());
       
        manageAddress(company, mainAddress);
       
        AddressVO postalAddress = getAddress(company, AddressVO.Type.POSTAL);
        postalAddress.setName(form.getPostalAddressName());
        postalAddress.setStreet(form.getPostalAddressStreet());
        postalAddress.setPostbox(form.getPostalAddressPostbox());
        postalAddress.setZip(form.getPostalAddressZip());
        postalAddress.setCity(form.getPostalAddressCity());
       
        manageAddress(company, postalAddress);
    }
View Full Code Here

        return isEmpty;
    }
   
    private AddressVO getAddress(CompanyVO company, AddressVO.Type type) {
        AddressVO foundValue = null;

        for (AddressVO address : company.getAddresses()) {
            if (type.equals(address.getType())) {
                if (log.isDebugEnabled())
                    log.debug("address found for " + type);

                foundValue = address;
                break;
            }
        }

        if (foundValue == null) {
            if (log.isDebugEnabled())
                log.debug("create address for " + type);

            foundValue = new AddressVO();
            foundValue.setType(type);
            foundValue.setCompany(company);
        }

        return foundValue;
    }
View Full Code Here

TOP

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

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.