package uk.ac.ebi.quickgo.ontology;

import uk.ac.ebi.quickgo.common.validator.OntologyIdPredicate;
import uk.ac.ebi.quickgo.ontology.controller.validation.OBOControllerValidationHelper;
import uk.ac.ebi.quickgo.ontology.controller.validation.OBOControllerValidationHelperImpl;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import static uk.ac.ebi.quickgo.common.validator.OntologyIdPredicate.isValidGOTermId;

/**
 * @author Tony Wardell
 * Date: 17/01/2017
 * Time: 13:32
 * Created with IntelliJ IDEA.
 */
@Configuration
public class OntologyRestConfig {

    @Bean
    public OntologyPagingConfig ontologyPagingConfig(
            @Value("${ontology.default_page_size:25}") int defaultPageSize) {

        return () -> defaultPageSize;
    }

    public interface OntologyPagingConfig{
        int defaultPageSize();

    }

    @Bean
    public OBOControllerValidationHelper goValidationHelper(@Value("${ontology.max_page_size:600}") int maxPageSize){
        return new OBOControllerValidationHelperImpl(maxPageSize, isValidGOTermId());
    }

    @Bean
    public OBOControllerValidationHelper ecoValidationHelper(@Value("${ontology.max_page_size:600}") int maxPageSize){
        return new OBOControllerValidationHelperImpl(maxPageSize, OntologyIdPredicate.isValidECOTermId());
    }
}

@@ -626,16 +626,158 @@
 J IDEA.%0A
+ *%0A * Configure the beans related to the operation of the restful service - id validation helpers and configuration%0A * object for page sizes.%0A
  */%0A@Con
@@ -964,17 +964,16 @@
 Size) %7B%0A
-%0A
         
@@ -1013,90 +1013,8 @@
  %7D%0A%0A
-    public interface OntologyPagingConfig%7B%0A        int defaultPageSize();%0A%0A    %7D%0A%0A
     
@@ -1127,32 +1127,33 @@
 int maxPageSize)
+ 
 %7B%0A        return
@@ -1358,16 +1358,17 @@
 ageSize)
+ 
 %7B%0A      
@@ -1473,11 +1473,93 @@
 );%0A    %7D
+%0A%0A    public interface OntologyPagingConfig %7B%0A        int defaultPageSize();%0A    %7D
 %0A%7D%0A

Add javadoc and reformat code.