goci-interfaces/goci-curation/src/main/java/uk/ac/ebi/spot/goci/curation/controller/StudyController.java
// Find correct sorting type and direction
Find correct sorting type and direction
Find correct sorting type and direction
private Sort findSort(String sortType) {
        Sort sort = sortByPublicationDateDesc();
        Map<String, Sort> sortTypeMap = new HashMap<>();
        sortTypeMap.put("authorsortasc", sortByAuthorAsc());
        sortTypeMap.put("authorsortdesc", sortByAuthorDesc());
        sortTypeMap.put("titlesortasc", sortByTitleAsc());
        sortTypeMap.put("titlesortdesc", sortByTitleDesc());
        sortTypeMap.put("publicationdatesortasc", sortByPublicationDateAsc());
        sortTypeMap.put("publicationdatesortdesc", sortByPublicationDateDesc());
        sortTypeMap.put("pubmedsortasc", sortByPubmedIdAsc());
        sortTypeMap.put("pubmedsortdesc", sortByPubmedIdDesc());
        sortTypeMap.put("userrequestedsortasc", sortByUserRequestedAsc());
        sortTypeMap.put("userrequestedsortdesc", sortByUserRequestedDesc());
        sortTypeMap.put("opentargetssortasc", sortByOpenTargetsAsc());
        sortTypeMap.put("opentargetssortdesc", sortByOpenTargetsDesc());
        sortTypeMap.put("publicationsortasc", sortByPublicationAsc());
        sortTypeMap.put("publicationsortdesc", sortByPublicationDesc());
        sortTypeMap.put("efotraitsortasc", sortByEfoTraitAsc());
        sortTypeMap.put("efotraitsortdesc", sortByEfoTraitDesc());
        sortTypeMap.put("diseasetraitsortasc", sortByDiseaseTraitAsc());
        sortTypeMap.put("diseasetraitsortdesc", sortByDiseaseTraitDesc());
        sortTypeMap.put("curatorsortasc", sortByCuratorAsc());
        sortTypeMap.put("curatorsortdesc", sortByCuratorDesc());
        sortTypeMap.put("curationstatussortasc", sortByCurationStatusAsc());
        sortTypeMap.put("curationstatussortdesc", sortByCurationStatusDesc());
        if (sortType != null && !sortType.isEmpty()) {
            sort = sortTypeMap.get(sortType);
        }
        return sort;
    }
private Sort findSort ( String sortType ) { Sort sort = sortByPublicationDateDesc ( ) ; Map < String , Sort > sortTypeMap = new HashMap < > ( ) ; sortTypeMap . put ( "authorsortasc" , sortByAuthorAsc ( ) ) ; sortTypeMap . put ( "authorsortdesc" , sortByAuthorDesc ( ) ) ; sortTypeMap . put ( "titlesortasc" , sortByTitleAsc ( ) ) ; sortTypeMap . put ( "titlesortdesc" , sortByTitleDesc ( ) ) ; sortTypeMap . put ( "publicationdatesortasc" , sortByPublicationDateAsc ( ) ) ; sortTypeMap . put ( "publicationdatesortdesc" , sortByPublicationDateDesc ( ) ) ; sortTypeMap . put ( "pubmedsortasc" , sortByPubmedIdAsc ( ) ) ; sortTypeMap . put ( "pubmedsortdesc" , sortByPubmedIdDesc ( ) ) ; sortTypeMap . put ( "userrequestedsortasc" , sortByUserRequestedAsc ( ) ) ; sortTypeMap . put ( "userrequestedsortdesc" , sortByUserRequestedDesc ( ) ) ; sortTypeMap . put ( "opentargetssortasc" , sortByOpenTargetsAsc ( ) ) ; sortTypeMap . put ( "opentargetssortdesc" , sortByOpenTargetsDesc ( ) ) ; sortTypeMap . put ( "publicationsortasc" , sortByPublicationAsc ( ) ) ; sortTypeMap . put ( "publicationsortdesc" , sortByPublicationDesc ( ) ) ; sortTypeMap . put ( "efotraitsortasc" , sortByEfoTraitAsc ( ) ) ; sortTypeMap . put ( "efotraitsortdesc" , sortByEfoTraitDesc ( ) ) ; sortTypeMap . put ( "diseasetraitsortasc" , sortByDiseaseTraitAsc ( ) ) ; sortTypeMap . put ( "diseasetraitsortdesc" , sortByDiseaseTraitDesc ( ) ) ; sortTypeMap . put ( "curatorsortasc" , sortByCuratorAsc ( ) ) ; sortTypeMap . put ( "curatorsortdesc" , sortByCuratorDesc ( ) ) ; sortTypeMap . put ( "curationstatussortasc" , sortByCurationStatusAsc ( ) ) ; sortTypeMap . put ( "curationstatussortdesc" , sortByCurationStatusDesc ( ) ) ; if ( sortType != null && ! sortType . isEmpty ( ) ) { sort = sortTypeMap . get ( sortType ) ; } return sort ; }
Find correct sorting type and direction
Find correct sorting type and direction
// Default sort by date