-
Bug
-
Resolution: Fixed
-
Major
-
None
-
None
When calling RootOrgUnitProvider.getRoot(), the provider gets the OrgUnit by stored node ID (in the "default" workspace), which means the "back-office" object is returned whether we call it from the "default" or "live" workspace. This can lead to UnknownAmetysObjectException.
Moreover, when calling getSubOrgUnits(), we get IDs of contents that are not validated, and therefore not present in the live workspace.
This snippet from the ODF search service
ODFSearch.java
OrgUnit mainOu = _rootOrgUnitProvider.getRoot(); [...] Collection<String> childrenIDs = mainOu.getSubOrgUnits(); for (String id : childrenIDs) { OrgUnit ou = _resolver.resolveById(id); [...] }
should cause the following unknown object exception when called in the live version/front-office if either the root org unit or one of its children is not yet validated:
Caused by: org.ametys.plugins.repository.UnknownAmetysObjectException: There's no node for id orgunitContent://003d2e03-2ef4-4137-907d-79115a440c50 at org.ametys.plugins.repository.jcr.SimpleAmetysObjectFactory.getNode(SimpleAmetysObjectFactory.java:170) at org.ametys.plugins.repository.jcr.SimpleAmetysObjectFactory.getAmetysObjectById(SimpleAmetysObjectFactory.java:117) at org.ametys.plugins.repository.jcr.SimpleAmetysObjectFactory.getAmetysObjectById(SimpleAmetysObjectFactory.java:58) at org.ametys.plugins.repository.AmetysObjectResolver.resolveById(AmetysObjectResolver.java:241) at org.ametys.odf.orgunit.RootOrgUnitProvider.getRoot(RootOrgUnitProvider.java:70)