Package org.opencustomer.db.vo.crm

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


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

    @Override
    public void readForm(PageStandardForm form, ActionMessages errors, HttpServletRequest request)
    {
        ContactVO contact = (ContactVO) getPanel().getEntity();

        contact.setSubject(form.getSubject());
        contact.setContent(form.getContent());
        contact.setContactName(form.getContactName());
        contact.setContactType(EnumUtility.valueOf(ContactVO.ContactType.class, form.getContactType()));
        contact.setBoundType(EnumUtility.valueOf(ContactVO.BoundType.class, form.getBoundType()));

        SimpleDateFormat sdf = new SimpleDateFormat(MessageUtil.message(request, "default.format.input.dateTime"));
        try
        {
            contact.setContactTimestamp(sdf.parse(form.getContactTime()));
        }
        catch (ParseException e)
        {
            log.error("problems parsing contact timestamp", e);
        }
View Full Code Here


    }
   
    @Override
    public void writeForm(PageStandardForm form, ActionMessages errors, HttpServletRequest request)
    {
        ContactVO contact = (ContactVO)getPanel().getEntity();

        form.setSubject(contact.getSubject());
        form.setContent(contact.getContent());
        form.setContactName(contact.getContactName());
        if (contact.getContactType() != null)
            form.setContactType(contact.getContactType().toString());
        if (contact.getBoundType() != null)
            form.setBoundType(contact.getBoundType().toString());

        if (contact.getContactTimestamp() != null)
        {
            SimpleDateFormat sdf = new SimpleDateFormat(MessageUtil.message(request, "default.format.input.dateTime"));
            form.setContactTime(sdf.format(contact.getContactTimestamp()));
        }
    }
View Full Code Here

        {
            if (log.isDebugEnabled())
                log.debug("add own person");

            UserVO user = (UserVO) request.getSession().getAttribute(Globals.USER_KEY);
            ContactVO contact = (ContactVO) getPanel().getEntity();

            if (user.getPerson() != null)
            {
                PersonContactVO pc = new PersonContactVO(user.getPerson(), contact);

                if (!contact.getPersonContacts().contains(pc))
                    contact.getPersonContacts().add(pc);
            }

            return Panel.getForward(getPanel().getActivePage().getAction(), request);
        }
        else if(form.getDoAddPerson().isSelected())
        {
            if (log.isDebugEnabled())
                log.debug("add person");
           
            return mapping.findForward("addPerson");
        }
        else if(form.getDoAddCompany().isSelected())
        {
            if (log.isDebugEnabled())
                log.debug("add company");
           
            return mapping.findForward("addCompany");
        }
        else if(form.getDoRemovePerson() > 0)
        {
            if (log.isDebugEnabled())
                log.debug("remove person with id: "+form.getDoRemovePerson());         
           
            ContactVO contact = (ContactVO) getPanel().getEntity();
           
            if(contact.getPersonContacts().size() > 1 || contact.getCompany() != null)
            {
                Iterator<PersonContactVO> it = contact.getPersonContacts().iterator();
                while(it.hasNext()) {
                    if(it.next().getPerson().getId().intValue() == form.getDoRemovePerson()) {
                        it.remove();
                        break;
                    }
                }
            }
            else
                log.info("tried to delete last person of contact / no company available");
           
            return Panel.getForward(getPanel().getActivePage().getAction(), request);
        }
        else if(form.getDoRemoveCompany().isSelected()) {
            if (log.isDebugEnabled())
                log.debug("remove company");
           
            ContactVO contact = (ContactVO) getPanel().getEntity();
            if (contact.getPersonContacts().size() > 0)
                contact.setCompany(null);
            else
                log.info("tried to delete company of contact / no persons available");
           
            return Panel.getForward(getPanel().getActivePage().getAction(), request);
        }
View Full Code Here

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

    @Override
    protected void deleteEntity(DeletePanel panel, HttpServletRequest request, HttpServletResponse response, ActionMessages errors)
    {
        ContactVO contact = (ContactVO) panel.getEntity();

        if (log.isDebugEnabled())
            log.debug("delete contact (ID:" + contact.getId() + ")");

        if (contact.getId() != null)
        {
            try
            {
                new ContactDAO().delete(contact);
            }
            catch (HibernateException e)
            {
                errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("default.error.couldNotDeleteEntity", panel.getEntity().getId()));

                log.debug("problems deleting contact (ID:" + contact.getId() + ")");
            }
        }       
    }
