use of com.emc.metalnx.modelattribute.breadcrumb.DataGridBreadcrumb in project metalnx-web by irods-contrib.
the class CollectionInfoController method index.
@RequestMapping(method = RequestMethod.GET)
public String index(final Model model, HttpServletRequest request, @RequestParam("path") final String path) throws DataGridException, DataGridConnectionRefusedException, JargonException {
logger.info("index()");
if (path == null || path.isEmpty()) {
throw new IllegalArgumentException("null or empty path");
}
logger.info("path:{}", path);
String myPath = URLDecoder.decode(path);
logger.info("decoded myPath:{}", myPath);
IconObject icon = null;
String mimeType = "";
String template = "";
@SuppressWarnings("rawtypes") DataProfile dataProfile = collectionService.getCollectionDataProfile(myPath);
if (dataProfile != null && dataProfile.isFile()) {
mimeType = dataProfile.getDataType().getMimeType();
}
icon = collectionService.getIcon(mimeType);
model.addAttribute("icon", icon);
model.addAttribute("dataProfile", dataProfile);
model.addAttribute("breadcrumb", new DataGridBreadcrumb(dataProfile.getAbsolutePath()));
if (!dataProfile.isFile())
template = "collections/collectionInfo";
if (dataProfile.isFile())
template = "collections/fileInfo";
return template;
}
use of com.emc.metalnx.modelattribute.breadcrumb.DataGridBreadcrumb in project metalnx-web by irods-contrib.
the class BrowseController method setBreadcrumbToModel.
/**
* Creates the breadcrumb based on a given path.
*
* @param model
* Model attribute to set variables to be used in the view
* @param obj
* {@code DataGridCollectionAndDataObject} object
*/
private void setBreadcrumbToModel(final Model model, final DataGridCollectionAndDataObject obj) {
logger.info("setBreadcrumbToModel()");
if (model == null) {
throw new IllegalArgumentException("null model");
}
if (obj == null) {
throw new IllegalArgumentException("null obj");
}
logger.info("model:{}", model);
logger.info("obj:{}", obj);
model.addAttribute("collectionAndDataObject", obj);
logger.info("path for breadcrumb:{}", obj.getPath());
DataGridBreadcrumb breadcrumb = new DataGridBreadcrumb(obj.getPath());
logger.info("breadcrumb is:{}", breadcrumb);
model.addAttribute("breadcrumb", breadcrumb);
model.addAttribute("homeCollectionName", irodsServices.getCurrentUser());
}
Aggregations