Example usage for com.liferay.portal.kernel.service ServiceContext setUuid

List of usage examples for com.liferay.portal.kernel.service ServiceContext setUuid

Introduction

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

Prototype

public void setUuid(String uuid) 

Source Link

Document

Sets the UUID of this service context's current entity.

Usage

From source file:com.liferay.asset.categories.admin.web.internal.exportimport.data.handler.AssetCategoryStagedModelDataHandler.java

License:Open Source License

@Override
protected void doImportStagedModel(PortletDataContext portletDataContext, AssetCategory category)
        throws Exception {

    long userId = portletDataContext.getUserId(category.getUserUuid());

    Map<Long, Long> vocabularyIds = (Map<Long, Long>) portletDataContext
            .getNewPrimaryKeysMap(AssetVocabulary.class);

    long vocabularyId = MapUtil.getLong(vocabularyIds, category.getVocabularyId(), category.getVocabularyId());

    Map<Long, Long> categoryIds = (Map<Long, Long>) portletDataContext
            .getNewPrimaryKeysMap(AssetCategory.class);

    long parentCategoryId = MapUtil.getLong(categoryIds, category.getParentCategoryId(),
            category.getParentCategoryId());

    Element categoryElement = portletDataContext.getImportDataElement(category);

    List<Element> propertyElements = categoryElement.elements("property");

    String[] properties = new String[propertyElements.size()];

    for (int i = 0; i < propertyElements.size(); i++) {
        Element propertyElement = propertyElements.get(i);

        String key = propertyElement.attributeValue("key");
        String value = propertyElement.attributeValue("value");

        properties[i] = key.concat(AssetCategoryConstants.PROPERTY_KEY_VALUE_SEPARATOR).concat(value);
    }//from w ww. j  av  a  2  s  .c  o  m

    ServiceContext serviceContext = createServiceContext(portletDataContext, category);

    AssetCategory importedCategory = null;

    AssetCategory existingCategory = fetchStagedModelByUuidAndGroupId(category.getUuid(),
            portletDataContext.getScopeGroupId());

    if (existingCategory == null) {
        String name = getCategoryName(null, portletDataContext.getScopeGroupId(), parentCategoryId,
                category.getName(), vocabularyId, 2);

        serviceContext.setUuid(category.getUuid());

        importedCategory = _assetCategoryLocalService.addCategory(userId, portletDataContext.getScopeGroupId(),
                parentCategoryId, getCategoryTitleMap(portletDataContext.getScopeGroupId(), category, name),
                category.getDescriptionMap(), vocabularyId, properties, serviceContext);
    } else {
        String name = getCategoryName(category.getUuid(), portletDataContext.getScopeGroupId(),
                parentCategoryId, category.getName(), vocabularyId, 2);

        importedCategory = _assetCategoryLocalService.updateCategory(userId, existingCategory.getCategoryId(),
                parentCategoryId, getCategoryTitleMap(portletDataContext.getScopeGroupId(), category, name),
                category.getDescriptionMap(), vocabularyId, properties, serviceContext);
    }

    categoryIds.put(category.getCategoryId(), importedCategory.getCategoryId());

    Map<String, String> categoryUuids = (Map<String, String>) portletDataContext
            .getNewPrimaryKeysMap(AssetCategory.class + ".uuid");

    categoryUuids.put(category.getUuid(), importedCategory.getUuid());

    portletDataContext.importPermissions(AssetCategory.class, category.getCategoryId(),
            importedCategory.getCategoryId());
}

From source file:com.liferay.asset.categories.admin.web.internal.exportimport.data.handler.AssetVocabularyStagedModelDataHandler.java

License:Open Source License

