use of org.hisp.dhis.dxf2.metadata.MetadataExportService in project dhis2-core by dhis2.
the class MetadataExportControllerUtils method getWithDependencies.
/**
* Returns the response entity for metadata download with dependencies.
*
* @param contextService the context service that is used to retrieve
* request parameters.
* @param exportService the export service that is used to export metadata
* with dependencies.
* @param identifiableObject the identifiable object that should be exported
* with dependencies.
* @param download <code>true</code> if the data should be downloaded (as
* attachment), <code>false</code> otherwise.
* @return the response with the metadata.
*/
@Nonnull
public static ResponseEntity<JsonNode> getWithDependencies(@Nonnull ContextService contextService, @Nonnull MetadataExportService exportService, @Nonnull IdentifiableObject identifiableObject, boolean download) {
final MetadataExportParams exportParams = exportService.getParamsFromMap(contextService.getParameterValuesMap());
exportService.validate(exportParams);
ObjectNode rootNode = exportService.getMetadataWithDependenciesAsNode(identifiableObject, exportParams);
return createJsonNodeResponseEntity(rootNode, download);
}
Aggregations