Search in sources :

Example 1 with SerecoAnnotationType

use of com.mercedesbenz.sechub.sereco.metadata.SerecoAnnotationType in project sechub by mercedes-benz.

the class SerecoProductResultTransformer method handleAnnotation.

private void handleAnnotation(SerecoAnnotation annotation, ReportTransformationResult transformerResult, UUID sechubJobUUID) {
    if (annotation == null) {
        return;
    }
    SerecoAnnotationType annotationType = annotation.getType();
    String annotationValue = annotation.getValue();
    if (annotationType == null) {
        LOG.error("Sereco message type not set for message :{}, sechub job uuid: {}", annotationValue, sechubJobUUID);
        return;
    }
    switch(annotationType) {
        case USER_INFO:
            appendSecHubMessage(transformerResult, new SecHubMessage(SecHubMessageType.INFO, annotationValue));
            return;
        case USER_WARNING:
            appendSecHubMessage(transformerResult, new SecHubMessage(SecHubMessageType.WARNING, annotationValue));
            return;
        case USER_ERROR:
            appendSecHubMessage(transformerResult, new SecHubMessage(SecHubMessageType.ERROR, annotationValue));
            return;
        case INTERNAL_ERROR_PRODUCT_FAILED:
            /* internal errors are marked with status failed */
            transformerResult.setStatus(SecHubStatus.FAILED);
            /* we add an information to user as well */
            appendSecHubMessage(transformerResult, new SecHubMessage(SecHubMessageType.ERROR, "Job execution failed because of an internal problem."));
            return;
        default:
            // nothing
            LOG.error("Unhandled sereco annotation type:{}, value:{}, sechub job uuid: {}", annotationType, annotationValue, sechubJobUUID);
    }
}
Also used : SecHubMessage(com.mercedesbenz.sechub.commons.model.SecHubMessage) SerecoAnnotationType(com.mercedesbenz.sechub.sereco.metadata.SerecoAnnotationType)

Aggregations

SecHubMessage (com.mercedesbenz.sechub.commons.model.SecHubMessage)1 SerecoAnnotationType (com.mercedesbenz.sechub.sereco.metadata.SerecoAnnotationType)1