PropertyDescriptor to get value from map property


Oracle Commerce have derivations, however you can't get a derivation expression from a map.

But you can make this happen with a property descriptor.

This is kind of properties are needed often within projects to have access to a particular property within a property.

An example of this is when customer have custom image properties to hold all the image scales on a map, something like this:



Now, lets assume we need a particular image url from this map to be exposed as a property.

Here is how you can make it:

Above you see the definition of a property that uses ValueFromMapPropertyDescriptor, this will require two attributes, the property which needs to be a map, and the key which needs to be a string.

Having this property descriptor, the repository will be able to return the thumbnail Image from the images map.
With this approach I was able to get bcc being able to display thumbnail images for products and skus. This is docummented at: http://obed33.blogspot.com/2015/11/make-thumbnails-on-bcc-use-image-you.html


Comments