[CELUM-34] Saving public URLs in JCR creates redundant and ambiguous nodes Created: 05/Apr/22 Updated: 21/Dec/22 Resolved: 19/Oct/22 |
|
| Status: | Closed |
| Project: | Celum DAM Connector |
| Component/s: | None |
| Affects Version/s: | 1.0.2 |
| Fix Version/s: | 1.0.4 |
| Type: | Bug | Priority: | Neutral |
| Reporter: | Tobias Szczepanski | Assignee: | Raphael Falvo |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Template: |
|
||||||||
| Acceptance criteria: |
Empty
|
||||||||
| Date of First Response: | |||||||||
| Team: | |||||||||
| Description |
Status quo (code)info.magnolia.external.dam.celum.service.CelumJcrServiceImpl#savePublicUrlToJcr: public void savePublicUrlToJcr(String url, String description, String assetId) { [...] Node node = findNode(session, assetId); [...] node = NodeUtil.createPath(session.getRootNode(), createPath() + assetId, ContentNode.NAME); } info.magnolia.external.dam.celum.service.CelumJcrServiceImpl#findNode: protected Node findNode(Session session, String assetId) { [...] Query query = jcrQueryManager.createQuery(String.format(GET_QUERY, assetId), Query.JCR_SQL2); } info.magnolia.external.dam.celum.service.CelumJcrServiceImpl#GET_QUERY private static final String GET_QUERY = "SELECT * from ['mgnl:contentNode'] as t WHERE name(t) ='%s'"; The following is tremendously prone to conflicts and causes a bug with the used GET_QUERY: private String createPath() { return "" + new Random().nextInt(1000) + CelumConstants.SLASH; } ExplainationThe above results in multiple nodes for one single celum asset, e.g. with asset-id 100 Each rendition is potentially written into a different node, e.g. Given the asset id 100, the GET_QUERY finds all nodes which are named 100, but the findNode-method returns only the first found node: if (iterator.hasNext()) { return iterator.nextNode(); } SuggestionGet rid of createPath(), in particular of the random parent node name ranging 0-999 |
| Comments |
| Comment by Teresa Miyar [ 10/Oct/22 ] |
|
Hi, This two points are valid: Write all public-urls as properties under the same node but we cannot save the assets using the same path they have in the Celum server since we want to avoid the problem of having too many nodes under the same path due to JCR limitation and the fact that you have folders with more than 40 thousand items |