@SuppressWarnings("unchecked")
  @RequestMapping(value = "client/version/view")
  public String viewVersionInfo(Model model)
      throws JsonParseException, JsonMappingException, IOException {

    for (ClientTypeEnum clientType : ClientTypeEnum.values()) {

      for (OsTypeEnum osType : OsTypeEnum.values()) {
        String finalKey =
            clientHelper.toFinalKey(clientType.toString().charAt(0), osType.toString().charAt(0));
        Map<String, Object> para = new HashMap<String, Object>();
        para.put("key", finalKey);
        List<KeyValueEntity> keyValues = keyValueDao.select("selectByKey", para);

        if (CollectionUtils.isNotEmpty(keyValues)) {
          KeyValueEntity entity = keyValues.get(0);
          Map<String, String> value = mapper.readValue(entity.getValue(), Map.class);

          model.addAttribute(
              ClientHelper.ATTR_CURRENT_VERSION, value.get(ClientHelper.ATTR_CURRENT_VERSION));
          model.addAttribute(
              ClientHelper.ATTR_CURRENT_VERSION_INFO,
              value.get(ClientHelper.ATTR_CURRENT_VERSION_INFO));
          model.addAttribute(
              ClientHelper.ATTR_REQUIRED_VERSION, value.get(ClientHelper.ATTR_REQUIRED_VERSION));

          model.addAttribute(finalKey, value);
        }
      }
    }

    return ("client/version");
  }
Beispiel #2
0
 public static String stringValueOf(int v) {
   String result = null;
   for (ClientTypeEnum typeEnum : ClientTypeEnum.values()) {
     if (typeEnum.value.intValue() == v) {
       result = typeEnum.name();
       break;
     }
   }
   return result;
 }