View Full Code Here

    {
        try
        {
            HibernateContext.beginTransaction();
           
            ContactVO contact = (ContactVO) panel.getEntity();

            if (contact.getId() == null)
            {
                if (log.isDebugEnabled())
                    log.debug("create contact " + contact);
                new ContactDAO().insert(contact);
            }
View Full Code Here

        }       
    }
    @Override
    protected boolean validateData(EditPanel panel, ActionMessages errors, HttpServletRequest request)
    {
        ContactVO contact = (ContactVO)panel.getEntity();

        if (contact.getSubject() == null)
            errors.add("subject", new ActionMessage("default.error.missingInput", MessageUtil.message(request, "entity.crm.contact.subject")));

        if (errors.isEmpty())
            return true;
        else
View Full Code Here

{
    private static Logger log = Logger.getLogger(LoadAction.class);

    public EditPanel createPanel(ActionMessages errors, EditLoadForm form, Hashtable<String, Object> attributes, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
    {
        ContactVO contact = (ContactVO)attributes.get("contact");

        EditPanel panel = new EditPanel(Right.CRM_CONTACTS_WRITE, contact);
       
        if(contact.getId() == null)
            panel.setTitle(MessageUtil.message(request, "module.crm.contact.headLine.create"));
        else
        {
            panel.setTitle(MessageUtil.message(request, "module.crm.contact.headLine.edit", contact.getSubject()));
           
            panel.setAttribute(DeleteAction.TEXT_TITLE, MessageUtil.message(request, "module.crm.contact.delete.headLine", contact.getSubject()));
            panel.setAttribute(DeleteAction.TEXT_QUESTION, MessageUtil.message(request, "module.crm.contact.delete.question", contact.getSubject()));
        }
       
        EditPanel lastPanel = (EditPanel)Panel.getPanelStack(request).peek();
       
        panel.addAction(Action.Type.SAVE, "/crm/contact/save");
View Full Code Here

    @Override
    public void createEntity(ActionMessages errors, EditLoadForm form, Hashtable<String, Object> attributes, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
    {
        UserVO activeUser = (UserVO) request.getSession().getAttribute(Globals.USER_KEY);
       
        ContactVO contact = new ContactVO();
        contact.setContactTimestamp(new Date());
       
        contact.setAccessUser(EntityAccess.Access.WRITE_SYSTEM);
        contact.setOwnerUser(activeUser.getId());
        contact.setAccessGroup(EntityAccess.Access.NONE);
        contact.setOwnerGroup(activeUser.getProfile().getDefaultUsergroup().getId());
        contact.setAccessGlobal(EntityAccess.Access.WRITE_SYSTEM);
       
        EditPanel lastPanel = (EditPanel)Panel.getPanelStack(request).peek();
       
        if(lastPanel.getEntity() instanceof CompanyVO)
        {
            if (log.isDebugEnabled())
                log.debug("contact for company");

            CompanyVO company = (CompanyVO) lastPanel.getEntity();
            contact.setCompany(company);
        }
        else if(lastPanel.getEntity() instanceof PersonVO)
        {
            if (log.isDebugEnabled())
                log.debug("contact for person");

            PersonVO person = (PersonVO)lastPanel.getEntity();
            contact.getPersonContacts().add(new PersonContactVO(person, contact));
        }
        else
        {
            log.error("unknown entity foundin panel: "+lastPanel);
        }   
       
        // add own user by default
        if(activeUser.getPerson() != null) {
            PersonVO person = activeUser.getPerson();
            boolean containsPerson = false;
            for(PersonContactVO personContact : contact.getPersonContacts()) {
                if(person.equals(personContact.getPerson())) {
                    containsPerson = true;
                }
            }
           
            if(!containsPerson) {
                contact.getPersonContacts().add(new PersonContactVO(person, contact));
            }
        }
       
        attributes.put("contact", contact);
    }
View Full Code Here

    @Override
    public void loadEntity(ActionMessages errors, EditLoadForm form, Hashtable<String, Object> attributes, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
    {
        try
        {
            ContactVO contact = new ContactDAO().getById(form.getId());
            Hibernate.initialize(contact.getPersonContacts());
           
            attributes.put("contact", contact);
        }
        catch (HibernateException e)
        {
View Full Code Here

            PersonContactVO pc;
            List<PersonContactVO> pcs = new ArrayList<PersonContactVO>();

            MimeMessage message = mail.getMessage();
            MailetContext mailetContext = getMailetContext();
            contact = new ContactVO();

            contact.setBoundType(ContactVO.BoundType.IN);
            contact.setContactType(ContactVO.ContactType.EMAIL);
            contact.setContactTimestamp(new Date());
            contact.setImportType(ContactVO.ImportType.NEW);
View Full Code Here

TOP

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

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.