Example usage for com.liferay.portal.kernel.model Organization isParentable

List of usage examples for com.liferay.portal.kernel.model Organization isParentable

Introduction

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

Prototype

public boolean isParentable();

Source Link

Usage

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

License:Open Source License

/**
 * Returns child organization based on bemisCustId
 * @param bemisCustomerId/*from  ww w.ja v  a 2s. c  om*/
 * @return
 * @throws PortalException
 */
@Override
public Organization getOrganization(String bemisCustomerId) throws PortalException {

    long companyId = _bemisPortalService.getDefaultCompanyId();

    long classNameId = _classNameLocalService.getClassNameId(Organization.class);

    List<ExpandoValue> values = _expandoValueLocalService.getColumnValues(companyId, classNameId,
            ExpandoTableConstants.DEFAULT_TABLE_NAME, BEMIS_CUSTOMER_ID, bemisCustomerId, -1, -1);

    if (values.isEmpty()) {
        return null;
    }

    for (ExpandoValue value : values) {
        long organizationId = value.getClassPK();

        Organization organization = _organizationLocalService.getOrganization(organizationId);

        if (organization.isParentable()) {
            continue;
        }

        return organization;
    }

    return null;
}