@DELETE
 @Path("{id}")
 @Consumes({MediaType.APPLICATION_JSON})
 public void delete(@PathParam("id") Long id) {
   log.info("delete:" + id);
   Datastore.delete(Datastore.createKey(ShopModel.class, id));
 }
  @Override
  public Navigation run() throws Exception {

    Integer id = asInteger("id");
    if (id != null) {
      Key key = Datastore.createKey(PrizeRule.class, id);

      GlobalTransaction tx = Datastore.beginGlobalTransaction();
      Datastore.delete(key);
      tx.commit();

    } else {
      return redirect("prizeRules");
    }
    return redirect("prizeRules");
  }
  /**
   * Removes an Event todo in the the Datastore
   *
   * @param key the key of the event to be removed
   * @return whether the transaction is successful
   */
  public boolean removeEventTodo(EventTodoModel et) {
    boolean ok = true;

    try {
      EventTodoModel etm = getEventTodoModelById(et.getId());
      if (etm != null) {
        Transaction trans = Datastore.beginTransaction();
        Datastore.delete(etm.getKey());
        trans.commit();
      }
    } catch (Exception e) {
      ok = false;
    }

    return ok;
  }
Пример #4
0
  /*
   * (non-Javadoc)
   *
   * @see yanitime4u.yanitime.logic.UserLogic#delete(com.google.appengine.api.datastore.Key,
   * java.lang.Long)
   */
  @Override
  public void delete(Key key, Long version) {
    AssertionUtil.assertNotNull(key);
    AssertionUtil.assertNotNull(version);

    Transaction tx = Datastore.beginTransaction();
    try {
      Users latest = Datastore.get(meta, key, version);
      Datastore.delete(latest.getKey());
      tx.commit();
    } catch (ConcurrentModificationException e) {
      if (tx.isActive()) {
        tx.rollback();
      }
      throw e;
    }
  }
 public void deleteProductSpecialOffer(Key key) {
   Transaction tx = Datastore.beginTransaction();
   Datastore.delete(tx, key);
   tx.commit();
 }