@Override
protected void doImportStagedModel(PortletDataContext portletDataContext, AssetVocabulary vocabulary)
        throws Exception {

    long userId = portletDataContext.getUserId(vocabulary.getUserUuid());

    ServiceContext serviceContext = createServiceContext(portletDataContext, vocabulary);

    vocabulary.setSettings(getImportSettings(portletDataContext, vocabulary));

    AssetVocabulary importedVocabulary = null;

    AssetVocabulary existingVocabulary = fetchStagedModelByUuidAndGroupId(vocabulary.getUuid(),
            portletDataContext.getScopeGroupId());

    if (existingVocabulary == null) {
        String name = getVocabularyName(null, portletDataContext.getScopeGroupId(), vocabulary.getName(), 2);

        serviceContext.setUuid(vocabulary.getUuid());

        importedVocabulary = _assetVocabularyLocalService.addVocabulary(userId,
                portletDataContext.getScopeGroupId(), StringPool.BLANK,
                getVocabularyTitleMap(portletDataContext.getScopeGroupId(), vocabulary, name),
                vocabulary.getDescriptionMap(), vocabulary.getSettings(), serviceContext);
    } else {/*from   w ww.ja  v  a 2s  .  c  o m*/
        String name = getVocabularyName(vocabulary.getUuid(), portletDataContext.getScopeGroupId(),
                vocabulary.getName(), 2);

        importedVocabulary = _assetVocabularyLocalService.updateVocabulary(existingVocabulary.getVocabularyId(),
                StringPool.BLANK, getVocabularyTitleMap(portletDataContext.getScopeGroupId(), vocabulary, name),
                vocabulary.getDescriptionMap(), vocabulary.getSettings(), serviceContext);
    }

    Map<Long, Long> vocabularyIds = (Map<Long, Long>) portletDataContext
            .getNewPrimaryKeysMap(AssetVocabulary.class);

    vocabularyIds.put(vocabulary.getVocabularyId(), importedVocabulary.getVocabularyId());

    portletDataContext.importPermissions(AssetVocabulary.class, vocabulary.getVocabularyId(),
            importedVocabulary.getVocabularyId());
}

From source file:com.liferay.asset.publisher.lar.test.AssetPublisherExportImportTest.java

License:Open Source License

@Test
public void testOneDLFileEntryType() throws Exception {
    DDMStructure ddmStructure = DDMStructureTestUtil.addStructure(group.getGroupId(),
            DLFileEntryMetadata.class.getName());

    ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(group.getGroupId(),
            TestPropsValues.getUserId());

    DLFileEntryType dlFileEntryType = addDLFileEntryType(group.getGroupId(), ddmStructure.getStructureId(),
            serviceContext);//from   w w w .j a  v  a2  s.co m

    serviceContext.setUuid(ddmStructure.getUuid());

    DDMStructure importedDDMStructure = DDMStructureTestUtil.addStructure(importedGroup.getGroupId(),
            DLFileEntryMetadata.class.getName(), 0, ddmStructure.getDDMForm(), LocaleUtil.getDefault(),
            serviceContext);

    serviceContext.setUuid(dlFileEntryType.getUuid());

    DLFileEntryType importedDLFileEntryType = addDLFileEntryType(importedGroup.getGroupId(),
            importedDDMStructure.getStructureId(), serviceContext);

    Map<String, String[]> preferenceMap = new HashMap<>();

    long dlFileEntryClassNameId = PortalUtil.getClassNameId(DLFileEntry.class);

    preferenceMap.put("anyAssetType", new String[] { String.valueOf(dlFileEntryClassNameId) });

    preferenceMap.put("anyClassTypeDLFileEntryAssetRendererFactory",
            new String[] { String.valueOf(dlFileEntryType.getFileEntryTypeId()) });
    preferenceMap.put("classTypeIds", new String[] { String.valueOf(dlFileEntryType.getFileEntryTypeId()) });

    PortletPreferences portletPreferences = getImportedPortletPreferences(preferenceMap);

    long anyClassTypeDLFileEntryAssetRendererFactory = GetterUtil
            .getLong(portletPreferences.getValue("anyClassTypeDLFileEntryAssetRendererFactory", null));

    Assert.assertEquals(anyClassTypeDLFileEntryAssetRendererFactory,
            importedDLFileEntryType.getFileEntryTypeId());

    long anyAssetType = GetterUtil.getLong(portletPreferences.getValue("anyAssetType", null));

    Assert.assertEquals(dlFileEntryClassNameId, anyAssetType);

    long classTypeIds = GetterUtil.getLong(portletPreferences.getValue("classTypeIds", null));

    Assert.assertEquals(importedDLFileEntryType.getFileEntryTypeId(), classTypeIds);
}

From source file:com.liferay.asset.publisher.lar.test.AssetPublisherExportImportTest.java

License:Open Source License

