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);
}
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;
}
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;
}
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;
}
Aggregations