package uk.ac.ebi.quickgo.ontology.controller;

import uk.ac.ebi.quickgo.common.SearchableField;
import uk.ac.ebi.quickgo.graphics.service.GraphImageService;
import uk.ac.ebi.quickgo.ontology.common.OntologyType;
import uk.ac.ebi.quickgo.ontology.model.GOTerm;
import uk.ac.ebi.quickgo.ontology.model.OBOTerm;
import uk.ac.ebi.quickgo.ontology.service.OntologyService;
import uk.ac.ebi.quickgo.ontology.service.search.SearchServiceConfig;
import uk.ac.ebi.quickgo.rest.search.SearchService;

import java.util.function.Predicate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

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

/**
 * REST controller for accessing GO related information.
 *
 * For complete list of necessary endpoints, and their behaviour:
 *  refer to https://www.ebi.ac.uk/seqdb/confluence/display/GOA/REST+API
 *
 * Created 16/11/15
 * @author Edd
 */
@RestController
@RequestMapping(value = "/ontology/go")
public class GOController extends OBOController<GOTerm> {

    @Autowired
    public GOController(OntologyService<GOTerm> goOntologyService,
            SearchService<OBOTerm> ontologySearchService,
            SearchableField searchableField,
            SearchServiceConfig.OntologyCompositeRetrievalConfig ontologyRetrievalConfig,
            GraphImageService graphImageService) {
        super(goOntologyService, ontologySearchService, searchableField, ontologyRetrievalConfig, graphImageService);
    }

    @Override
    public Predicate<String> idValidator() {
        return isValidGOTermId();
    }

    @Override protected OntologyType getOntologyType() {
        return OntologyType.GO;
    }

}

@@ -585,16 +585,75 @@
 owired;%0A
+import org.springframework.beans.factory.annotation.Value;%0A
 import o
@@ -1540,16 +1540,161 @@
 eService
+,%0A            @Value(%22$%7Bontology.max_page_size:600%7D%22) int maxPageSize,%0A            @Value(%22$%7Bontology.default_page_size:25%7D%22) int defaultPageSize
 ) %7B%0A    
@@ -1804,16 +1804,60 @@
 eService
+,%0A              maxPageSize, defaultPageSize
 );%0A    %7D

Load values for default and max pages sizes in constructor.