@Test
public void testOneJournalStructure() throws Exception {
    DDMStructure ddmStructure = DDMStructureTestUtil.addStructure(group.getGroupId(),
            JournalArticle.class.getName());

    ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext();

    serviceContext.setUuid(ddmStructure.getUuid());

    DDMStructure importedDDMStructure = DDMStructureTestUtil.addStructure(importedGroup.getGroupId(),
            JournalArticle.class.getName(), 0, ddmStructure.getDDMForm(), LocaleUtil.getDefault(),
            serviceContext);/* w  w w.  j ava2 s.c  o  m*/

    Map<String, String[]> preferenceMap = new HashMap<>();

    long journalArticleClassNameId = PortalUtil.getClassNameId(JournalArticle.class);

    preferenceMap.put("anyAssetType", new String[] { String.valueOf(journalArticleClassNameId) });

    preferenceMap.put("anyClassTypeJournalArticleAssetRendererFactory",
            new String[] { String.valueOf(ddmStructure.getStructureId()) });
    preferenceMap.put("classTypeIds", new String[] { String.valueOf(ddmStructure.getStructureId()) });

    PortletPreferences portletPreferences = getImportedPortletPreferences(preferenceMap);

    long anyClassTypeJournalArticleAssetRendererFactory = GetterUtil
            .getLong(portletPreferences.getValue("anyClassTypeJournalArticleAssetRendererFactory", null));

    Assert.assertEquals(anyClassTypeJournalArticleAssetRendererFactory, importedDDMStructure.getStructureId());

    long anyAssetType = GetterUtil.getLong(portletPreferences.getValue("anyAssetType", null));

    Assert.assertEquals(journalArticleClassNameId, anyAssetType);

    long classTypeIds = GetterUtil.getLong(portletPreferences.getValue("classTypeIds", null));

    Assert.assertEquals(importedDDMStructure.getStructureId(), classTypeIds);
}

From source file:com.liferay.asset.publisher.lar.test.AssetPublisherExportImportTest.java

License:Open Source License

@Test
public void testSeveralDLFileEntryTypes() throws Exception {
    DDMStructure ddmStructure1 = DDMStructureTestUtil.addStructure(group.getGroupId(),
            DLFileEntryMetadata.class.getName());

    ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(group.getGroupId(),
            TestPropsValues.getUserId());

    DLFileEntryType dlFileEntryType1 = addDLFileEntryType(group.getGroupId(), ddmStructure1.getStructureId(),
            serviceContext);// w  ww .j  a va 2 s. c o  m

    serviceContext.setUuid(ddmStructure1.getUuid());

    DDMStructure importedDDMStructure1 = DDMStructureTestUtil.addStructure(importedGroup.getGroupId(),
            DLFileEntryMetadata.class.getName(), 0, ddmStructure1.getDDMForm(), LocaleUtil.getDefault(),
            serviceContext);

    serviceContext.setUuid(dlFileEntryType1.getUuid());

    DLFileEntryType importedDLFileEntryType1 = addDLFileEntryType(importedGroup.getGroupId(),
            importedDDMStructure1.getStructureId(), serviceContext);

    DDMStructure ddmStructure2 = DDMStructureTestUtil.addStructure(group.getGroupId(),
            DLFileEntryMetadata.class.getName());

    serviceContext.setUuid(null);

    DLFileEntryType dlFileEntryType2 = addDLFileEntryType(group.getGroupId(), ddmStructure2.getStructureId(),
            serviceContext);

    serviceContext.setUuid(ddmStructure2.getUuid());

    DDMStructure importedDDMStructure2 = DDMStructureTestUtil.addStructure(importedGroup.getGroupId(),
            DLFileEntryMetadata.class.getName(), 0, ddmStructure2.getDDMForm(), LocaleUtil.getDefault(),
            serviceContext);

    serviceContext.setUuid(dlFileEntryType2.getUuid());

    DLFileEntryType importedDLFileEntryType2 = addDLFileEntryType(importedGroup.getGroupId(),
            importedDDMStructure2.getStructureId(), serviceContext);

    Map<String, String[]> preferenceMap = new HashMap<>();

    long dlFileEntryClassNameId = PortalUtil.getClassNameId(DLFileEntry.class);

    preferenceMap.put("anyAssetType", new String[] { String.valueOf(dlFileEntryClassNameId) });

    preferenceMap.put("anyClassTypeDLFileEntryAssetRendererFactory",
            new String[] { String.valueOf(Boolean.FALSE) });

    preferenceMap.put("classTypeIdsDLFileEntryAssetRendererFactory",
            new String[] { String.valueOf(dlFileEntryType1.getFileEntryTypeId()),
                    String.valueOf(dlFileEntryType2.getFileEntryTypeId()) });

    PortletPreferences portletPreferences = getImportedPortletPreferences(preferenceMap);

    Assert.assertEquals(
            importedDLFileEntryType1.getFileEntryTypeId() + StringPool.COMMA
                    + importedDLFileEntryType2.getFileEntryTypeId(),
            StringUtil
                    .merge(portletPreferences.getValues("classTypeIdsDLFileEntryAssetRendererFactory", null)));
}

