Yep, the only option is to use Expando AKA custom properties/fields. In case of fileEntry you don t need to create table and columns programmatically but you can set it up in Control Panel > custom fields.
After that you have a few options how to populate the expando values.
fileEntry.getExpandoBridge().setAttribute("propName", "propValue")
or if you get the properties from view layer
<liferay-ui:custom-attributes-available className="<%= DLFileEntry.class.getName() %>">
<liferay-ui:custom-attribute-list
className="<%= DLFileEntry.class.getName() %>"
classPK="<%= (fileVersion != null) ? fileVersion.getFileVersionId() : 0 %>"
editable="<%= true %>"
label="<%= true %>"
/>
</liferay-ui:custom-attributes-available>
and then
ServiceContext serviceContext = ServiceContextFactory.getInstance(
DLFileEntry.class.getName(), actionRequest);
serviceContext gets populated by parameters in actionRequest and you then just call
fileEntry.getExpandoBridge().setAttributes(serviceContext)
Finally, you may need to query for fileEntries with particular properties
public Hits search() {
Map<String, Serializable> attributes = new HashMap<String, Serializable>();
attributes.put("propertyName", "propertyValue");
SearchContext searchContext = new SearchContext();
searchContext.setAttributes(attributes);
Indexer indexer = IndexerRegistryUtil.getIndexer(FileEntry.class);
return indexer.search(searchContext);
}
Of course, this solution may seem a little complicated, because Liferay Document Library is not a JCR content repository, but it s literally a document library that provides abstraction layer for concrete repo implementations via Hooks, such as JCRHook ( where files are stored into jackrabbit repository ), CMIS support, migration support etc. It also handles permissionChecking, fileVersioning, document workflow and asset management.
So if you intend to do something more complicated and you will have to query the properties/metadata, change them and expand them. You should consider using JCR repository directly...