Package org.opencustomer.db.dao.crm

Examples of org.opencustomer.db.dao.crm.PersonDAO


        return panel;
    }
   
    @Override
    public void loadEntity(ActionMessages errors, LoadForm form, Hashtable<String, Object> attributes, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
        PersonDAO dao = new PersonDAO();
        try {
            PersonVO person = dao.getById(form.getId());
            Hibernate.initialize(person.getCompany());
            if(person.getCompany() != null)
                Hibernate.initialize(person.getCompany().getAddresses());
            Hibernate.initialize(person.getAddresses());
           
View Full Code Here


    protected void chooseEntity(EntityPanel panel, AddPersonForm form, ActionMessages errors, HttpServletRequest request, HttpServletResponse response)
    {
        if (log.isDebugEnabled())
            log.debug("add person with ID: " + form.getId());

        PersonVO person = new PersonDAO().getById(form.getId());

        if (person == null)
        {
            errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("default.error.invalidEntity", new Integer(form.getId())));
View Full Code Here

    {
        UserVO user = (UserVO)request.getSession().getAttribute(Globals.USER_KEY);
       
        try
        {
            new PersonDAO().delete((PersonVO)panel.getEntity());
        }
        catch (HibernateException e)
        {
            log.error("could not delete person", e);
View Full Code Here

           
            if (person.getId() == null) {
                if (log.isDebugEnabled())
                    log.debug("create person");

                new PersonDAO().insert(person);
            } else {
                if (log.isDebugEnabled())
                    log.debug("save person (ID:" + person.getId() + ")");

                new PersonDAO().update(person);
            }
        } catch (HibernateException e) {
            log.error("problems saving person", e);
            errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("default.error.rollback"));
        }
View Full Code Here

        if (person.getLastName() == null)
            errors.add("lastName", new ActionMessage("default.error.missingInput", MessageUtil.message(request, "entity.crm.person.lastName")));

        if (person.getFirstName() != null && person.getLastName() != null) {
            try {
                PersonDAO dao = new PersonDAO();

                PersonVO foundPerson = dao.getByName(person.getFirstName(), person.getLastName());

                if (foundPerson != null && !foundPerson.getId().equals(person.getId()))
                    errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("module.crm.person.error.nameExists"));

                HibernateContext.getSession().evict(foundPerson);
View Full Code Here

                if(log.isInfoEnabled())
                    log.info("blacklist is empty");
            }
           
            // Emfaenger im OC
            if (new PersonDAO().getByMail(mail.getSender().toString()).isEmpty())
            {
                if(log.isInfoEnabled())
                    log.info("sender " + mail.getSender() + " not in database");
                return null;
            }
           
            // Absender im OC
            for (MailAddress address : recipients)
            {
                if (!(new PersonDAO().getByMail(address.toString()).isEmpty()))
                    rcnfound = false;
            }
           
            if (rcnfound)
            {
View Full Code Here

                contact.setContentType(ContactVO.ContentType.PLAINTEXT);
            else
                contact.setContentType(ContactVO.ContentType.HTML);

            // Absender
            List<PersonVO> senders = new PersonDAO().getByMail(mail.getSender().toString());
            if (!senders.isEmpty())
                for (PersonVO person : senders)
                {
                    pc = new PersonContactVO(person, contact);
                    pc.setRelationType(PersonContactVO.Type.SENDER);
                    pcs.add(pc);
                    if ((mailetContext.isLocalUser(mail.getSender().getUser())) && mailetContext.isLocalServer(mail.getSender().getHost()))
                    {
                        contact.setBoundType(ContactVO.BoundType.OUT);
                    }
                }
            else
                contact.setContactName("From: " + mail.getSender().toString());

            // Emfaenger TO
            Address[] addresses = message.getRecipients(MimeMessage.RecipientType.TO);
            for (Address address : addresses)
            {
                recipient = address.toString();
                List<PersonVO> recipients = new PersonDAO().getByMail(recipient);
                if (!recipients.isEmpty())
                    for (PersonVO person : recipients)
                    {
                        pc = new PersonContactVO(person, contact);
                        pc.setRelationType(PersonContactVO.Type.TO);
                        pcs.add(pc);
                    }
                else if (contact.getContactName() == null)
                    contact.setContactName("To: " + recipient);
                else
                    contact.setContactName(contact.getContactName() + ", To: " + recipient);
            }

            // Emfaenger CC
            addresses = message.getRecipients(MimeMessage.RecipientType.CC);
            if (addresses != null)
                for (Address address : addresses)
                {
                    recipient = address.toString();
                    List<PersonVO> recipients = new PersonDAO().getByMail(recipient);
                    if (!recipients.isEmpty())
                        for (PersonVO person : recipients)
                        {
                            pc = new PersonContactVO(person, contact);
                            pc.setRelationType(PersonContactVO.Type.CC);
                            pcs.add(pc);
                        }
                    else if (contact.getContactName() == null)
                        contact.setContactName("CC: " + recipient);
                    else
                        contact.setContactName(contact.getContactName() + ", CC: " + recipient);
                }

            // Emfaenger BCC
            addresses = message.getRecipients(MimeMessage.RecipientType.BCC);
            if (addresses != null)
                for (Address address : addresses)
                {
                    recipient = address.toString();
                    List<PersonVO> recipients = new PersonDAO().getByMail(recipient);
                    if (!recipients.isEmpty())
                        for (PersonVO person : recipients)
                        {
                            pc = new PersonContactVO(person, contact);
                            pc.setRelationType(PersonContactVO.Type.BCC);
View Full Code Here

    {

        if (log.isDebugEnabled())
            log.debug("add  person with ID: " + form.getId());

        PersonDAO dao = new PersonDAO();
        PersonVO person = dao.getById(form.getId());

        if (person == null)
        {
            errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("default.error.invalidEntity", new Integer(form.getId())));
View Full Code Here

        try
        {
            UserVO user = (UserVO) panel.getEntity();
           
            if(!user.getProfile().getRole().isAdmin()) {
                PersonVO person = new PersonDAO().getById(form.getId());
                user.setPerson(person);
            }
        }
        catch (HibernateException e)
        {
View Full Code Here

    @Override
    protected List<PersonVO> getIgnoredPersons(EntityPanel panel){
        UserVO user = (UserVO) panel.getEntity();
       
        List<PersonVO> ignoredPersons = new ArrayList<PersonVO>();
        for(PersonVO person : new PersonDAO().getWithUser(user.getPerson()))
            ignoredPersons.add(person);
       
        return ignoredPersons;
    }
View Full Code Here

TOP

Related Classes of org.opencustomer.db.dao.crm.PersonDAO

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.