@@ -0,0 +1,2790 @@
+package uk.ac.ebi.spot.goci.curation.controller;%0A%0Aimport lombok.extern.slf4j.Slf4j;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.data.domain.PageRequest;%0Aimport org.springframework.stereotype.Controller;%0Aimport org.springframework.ui.Model;%0Aimport org.springframework.web.bind.annotation.GetMapping;%0Aimport uk.ac.ebi.spot.goci.model.DiseaseTrait;%0Aimport uk.ac.ebi.spot.goci.model.projection.DiseaseTraitProjection;%0Aimport uk.ac.ebi.spot.goci.repository.DiseaseTraitRepository;%0A%0Aimport java.util.*;%0Aimport java.util.concurrent.atomic.AtomicInteger;%0A%0A@Slf4j%0A@Controller%0Aclass ViewController %7B%0A%0A    @Autowired%0A    private DiseaseTraitRepository diseaseTraitRepository;%0A%0A%0A    @GetMapping(%22/disease-traits%22)%0A    public String masterdetailPage(Model model) %7B%0A%0A        List%3CMap%3CString, Object%3E%3E dataList = new ArrayList%3C%3E();%0A        List%3CDiseaseTraitProjection%3E projections =%0A                diseaseTraitRepository.findAllOrOrderByStudiesLargest(new PageRequest(0, 30));%0A%0A        projections.forEach(x-%3E%7B%0A            Map%3CString, Object%3E result = new HashMap%3C%3E();%0A            result.put(%22country%22, x.getTrait());%0A            result.put(%22visits%22, x.getStudiesCount());%0A            dataList.add(result);%0A        %7D);%0A%0A        List%3CLong%3E ids = new ArrayList%3C%3E();%0A        AtomicInteger count = new AtomicInteger(1);%0A        projections.forEach(projection -%3E %7B%0A            if (count.get() %3C= 4)%7B%0A                ids.add(projection.getId());%0A                count.getAndIncrement();%0A            %7D%0A        %7D);%0A        List%3CDiseaseTrait%3E diseaseTraits = diseaseTraitRepository.findAllByIdIsIn(ids);%0A        List%3CObject%3E parents = new ArrayList%3C%3E();%0A        diseaseTraits.forEach(diseaseTrait -%3E %7B%0A            String trait = diseaseTrait.getTrait();%0A            List%3CMap%3CString, Object%3E%3E children = new ArrayList%3C%3E();%0A            diseaseTrait.getStudies().forEach(study -%3E %7B%0A                Map%3CString, Object%3E child = new HashMap%3C%3E();%0A                child.put(%22name%22, study.getPublicationId().getPubmedId());%0A                child.put(%22value%22, 40);%0A                children.add(child);%0A            %7D);%0A%0A            Map%3CString, Object%3E parent = new LinkedHashMap%3C%3E();%0A            parent.put(%22name%22, trait+%22 (%22+children.size()+%22)%22);%0A            parent.put(%22value%22, 102);%0A            parent.put(%22children%22, children);%0A            parents.add(parent);%0A        %7D);%0A%0A%0A        List%3CObject%3E parents2 = new ArrayList%3C%3E();%0A        Map%3CString, Object%3E parenta = new LinkedHashMap%3C%3E();%0A%0A        parenta.put(%22name%22, %22core%22);%0A        parenta.put(%22value%22, %2210%22);%0A        parenta.put(%22children%22, parents);%0A        parents2.add(parenta);%0A%0A        model.addAttribute(%22dataList%22, dataList);%0A        model.addAttribute(%22mapData%22, parents2);%0A        return %22disease-traits%22;%0A    %7D%0A%7D

Add New View controller to serve the new diseaseTait Page