[MGNLREST-130] Provide Reference resolver for DAM Created: 19/Oct/17 Updated: 12/Mar/18 Resolved: 09/Mar/18 |
|
| Status: | Closed |
| Project: | Magnolia REST Framework |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 2.1 |
| Type: | Improvement | Priority: | Neutral |
| Reporter: | Sang Ngo Huu | Assignee: | Ngoc Nguyenthanh |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | 0d | ||
| Time Spent: | 3d 7h | ||
| Original Estimate: | 3d | ||
| 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)
|
||||||||
| Documentation update required: |
Yes
|
||||||||
| Date of First Response: | |||||||||
| Epic Link: | REST Phase2 | ||||||||
| Sprint: | Saigon 131, Saigon 132, Saigon 133, Saigon 134, Saigon 135, Saigon 136, Saigon 137 | ||||||||
| Story Points: | 8 | ||||||||
| Description |
|
Implements `AssetReferenceResolver` for resolving Asset item key (jcr:uuid). Allows to configure options: expansion, include download link, include `DublinCore` metadata, include renditions (should be handled by |
| Comments |
| Comment by Ngoc Nguyenthanh [ 09/Mar/18 ] |
Solution
UsagesDefines a configurable asset resolver by using `info.magnolia.rest.reference.dam.ConfiguredAssetReferenceResolverDefinition`
references:
- name: assetReference
propertyName: image
referenceResolver:
expand: true
includeAssetMetadata: false
includeDownloadLink: true
class: info.magnolia.rest.reference.dam.ConfiguredAssetReferenceResolverDefinition
It's also allows to resolve without output configuration needed. It'll print out of data of the Asset
references:
- name: assetReference
propertyName: image
referenceResolver:
implementationClass: info.magnolia.rest.reference.dam.AssetReferenceResolver
The definition supports 3 options
The end result will look like
"image": {
"@name": "flickr-surfer-mandolin-373088839_7da451ccc8_b.jpg",
"@path": "/flickr-surfer-mandolin-373088839_7da451ccc8_b/flickr-surfer-mandolin-373088839_7da451ccc8_b.jpg",
"@id": "jcr:d01deefa-dba9-4708-8cfa-604320720253",
"@link": "/magnoliaTest/dam/jcr:d01deefa-dba9-4708-8cfa-604320720253/flickr-surfer-mandolin-373088839_7da451ccc8_b.jpg",
"metadata": {
"fileName": "flickr-surfer-mandolin-373088839_7da451ccc8_b.jpg",
"mimeType": "image/jpeg",
"caption": "Mandolin",
"fileSize": "327927",
"height": "681",
"width": "1024",
"format": "image/jpeg",
"rights": "by-sa/2.0/",
"creator": [
"superuser"
],
"date": "2018-02-27T14:33:43.335+07:00",
"created": "2015-01-29T03:28:44.217+07:00",
"modified": "2018-02-27T14:33:43.335+07:00"
}
},
If the `expand` is disabled but `includeDownloadLink` is enabled, the result will be as: "image": "/magnoliaTest/dam/jcr:d01deefa-dba9-4708-8cfa-604320720253/flickr-surfer-mandolin-373088839_7da451ccc8_b.jpg", Otherwise, the asset item key will be returned when all flags are off "image": "jcr:d01deefa-dba9-4708-8cfa-604320720253" metadata will be include DublinCore properties as well as Magnolia extended properties for Asset
contributor , coverage , creator , date , description , format , identifier , language , publisher , relation , rights , source , subject , title , type
fileName, mimeType, caption, comment, fileSize, height, width, created, modified
@name, @path, @id, @nodetype
@nodetype is only visible when AssetProvider is an instance of info.magnolia.dam.jcr.JcrAssetProvider See info.magnolia.integrationtests.rest.delivery.jcr.v2.AssetReferenceResolverTest for more cases |