From source file:com.liferay.asset.publisher.lar.test.AssetPublisherExportImportTest.java

License:Open Source License

@Test
public void testSeveralJournalStructures() throws Exception {
    DDMStructure ddmStructure1 = DDMStructureTestUtil.addStructure(group.getGroupId(),
            JournalArticle.class.getName());

    ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext();

    serviceContext.setUuid(ddmStructure1.getUuid());

    DDMStructure importedDDMStructure1 = DDMStructureTestUtil.addStructure(importedGroup.getGroupId(),
            JournalArticle.class.getName(), 0, ddmStructure1.getDDMForm(), LocaleUtil.getDefault(),
            serviceContext);/*from  w  w  w . j a v a  2s  . c o m*/

    DDMStructure ddmStructure2 = DDMStructureTestUtil.addStructure(group.getGroupId(),
            JournalArticle.class.getName());

    serviceContext.setUuid(ddmStructure2.getUuid());

    DDMStructure importedDDMStructure2 = DDMStructureTestUtil.addStructure(importedGroup.getGroupId(),
            JournalArticle.class.getName(), 0, ddmStructure1.getDDMForm(), LocaleUtil.getDefault(),
            serviceContext);

    Map<String, String[]> preferenceMap = new HashMap<>();

    long journalArticleClassNameId = PortalUtil.getClassNameId(JournalArticle.class);

    preferenceMap.put("anyAssetType", new String[] { String.valueOf(journalArticleClassNameId) });

    preferenceMap.put("anyClassTypeJournalArticleAssetRendererFactory",
            new String[] { String.valueOf(Boolean.FALSE) });

    preferenceMap.put("classTypeIdsJournalArticleAssetRendererFactory", new String[] {
            String.valueOf(ddmStructure1.getStructureId()), String.valueOf(ddmStructure2.getStructureId()) });

    PortletPreferences portletPreferences = getImportedPortletPreferences(preferenceMap);

    Assert.assertEquals(
            importedDDMStructure1.getStructureId() + StringPool.COMMA + importedDDMStructure2.getStructureId(),
            StringUtil.merge(
                    portletPreferences.getValues("classTypeIdsJournalArticleAssetRendererFactory", null)));
}

From source file:com.liferay.asset.tags.internal.exportimport.data.handler.AssetTagStagedModelDataHandler.java

License:Open Source License

@Override
protected void doImportStagedModel(PortletDataContext portletDataContext, AssetTag assetTag) throws Exception {

    long userId = portletDataContext.getUserId(assetTag.getUserUuid());

    ServiceContext serviceContext = createServiceContext(portletDataContext, assetTag);

    AssetTag existingAssetTag = fetchStagedModelByUuidAndGroupId(assetTag.getUuid(),
            portletDataContext.getScopeGroupId());

    if (portletDataContext.getBooleanParameter(AssetTagsPortletDataHandler.NAMESPACE, "merge-tags-by-name",
            false)) {//from  w w  w.  ja v a 2  s.c o m

        Optional<AssetTag> assetTagOptional = Optional.ofNullable(
                _assetTagLocalService.fetchTag(portletDataContext.getScopeGroupId(), assetTag.getName()));

        existingAssetTag = assetTagOptional.orElse(existingAssetTag);
    }

    AssetTag importedAssetTag = null;

    if (existingAssetTag == null) {
        serviceContext.setUuid(assetTag.getUuid());

        try {
            importedAssetTag = _assetTagLocalService.addTag(userId, portletDataContext.getScopeGroupId(),
                    assetTag.getName(), serviceContext);
        } catch (DuplicateTagException dte) {
            if (_log.isDebugEnabled()) {
                _log.debug(dte);
            }

            importedAssetTag = _assetTagLocalService.addTag(userId, portletDataContext.getScopeGroupId(),
                    assetTag.getName() + " (Duplicate)", serviceContext);
        }
    } else {
        try {
            importedAssetTag = _assetTagLocalService.updateTag(userId, existingAssetTag.getTagId(),
                    assetTag.getName(), serviceContext);
        } catch (DuplicateTagException dte) {
            if (_log.isDebugEnabled()) {
                _log.debug(dte);
            }

            importedAssetTag = _assetTagLocalService.updateTag(userId, existingAssetTag.getTagId(),
                    assetTag.getName() + " (Duplicate)", serviceContext);
        }
    }

    portletDataContext.importClassedModel(assetTag, importedAssetTag);
}

