Search in sources :

Example 1 with ContactInfo

use of com.autentia.tnt.businessobject.ContactInfo in project TNTConcept by autentia.

the class ContactPositionManagerTest method insertContactData.

/**
 * Metodo encargado de insertar los datos de los propios contactos
 */
private void insertContactData() {
    final PositionDAO positionDAO = (PositionDAO) SpringUtilsForTesting.getSpringBean("daoPosition");
    final ContactDAO contactDAO = (ContactDAO) SpringUtilsForTesting.getSpringBean("daoContact");
    // puestos
    becario.setName("becario");
    becario.setDescription("becario");
    becario.setEmail("becario@dominio.com");
    becario.setPhone("+344343");
    becario.setFax("+341212");
    becario.setCountry("España");
    becario.setProvince(province);
    becario.setCity("barbate");
    becario.setPostalCode("10111");
    becario.setAddress("C/ Becario");
    positionDAO.insert(becario);
    responsableDireccion.setName("Responsable de Dirección");
    responsableDireccion.setDescription("Responsable de Dirección");
    responsableDireccion.setEmail("responsableDireccion@dominio.com");
    responsableDireccion.setPhone("+344343");
    responsableDireccion.setFax("+341212");
    responsableDireccion.setCountry("España");
    responsableDireccion.setProvince(province);
    responsableDireccion.setCity("barbate");
    responsableDireccion.setPostalCode("10111");
    responsableDireccion.setAddress("C/ Becario");
    positionDAO.insert(responsableDireccion);
    responsableFacturacion.setName("Responsable de Facturación");
    responsableFacturacion.setDescription("Responsable de Facturación");
    responsableFacturacion.setEmail("responsableFacturacion@dominio.com");
    responsableFacturacion.setPhone("+344343");
    responsableFacturacion.setFax("+341212");
    responsableFacturacion.setCountry("España");
    responsableFacturacion.setProvince(province);
    responsableFacturacion.setCity("barbate");
    responsableFacturacion.setPostalCode("10111");
    responsableFacturacion.setAddress("C/ Becario");
    positionDAO.insert(responsableFacturacion);
    analista.setName("Analista");
    analista.setDescription("Analista");
    analista.setEmail("analista@dominio.com");
    analista.setPhone("+344343");
    analista.setFax("+341212");
    analista.setCountry("España");
    analista.setProvince(province);
    analista.setCity("barbate");
    analista.setPostalCode("10111");
    analista.setAddress("C/ Becario");
    positionDAO.insert(analista);
    // contactos
    antonioRuiz.setName("Antonio Ruiz");
    antonioRuiz.setEmail("antonio@dominio.com");
    antonioRuiz.setPhone("+341234");
    antonioRuiz.setFax("+349876");
    antonioRuiz.setCountry("España");
    antonioRuiz.setProvince(province);
    antonioRuiz.setCity("Casarrubuelos de arriba");
    antonioRuiz.setPostalCode("90666");
    antonioRuiz.setAddress("C/ Antonio Ruiz");
    contactDAO.insert(antonioRuiz);
    pilarSancho.setName("Pilar M. de Sancho");
    pilarSancho.setEmail("pilar@dominio.com");
    pilarSancho.setPhone("+342468");
    pilarSancho.setFax("+348642");
    pilarSancho.setCountry("España");
    pilarSancho.setProvince(province);
    pilarSancho.setCity("Casarrubuelos de abajo");
    pilarSancho.setPostalCode("90123");
    pilarSancho.setAddress("C/ Pilar Sancho");
    contactDAO.insert(pilarSancho);
    // relacion entre contactos y puestos
    final ContactInfo contactInfoAntonio = new ContactInfo();
    contactInfoAntonio.setContact(antonioRuiz);
    contactInfoAntonio.setDepartment(department);
    contactInfoAntonio.setOrganization(organization);
    contactInfoAntonio.setPosition(becario);
    antonioRuiz.addContactInfo(contactInfoAntonio);
    contactDAO.update(antonioRuiz);
    final ContactInfo contactInfoPilar = new ContactInfo();
    contactInfoPilar.setContact(pilarSancho);
    contactInfoPilar.setDepartment(department);
    contactInfoPilar.setOrganization(organization);
    contactInfoPilar.setPosition(analista);
    pilarSancho.addContactInfo(contactInfoPilar);
    contactDAO.update(pilarSancho);
}
Also used : PositionDAO(com.autentia.tnt.dao.hibernate.PositionDAO) ContactDAO(com.autentia.tnt.dao.hibernate.ContactDAO) ContactInfo(com.autentia.tnt.businessobject.ContactInfo)

