Search in sources :

Example 1 with UNPUBLISHED_FILE_IDS

use of org.icgc.dcc.song.core.exceptions.ServerErrors.UNPUBLISHED_FILE_IDS in project SONG by overture-stack.

the class AnalysisService method publish.

public ResponseEntity<String> publish(@NonNull String accessToken, @NonNull String id) {
    val files = readFiles(id);
    val missingFileIds = files.stream().filter(f -> !confirmUploaded(accessToken, f.getObjectId())).collect(toImmutableList());
    val isMissingFiles = missingFileIds.size() > 0;
    checkServer(!isMissingFiles, getClass(), UNPUBLISHED_FILE_IDS, "The following file ids must be published before analysisId %s can be published: %s", id, COMMA.join(missingFileIds));
    checkedUpdateState(id, PUBLISHED);
    sender.send(String.format("{\"analysis_id\": %s, \"state\": \"PUBLISHED\"}", id));
    return ok("AnalysisId %s successfully published", id);
}
Also used : lombok.val(lombok.val) ANALYSIS_ID_NOT_FOUND(org.icgc.dcc.song.core.exceptions.ServerErrors.ANALYSIS_ID_NOT_FOUND) File(org.icgc.dcc.song.server.model.entity.File) RequiredArgsConstructor(lombok.RequiredArgsConstructor) Autowired(org.springframework.beans.factory.annotation.Autowired) SequencingReadAnalysis(org.icgc.dcc.song.server.model.analysis.SequencingReadAnalysis) DUPLICATE_ANALYSIS_ATTEMPT(org.icgc.dcc.song.core.exceptions.ServerErrors.DUPLICATE_ANALYSIS_ATTEMPT) COMMA(org.icgc.dcc.common.core.util.Joiners.COMMA) Analysis(org.icgc.dcc.song.server.model.analysis.Analysis) SequencingRead(org.icgc.dcc.song.server.model.experiment.SequencingRead) InfoSearchResponse(org.icgc.dcc.song.server.repository.search.InfoSearchResponse) SearchRepository(org.icgc.dcc.song.server.repository.search.SearchRepository) VARIANT_CALL_REPOSITORY_CREATE_RECORD(org.icgc.dcc.song.core.exceptions.ServerErrors.VARIANT_CALL_REPOSITORY_CREATE_RECORD) Service(org.springframework.stereotype.Service) VariantCallAnalysis(org.icgc.dcc.song.server.model.analysis.VariantCallAnalysis) ANALYSIS_STATE_UPDATE_FAILED(org.icgc.dcc.song.core.exceptions.ServerErrors.ANALYSIS_STATE_UPDATE_FAILED) PUBLISHED(org.icgc.dcc.song.server.model.enums.AnalysisStates.PUBLISHED) Objects.isNull(java.util.Objects.isNull) ServerException.checkServer(org.icgc.dcc.song.core.exceptions.ServerException.checkServer) Sender(org.icgc.dcc.song.server.kafka.Sender) UNPUBLISHED_FILE_IDS(org.icgc.dcc.song.core.exceptions.ServerErrors.UNPUBLISHED_FILE_IDS) ANALYSIS_MISSING_FILES(org.icgc.dcc.song.core.exceptions.ServerErrors.ANALYSIS_MISSING_FILES) SUPPRESSED(org.icgc.dcc.song.server.model.enums.AnalysisStates.SUPPRESSED) AnalysisStates(org.icgc.dcc.song.server.model.enums.AnalysisStates) InfoSearchRequest(org.icgc.dcc.song.server.repository.search.InfoSearchRequest) NonNull(lombok.NonNull) Collection(java.util.Collection) lombok.val(lombok.val) SearchTerm.createMultiSearchTerms(org.icgc.dcc.song.server.repository.search.SearchTerm.createMultiSearchTerms) MultiValueMap(org.springframework.util.MultiValueMap) SEQUENCING_READ_REPOSITORY_CREATE_RECORD(org.icgc.dcc.song.core.exceptions.ServerErrors.SEQUENCING_READ_REPOSITORY_CREATE_RECORD) Responses.ok(org.icgc.dcc.song.core.utils.Responses.ok) VariantCall(org.icgc.dcc.song.server.model.experiment.VariantCall) CompositeEntity(org.icgc.dcc.song.server.model.entity.composites.CompositeEntity) AnalysisRepository(org.icgc.dcc.song.server.repository.AnalysisRepository) SEQUENCING_READ_NOT_FOUND(org.icgc.dcc.song.core.exceptions.ServerErrors.SEQUENCING_READ_NOT_FOUND) Objects(java.util.Objects) Slf4j(lombok.extern.slf4j.Slf4j) List(java.util.List) Collectors.toImmutableList(org.icgc.dcc.common.core.util.stream.Collectors.toImmutableList) ANALYSIS_MISSING_SAMPLES(org.icgc.dcc.song.core.exceptions.ServerErrors.ANALYSIS_MISSING_SAMPLES) VARIANT_CALL_NOT_FOUND(org.icgc.dcc.song.core.exceptions.ServerErrors.VARIANT_CALL_NOT_FOUND) ResponseEntity(org.springframework.http.ResponseEntity) ANALYSIS_REPOSITORY_CREATE_RECORD(org.icgc.dcc.song.core.exceptions.ServerErrors.ANALYSIS_REPOSITORY_CREATE_RECORD) IdSearchRequest(org.icgc.dcc.song.server.repository.search.IdSearchRequest) ServerException.buildServerException(org.icgc.dcc.song.core.exceptions.ServerException.buildServerException)

