Best practice for creating a new DSP extension class via inheritance (example for CustCollectionJour)

Best practice for creating an extension DSP class that will be separately selectable is to create a new class and extend the base DSP class via inheritance (using the extends keyword).

An overview of the process is like this:

  1. Create a new model.
  2. Set the references on the model to DocentricAX, DocentricAXSSRSReplicas and whatever else is needed for it to function (for example, Application Foundation).
  3. Create a new solution and a new project in the solution.
  4. Set the project’s model to be the model that you have created in step 1.
  5. Create a new class in the project and use the extends keyword to create an extension of the base DSP class via inheritance.

For example, here we have created a new solution addDspToCustomModel, a new project also called addDspToCustomModel and model called addDspClassTest . It has references to DocentricAX, DocentricAXSSRSReplicas, ApplicationSuite, ApplicationFoundation and ApplicationPlatform.


The class CustomDocCustCollectionJourReportDSP in the project has the following sample code:

// This class is a new class that inherits the original class. This is signified by the extends keyword.
class CustomDocCustCollectionJourReportDSP extends DocCustCollectionJourReportDSP
    // This method is an override, it doesn't call super, meaning original code is not executed.
    public ClassDescription description()
        return 'CUSTOM Collection letter note DSP';

    // This method is an extension, it calls super, which executes original code, while also executing its own code.
    protected void generateXmlDataSource(DocXmlRecordBuilder _recordBuilder)
        super (_recordBuilder);

        DocXmlRecord headerDataRecord = _recordBuilder.topRecord().getFirstChildRecordByName(#CollectionLetterHeader);

        headerDataRecord.addCalculatedField('customTestString', 'custom test value');


Which results in the following:

  1. The description is change by our override method:
  2. New data is added to the CollectionLetterHeader record: