List of usage examples for com.liferay.portal.kernel.service ServiceContext getExpandoBridgeAttributes
public Map<String, Serializable> getExpandoBridgeAttributes()
From source file:com.liferay.document.library.service.test.DLFileVersionTest.java
License:Open Source License
protected ServiceContext getServiceContext() throws Exception { ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(_group.getGroupId()); serviceContext.setAttribute("fileEntryTypeId", _contractDLFileEntryTypeId); Map<String, Serializable> expandoBridgeAttributes = serviceContext.getExpandoBridgeAttributes(); expandoBridgeAttributes.put(_EXPANDO_ATTRIBUTE_NAME, StringPool.BLANK); serviceContext.setExpandoBridgeAttributes(expandoBridgeAttributes); DLFileEntryType fileEntryType = DLFileEntryTypeLocalServiceUtil .getFileEntryType(_contractDLFileEntryTypeId); List<DDMStructure> ddmStructures = fileEntryType.getDDMStructures(); for (DDMStructure ddmStructure : ddmStructures) { DDMFormValues ddmFormValues = createDDMFormValues(ddmStructure.getDDMForm()); for (String fieldName : ddmStructure.getFieldNames()) { DDMFormFieldValue ddmFormFieldValue = createDDMFormFieldValue(fieldName); ddmFormValues.addDDMFormFieldValue(ddmFormFieldValue); }/* www. j ava 2 s . c om*/ serviceContext.setAttribute(DDMFormValues.class.getName() + ddmStructure.getStructureId(), ddmFormValues); } return serviceContext; }
From source file:com.liferay.wiki.service.test.WikiPageLocalServiceTest.java
License:Open Source License
protected void checkPopulatedServiceContext(ServiceContext serviceContext, WikiPage page, boolean hasExpandoValues) throws Exception { long[] assetCategoryIds = AssetCategoryLocalServiceUtil.getCategoryIds(WikiPage.class.getName(), page.getResourcePrimKey());// w w w. ja v a2 s.co m Assert.assertArrayEquals(serviceContext.getAssetCategoryIds(), assetCategoryIds); AssetEntry assetEntry = AssetEntryLocalServiceUtil.getEntry(WikiPage.class.getName(), page.getResourcePrimKey()); List<AssetLink> assetLinks = AssetLinkLocalServiceUtil.getLinks(assetEntry.getEntryId()); long[] assetLinkEntryIds = ListUtil.toLongArray(assetLinks, AssetLink.ENTRY_ID2_ACCESSOR); Assert.assertArrayEquals(serviceContext.getAssetLinkEntryIds(), assetLinkEntryIds); String[] assetTagNames = AssetTagLocalServiceUtil.getTagNames(WikiPage.class.getName(), page.getResourcePrimKey()); Assert.assertArrayEquals(serviceContext.getAssetTagNames(), assetTagNames); if (hasExpandoValues) { ExpandoBridge expandoBridge = page.getExpandoBridge(); AssertUtils.assertEquals(expandoBridge.getAttributes(), serviceContext.getExpandoBridgeAttributes()); } }