Example usage for com.liferay.portal.util PropsValues ASSET_VOCABULARY_DEFAULT

List of usage examples for com.liferay.portal.util PropsValues ASSET_VOCABULARY_DEFAULT

Introduction

In this page you can find the example usage for com.liferay.portal.util PropsValues ASSET_VOCABULARY_DEFAULT.

Prototype

String ASSET_VOCABULARY_DEFAULT

To view the source code for com.liferay.portal.util PropsValues ASSET_VOCABULARY_DEFAULT.

Click Source Link

Usage

From source file:com.liferay.asset.service.test.AssetVocabularyServiceTest.java

License:Open Source License

@Test
public void testLocalizedSiteAddDefaultVocabulary() throws Exception {
    LocaleThreadLocal.setSiteDefaultLocale(LocaleUtil.SPAIN);

    AssetVocabulary vocabulary = AssetVocabularyLocalServiceUtil.addDefaultVocabulary(_group.getGroupId());

    Assert.assertEquals(PropsValues.ASSET_VOCABULARY_DEFAULT, vocabulary.getTitle(LocaleUtil.US, true));
}

From source file:com.liferay.portlet.asset.service.impl.AssetVocabularyLocalServiceImpl.java

License:Open Source License

public List<AssetVocabulary> getGroupVocabularies(long groupId, boolean createDefaultVocabulary)
        throws PortalException, SystemException {

    List<AssetVocabulary> vocabularies = assetVocabularyPersistence.findByGroupId(groupId);

    if (!vocabularies.isEmpty() || !createDefaultVocabulary) {
        return vocabularies;
    }/*from  ww  w .  j  a va  2 s.c  o m*/

    Group group = groupLocalService.getGroup(groupId);

    long defaultUserId = userLocalService.getDefaultUserId(group.getCompanyId());

    Map<Locale, String> titleMap = new HashMap<Locale, String>();

    titleMap.put(LocaleUtil.getDefault(), PropsValues.ASSET_VOCABULARY_DEFAULT);

    ServiceContext serviceContext = new ServiceContext();

    serviceContext.setScopeGroupId(groupId);

    AssetVocabulary vocabulary = assetVocabularyLocalService.addVocabulary(defaultUserId, StringPool.BLANK,
            titleMap, null, StringPool.BLANK, serviceContext);

    vocabularies = new ArrayList<AssetVocabulary>();

    vocabularies.add(vocabulary);

    return vocabularies;
}