Search in sources :

Example 1 with AntivirusJobResponse

use of com.odysseusinc.arachne.portal.service.impl.antivirus.events.AntivirusJobResponse in project ArachneCentralAPI by OHDSI.

the class BaseAnalysisServiceImpl method processAntivirusResponse.

@EventListener
@Transactional
@Override
public void processAntivirusResponse(AntivirusJobAnalysisFileResponseEvent event) {
    final AntivirusJobResponse antivirusJobResponse = event.getAntivirusJobResponse();
    final AnalysisFile analysisFile = analysisFileRepository.findOne(antivirusJobResponse.getFileId());
    if (analysisFile != null) {
        analysisFile.setAntivirusStatus(antivirusJobResponse.getStatus());
        analysisFile.setAntivirusDescription(antivirusJobResponse.getDescription());
        analysisFileRepository.save(analysisFile);
    }
}
Also used : AnalysisFile(com.odysseusinc.arachne.portal.model.AnalysisFile) AntivirusJobResponse(com.odysseusinc.arachne.portal.service.impl.antivirus.events.AntivirusJobResponse) EventListener(org.springframework.context.event.EventListener) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with AntivirusJobResponse

use of com.odysseusinc.arachne.portal.service.impl.antivirus.events.AntivirusJobResponse in project ArachneCentralAPI by OHDSI.

the class BaseStudyServiceImpl method processAntivirusResponse.

@EventListener
@Transactional
@Override
public void processAntivirusResponse(AntivirusJobStudyFileResponseEvent event) {
    final AntivirusJobResponse antivirusJobResponse = event.getAntivirusJobResponse();
    final StudyFile studyFile = studyFileRepository.findOne(antivirusJobResponse.getFileId());
    if (studyFile != null) {
        studyFile.setAntivirusStatus(antivirusJobResponse.getStatus());
        studyFile.setAntivirusDescription(antivirusJobResponse.getDescription());
        studyFileRepository.save(studyFile);
    }
}
Also used : StudyFile(com.odysseusinc.arachne.portal.model.StudyFile) AntivirusJobResponse(com.odysseusinc.arachne.portal.service.impl.antivirus.events.AntivirusJobResponse) EventListener(org.springframework.context.event.EventListener) Transactional(org.springframework.transaction.annotation.Transactional)

Example 3 with AntivirusJobResponse

use of com.odysseusinc.arachne.portal.service.impl.antivirus.events.AntivirusJobResponse in project ArachneCentralAPI by OHDSI.

the class BasePaperServiceImpl method update.

private void update(AntivirusJobResponseEventBase event, JpaRepository repository) {
    final AntivirusJobResponse antivirusJobResponse = event.getAntivirusJobResponse();
    final AntivirusFile file = (AntivirusFile) repository.findOne(antivirusJobResponse.getFileId());
    if (file != null) {
        file.setAntivirusStatus(antivirusJobResponse.getStatus());
        file.setAntivirusDescription(antivirusJobResponse.getDescription());
        repository.save(file);
    }
}
Also used : AntivirusFile(com.odysseusinc.arachne.portal.model.AntivirusFile) AntivirusJobResponse(com.odysseusinc.arachne.portal.service.impl.antivirus.events.AntivirusJobResponse)

Example 4 with AntivirusJobResponse

use of com.odysseusinc.arachne.portal.service.impl.antivirus.events.AntivirusJobResponse in project ArachneCentralAPI by OHDSI.

the class AntivirusServiceImpl method publishResponse.

private void publishResponse(final AntivirusJobFileType fileType, final Long fileId, final AntivirusStatus status, final String description) {
    AntivirusJobResponse antivirusJobResponse = new AntivirusJobResponse(fileId, status, description);
    AntivirusJobResponseEventBase antivirusJobResponseEventBase;
    switch(fileType) {
        case STUDY_FILE:
            antivirusJobResponseEventBase = new AntivirusJobStudyFileResponseEvent(this, antivirusJobResponse);
            break;
        case PAPER_PAPER_FILE:
            antivirusJobResponseEventBase = new AntivirusJobPaperPaperFileResponseEvent(this, antivirusJobResponse);
            break;
        case PAPER_PROTOCOL_FILE:
            antivirusJobResponseEventBase = new AntivirusJobPaperProtocolFileResponseEvent(this, antivirusJobResponse);
            break;
        case ANALYSIS_FILE:
            antivirusJobResponseEventBase = new AntivirusJobAnalysisFileResponseEvent(this, antivirusJobResponse);
            break;
        default:
            throw new IllegalArgumentException();
    }
    eventPublisher.publishEvent(antivirusJobResponseEventBase);
}
Also used : AntivirusJobStudyFileResponseEvent(com.odysseusinc.arachne.portal.service.impl.antivirus.events.AntivirusJobStudyFileResponseEvent) AntivirusJobPaperProtocolFileResponseEvent(com.odysseusinc.arachne.portal.service.impl.antivirus.events.AntivirusJobPaperProtocolFileResponseEvent) AntivirusJobResponseEventBase(com.odysseusinc.arachne.portal.service.impl.antivirus.events.AntivirusJobResponseEventBase) AntivirusJobResponse(com.odysseusinc.arachne.portal.service.impl.antivirus.events.AntivirusJobResponse) AntivirusJobAnalysisFileResponseEvent(com.odysseusinc.arachne.portal.service.impl.antivirus.events.AntivirusJobAnalysisFileResponseEvent) AntivirusJobPaperPaperFileResponseEvent(com.odysseusinc.arachne.portal.service.impl.antivirus.events.AntivirusJobPaperPaperFileResponseEvent)

Aggregations

AntivirusJobResponse (com.odysseusinc.arachne.portal.service.impl.antivirus.events.AntivirusJobResponse)4 EventListener (org.springframework.context.event.EventListener)2 Transactional (org.springframework.transaction.annotation.Transactional)2 AnalysisFile (com.odysseusinc.arachne.portal.model.AnalysisFile)1 AntivirusFile (com.odysseusinc.arachne.portal.model.AntivirusFile)1 StudyFile (com.odysseusinc.arachne.portal.model.StudyFile)1 AntivirusJobAnalysisFileResponseEvent (com.odysseusinc.arachne.portal.service.impl.antivirus.events.AntivirusJobAnalysisFileResponseEvent)1 AntivirusJobPaperPaperFileResponseEvent (com.odysseusinc.arachne.portal.service.impl.antivirus.events.AntivirusJobPaperPaperFileResponseEvent)1 AntivirusJobPaperProtocolFileResponseEvent (com.odysseusinc.arachne.portal.service.impl.antivirus.events.AntivirusJobPaperProtocolFileResponseEvent)1 AntivirusJobResponseEventBase (com.odysseusinc.arachne.portal.service.impl.antivirus.events.AntivirusJobResponseEventBase)1 AntivirusJobStudyFileResponseEvent (com.odysseusinc.arachne.portal.service.impl.antivirus.events.AntivirusJobStudyFileResponseEvent)1