protected String extractDDMContent(DLFileVersion dlFileVersion, Locale locale) throws Exception { List<DLFileEntryMetadata> dlFileEntryMetadatas = DLFileEntryMetadataLocalServiceUtil.getFileVersionFileEntryMetadatas( dlFileVersion.getFileVersionId()); StringBundler sb = new StringBundler(dlFileEntryMetadatas.size()); for (DLFileEntryMetadata dlFileEntryMetadata : dlFileEntryMetadatas) { Fields fields = null; try { fields = StorageEngineUtil.getFields(dlFileEntryMetadata.getDDMStorageId()); } catch (Exception e) { } if (fields != null) { DDMStructure ddmStructure = DDMStructureLocalServiceUtil.getStructure(dlFileEntryMetadata.getDDMStructureId()); sb.append(DDMIndexerUtil.extractAttributes(ddmStructure, fields, locale)); } } return sb.toString(); }
@Test public void testUpdateExisting() throws Exception { long pk = ServiceTestUtil.nextLong(); DLFileEntryMetadata newDLFileEntryMetadata = _persistence.create(pk); newDLFileEntryMetadata.setUuid(ServiceTestUtil.randomString()); newDLFileEntryMetadata.setDDMStorageId(ServiceTestUtil.nextLong()); newDLFileEntryMetadata.setDDMStructureId(ServiceTestUtil.nextLong()); newDLFileEntryMetadata.setFileEntryTypeId(ServiceTestUtil.nextLong()); newDLFileEntryMetadata.setFileEntryId(ServiceTestUtil.nextLong()); newDLFileEntryMetadata.setFileVersionId(ServiceTestUtil.nextLong()); _persistence.update(newDLFileEntryMetadata, false); DLFileEntryMetadata existingDLFileEntryMetadata = _persistence.findByPrimaryKey(newDLFileEntryMetadata.getPrimaryKey()); Assert.assertEquals(existingDLFileEntryMetadata.getUuid(), newDLFileEntryMetadata.getUuid()); Assert.assertEquals( existingDLFileEntryMetadata.getFileEntryMetadataId(), newDLFileEntryMetadata.getFileEntryMetadataId()); Assert.assertEquals( existingDLFileEntryMetadata.getDDMStorageId(), newDLFileEntryMetadata.getDDMStorageId()); Assert.assertEquals( existingDLFileEntryMetadata.getDDMStructureId(), newDLFileEntryMetadata.getDDMStructureId()); Assert.assertEquals( existingDLFileEntryMetadata.getFileEntryTypeId(), newDLFileEntryMetadata.getFileEntryTypeId()); Assert.assertEquals( existingDLFileEntryMetadata.getFileEntryId(), newDLFileEntryMetadata.getFileEntryId()); Assert.assertEquals( existingDLFileEntryMetadata.getFileVersionId(), newDLFileEntryMetadata.getFileVersionId()); }
protected void addFileEntryTypeAttributes(Document document, DLFileVersion dlFileVersion) throws PortalException { List<DLFileEntryMetadata> dlFileEntryMetadatas = DLFileEntryMetadataLocalServiceUtil.getFileVersionFileEntryMetadatas( dlFileVersion.getFileVersionId()); for (DLFileEntryMetadata dlFileEntryMetadata : dlFileEntryMetadatas) { Fields fields = null; try { fields = StorageEngineUtil.getFields(dlFileEntryMetadata.getDDMStorageId()); } catch (Exception e) { } if (fields != null) { DDMStructure ddmStructure = DDMStructureLocalServiceUtil.getStructure(dlFileEntryMetadata.getDDMStructureId()); DDMIndexerUtil.addAttributes(document, ddmStructure, fields); } } }