CddQueryService to QueryService migration

Hi,

I am having problems migrating from the CddQueryService to the QueryService.

What I used:

ResultSet<DataServicesDocument> resultSet = cddQueryService.query(cdmName, filterSpec, Collections.emptyList(),
                                                                  PageSpec.MAX_RESULTS,
                                                                  Collections.emptyList());

What I try to use now:

QueryRoot queryRoot = QueryRoot.builder().projectionName("cdd").targetDocumentModel(cdmName).paging(Paging.builder().pageNumber(0).pageSize(100).build()).build();
QueryPage<Object> resultSet = cddQueryService.query(queryRoot,null);

However, the content in the result page is a DocumentSpec and document in there is not a document but just a String.

The projection document-graph also doesnt give me a cdd document, but I am confused about “A document graph contains all documents and links which are needed to construct a CDD”, is that what I need instead and do I need to programm that constructing myself or is there already a method for that?

I need the document to compute the cdm document (IDocumentRtService.compute.

Thanks!

Hi @alicia-secure-haze ,

The CDD projection creates a DocumentSpec instance, where the document is a CDD document serialized as a string. This approach is used because it addresses the most common use case. If you require a DocumentV2 instance instead, please utilize DocumentSupport.

For scenarios where retrieving a DocumentV2 from a CDD projection is a frequent requirement, you may create a custom projection that always returns a DocumentV2 for CDD queries. Our repository contains an example of a custom projection, named BusinessPartnerTaxAuthorityRegistrationStatus, which can be configured using the configuration profile: dataservices-example-business-partner-tax-authority-registration-status-projection.

The document-graph projection is not recommended for your current needs, as it is primarily intended for use with the form engine. The form engine cannot operate directly with CDDs since these do not contain information about links. Consequently, the entire document graph, along with all document and link metadata, is provided to the form engine via the document-graph projection.

This information is valid for DS version 38.0.0 and higher.