Issues with CDM configuration in the application

Hello,

I am having some issues after the doing configuration for CDM in the application.
For reference, I added following configuration to enable support for CDMs:

  1. Added the necessary client code in appsetup.ts as per the documentation.
  2. Added LOAD_DOCUMENT_GRAPH and LIST_CDDS as allowed operations in mgmtp.a12.dataservices.jsonRpc.allowedOperations in application-shared.properties.

After adding these configurations, I can see the CDM overview tab being loaded but there are 2 issues:

  1. On the server start-up, I do not see the data in the CDM overview tab. It’s empty.

  2. While creating new documents in the application, the documents are saved twice!

Am I missing any additional configuration?

Thank you,
Mokshada

Hey Mokshada,

regarding the first point: Documents are only listed in CDM overviews if they are created or saved after the CDM feature was turned on, as there is a special “CDM database/index” the documents have to be added to.
(There is a bug in the 2023.06ext2 Preview App and the CDM index is lost after closing the PAC, so this could be the reason you see this behavior in the PAC.)

Cheers Felix

As @felix-blazing-river already said, this is a known issue that the DS team is already aware of & still working on.

I am facing the same issue when upgrading from dataservices v36.0.0 → v36.2.2. I’m not really sure if it’s a valid usage, but as a workaround, this is how I managed to trigger the cdm indexing while initialization

@Component
@RequiredArgsConstructor
public class TriggerCdmIndexing {
    private final CddDirtyDocumentsJmsConsumer cddDirtyDocumentsJmsConsumer;
    private final DocumentJpaRepository documentJpaRepository;
    @DataServicesEventListener
    public void afterInit(DataServicesInitializationFinishedEvent ignored) {
        documentJpaRepository.findIdByModelName(Erstattungsantrag_Schueler_DM.Name).parallelStream().forEach(
                id -> {
                    cddDirtyDocumentsJmsConsumer.process(new DocumentReference("your-model-name" + "/" + id));
                }
        );

    }
}

your-model-name can be changed to the root document model defined in the cdm model, e.g. user-cdm has root user-dm, so you can change your-model-name by user-dm.

Thanks to @loi-risen-dale :slight_smile: Both the issues are resolved for me.

To summarize the resolution for the issues I was facing:
Resolution for Issue 1: Used the solution above from @loi-risen-dale
Resolution for Issue 2: Removed createFormEngineMiddlewares() from additionalMiddlewares section in appsetup.ts to avoid duplicate creation of documents as the middleware createCdmMiddlewares() already has createFormEngineMiddlewares() in it.