Example usage for com.liferay.portal.kernel.service OrganizationServiceUtil getOrganization

List of usage examples for com.liferay.portal.kernel.service OrganizationServiceUtil getOrganization

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.service OrganizationServiceUtil getOrganization.

Prototype

public static com.liferay.portal.kernel.model.Organization getOrganization(long organizationId)
        throws com.liferay.portal.kernel.exception.PortalException 

Source Link

Document

Returns the organization with the primary key.

Usage

From source file:com.liferay.users.admin.web.internal.portlet.action.ActionUtil.java

License:Open Source License

public static Organization getOrganization(HttpServletRequest request) throws Exception {

    long organizationId = ParamUtil.getLong(request, "organizationId");

    Organization organization = null;//w w  w  .  j a  v  a2  s  .co m

    if (organizationId > 0) {
        organization = OrganizationServiceUtil.getOrganization(organizationId);
    }

    request.setAttribute(WebKeys.ORGANIZATION, organization);

    return organization;
}

From source file:com.liferay.users.admin.web.internal.search.OrganizationUserChecker.java

License:Open Source License

@Override
protected String getRowCheckBox(HttpServletRequest request, boolean checked, boolean disabled, String name,
        String value, String checkBoxRowIds, String checkBoxAllRowIds, String checkBoxPostOnClick) {

    try {/*ww w. j ava 2s.  com*/
        long organizationId = GetterUtil.getLong(value);

        OrganizationServiceUtil.getOrganization(organizationId);

        name += Organization.class.getSimpleName();
    } catch (Exception e1) {
        if (e1 instanceof NoSuchOrganizationException) {
            try {
                long userId = GetterUtil.getLong(value);

                UserServiceUtil.getUserById(userId);

                name += User.class.getSimpleName();
            } catch (Exception e2) {
                return StringPool.BLANK;
            }
        }
    }

    return super.getRowCheckBox(request, checked, disabled, name, value, checkBoxRowIds, checkBoxAllRowIds,
            checkBoxPostOnClick);
}

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

License:Open Source License

@Override
public Organization getOrganization(long organizationId) throws PortalException {

    _log.info("Getting organization information for organizatin with id: " + String.valueOf(organizationId));

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

    PortalPermissionUtil.check(getPermissionChecker(), AngularActionKeys.LIST_ORGANIZATIONS);

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

    Organization organization = OrganizationServiceUtil.getOrganization(organizationId);
    return organization;
}

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

License:Open Source License

@Override
public List<User> getOrganizationUsers(long organizationId) throws PortalException {

    _log.info("Getting users for organization id: " + String.valueOf(organizationId));

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

    PortalPermissionUtil.check(getPermissionChecker(), AngularActionKeys.LIST_ORGANIZATIONS);
    PortalPermissionUtil.check(getPermissionChecker(), AngularActionKeys.LIST_USERS);

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

    Organization organization = OrganizationServiceUtil.getOrganization(organizationId);
    List<User> organizationUsers = null;

    if (organization != null) {

        organizationUsers = UserLocalServiceUtil.getOrganizationUsers(organizationId);

    }/*w w  w .  j av a  2  s. c  o m*/

    return organizationUsers;
}

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

License:Open Source License

@Override
public List<Address> getOrganizationAdresses(long organizationId) throws PortalException {

    _log.info("Getting organization address for organization id: " + String.valueOf(organizationId));

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

    PortalPermissionUtil.check(getPermissionChecker(), AngularActionKeys.LIST_ORGANIZATIONS);

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

    Organization organization = OrganizationServiceUtil.getOrganization(organizationId);
    List<Address> addresses = null;

    if (organization != null) {
        addresses = organization.getAddresses();
    }//from   w w  w.jav a  2  s  .c o  m

    return addresses;
}

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

License:Open Source License

@Override
public List<Phone> getOrganizationPhones(long organizationId) throws PortalException {

    _log.info("getting phones for organization id: " + String.valueOf(organizationId));

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

    PortalPermissionUtil.check(getPermissionChecker(), AngularActionKeys.DELETE_COMMUNITY);

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

    Organization organization = OrganizationServiceUtil.getOrganization(organizationId);
    List<Phone> phones = null;

    if (organization != null) {

        long companyId = organization.getCompanyId();

        phones = PhoneLocalServiceUtil.getPhones(companyId, Organization.class.getName(),
                organization.getOrganizationId());

    }/* ww w  . j  av  a2s .  c  o  m*/

    return phones;
}

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

License:Open Source License

@Override
public List<EmailAddress> getOrganizationEmailAddresses(long organizationId) throws PortalException {

    _log.info("Getting email addresses for organization id: " + String.valueOf(organizationId));

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

    PortalPermissionUtil.check(getPermissionChecker(), AngularActionKeys.LIST_ORGANIZATIONS);

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

    Organization organization = OrganizationServiceUtil.getOrganization(organizationId);
    long companyId = organization.getCompanyId();

    List<EmailAddress> emailAddresses = null;

    if (organization != null) {
        emailAddresses = EmailAddressLocalServiceUtil.getEmailAddresses(companyId, Organization.class.getName(),
                organization.getOrganizationId());
    }/*from  ww w .java  2  s  .  c o  m*/

    return emailAddresses;
}

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

License:Open Source License

@Override
public List<Website> getOrganizationWebsites(long organizationId) throws PortalException {

    _log.info("Getting websites for organization id: " + String.valueOf(organizationId));

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

    PortalPermissionUtil.check(getPermissionChecker(), AngularActionKeys.LIST_ORGANIZATIONS);

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

    Organization organization = OrganizationServiceUtil.getOrganization(organizationId);

    List<Website> organizationWebsites = null;

    if (organization != null) {

        long companyId = organization.getCompanyId();
        organizationWebsites = WebsiteLocalServiceUtil.getWebsites(companyId, Organization.class.getName(),
                organization.getOrganizationId());

    }/*from w  ww  . j  a va  2s.  c om*/

    return organizationWebsites;
}