Package org.opencustomer.db.vo.crm

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


public class LoadAction extends EditLoadAction<LoadForm> {
    private static Logger log = Logger.getLogger(LoadAction.class);

    @Override
    public EditPanel createPanel(ActionMessages errors, LoadForm form, Hashtable<String, Object> attributes, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
        PersonVO person = (PersonVO)attributes.get("person");

        EditPanel panel = new EditPanel(Right.CRM_PERSONS_WRITE, person);
        boolean contactSelectable = true;
        boolean deletable = true;
       
        if(person.getId() == null) {
            panel.setTitle(MessageUtil.message(request, "module.crm.person.headLine.create"));
            contactSelectable = false;
        } else {
            String name = new String(person.getFirstName()+" "+person.getLastName());
            if(person.getTitle() != null)
                name = person.getTitle()+" "+name;
            if(person.getNameAffix() != null)
                name = name+" "+person.getNameAffix();
           
            panel.setTitle(MessageUtil.message(request, "module.crm.person.headLine.edit", name));

            panel.setAttribute(DeleteAction.TEXT_TITLE, MessageUtil.message(request, "module.crm.person.delete.headLine", person.getLastName(), person.getFirstName()));
            panel.setAttribute(DeleteAction.TEXT_QUESTION, MessageUtil.message(request, "module.crm.person.delete.question", person.getLastName(), person.getFirstName()));
        }
       
        if(person.getPersonContacts().size() > 0 || person.getJobs().size() > 0)
            deletable = false;
       
        panel.addAction(Action.Type.DELETE, "/crm/person/delete", deletable);
        panel.addAction(Action.Type.SAVE, "/crm/person/save");
       
        if(SystemConfiguration.getInstance().getBooleanValue(SystemConfiguration.Key.SHOW_OVERVIEW)) {
            panel.addPage("OVERVIEW", "/crm/person/pageOverview""module.generic.panel.tab.overview");
        }
        panel.addPage("STANDARD", "/crm/person/pageStandard", "module.crm.person.pageStandard");
        panel.addPage("ADDRESS""/crm/person/pageAddress", "module.crm.person.pageAddress");
        panel.addPage("CONTACT""/crm/person/pageContact", "module.crm.person.pageContact", contactSelectable, true);
        panel.addPage("JOBS",     "/crm/person/pageJob", "module.generic.panel.tab.crm.jobs", contactSelectable, true);
        panel.addPage("SYSTEM",   "/crm/person/pageSystem",   "module.generic.panel.tab.system");
       
        if(person.getId() == null) {
            panel.activatePage(panel.findPage("STANDARD"));
        }
       
        return panel;
    }
View Full Code Here


   
    @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());
           
            attributes.put("person", person);
        } catch (HibernateException e) {
            log.debug("problems loading person (ID:" + form.getId() + ")");
View Full Code Here

        UserVO activeUser = (UserVO) request.getSession().getAttribute(Globals.USER_KEY);
        Panel lastPanel = null;
        if(!Panel.getPanelStack(request).isEmpty())
            lastPanel = Panel.getPanelStack(request).peek();
       
        PersonVO person = new PersonVO();
       
        if(lastPanel != null && lastPanel instanceof EditPanel && ((EditPanel)lastPanel).getEntity() instanceof CompanyVO) {
            person.setCompany((CompanyVO)((EditPanel)lastPanel).getEntity());
        }
       
        person.setAccessUser(EntityAccess.Access.WRITE_SYSTEM);
        person.setOwnerUser(activeUser.getId());
        person.setAccessGroup(EntityAccess.Access.NONE);
        person.setOwnerGroup(activeUser.getProfile().getDefaultUsergroup().getId());
        person.setAccessGlobal(EntityAccess.Access.WRITE_SYSTEM);
       
        attributes.put("person", person);
    }
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())));

            log.error("problems loading person (ID:" + form.getId() + ")");
        }
        else
        {
            JobVO job = (JobVO) panel.getEntity();
            job.setReferencedPerson(person);
            job.setReferencedCompany(person.getCompany());
        }
    }
