Example #1
0
  /**
   * Serialises <code>beanContent</code> and then puts all properties directly into an existing
   * <code>document</code>, overwriting existing properties if necessary.
   *
   * @param document the destination document
   * @param beanContent the data bean to be serialised
   */
  public static void serialiseIntoDocument(Document document, Object beanContent) {
    //    JsonNode beanAsJson = mapper.valueToTree(beanContent);
    // JsonNode beanAsJson = mapper.convertValue(beanContent, JsonNode.class);

    ObjectNode beanAsJson = mapper.valueToTree(beanContent); // Bean --> JSON tree
    document
        .getContent()
        .putAll(beanAsJson); // Replace values in the document content with the tree
  }
 public JSONObject getSummonerSpelByID(Long id) {
   Document summonerSpel = couch.getDataFromDatabase(CouchDB.SUMMONER_SPEL_ID + id.toString());
   summonerSpel.remove("_id");
   summonerSpel.remove("_rev");
   return summonerSpel.getJSONObject();
 }
 public JSONObject getRuneByID(Long id) {
   Document rune = couch.getDataFromDatabase(CouchDB.RUNE_ID + id.toString());
   rune.remove("_id");
   rune.remove("_rev");
   return rune.getJSONObject();
 }
 public JSONObject getMasteryByID(Long id) {
   Document mastery = couch.getDataFromDatabase(CouchDB.MASTERY_ID + id.toString());
   mastery.remove("_id");
   mastery.remove("_rev");
   return mastery.getJSONObject();
 }
 public JSONObject getItemByID(Long id) {
   Document item = couch.getDataFromDatabase(CouchDB.ITEM_ID + id.toString());
   item.remove("_id");
   item.remove("_rev");
   return item.getJSONObject();
 }
 public JSONObject getChampionByID(Long id) {
   Document champion = couch.getDataFromDatabase(CouchDB.CHAMPION_ID + id.toString());
   champion.remove("_id");
   champion.remove("_rev");
   return champion.getJSONObject();
 }