CPD Results

The following document contains the results of PMD's CPD 7.26.0.

Duplications

File Line
org/tailormap/api/controller/admin/AttributeStatisticsAdminController.java 36
org/tailormap/api/controller/admin/UniqueValuesAdminController.java 42
public AttributeStatisticsAdminController(
      FeatureTypeRepository featureTypeRepository, FeatureSourceFactoryHelper featureSourceFactoryHelper) {
    this.featureTypeRepository = featureTypeRepository;
    this.featureSourceFactoryHelper = featureSourceFactoryHelper;
  }

  @ExceptionHandler({ResponseStatusException.class})
  public ResponseEntity<?> handleException(ResponseStatusException ex) {
    // wrap the exception in a proper json response
    return ResponseEntity.status(ex.getStatusCode())
        .contentType(MediaType.APPLICATION_JSON)
        .body(new ErrorResponse()
            .message(
                ex.getReason() != null
                    ? ex.getReason()
                    : ex.getBody().getTitle())
            .code(ex.getStatusCode().value()));
  }

  /**
   * Retrieve attribute statistics for a feature type.
   *
   * @param featureTypeId the feature type id for which to retrieve statistics
   * @param attributeName the name of the attribute
   * @param filter an optional CQL filter to apply to the features before calculating statistics
   * @return @return the calculated statistics; fields may be null when not applicable or when no features match
   * @throws ResponseStatusException if the feature type or attribute does not exist, or if a bad request was
   *     submitted
   */
  @Operation(