Search in sources :

Example 1 with IconObject

use of com.emc.metalnx.core.domain.entity.IconObject in project metalnx-web by irods-contrib.

the class IconServiceImpl method createMap.

private static Map<String, IconObject> createMap() {
    Map<String, IconObject> myMap = new HashMap<String, IconObject>();
    myMap.put("image/jpg", new IconObject("File", "fa fa-file-image-o"));
    myMap.put("image/jpeg", new IconObject("File", "fa fa-file-image-o"));
    myMap.put("image/png", new IconObject("File", "fa fa-file-image-o"));
    myMap.put("image/gif", new IconObject("File", "fa fa-file-image-o"));
    myMap.put("application/pdf", new IconObject("File", "fa fa-file-pdf-o"));
    myMap.put("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", new IconObject("File", "fa fa-file-excel-o"));
    myMap.put("application/vnd.openxmlformats-officedocument.spreadsheetml.template", new IconObject("File", "fa fa-file-excel-o"));
    myMap.put("application/vnd.openxmlformats-officedocument.wordprocessingml.document", new IconObject("File", "fa fa-file-word-o"));
    myMap.put("text/csv", new IconObject("File", "fa fa-file-excel-o"));
    myMap.put("text/plain", new IconObject("File", "fa fa-file-text-o"));
    return myMap;
}
Also used : IconObject(com.emc.metalnx.core.domain.entity.IconObject) HashMap(java.util.HashMap)

Example 2 with IconObject

use of com.emc.metalnx.core.domain.entity.IconObject in project metalnx-web by irods-contrib.

the class BrowseController method getSummary.

@RequestMapping(value = "/summary", method = RequestMethod.POST)
public String getSummary(final Model model, @RequestParam("path") final String path) throws DataGridException, UnsupportedEncodingException {
    logger.info("BrowseController getSummary() starts :: " + path);
    IconObject icon = null;
    String mimeType = "";
    @SuppressWarnings("rawtypes") DataProfile dataProfile = cs.getCollectionDataProfile(URLDecoder.decode(path, "UTF-8"));
    logger.info("DataProfiler is :: " + dataProfile);
    if (dataProfile != null && dataProfile.isFile()) {
        mimeType = dataProfile.getDataType().getMimeType();
    }
    icon = cs.getIcon(mimeType);
    model.addAttribute("icon", icon);
    model.addAttribute("dataProfile", dataProfile);
    logger.info("getSummary() ends !!");
    return "collections/summarySidenav :: SummarySidenavView";
}
Also used : DataProfile(org.irods.jargon.extensions.dataprofiler.DataProfile) IconObject(com.emc.metalnx.core.domain.entity.IconObject) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with IconObject

use of com.emc.metalnx.core.domain.entity.IconObject 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 4 with IconObject

use of com.emc.metalnx.core.domain.entity.IconObject in project metalnx-web by irods-contrib.

the class CollectionInfoController method getCollectionFileInfo.

@RequestMapping(value = "/collectionFileInfo/", method = RequestMethod.POST)
public String getCollectionFileInfo(final Model model, @RequestParam("path") final String path) throws DataGridException {
    logger.info("CollectionInfoController getCollectionFileInfo() starts :: " + path);
    IconObject icon = null;
    String mimeType = "";
    @SuppressWarnings("rawtypes") String myPath = URLDecoder.decode(path);
    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);
    logger.info("getCollectionFileInfo() ends !!");
    return "collections/details :: detailsView";
}
Also used : DataProfile(org.irods.jargon.extensions.dataprofiler.DataProfile) IconObject(com.emc.metalnx.core.domain.entity.IconObject) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

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