class MetadataRestController {

    @Nonnull
    @RequestMapping( method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE )
    @PreAuthorize( "hasRole('CODE_MAPPING') and hasRole('DATA_MAPPING')" )
    public ResponseEntity<JsonNode> exp( @RequestParam( name = "trackerProgramId", required = false ) List<UUID> trackerProgramIds,
        @RequestParam( name = "excludedSystemUri", required = false ) List<String> excludedSystemUris,
        @RequestParam( name = "includeTrackedEntities", required = false, defaultValue = "false" ) boolean includeTrackedEntities,
        @RequestParam( name = "includeResourceMappings", required = false, defaultValue = "false" ) boolean includeResourceMappings,
        @RequestParam( name = "download", required = false, defaultValue = "false" ) boolean download )
    {
        final MetadataExportParams params = new MetadataExportParams();
        params.setIncludeTrackedEntities( includeTrackedEntities );
        params.setIncludeResourceMappings( includeResourceMappings );

        if ( trackerProgramIds != null )
        {
            params.getTrackerProgramIds().addAll( trackerProgramIds );
        }

        if ( excludedSystemUris != null )
        {
            params.getExcludedSystemUris().addAll( excludedSystemUris );
        }

        final JsonNode node = metadataExportService.exp( params );
        final HttpHeaders headers = new HttpHeaders();

        if ( download )
        {
            headers.set( HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"metadata.json\"" );
        }

        return new ResponseEntity<>( node, headers, HttpStatus.OK );
    }

    public  MetadataRestController( @Nonnull MetadataExportService metadataExportService, @Nonnull MetadataImportService metadataImportService );

}