private MetricInfo unmarshalMetricInfo(Map<String, Object> metricInfoMap) throws DatamodelMappingException, JsonParseException, JsonMappingException, IOException, ParseException { KapuaId scopeId = new KapuaEid(new BigInteger((String) metricInfoMap.get(MetricInfoSchema.METRIC_SCOPE_ID))); MetricInfo metricInfo = new MetricInfoImpl(scopeId); String id = (String) metricInfoMap.get(ModelContext.DATASTORE_ID_KEY); metricInfo.setId(new StorableIdImpl(id)); @SuppressWarnings("unchecked") Map<String, Object> metricMap = (Map<String, Object>) metricInfoMap.get(MetricInfoSchema.METRIC_MTR); String name = (String) metricMap.get(MetricInfoSchema.METRIC_MTR_NAME); String type = (String) metricMap.get(MetricInfoSchema.METRIC_MTR_TYPE); String lastMsgTimestamp = (String) metricMap.get(MetricInfoSchema.METRIC_MTR_TIMESTAMP); String lastMsgId = (String) metricMap.get(MetricInfoSchema.METRIC_MTR_MSG_ID); String clientId = (String) metricInfoMap.get(MetricInfoSchema.METRIC_CLIENT_ID); String channel = (String) metricInfoMap.get(MetricInfoSchema.METRIC_CHANNEL); metricInfo.setClientId(clientId); metricInfo.setChannel(channel); metricInfo.setFirstMessageId(new StorableIdImpl(lastMsgId)); String metricName = DatastoreUtils.restoreMetricName(name); metricInfo.setName(metricName); Date timestamp = KapuaDateUtils.parseDate(lastMsgTimestamp); metricInfo.setFirstMessageOn(timestamp); metricInfo.setMetricType(DatastoreUtils.convertToKapuaType(type)); return metricInfo; }