Aggregations

Collection (java.util.Collection)1 List (java.util.List)1 Objects (java.util.Objects)1 Objects.isNull (java.util.Objects.isNull)1 NonNull (lombok.NonNull)1 RequiredArgsConstructor (lombok.RequiredArgsConstructor)1 Slf4j (lombok.extern.slf4j.Slf4j)1 lombok.val (lombok.val)1 COMMA (org.icgc.dcc.common.core.util.Joiners.COMMA)1 Collectors.toImmutableList (org.icgc.dcc.common.core.util.stream.Collectors.toImmutableList)1 ANALYSIS_ID_NOT_FOUND (org.icgc.dcc.song.core.exceptions.ServerErrors.ANALYSIS_ID_NOT_FOUND)1 ANALYSIS_MISSING_FILES (org.icgc.dcc.song.core.exceptions.ServerErrors.ANALYSIS_MISSING_FILES)1 ANALYSIS_MISSING_SAMPLES (org.icgc.dcc.song.core.exceptions.ServerErrors.ANALYSIS_MISSING_SAMPLES)1 ANALYSIS_REPOSITORY_CREATE_RECORD (org.icgc.dcc.song.core.exceptions.ServerErrors.ANALYSIS_REPOSITORY_CREATE_RECORD)1 ANALYSIS_STATE_UPDATE_FAILED (org.icgc.dcc.song.core.exceptions.ServerErrors.ANALYSIS_STATE_UPDATE_FAILED)1 DUPLICATE_ANALYSIS_ATTEMPT (org.icgc.dcc.song.core.exceptions.ServerErrors.DUPLICATE_ANALYSIS_ATTEMPT)1 SEQUENCING_READ_NOT_FOUND (org.icgc.dcc.song.core.exceptions.ServerErrors.SEQUENCING_READ_NOT_FOUND)1 SEQUENCING_READ_REPOSITORY_CREATE_RECORD (org.icgc.dcc.song.core.exceptions.ServerErrors.SEQUENCING_READ_REPOSITORY_CREATE_RECORD)1 UNPUBLISHED_FILE_IDS (org.icgc.dcc.song.core.exceptions.ServerErrors.UNPUBLISHED_FILE_IDS)1 VARIANT_CALL_NOT_FOUND (org.icgc.dcc.song.core.exceptions.ServerErrors.VARIANT_CALL_NOT_FOUND)1