Exemplo n.º 1
0
  public UpdateResponse update(String alias, ShowToSave showToSave) {
    DBObject show = findShow(alias);

    if (!show.get("alias").toString().equals(showToSave.getAlias())) {
      updateDenormalizedFields(show.get("alias").toString(), showToSave.getAlias());
    }

    mapper.map(showToSave, show);
    db.getCollection("show").update(aliasOrId(alias), show);
    return new UpdateResponse(true);
  }
Exemplo n.º 2
0
 public CreateResponse create(ShowToSave objectToSave) {
   DBObject newObject = mapper.map(objectToSave, BasicDBObject.class);
   newObject.put("alias", objectToSave.getAlias());
   db.getCollection("show").insert(newObject);
   return new CreateResponse(((ObjectId) newObject.get("_id")).toHexString());
 }