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

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

Introduction

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

Prototype

public Organization getParentOrganization() throws com.liferay.portal.kernel.exception.PortalException;

Source Link

Usage

From source file:com.liferay.users.admin.internal.exportimport.data.handler.OrganizationStagedModelDataHandler.java

License:Open Source License

@Override
protected void doExportStagedModel(PortletDataContext portletDataContext, Organization organization)
        throws Exception {

    Queue<Organization> organizations = new LinkedList<>();

    organizations.add(organization);/*  w w w . j  a v  a 2s. com*/

    while (!organizations.isEmpty()) {
        Organization exportedOrganization = organizations.remove();

        if (exportedOrganization
                .getParentOrganizationId() != OrganizationConstants.DEFAULT_PARENT_ORGANIZATION_ID) {

            StagedModelDataHandlerUtil.exportReferenceStagedModel(portletDataContext, exportedOrganization,
                    exportedOrganization.getParentOrganization(), PortletDataContext.REFERENCE_TYPE_PARENT);
        }

        exportAddresses(portletDataContext, exportedOrganization);
        exportEmailAddresses(portletDataContext, exportedOrganization);
        exportOrgLabors(portletDataContext, exportedOrganization);
        exportPasswordPolicyRel(portletDataContext, exportedOrganization);
        exportPhones(portletDataContext, exportedOrganization);
        exportWebsites(portletDataContext, exportedOrganization);

        Element organizationElement = portletDataContext.getExportDataElement(exportedOrganization);

        portletDataContext.addClassedModel(organizationElement,
                ExportImportPathUtil.getModelPath(exportedOrganization), exportedOrganization);

        organizations.addAll(exportedOrganization.getSuborganizations());
    }
}