The Generic report Service provides a simple API for logging the executions of interfaces. Each execution creates a Protocol asset that stores log messages, links to the created/modified assets and some meta information (see data model below). All protocols of the same interface are referenced in a Interface asset that is unique for each interface.

Implementation

The Generic report service is configured in com.censhare.manager.genericreport.GenericReportService. The Protocol service is configured in com.censhare.manager.genericreport.GenericReportService.Protocol.

Usage

The code snippet below displays how to use the GenericReportService. An interface logic and a specific error handling must be provided:

GenericReportService reportService = Platform.getCCServiceEx(GenericReportService.class);
protocol = reportService.createProtocol(INTERFACE_KEY, PersistenceMode.WRITE_ALWAYS);
protocol.setName("Import GPC classification structure: " + metadata.getRootName());
 
try{
    //interface logic
    protocol.setSourceAssetId(sourceFileAsset.getId());
    protocol.addCreatedAsset(assetId);
    protocol.addModifiedAsset(assetID);
    protocol.complete();
}
catch(InterfaceException error) {
    // inerface specific error handling
    protocol.error(error.getMessage());
    protocol.fail();
}

Data model

The graphic shows the data model of the Generic report service:

datamodel.png

Sequence diagram

The diagram shows the protocol life cycle with its dependencies on the chosen persistence modes.

persistentModes.png

Last Updated: 21 December 2018