View Full Code Here

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

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

        if(personVO.getType() != null)
            form.setType(personVO.getType().toString());
       
        form.setFirstName(personVO.getFirstName());
        form.setLastName(personVO.getLastName());
        if(personVO.getGender() != null)
            form.setGender(personVO.getGender().toString());
        form.setNameAffix(personVO.getNameAffix());
        form.setTitle(personVO.getTitle());


        form.setEmail(personVO.getEmail());
        form.setPhone(personVO.getPhone());
        form.setMobile(personVO.getMobile());
        form.setFax(personVO.getFax());
        form.setUrl(personVO.getUrl());
       
        form.setComment(personVO.getComment());

        form.setDegree(personVO.getDegree());
        form.setFunction(personVO.getFunction());
       
        if(personVO.getDayOfBirth() != null) {
            SimpleDateFormat sdf = new SimpleDateFormat(MessageUtil.message(request, "default.format.input.date"));
            form.setDayOfBirth(sdf.format(personVO.getDayOfBirth()));
        }
    }
View Full Code Here

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

        personVO.setType(EnumUtility.valueOf(PersonVO.Type.class, form.getType()));
       
        personVO.setFirstName(form.getFirstName());
        personVO.setLastName(form.getLastName());
        personVO.setGender(EnumUtility.valueOf(PersonVO.Gender.class, form.getGender()));
        personVO.setNameAffix(form.getNameAffix());
        personVO.setTitle(form.getTitle());

        personVO.setEmail(form.getEmail());
        personVO.setPhone(form.getPhone());
        personVO.setMobile(form.getMobile());
        personVO.setFax(form.getFax());
        personVO.setUrl(form.getUrl());

        personVO.setComment(form.getComment());
       
        personVO.setDegree(form.getDegree());
        personVO.setFunction(form.getFunction());

        if(form.getDayOfBirth() != null) {
            SimpleDateFormat sdf = new SimpleDateFormat(MessageUtil.message(request, "default.format.input.date"));
            try {
                personVO.setDayOfBirth(sdf.parse(form.getDayOfBirth()));
            } catch (ParseException e) {
                log.error("problems parsing day of birth", e);
            }
        }
    }
View Full Code Here

        else if (form.getDoRemoveCompany().isSelected())
        {
            if (log.isDebugEnabled())
                log.debug("remove company");

            PersonVO person = (PersonVO)getPanel().getEntity();
            person.setCompany(null);
           
            return Panel.getForward(getPanel().getActivePage().getAction(), request);
        }
        else
        {
View Full Code Here

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

    @Override
    public void writeForm(PageAddressForm form, ActionMessages errors, HttpServletRequest request)
    {
        PersonVO person = (PersonVO) getPanel().getEntity();

        for(AddressVO address : person.getAddresses()) {
            if(AddressVO.Type.MAIN.equals(address.getType())) {
                form.setMainAddressName(address.getName());
                form.setMainAddressStreet(address.getStreet());
                form.setMainAddressZip(address.getZip());
                form.setMainAddressCity(address.getCity());
View Full Code Here

    }
   
    @Override
    public void readForm(PageAddressForm form, ActionMessages errors, HttpServletRequest request)
    {
        PersonVO person = (PersonVO) getPanel().getEntity();

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

        AddressVO mainAddress = getAddress(person, AddressVO.Type.MAIN);
View Full Code Here

        String _lastName = toLower(lastName);

        if (log.isDebugEnabled())
            log.debug("search for person by name (firstNane=" + firstName + "/lastName=" + lastName + ")");

        PersonVO person = null;

        try
        {
            StringBuilder hql = new StringBuilder();
            hql.append(" FROM ").append(getEntityClass().getName()).append(" e ");
View Full Code Here

TOP

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

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.