[MAGNOLIA-7606] Provide a way for Repository Exception free JCR operations Created: 20/Aug/19 Updated: 02/Dec/19 Resolved: 28/Nov/19 |
|
| Status: | Closed |
| Project: | Magnolia |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 6.2 |
| Type: | Improvement | Priority: | Neutral |
| Reporter: | Roman Kovařík | Assignee: | Roman Kovařík |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | 0d | ||
| Time Spent: | 1d 52m | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Template: |
|
||||||||
| Acceptance criteria: |
Empty
|
||||||||
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
||||||||
| Sprint: | UI Framework 4, UI Framework 11 | ||||||||
| Story Points: | 2 | ||||||||
| Description |
|
We do have utilities to work with JCR such as NodeUtil or PropertyUtil. Optional.of(Node).map(getName()); String getName(Node node) { try { return node.getName(); } catch (RE e) { throw new RuntimeRepositoryException(e); } } As result, such methods are duplicated all over the place. |
| Comments |
| Comment by Roman Kovařík [ 20/Aug/19 ] |
|
We've introduced info.magnolia.jcr.util.JcrFunctions which can be used as follows:
Set<Node> parents = getValueContext().get()
.map(JcrFunctions::getParent)
.collect(Collectors.toSet());
|
| Comment by Roman Kovařík [ 25/Sep/19 ] |
|
Reopened: consider using https://github.com/pivovarit/throwing-function. or https://noexception.machinezoo.com |
| Comment by Roman Kovařík [ 02/Dec/19 ] |
|
Custom JcrFunctions dropped in favour of external library. |