Closed nidhinprathap closed 4 years ago
There are various types of images.
For example, in Onix3, the typical way to find a Front Cover Url (although you have to check with your specific providers) is in ResourceLink
tag, like that:
So for example, with Jonix9 using streams syntax, given a Product
object, you can do something like that:
List<String> frontCoverUrls =
product.collateralDetail().supportingResources().stream()
.filter(sr -> sr.resourceContentType().value == ResourceContentTypes.Front_cover).findFirst()
.flatMap(sr -> sr.resourceVersions().stream()
.filter(rv -> rv.resourceForm().value == ResourceForms.Downloadable_file)
.findFirst().map(rv -> rv.resourceLinks().values()))
.orElse(null);
Two important conditions here:
sr.resourceContentType().value == ResourceContentTypes.Front_cover
: require that the resource is a FrontCoverrv.resourceForm().value == ResourceForms.Downloadable_file
: require that it is a Downloadable URLAs there could be more than one, this code snippets will get you a list of the URLs in the order they appear in the ONIX file.
I hope this points you at the right direction.
HI, Using Unify can I get the additional details that are not available in base class.. Like Images, Contributor description etc.
For example right now to take Auther description I need to do the following:-
product.contributors.findByRole(ContributorRoles.By_author).get(0).biographicalNote
This will return the the 1st Authors description. What for Images,countries etc?