Example usage for com.liferay.portal.kernel.model ClassedModel getExpandoBridge

List of usage examples for com.liferay.portal.kernel.model ClassedModel getExpandoBridge

Introduction

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

Prototype

public ExpandoBridge getExpandoBridge();

Source Link

Usage

From source file:com.liferay.exportimport.lar.PortletDataContextImpl.java

License:Open Source License

protected void addExpando(Element element, String path, ClassedModel classedModel, Class<?> clazz) {

    String className = clazz.getName();

    if (!_expandoColumnsMap.containsKey(className)) {
        List<ExpandoColumn> expandoColumns = ExpandoColumnLocalServiceUtil.getDefaultTableColumns(_companyId,
                className);//from  ww w.ja va2 s .  c o m

        for (ExpandoColumn expandoColumn : expandoColumns) {
            addPermissions(ExpandoColumn.class, Long.valueOf(expandoColumn.getColumnId()));
        }

        _expandoColumnsMap.put(className, expandoColumns);
    }

    ExpandoBridge expandoBridge = classedModel.getExpandoBridge();

    if (expandoBridge == null) {
        return;
    }

    Map<String, Serializable> expandoBridgeAttributes = expandoBridge.getAttributes();

    if (!expandoBridgeAttributes.isEmpty()) {
        String expandoPath = ExportImportPathUtil.getExpandoPath(path);

        element.addAttribute("expando-path", expandoPath);

        addZipEntry(expandoPath, expandoBridgeAttributes);
    }
}