class ViolationAnalysisResource extends AlpineResource {

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    @ApiOperation(
            value = "Retrieves a violation analysis trail",
            response = ViolationAnalysis.class,
            notes = "<p>Requires permission <strong>VIEW_POLICY_VIOLATION</strong></p>"
    )
    @ApiResponses(value = {
            @ApiResponse(code = 401, message = "Unauthorized"),
            @ApiResponse(code = 404, message = "The component or policy violation could not be found")
    })
    @PermissionRequired(Permissions.Constants.VIEW_POLICY_VIOLATION)
    public Response retrieveAnalysis(@ApiParam(value = "The UUID of the component", format = "uuid", required = true)
                                     @QueryParam("component") @ValidUuid String componentUuid,
                                     @ApiParam(value = "The UUID of the policy violation", format = "uuid", required = true)
                                     @QueryParam("policyViolation") @ValidUuid String violationUuid) {
        failOnValidationError(
                new ValidationTask(RegexSequence.Pattern.UUID, componentUuid, "Component is not a valid UUID"),
                new ValidationTask(RegexSequence.Pattern.UUID, violationUuid, "Policy violation is not a valid UUID")
        );
        try (QueryManager qm = new QueryManager()) {
            final Component component = qm.getObjectByUuid(Component.class, componentUuid);
            if (component == null) {
                return Response.status(Response.Status.NOT_FOUND).entity("The component could not be found.").build();
            }
            final PolicyViolation policyViolation = qm.getObjectByUuid(PolicyViolation.class, violationUuid);
            if (policyViolation == null) {
                return Response.status(Response.Status.NOT_FOUND).entity("The policy violation could not be found.").build();
            }
            final ViolationAnalysis analysis = qm.getViolationAnalysis(component, policyViolation);
            return Response.ok(analysis).build();
        }
    }

    @PUT
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    @ApiOperation(
            value = "Records a violation analysis decision",
            response = ViolationAnalysis.class,
            notes = "<p>Requires permission <strong>POLICY_VIOLATION_ANALYSIS</strong></p>"
    )
    @ApiResponses(value = {
            @ApiResponse(code = 401, message = "Unauthorized"),
            @ApiResponse(code = 404, message = "The component or policy violation could not be found")
    })
    @PermissionRequired(Permissions.Constants.POLICY_VIOLATION_ANALYSIS)
    public Response updateAnalysis(ViolationAnalysisRequest request) {<FILL_FUNCTION_BODY>}

}

        final Validator validator = getValidator();
        failOnValidationError(
                validator.validateProperty(request, "component"),
                validator.validateProperty(request, "policyViolation"),
                validator.validateProperty(request, "analysisState"),
                validator.validateProperty(request, "comment")
        );
        try (QueryManager qm = new QueryManager()) {
            final Component component = qm.getObjectByUuid(Component.class, request.getComponent());
            if (component == null) {
                return Response.status(Response.Status.NOT_FOUND).entity("The component could not be found.").build();
            }
            final PolicyViolation violation = qm.getObjectByUuid(PolicyViolation.class, request.getPolicyViolation());
            if (violation == null) {
                return Response.status(Response.Status.NOT_FOUND).entity("The policy violation could not be found.").build();
            }

            String commenter = null;
            if (getPrincipal() instanceof LdapUser || getPrincipal() instanceof ManagedUser || getPrincipal() instanceof OidcUser) {
                commenter = ((UserPrincipal) getPrincipal()).getUsername();
            }

            boolean analysisStateChange = false;
            boolean suppressionChange = false;
            ViolationAnalysis analysis = qm.getViolationAnalysis(component, violation);
            if (analysis != null) {
                if (request.getAnalysisState() != null && analysis.getAnalysisState() != request.getAnalysisState()) {
                    analysisStateChange = true;
                    qm.makeViolationAnalysisComment(analysis, String.format("%s → %s", analysis.getAnalysisState(), request.getAnalysisState()), commenter);
                }
                if (request.isSuppressed() != null && analysis.isSuppressed() != request.isSuppressed()) {
                    suppressionChange = true;
                    final String message = (request.isSuppressed()) ? "Suppressed" : "Unsuppressed";
                    qm.makeViolationAnalysisComment(analysis, message, commenter);
                }
                analysis = qm.makeViolationAnalysis(component, violation, request.getAnalysisState(), request.isSuppressed());
            } else {
                analysis = qm.makeViolationAnalysis(component, violation, request.getAnalysisState(), request.isSuppressed());
                analysisStateChange = true; // this is a new analysis - so set to true because it was previously null
                if (ViolationAnalysisState.NOT_SET != request.getAnalysisState()) {
                    qm.makeViolationAnalysisComment(analysis, String.format("%s → %s", ViolationAnalysisState.NOT_SET, request.getAnalysisState()), commenter);
                }
            }

            final String comment = StringUtils.trimToNull(request.getComment());
            qm.makeViolationAnalysisComment(analysis, comment, commenter);
            analysis = qm.getObjectById(ViolationAnalysis.class, analysis.getId());
            NotificationUtil.analyzeNotificationCriteria(qm, analysis, analysisStateChange, suppressionChange);
            return Response.ok(analysis).build();
        }
    
<no_super_class>