Example 2 with ContactInfo

use of com.autentia.tnt.businessobject.ContactInfo in project TNTConcept by autentia.

the class ContactBean method deleteContactInfo.

public String deleteContactInfo() {
    UIData table = (UIData) FacesUtils.getComponent("contact:contactInfos");
    ContactInfo toDelete = (ContactInfo) table.getRowData();
    contact.removeContactInfo(toDelete);
    return NavigationResults.EDIT;
}
Also used : ContactInfo(com.autentia.tnt.businessobject.ContactInfo) UIData(javax.faces.component.UIData)

Example 3 with ContactInfo

use of com.autentia.tnt.businessobject.ContactInfo in project TNTConcept by autentia.

the class ContactBean method addPosition.

public String addPosition() {
    final ContactInfo contactInfo = new ContactInfo();
    contactInfo.setContact(contact);
    contactInfo.setDepartment(selectedDepartment);
    contactInfo.setOrganization(selectedOrganization);
    contactInfo.setPosition(selectedPosition);
    // if (contact.getContactInfos() == null) {
    // contact.setContactInfos(new LinkedHashSet<ContactInfo>());
    // }
    contact.addContactInfo(contactInfo);
    selectedOrganization = null;
    selectedDepartment = null;
    selectedPosition = null;
    for (ContactInfo contactInf : contact.getContactInfos()) {
        final ContactInfo c = new ContactInfo();
        c.setContact(contactInf.getContact());
        c.setDepartment(contactInf.getDepartment());
        c.setOrganization(contactInf.getOrganization());
        c.setPosition(contactInf.getPosition());
    }
    return NavigationResults.EDIT;
}
Also used : ContactInfo(com.autentia.tnt.businessobject.ContactInfo)

Example 4 with ContactInfo

use of com.autentia.tnt.businessobject.ContactInfo in project TNTConcept by autentia.

the class ContactManager method addOrganizationDepartmentOrPositionByDefault.

public Contact addOrganizationDepartmentOrPositionByDefault(final Contact contact, final Organization organization, final Department department, final Position position) {
    try {
        if (organization != null) {
            Department selectedDepartment = null;
            Position selectedPosition = null;
            if (department == null) {
                final DepartmentSearch departmentSearch = new DepartmentSearch();
                departmentSearch.setName("Indefinido");
                selectedDepartment = DepartmentDAO.getDefault().search(departmentSearch, new SortCriteria("id")).get(0);
            } else {
                selectedDepartment = department;
            }
            if (position == null) {
                final PositionSearch positionSearch = new PositionSearch();
                positionSearch.setName("Indefinido");
                selectedPosition = PositionDAO.getDefault().search(positionSearch, new SortCriteria("id")).get(0);
            } else {
                selectedPosition = position;
            }
            final ContactInfo contactInfo = new ContactInfo();
            contactInfo.setContact(contact);
            contactInfo.setOrganization(organization);
            contactInfo.setDepartment(selectedDepartment);
            contactInfo.setPosition(selectedPosition);
            contact.addContactInfo(contactInfo);
            this.updateEntity(contact);
        }
    } catch (Exception e) {
        log.error("addOrganizationDepartmentOrPositionByDefault - Error ", e);
    }
    return contact;
}
Also used : SortCriteria(com.autentia.tnt.dao.SortCriteria) PositionSearch(com.autentia.tnt.dao.search.PositionSearch) Department(com.autentia.tnt.businessobject.Department) ContactPosition(com.autentia.tnt.manager.contacts.advancedsearch.ContactPosition) Position(com.autentia.tnt.businessobject.Position) DepartmentSearch(com.autentia.tnt.dao.search.DepartmentSearch) ContactInfo(com.autentia.tnt.businessobject.ContactInfo)

Aggregations

ContactInfo (com.autentia.tnt.businessobject.ContactInfo)4 Department (com.autentia.tnt.businessobject.Department)1 Position (com.autentia.tnt.businessobject.Position)1 SortCriteria (com.autentia.tnt.dao.SortCriteria)1 ContactDAO (com.autentia.tnt.dao.hibernate.ContactDAO)1 PositionDAO (com.autentia.tnt.dao.hibernate.PositionDAO)1 DepartmentSearch (com.autentia.tnt.dao.search.DepartmentSearch)1 PositionSearch (com.autentia.tnt.dao.search.PositionSearch)1 ContactPosition (com.autentia.tnt.manager.contacts.advancedsearch.ContactPosition)1 UIData (javax.faces.component.UIData)1