1
22
23 package com.liferay.portal.service.impl;
24
25 import com.liferay.portal.NoSuchContactException;
26 import com.liferay.portal.PortalException;
27 import com.liferay.portal.SystemException;
28 import com.liferay.portal.model.Contact;
29 import com.liferay.portal.service.base.ContactLocalServiceBaseImpl;
30
31
37 public class ContactLocalServiceImpl extends ContactLocalServiceBaseImpl {
38
39 public Contact getContact(long contactId)
40 throws PortalException, SystemException {
41
42 return contactPersistence.findByPrimaryKey(contactId);
43 }
44
45 public void deleteContact(long contactId) throws SystemException {
46 try {
47 Contact contact = contactPersistence.findByPrimaryKey(contactId);
48
49 deleteContact(contact);
50 }
51 catch (NoSuchContactException nsce) {
52 }
53 }
54
55 public void deleteContact(Contact contact) throws SystemException {
56
57
59 addressLocalService.deleteAddresses(
60 contact.getCompanyId(), Contact.class.getName(),
61 contact.getContactId());
62
63
65 emailAddressLocalService.deleteEmailAddresses(
66 contact.getCompanyId(), Contact.class.getName(),
67 contact.getContactId());
68
69
71 phoneLocalService.deletePhones(
72 contact.getCompanyId(), Contact.class.getName(),
73 contact.getContactId());
74
75
77 websiteLocalService.deleteWebsites(
78 contact.getCompanyId(), Contact.class.getName(),
79 contact.getContactId());
80
81
83 contactPersistence.remove(contact);
84 }
85
86 }