public Optional < QualityGateData > getQualityGate ( DbSession dbSession , OrganizationDto organization , ComponentDto component ) { Optional < QualityGateData > res = dbClient . projectQgateAssociationDao ( ) . selectQGateIdByComponentId ( dbSession , component . getId ( ) ) . map ( qualityGateId -> dbClient . qualityGateDao ( ) . selectById ( dbSession , qualityGateId ) ) . map ( qualityGateDto -> new QualityGateData ( qualityGateDto , false ) ) ; if ( res . isPresent ( ) ) { return res ; } return ofNullable ( dbClient . qualityGateDao ( ) . selectByOrganizationAndUuid ( dbSession , organization , organization . getDefaultQualityGateUuid ( ) ) ) . map ( qualityGateDto -> new QualityGateData ( qualityGateDto , true ) ) ; }
Return effective quality gate of a project .