Search in sources :

Example 6 with UseCaseDefinition

use of com.mercedesbenz.sechub.sharedkernel.usecases.UseCaseDefinition in project sechub by mercedes-benz.

the class RestDocFactory method createDescription.

public static String createDescription(Class<? extends Annotation> useCase) {
    UseCaseDefinition usecaseAnnotation = useCase.getAnnotation(UseCaseDefinition.class);
    StringBuilder sb = new StringBuilder();
    if (usecaseAnnotation == null) {
        throw new IllegalArgumentException("given use case must have annotation of use case defintiion inside but hasnot :" + useCase);
    } else {
        String description = usecaseAnnotation.description();
        if (description.contains(".adoc")) {
            sb.append(usecaseAnnotation.title());
        } else {
            sb.append(description);
        }
    }
    return sb.toString();
}
Also used : UseCaseDefinition(com.mercedesbenz.sechub.sharedkernel.usecases.UseCaseDefinition)

Example 7 with UseCaseDefinition

use of com.mercedesbenz.sechub.sharedkernel.usecases.UseCaseDefinition in project sechub by mercedes-benz.

the class RestDocFactory method createIdentifier.

public static String createIdentifier(Class<? extends Annotation> useCase) {
    UseCaseDefinition usecaseAnnotation = useCase.getAnnotation(UseCaseDefinition.class);
    if (usecaseAnnotation == null) {
        throw new IllegalArgumentException("given use case must have annotation of use case definition inside but has not: " + useCase);
    }
    String usecaseIdentifier = usecaseAnnotation.apiName();
    if (usecaseIdentifier == null) {
        throw new IllegalArgumentException("use case annotation of class does not contain id:" + useCase);
    }
    return usecaseIdentifier;
}
Also used : UseCaseDefinition(com.mercedesbenz.sechub.sharedkernel.usecases.UseCaseDefinition)

Aggregations

UseCaseDefinition (com.mercedesbenz.sechub.sharedkernel.usecases.UseCaseDefinition)7 Reflections (com.mercedesbenz.sechub.docgen.reflections.Reflections)2 PDSUseCaseDefinition (com.mercedesbenz.sechub.pds.usecase.PDSUseCaseDefinition)2 HashMap (java.util.HashMap)2 Test (org.junit.Test)2 PDSUseCaseIdentifier (com.mercedesbenz.sechub.pds.usecase.PDSUseCaseIdentifier)1 UseCaseIdentifier (com.mercedesbenz.sechub.sharedkernel.usecases.UseCaseIdentifier)1