1
19
20 package com.liferay.portal.service.impl;
21
22 import com.liferay.portal.PortalException;
23 import com.liferay.portal.SystemException;
24 import com.liferay.portal.model.Contact;
25 import com.liferay.portal.service.base.ContactLocalServiceBaseImpl;
26
27
33 public class ContactLocalServiceImpl extends ContactLocalServiceBaseImpl {
34
35 public Contact getContact(long contactId)
36 throws PortalException, SystemException {
37
38 return contactPersistence.findByPrimaryKey(contactId);
39 }
40
41 public void deleteContact(long contactId) throws SystemException {
42 Contact contact = contactPersistence.fetchByPrimaryKey(contactId);
43
44 if (contact != null) {
45 deleteContact(contact);
46 }
47 }
48
49 public void deleteContact(Contact contact) throws SystemException {
50
51
53 addressLocalService.deleteAddresses(
54 contact.getCompanyId(), Contact.class.getName(),
55 contact.getContactId());
56
57
59 emailAddressLocalService.deleteEmailAddresses(
60 contact.getCompanyId(), Contact.class.getName(),
61 contact.getContactId());
62
63
65 phoneLocalService.deletePhones(
66 contact.getCompanyId(), Contact.class.getName(),
67 contact.getContactId());
68
69
71 websiteLocalService.deleteWebsites(
72 contact.getCompanyId(), Contact.class.getName(),
73 contact.getContactId());
74
75
77 contactPersistence.remove(contact);
78 }
79
80 }