Tribune

Home » Liferay Portal » English » 3. Development

Vista Combinata Vista Piatta Vista ad Albero
Discussioni [ Precedente | Successivo ]
toggle
Andrew Jardine
5.2.3 API Help
12 giugno 2012 8.38
Risposta

Andrew Jardine

Community Moderator

Punteggio: Liferay Legend

Messaggi: 1087

Data di Iscrizione: 22 dicembre 2010

Messaggi recenti

Hi,

I realize this is the lamest post on the forum right now but i need more eyes. I'm used to working with Liferay 6+ where the User model object has methods on it (as part of the API) to retrieve Addresses and Phone number collections assigned to them. I have zero experience with 5.2.3 but know that the methodology is sound. So, Here is what I am doing -

1. Retrieve my list of organization ids (that I am trying to report on)
2. For each orgnization, get the list of users assigned to it
3. For each user in the list, append their details to a StringBuffer for the CSV report

... now for the raw fields like, first, last, email, its easy. But I can't see in the 5.2.3 API how I can retrieve their address(es) and phone number(s). Can someone point out the obvious to me?
Marco Re
RE: 5.2.3 API Help
13 giugno 2012 15.48
Risposta

Marco Re

Punteggio: Junior Member

Messaggi: 29

Data di Iscrizione: 30 luglio 2009

Messaggi recenti

Hi Andrew,
this is what you are looking for :
 1
 2List<Address> addresses = AddressLocalServiceUtil.getAddresses(
 3        user.getCompanyId(), Contact.class.getName(),
 4        user.getContact().getContactId());
 5List<Phone> phones = PhoneLocalServiceUtil.getPhones(
 6        user.getCompanyId(), Contact.class.getName(),
 7        user.getContact().getContactId());
 8List<Website> websites = WebsiteLocalServiceUtil.getWebsites(
 9        user.getCompanyId(), Contact.class.getName(),
10        user.getContact().getContactId());