Getting Site repository from 'groupId' and 'repositoryId' values.

txapeldot ., modified 2 Years ago. Junior Member Posts: 91 Join Date: 1/15/15 Recent Posts

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.