Search in sources :

Example 1 with DataGridBreadcrumb

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;
}
Also used : DataProfile(org.irods.jargon.extensions.dataprofiler.DataProfile) DataGridBreadcrumb(com.emc.metalnx.modelattribute.breadcrumb.DataGridBreadcrumb) IconObject(com.emc.metalnx.core.domain.entity.IconObject) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with DataGridBreadcrumb

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());
}
Also used : DataGridBreadcrumb(com.emc.metalnx.modelattribute.breadcrumb.DataGridBreadcrumb)

Aggregations

DataGridBreadcrumb (com.emc.metalnx.modelattribute.breadcrumb.DataGridBreadcrumb)2 IconObject (com.emc.metalnx.core.domain.entity.IconObject)1 DataProfile (org.irods.jargon.extensions.dataprofiler.DataProfile)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1