留言板

DLFileEntryMetadata not retrieved

Madasamy P,修改在7 年前。

DLFileEntryMetadata not retrieved

Junior Member 帖子: 90 加入日期: 16-7-27 最近的帖子
for(long fileEntryId:docxChapterId)
{
DLFileEntry fileEntry = DLFileEntryLocalServiceUtil.getDLFileEntry(fileEntryId);

//System.out.println("%%%%%%%%%%%%%"+fileEntry);

long fileEntryTypeId=0;

//FileVersion fileVersion = (FileVersion)request.getAttribute(WebKeys.DOCUMENT_LIBRARY_FILE_VERSION);
DLFileVersion fileVersion = fileEntry.getFileVersion();

long fileVersionId = fileEntry.getFileVersion().getFileVersionId();
//fileEntryTypeId=fileEntry.getFileEntryTypeId();

fileEntryTypeId = fileEntry.getFileVersion().getFileEntryTypeId();
//DLFileEntryType fileEntryType=DLFileEntryTypeServiceUtil.getFileEntryType(fileEntryTypeId);


//System.out.println("PPPPPPPPPPPPP"+fileVersionId+"PPPPPPPPPP");
w++;
long structureId=0;
List<DDMStructure> ddmStructures = DDMStructureLocalServiceUtil.getClassStructures(themeDisplay1.getCompanyId(), PortalUtil.getClassNameId(RawMetadataProcessor.class), new StructureStructureKeyComparator(true));
System.out.println("DDMStructure value"+ddmStructures+" for count"+w);
Fields fields = null;
for (DDMStructure ddmStructure : ddmStructures) {
structureId=ddmStructure.getStructureId();
System.out.println("^^^^^^^^^^"+structureId);
}

DLFileEntryMetadata fileEntryMetadata = DLFileEntryMetadataLocalServiceUtil.getFileEntryMetadata(structureId,fileVersionId);

fields = StorageEngineUtil.getFields(fileEntryMetadata.getDDMStorageId());

if (fields != null) {
com.liferay.portlet.dynamicdatamapping.storage.Field mime= fields.get("HttpHeaders_CONTENT_TYPE");
com.liferay.portlet.dynamicdatamapping.storage.Field author = fields.get("MSOffice_AUTHOR");
com.liferay.portlet.dynamicdatamapping.storage.Field page_count = fields.get("MSOffice_PAGE_COUNT");
com.liferay.portlet.dynamicdatamapping.storage.Field word_count = fields.get("MSOffice_WORD_COUNT");
com.liferay.portlet.dynamicdatamapping.storage.Field cdate= fields.get("MSOffice_CREATION_DATE");
com.liferay.portlet.dynamicdatamapping.storage.Field mdate= fields.get("HttpHeaders_LAST_MODIFIED");
com.liferay.portlet.dynamicdatamapping.storage.Field application_name= fields.get("MSOffice_APPLICATION_NAME");
com.liferay.portlet.dynamicdatamapping.storage.Field image_length= fields.get("TIFF_IMAGE_LENGTH");
com.liferay.portlet.dynamicdatamapping.storage.Field image_width= fields.get("TIFF_IMAGE_WIDTH");


contentType = mime.getValue().toString();
if(author!=null)
authorName=author.getValue().toString();
if(cdate!=null)
creationDate=cdate.getValue().toString();
if(mdate!=null)
modifiedDate=mdate.getValue().toString();
if(application_name!=null)
applicationName=application_name.getValue().toString();
//Getting Extension of file

if(page_count!= null)
pageCount=page_count.getValue().toString();
if(word_count!= null)
wordCount=word_count.getValue().toString();

if(image_length!=null)
imageLength=image_length.getValue().toString();
if(image_width!=null)
imageWidth=image_width.getValue().toString();
}



In the above loop ,
When I have uploaded 3 files, I get metadata for 2 file Entries
If I upload 4 files, I get metadata for 3 file Entries

The last one retrieve the contents upto DDMStructures then the metadata not retrieved

Please let me know the solution