5

We are trying to generate a list of all published Download components on our site (these components all use the same (Multimedia) schema). We are using DXA 2.0 Java and had the idea to use the out of the box broker query functionality (QueryImpl class).

We have run into a number of issues so I was wondering if there isn't just an easier way. Has anyone done this kind of thing before and if so how?

The main problem we have is getting the components published with a Dynamic Component Template (otherwise they are not returned as the result of a broker query). I thought that the DXA Custom Resolver would take care of this, but it doesn't seem to pick up components linked from the content of Rich Text Fields. Is this deliberate? Is there any way to query the downloads without having them published as dynamic components?

3

Based on my quick investigation, I could say it is possible.

As I could retrieve multimedia components by adding a one more additional query criteria of new MultimediaCriteria(true) in the buildCrieria method of DefaultContentProvider.

But strantegly, ComponentMeta of MM componenets does not seems to have SchemaId filled. So I had to remove ItemSchemaCriteria criteria to get the desired results.

  • Great! I wasn't aware of the MultimediaCriteria - thanks. It is a shame that SchemaId is not there, but perhaps I can filter in other ways on file extension or something - I will dig further. – Will Price May 22 at 7:49
3

AFAIK, you don’t need DCPs to be able to query for Component metadata.

For example, the Latest News widget on the DXA Example Site Home Page queries embedded Component Presentations.

In general, the DXA Resolver is intended to deal with dynamic expansion. That is: linked Components based on a Schema associated with the “Generate Data Presentation” DCT will not get statically expanded on CM-side, but published as separate DCP and dynamically expanded on CD-side. The DXA Resolver ensures that those so-called Data Presentations are resolved/published.

However, Component Links in a RTF are (currently) always statically expanded, regardless of whether their Schema is associated with the “Generate Data Presentation” DCT or not.

That explains why the DXA Resolver doesn’t have to resolve Component Links in a RTF (since these are never dynamically expanded).

You could argue that it should be possible to use dynamic expansion for Component Links in an RTF too, though.

  • Good explanation of the resolver - thanks. I had the feeling that (ab)using this for dynamic publishing wasn't the way forward. – Will Price May 22 at 7:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.