From 31bfa590fc9c51066d8cbe112ae193782c711344 Mon Sep 17 00:00:00 2001 From: Hetal Patel Date: Fri, 19 Jan 2018 16:46:16 -0500 Subject: [PATCH] #27 icon load --- .../controller/CollectionInfoController.java | 39 +++++++------------ 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/src/emc-metalnx-shared/src/main/java/com/emc/metalnx/controller/CollectionInfoController.java b/src/emc-metalnx-shared/src/main/java/com/emc/metalnx/controller/CollectionInfoController.java index bb3f0fd77..dc893b8ba 100644 --- a/src/emc-metalnx-shared/src/main/java/com/emc/metalnx/controller/CollectionInfoController.java +++ b/src/emc-metalnx-shared/src/main/java/com/emc/metalnx/controller/CollectionInfoController.java @@ -73,8 +73,7 @@ public String getTestCollectionInfo(final Model model, HttpServletRequest reques DataProfile dataProfile = getCollectionDataProfile(path); String iconToDisplay = ""; - - + if(dataProfile!= null && dataProfile.isFile()) iconToDisplay = iconService.getIconToDisplayFile(dataProfile.getDataType().getMimeType()); if(dataProfile!= null && !dataProfile.isFile()) @@ -83,25 +82,10 @@ public String getTestCollectionInfo(final Model model, HttpServletRequest reques model.addAttribute("iconToDisplay", iconToDisplay); model.addAttribute("dataProfile", dataProfile); - return "collections/info"; //:: mainPage(page='collections/collectionInfo', fragment='collectionInfo')"; + return "collections/info"; + //:: mainPage(page='collections/collectionInfo', fragment='collectionInfo')"; //"main :: mainPage(page='some-page', fragment='somePage')"; - //return "collections/collectionInfo"; - - - /* - * DataGridCollectionAndDataObject dgColObj = null; - * - * try { dgColObj = collectionService.findByName(path); - * permissionsService.resolveMostPermissiveAccessForUser(dgColObj, - * loggedUserUtils.getLoggedDataGridUser()); } catch (DataGridException e) { - * logger.error("Could not retrieve collection/dataobject from path: {}", path); - * } model.addAttribute("currentPath", path); - * model.addAttribute("collectionAndDataObject", dgColObj); if (dgColObj != - * null) model.addAttribute("flag", true); else { model.addAttribute("flag", - * false); } - */ - } @SuppressWarnings("unchecked") @@ -123,7 +107,6 @@ public DataProfile getCollectionDataProfile(String path) thro logger.info("------CollectionInfoController getTestCollectionInfo() ends !!"); logger.info("data profile retrieved:{}", dataProfile); - /* * TODO: after this do an if test and send to right view with the DataProfile in * the model @@ -143,15 +126,23 @@ public DataProfile getCollectionDataProfile(String path) thro public String getCollectionFileInfo(final Model model, @RequestParam("path") final String path) throws DataGridException { - logger. - info("------CollectionInfoController getCollectionFileInfo() starts :: " - +path); + logger.info("CollectionInfoController getCollectionFileInfo() starts :: " +path); @SuppressWarnings("rawtypes") DataProfile dataProfile = getCollectionDataProfile(path); - + String iconToDisplay = ""; + + if(dataProfile!= null && dataProfile.isFile()) + iconToDisplay = iconService.getIconToDisplayFile(dataProfile.getDataType().getMimeType()); + if(dataProfile!= null && !dataProfile.isFile()) + iconToDisplay = iconService.getIconToDisplayCollection(); + + model.addAttribute("iconToDisplay", iconToDisplay); model.addAttribute("dataProfile", dataProfile); + + logger.info("CollectionInfoController getCollectionFileInfo() ends !!"); + return "collections/collectionInfo"; }