Class CreateLayerExtractService
java.lang.Object
org.tailormap.api.service.CreateLayerExtractService
-
Constructor Summary
ConstructorsConstructorDescriptionCreateLayerExtractService(ch.rasc.sse.eventbus.SseEventBus eventBus, tools.jackson.databind.json.JsonMapper jsonMapper, FeatureSourceFactoryHelper featureSourceFactoryHelper) -
Method Summary
Modifier and TypeMethodDescriptionvoidCleanup expired extract files.createExtractFilename(@NonNull String clientId, @NonNull TMFeatureType sourceFT, @NonNull LayerExtractController.ExtractOutputFormat outputFormat) Create a validated filename for an extract.voidcreateLayerExtract(@NonNull String clientId, @NonNull TMFeatureType inputTmFeatureType, @NonNull Set<String> attributes, @Nullable org.geotools.api.filter.Filter filter, String sortBy, org.geotools.api.filter.sort.SortOrder sortOrder, @NonNull LayerExtractController.ExtractOutputFormat extractOutputFormat, @NonNull String outputFileName) voidemitProgress(@NonNull String clientId, @Nullable String fileId, int progress, boolean completed, @Nullable String message) voidvalidateClientId(@NonNull String clientId) Check that the sse client id is valid and exists.
-
Constructor Details
-
CreateLayerExtractService
public CreateLayerExtractService(@Qualifier("viewerSseEventBus") ch.rasc.sse.eventbus.SseEventBus eventBus, tools.jackson.databind.json.JsonMapper jsonMapper, FeatureSourceFactoryHelper featureSourceFactoryHelper)
-
-
Method Details
-
getExportFilesLocation
-
emitProgress
-
validateClientId
Check that the sse client id is valid and exists.- Parameters:
clientId- the SSE client id- Throws:
IllegalArgumentException- when the SSE client id is invalid or not found on the event bus
-
createExtractFilename
public String createExtractFilename(@NonNull String clientId, @NonNull TMFeatureType sourceFT, @NonNull LayerExtractController.ExtractOutputFormat outputFormat) throws IllegalArgumentException Create a validated filename for an extract. The naming follows the pattern"%s_%s_%s%s".formatted(sourceFT.getName(), clientId, UUIDv7.randomV7(), outputFormat.getExtension())where the first part is the source feature type name (this is cleaned from some characters), the second part is the SSE client id, the third part is a random UUIDv7 and the fourth part is the file extension based on the requested output format.- Parameters:
clientId- the SSE client idsourceFT- the source featuretype for the extractoutputFormat- the required format of the extract- Returns:
- the filename used to create an extract
- Throws:
IllegalArgumentException- when the SSE clientId is invalid or not found on the event bus
-
createLayerExtract
@Async("extractTaskExecutor") @Transactional public void createLayerExtract(@NonNull String clientId, @NonNull TMFeatureType inputTmFeatureType, @NonNull Set<String> attributes, @Nullable org.geotools.api.filter.Filter filter, String sortBy, org.geotools.api.filter.sort.SortOrder sortOrder, @NonNull LayerExtractController.ExtractOutputFormat extractOutputFormat, @NonNull String outputFileName) -
cleanupExpiredExtracts
Cleanup expired extract files. Filenames are created increateExtractFilename(String, TMFeatureType, LayerExtractController.ExtractOutputFormat)and follow the pattern"%s_%s_%s.%s".formatted(sourceFT.getName(), clientId, UUIDv7.randomV7(), outputFormat.getExtension())
-