/**
  * Display the "device detail" page.
  *
  * @param hardwareId
  * @param request
  * @return
  */
 @RequestMapping("/devices/{hardwareId}")
 public ModelAndView deviceDetail(
     @PathVariable("hardwareId") String hardwareId, HttpServletRequest request) {
   Tracer.start(TracerCategory.AdminUserInterface, "deviceDetail", LOGGER);
   try {
     Map<String, Object> data = createBaseData(request);
     ITenant tenant = (ITenant) data.get(DATA_TENANT);
     IDeviceManagement management = SiteWhere.getServer().getDeviceManagement(tenant);
     IDevice device = management.getDeviceByHardwareId(hardwareId);
     if (device != null) {
       IDeviceSpecification specification =
           management.getDeviceSpecificationByToken(device.getSpecificationToken());
       data.put("device", device);
       data.put("specification", specification);
       return new ModelAndView("devices/detail", data);
     }
     return showError("Device for hardware id '" + hardwareId + "' not found.");
   } catch (NoTenantException e) {
     return showTenantChoices(getUrl(request), request);
   } catch (SiteWhereException e) {
     return showError(e);
   } finally {
     Tracer.stop(LOGGER);
   }
 }