Source:
public String listTransformations(ModelMap model, Principal principal) throws QuadrigaStorageException { IUser user = userManager.getUser(principal.getName()); Set<IProject> projects = new HashSet<>(); Map<String, List<INetwork>> networkMap = new HashMap<>(); List<IProject> retrievedProjects=new ArrayList<IProject>(); try { retrievedProjects=retrieveProjectManager.getProjectList(user.getUserName()); if (retrievedProjects == null) { retrievedProjects = new ArrayList<IProject>(); } } catch (QuadrigaStorageException e) { logger.error("Error fetching list of approved networks", e); model.addAttribute("show_error_alert", true); model.addAttribute("error_alert_msg", "There was an error retrieving the list of approved networks."); return "auth/transformation"; } List<INetwork> networks = new ArrayList<INetwork>(); for(IProject retrievedProj: retrievedProjects){ networks.addAll(networkManager.getNetworksInProject(retrievedProj.getProjectId(), null)); } List<INetwork> allNetworkList = new ArrayList<INetwork>(); for(INetwork individualNetworks: networks){ if(individualNetworks.getStatus().equalsIgnoreCase("APPROVED")){ allNetworkList.add(individualNetworks); } } for (INetwork network : allNetworkList) { IProject project = network.getNetworkWorkspace().getWorkspace() .getProjectWorkspace().getProject(); if (networkMap.get(project.getProjectName()) == null) { networkMap.put(project.getProjectName(), new ArrayList<INetwork>()); projects.add(project); } networkMap.get(project.getProjectName()).add(network); } List<TransformFilesDTO> transformationsList = transformManager .getTransformationsList(); model.addAttribute("projects", projects); model.addAttribute("networkMap", networkMap); model.addAttribute("transformationsList", transformationsList); return "auth/transformation"; }

Target:
public String listTransformations(ModelMap model, Principal principal) throws QuadrigaStorageException { IUser user = userManager.getUser(principal.getName()); Set<IProject> projects = new HashSet<>(); Map<String, List<INetwork>> networkMap = new HashMap<>(); List<IProject> retrievedProjects=new ArrayList<IProject>(); try { retrievedProjects=retrieveProjectManager.getProjectList(user.getUserName()); if (retrievedProjects == null) { retrievedProjects = new ArrayList<IProject>(); } } catch (QuadrigaStorageException e) { logger.error("Error fetching list of approved networks", e); model.addAttribute("show_error_alert", true); model.addAttribute("error_alert_msg", "There was an error retrieving the list of approved networks."); return "auth/transformation"; } List<INetwork> networks = new ArrayList<INetwork>(); for(IProject retrievedProj: retrievedProjects){ networks.addAll(networkManager.getNetworksInProject(retrievedProj.getProjectId(), INetworkStatus.APPROVED)); } List<INetwork> allNetworkList = new ArrayList<INetwork>(); for(INetwork individualNetworks: networks){ if(individualNetworks.getStatus().equalsIgnoreCase("APPROVED")){ allNetworkList.add(individualNetworks); } } for (INetwork network : allNetworkList) { IProject project = network.getNetworkWorkspace().getWorkspace() .getProjectWorkspace().getProject(); if (networkMap.get(project.getProjectName()) == null) { networkMap.put(project.getProjectName(), new ArrayList<INetwork>()); projects.add(project); } networkMap.get(project.getProjectName()).add(network); } List<TransformFilesDTO> transformationsList = transformManager .getTransformationsList(); model.addAttribute("projects", projects); model.addAttribute("networkMap", networkMap); model.addAttribute("transformationsList", transformationsList); return "auth/transformation"; }