From source file:com.liferay.blogs.internal.exportimport.data.handler.BlogsEntryStagedModelDataHandler.java

License:Open Source License

@Override
protected void doImportStagedModel(PortletDataContext portletDataContext, BlogsEntry entry) throws Exception {

    long userId = portletDataContext.getUserId(entry.getUserUuid());

    Element entryElement = portletDataContext.getImportDataStagedModelElement(entry);

    String content = _exportImportContentProcessorController.replaceImportContentReferences(portletDataContext,
            entry, entry.getContent());//from w  w  w . j  a  va 2s. com

    entry.setContent(content);

    Calendar displayDateCal = CalendarFactoryUtil.getCalendar();

    displayDateCal.setTime(entry.getDisplayDate());

    int displayDateMonth = displayDateCal.get(Calendar.MONTH);
    int displayDateDay = displayDateCal.get(Calendar.DATE);
    int displayDateYear = displayDateCal.get(Calendar.YEAR);
    int displayDateHour = displayDateCal.get(Calendar.HOUR);
    int displayDateMinute = displayDateCal.get(Calendar.MINUTE);

    if (displayDateCal.get(Calendar.AM_PM) == Calendar.PM) {
        displayDateHour += 12;
    }

    boolean allowPingbacks = entry.isAllowPingbacks();
    boolean allowTrackbacks = entry.isAllowTrackbacks();
    String[] trackbacks = StringUtil.split(entry.getTrackbacks());

    ServiceContext serviceContext = portletDataContext.createServiceContext(entry);

    BlogsEntry importedEntry = null;

    if (portletDataContext.isDataStrategyMirror()) {
        BlogsEntry existingEntry = fetchStagedModelByUuidAndGroupId(entry.getUuid(),
                portletDataContext.getScopeGroupId());

        if (existingEntry == null) {
            serviceContext.setUuid(entry.getUuid());

            importedEntry = _blogsEntryLocalService.addEntry(userId, entry.getTitle(), entry.getSubtitle(),
                    entry.getDescription(), entry.getContent(), displayDateMonth, displayDateDay,
                    displayDateYear, displayDateHour, displayDateMinute, allowPingbacks, allowTrackbacks,
                    trackbacks, entry.getCoverImageCaption(), null, null, serviceContext);
        } else {
            importedEntry = _blogsEntryLocalService.updateEntry(userId, existingEntry.getEntryId(),
                    entry.getTitle(), entry.getSubtitle(), entry.getDescription(), entry.getContent(),
                    displayDateMonth, displayDateDay, displayDateYear, displayDateHour, displayDateMinute,
                    allowPingbacks, allowTrackbacks, trackbacks, entry.getCoverImageCaption(),
                    new ImageSelector(), new ImageSelector(), serviceContext);
        }
    } else {
        importedEntry = _blogsEntryLocalService.addEntry(userId, entry.getTitle(), entry.getSubtitle(),
                entry.getDescription(), entry.getContent(), displayDateMonth, displayDateDay, displayDateYear,
                displayDateHour, displayDateMinute, allowPingbacks, allowTrackbacks, trackbacks,
                entry.getCoverImageCaption(), null, null, serviceContext);
    }

    if ((entry.getCoverImageFileEntryId() == 0) && Validator.isNull(entry.getCoverImageURL())
            && (entry.getSmallImageFileEntryId() == 0) && Validator.isNull(entry.getSmallImageURL())
            && !entry.isSmallImage()) {

        portletDataContext.importClassedModel(entry, importedEntry);

        return;
    }

    // Cover image

    ImageSelector coverImageSelector = null;

    List<Element> attachmentElements = portletDataContext.getReferenceDataElements(entry, DLFileEntry.class,
            PortletDataContext.REFERENCE_TYPE_WEAK);

    if (Validator.isNotNull(entry.getCoverImageURL())) {
        coverImageSelector = new ImageSelector(entry.getCoverImageURL());
    } else if (entry.getCoverImageFileEntryId() != 0) {
        coverImageSelector = _getImageSelector(portletDataContext, entry.getCoverImageFileEntryId(),
                attachmentElements);
    }

    if (coverImageSelector != null) {
        _blogsEntryLocalService.addCoverImage(importedEntry.getEntryId(), coverImageSelector);
    }

    // Small image

    ImageSelector smallImageSelector = null;

    if (entry.isSmallImage()) {
        String smallImagePath = entryElement.attributeValue("small-image-path");

        if (Validator.isNotNull(entry.getSmallImageURL())) {
            smallImageSelector = new ImageSelector(entry.getSmallImageURL());
        } else if (Validator.isNotNull(smallImagePath)) {
            String smallImageFileName = entry.getSmallImageId() + StringPool.PERIOD + entry.getSmallImageType();

            InputStream inputStream = null;

            try {
                inputStream = portletDataContext.getZipEntryAsInputStream(smallImagePath);

                smallImageSelector = new ImageSelector(FileUtil.getBytes(inputStream), smallImageFileName,
                        MimeTypesUtil.getContentType(smallImageFileName), null);
            } finally {
                StreamUtil.cleanUp(inputStream);
            }
        } else if (entry.getSmallImageFileEntryId() != 0) {
            smallImageSelector = _getImageSelector(portletDataContext, entry.getSmallImageFileEntryId(),
                    attachmentElements);
        }
    }

    if (smallImageSelector != null) {
        _blogsEntryLocalService.addSmallImage(importedEntry.getEntryId(), smallImageSelector);
    }

    if ((coverImageSelector != null) || (smallImageSelector != null)) {
        importedEntry = _blogsEntryLocalService.getEntry(importedEntry.getEntryId());
    }

    portletDataContext.importClassedModel(entry, importedEntry);
}

