Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
Getting Site repository from 'groupId' and 'repositoryId' values.
When dealing with the Documents & Media API, and according to the official documentation, "a Site (group) can have multiple repositories, but only one can be accessed via the portal UI. This is called the Site repository, which is effectively a Site’s default repository. To access this repository via the API, provide the group ID as the repositoryId".
That is, it's seems it has to be provided the 'groupId' to get the site repository object.
Ok, the way I get the 'groupId' value is by means of the folowing sentence:
groupId = GroupLocalServiceUtil.getGroup(this.companyId, "Guest").getGroupId(); //which provides value '20124'
However, if it's analysed Liferay 'repository' table, it can be seen that the primary key is 'repositoryId' field, and if we check the rows of that table (within my current Liferay installation) I get these two rows:
repositoryId groupId companyId ...
--------------------------------------------------------
33727
20128 20101
33970 20124 20101
My question is how it is possible to get the Site repository object from the 'groupId' value if the 'groupId' value (20124) is not among the primary keys of the repository table? That is, if we were to write the following sentences to get the Site repository object, isn't it supposed we have to pass the primary key associated to the Site repository?
@Reference
private RepositoryProvider repositoryProvider;
Repository repository = repositoryProvider.getRepository(repositoryId); // repositoryId <- groupId <- 20124
I find it somewhat confussing. Any clarification would really be appreciated. Thanks.
Powered by Liferay™