How to implement a data provider for a new root entity

This chapter describes in broad outline how to implement a data provider for a new root entity.

The use case

How to implement a new data source 'Changed and new structure features'

Steps

Export data types

  • Create a new data type (e.g. “DataTypeStructureFeature”) as main data type of the new data provider, this new data type subclasses the DataTypeBaseImpl class

  • To can export sub-entities you only have to set the “export purpose” of the sub-entity to 1 in the repository

Export data provider

  • Create the new data provider as subclass of ReportListModelQueryDataProviderBaseImpl

  • The source data type should be the DataTypeStructure as this is the “main input” of the data provider

  • Implement required functions

getParameterGroups()

  • You should need a mandatory “structure” parameter with DataTypeStructure

  • You need the “date” parameter

getSubDataTypes()

  • to provide the activated sub-entities (“export purpose”=1) call com.heiler.ppm.texttemplate.core.dataprovider.util.DataTypeUtils.addSubDatatypes(…)

init()

  • Analyse given parameter values, set values of internal members (structure proxy, search date, revision, …)

  • No time-consuming operations!

  • There’s some useful functions to find parameters and check parameter values in the super class:

    • findParamByIdentifier

    • isParamValueEmpty

    • isParamValueValid

  • set value of “isInitialized” member

finishInit()

  • Complete initialisation: set query, retrieve and set report result, …

  • Create and execute a search query to retrieve a report of all new/changes structure features, set the report result as member, and use this report result to create and set the internal query (AnyListByReportResult) which will be used for queryData() calls

  • Set value of “initComplete” member

queryData()

  • It should not be necessary to overwrite queryData() method