Example usage for com.liferay.portal.kernel.model User getOrganizations

List of usage examples for com.liferay.portal.kernel.model User getOrganizations

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.model User getOrganizations.

Prototype

public java.util.List<Organization> getOrganizations()
            throws com.liferay.portal.kernel.exception.PortalException;

Source Link

Usage

From source file:com.bemis.portal.customer.service.impl.CustomerProfileLocalServiceImpl.java

License:Open Source License

@Override
public List<CustomerProfile> getBemisCustomerProfiles(User user) {
    List<CustomerProfile> customerProfiles = new ArrayList<>();

    try {/*from w  w  w . j  av  a  2s . c  o m*/
        List<Organization> userOrganizations = user.getOrganizations();

        for (Organization organization : userOrganizations) {
            customerProfiles.add(getCustomerProfile(organization.getOrganizationId()));
        }
    } catch (PortalException pe) {
        _log.error("Failed to retrieve organizations for user " + user + ": " + pe);
    }

    return customerProfiles;
}

From source file:com.liferay.osb.scv.connector.internal.model.SCVOrganization.java

License:Open Source License

@Override
public List<Organization> getModels(User user) throws Exception {
    return user.getOrganizations();
}

From source file:eu.gerhards.liferay.services.angular.service.impl.AngularUserServiceImpl.java

License:Open Source License

@Override
public List<Organization> getUserOrganizations(long userId) throws PortalException {

    _log.info("Getting organizations for user with id: " + String.valueOf(userId));

    _log.debug("    ... security check ...");

    PortalPermissionUtil.check(getPermissionChecker(), ActionKeys.VIEW);

    _log.debug("    ... getting information");

    User user = UserLocalServiceUtil.getUser(userId);
    List<Organization> organizations = new ArrayList<>();

    if (user != null) {
        organizations = user.getOrganizations();
    }//w w  w  .  j av  a 2s.c o  m

    return organizations;
}