From source file:com.liferay.bookmarks.internal.exportimport.staged.model.repository.BookmarksEntryStagedModelRepository.java

License:Open Source License

@Override
public BookmarksEntry addStagedModel(PortletDataContext portletDataContext, BookmarksEntry bookmarksEntry)
        throws PortalException {

    long userId = portletDataContext.getUserId(bookmarksEntry.getUserUuid());

    ServiceContext serviceContext = portletDataContext.createServiceContext(bookmarksEntry);

    if (portletDataContext.isDataStrategyMirror()) {
        serviceContext.setUuid(bookmarksEntry.getUuid());
    }//from w  w  w .j  a  v  a  2s  . c  o  m

    return _bookmarksEntryLocalService.addEntry(userId, bookmarksEntry.getGroupId(),
            bookmarksEntry.getFolderId(), bookmarksEntry.getName(), bookmarksEntry.getUrl(),
            bookmarksEntry.getDescription(), serviceContext);
}

From source file:com.liferay.bookmarks.internal.exportimport.staged.model.repository.BookmarksFolderStagedModelRepository.java

License:Open Source License

@Override
public BookmarksFolder addStagedModel(PortletDataContext portletDataContext, BookmarksFolder bookmarksFolder)
        throws PortalException {

    long userId = portletDataContext.getUserId(bookmarksFolder.getUserUuid());

    ServiceContext serviceContext = portletDataContext.createServiceContext(bookmarksFolder);

    if (portletDataContext.isDataStrategyMirror()) {
        serviceContext.setUuid(bookmarksFolder.getUuid());
    }//from w  ww. jav a  2 s.  c  o m

    return _bookmarksFolderLocalService.addFolder(userId, bookmarksFolder.getParentFolderId(),
            bookmarksFolder.getName(), bookmarksFolder.getDescription(), serviceContext);
}