Untitled

mail@pastecode.io avatar
unknown
java
a year ago
2.0 kB
2
Indexable
Never
    @Override
    public List<CmsStatementFull> getFullStatementsForLLM(LgtProjectId lgtProjectId, LgtClusterName lgtClusterName,
            Instant createdBefore, O<CmsStatementId> ostatementId, O<String> ostatementTypeCode, O<String> oreferenceSourceCode,
            O<Integer> oreferenceId, O<Float> oscore, O<Float> oweight, O<Integer> oconfidence, O<String> ogeneHgncSymbol,
            O<CmsBiologicalMechanismId> obiologicalMechanismId) {

        BooleanBuilder whereClause = new BooleanBuilder(qstatementFullJpa.projectId.eq(lgtProjectId)
                .and(qstatementFullJpa.clusterName.eq(lgtClusterName).or(qstatementFullJpa.clusterName.isNull()))
                .and(qstatementFullJpa.created.before(createdBefore)));

        ostatementId.ifPresent(statementId -> whereClause.and(qstatementFullJpa.id.eq(statementId)));
        ostatementTypeCode.ifPresent(typeCode -> whereClause.and(qstatementFullJpa.statementTypeCode.eq(typeCode)));
        oreferenceSourceCode.ifPresent(refSourceCode -> whereClause.and(qstatementFullJpa.referenceSourceCode.eq(
               CmsReferenceSourceCode.valueOf(refSourceCode))));
        oreferenceId.ifPresent(refId -> whereClause.and(qstatementFullJpa.referenceId.eq(new CmsReferenceId(refId))));
        oscore.ifPresent(score -> whereClause.and(qstatementFullJpa.score.eq(Double.valueOf(score))));
        oweight.ifPresent(weight -> whereClause.and(qstatementFullJpa.weight.eq(Double.valueOf(weight))));
        oconfidence.ifPresent(confidence -> whereClause.and(qstatementFullJpa.confidence.eq(confidence)));
        ogeneHgncSymbol.ifPresent(symbol -> whereClause.and(qstatementFullJpa.geneHgncSymbol.eq(new LgtHgncSymbol(symbol))));
        obiologicalMechanismId.map(bioMechId -> whereClause.and(qstatementFullJpa.biologicalMechanismId.eq(bioMechId))).orElse(whereClause);


        return Cc.list(statementFullRepo.findAll(whereClause, qstatementFullJpa.created.asc()));
    }