掲示板

Add metadata set programatically

6年前 に Daniel G によって更新されました。

Add metadata set programatically

Regular Member 投稿: 141 参加年月日: 17/03/14 最新の投稿
Hi everyone!

Is possible to create metadata set programatically?

I need to aggregate metadata fields for applying them to Document Types and I need to do more than the editor allows me.
I was looking for information but I find nothing.


I really appreciate any help.



Thanks!
thumbnail
6年前 に Jorge Díaz によって更新されました。

RE: Add metadata set programatically (回答)

Liferay Master 投稿: 753 参加年月日: 14/01/09 最新の投稿
Hi Daniel,

I answered this in Spanish in following post: https://web.liferay.com/es/community/forums/-/message_boards/message/56021517

Here a quick translation:
Metadata is stored in ddmcontent table. That table is related to DLFileEntry and DLFileVersion.
The relations between tables are:
dlfileentry => dlfileversion => dlfileentrymetadata => ddmcontent

You should never directly access to Database, you must use Liferay API.
Have a look to following class DLFileEntryMetadataLocalServiceUtil, see method
DLFileEntryMetadataLocalServiceUtil.getFileEntryMetadata(ddmStructureId, fileVersionId);

You have an example about how to retrieve information of a DLFileEntry with that method in following Liferay JSP:
- portal-web/docroot/html/portlet/document_library/view_file_entry.jsp

That information is refered to Liferay 6.2. Liferay 7 code should be very similar.

You have more information in other forum posts:
- metadata creation: https://web.liferay.com/community/forums/-/message_boards/message/57550572
- metadata index search: https://web.liferay.com/community/forums/-/message_boards/view_message/30782428