diff options
author | Stanislav Marszalek <s.marszalek2@partner.samsung.com> | 2021-07-09 09:41:08 +0200 |
---|---|---|
committer | Stanislav Marszalek <s.marszalek2@partner.samsung.com> | 2021-07-28 13:47:46 +0200 |
commit | 0b06291c6c0c6f8f1e8240c8c6b1175648a177aa (patch) | |
tree | 6a0a50a7836727dbe96259282550679876186219 /src/main/java/org/onap/a1pesimulator/service/fileready/FileReadyEventService.java | |
parent | de818385611ad0afb133996a4afe5b1b00ab1c57 (diff) |
O1 PM Bulk support - collecting events, basic structure for PM Bulk File creation
Issue-ID: INT-1945
Signed-off-by: Stanislav Marszalek <s.marszalek2@partner.samsung.com>
Change-Id: If08908035719798d8d7b129ddcdb6ef62f1787fe
Diffstat (limited to 'src/main/java/org/onap/a1pesimulator/service/fileready/FileReadyEventService.java')
-rw-r--r-- | src/main/java/org/onap/a1pesimulator/service/fileready/FileReadyEventService.java | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/main/java/org/onap/a1pesimulator/service/fileready/FileReadyEventService.java b/src/main/java/org/onap/a1pesimulator/service/fileready/FileReadyEventService.java new file mode 100644 index 0000000..47b338d --- /dev/null +++ b/src/main/java/org/onap/a1pesimulator/service/fileready/FileReadyEventService.java @@ -0,0 +1,48 @@ +package org.onap.a1pesimulator.service.fileready; + +import static org.onap.a1pesimulator.service.fileready.FtpServerService.deletePMBulkFile; + +import java.io.File; + +import org.onap.a1pesimulator.data.fileready.FileData; +import org.springframework.stereotype.Service; + +import reactor.core.publisher.Mono; + +/** + * Service for PM Bulk File creation and its handling + */ + +@Service +public class FileReadyEventService { + + /** + * It will create FileReadyEvent.json which will go to VES Collector + * + * @return created FileReadyEvent + */ + protected Mono<FileData> createFileReadyEventAndDeleteTmpFile(Mono<FileData> fileMono) { + return fileMono + .map(this::createFileReadyEvent) + .doOnNext(file -> deleteTempArchivedBulkFile(file.getArchivedPmBulkFile())); + } + + /** + * Creates File Ready Event + * + * @param fileData information about PM Bulk Files created in previous steps + * @return added newly created FileReadyEvent to FileData + */ + protected FileData createFileReadyEvent(FileData fileData) { + return fileData; + } + + /** + * Deletes temporary archived PM Bulk File + * + * @param fileMono temporary archived PM Bulk File + */ + private void deleteTempArchivedBulkFile(File fileMono) { + deletePMBulkFile(fileMono); + } +} |