Package com.denisk.appengine.nl.server.data

Examples of com.denisk.appengine.nl.server.data.Good


  }

  public ArrayList<Good> goodsFromEntities(Iterable<Entity> goodEntities) {
    ArrayList<Good> goods = new ArrayList<Good>();
    for(Entity goodEntity: goodEntities){
      Good good = new Good();
      setCommonJsonableProperties(goodEntity, good);
      //set parent
      good.setParentKeyStr(KeyFactory.keyToString(goodEntity.getParent()));
      goods.add(good);
    }
   
    return goods;
  }
View Full Code Here


  private Iterable<Entity> getAllGoodEntities(){
    return ds.prepare(new Query(Good.KIND)).asIterable();
  }
 
  public Key persistGood(String goodJson) {
    Good fromJson = new Good().getFromJson(goodJson);
    Key categoryKey = KeyFactory.stringToKey(fromJson.getParentKeyStr());
    return doPersistGood(ds, categoryKey, fromJson);
  }
View Full Code Here

    Category c = new Category();
    c.setName("hello");
    c.setDescription(new Text("desc"));

    Good g1 = new Good();
    Good g2 = new Good();

    g1.setName("g1_name");
    g2.setName("g2_name");

    g1.setName("g1_desc");
    g2.setDescription(new Text("g2_desc"));

    c.getGoods().add(g1);
    c.getGoods().add(g2);

    assertEquals(
View Full Code Here

    Category c1 = new Category();
    c1.setName("another");
    c1.setDescription(new Text("desc"));

    Good g1 = new Good();
    Good g2 = new Good();

    g1.setName("g1_name");
    g2.setName("g2_name");

    g1.setName("g1_desc");
    g2.setDescription(new Text("g2_desc"));

    c.getGoods().add(g1);
    c.getGoods().add(g2);

    dh.saveCategoryWithGoods(c);
View Full Code Here

    Category c1 = new Category();
    c1.setName("another");
    c1.setDescription(new Text("desc"));

    Good g1 = new Good();
    Good g2 = new Good();

    g1.setName("g1_name");
    g2.setName("g2_name");

    g1.setDescription(new Text("g1_desc"));
    g2.setDescription(new Text("g2_desc"));

    c.getGoods().add(g1);
    c.getGoods().add(g2);

    dh.saveCategoryWithGoods(c);
View Full Code Here

    Category c1 = new Category();
    c1.setName("another");
    c1.setDescription(new Text("desc"));

    Good g1 = new Good();
    Good g2 = new Good();
    Good g3 = new Good();

    g1.setName("g1_name");
    g2.setName("g2_name");
    g3.setName("g3_name");

    g1.setDescription(new Text("g1_desc"));
    g2.setDescription(new Text("g2_desc"));
    g3.setDescription(new Text("g3_desc"));

    c.getGoods().add(g1);
    c.getGoods().add(g2);

    c1.getGoods().add(g3);
View Full Code Here

    Category c1 = new Category();
    c1.setName("another");
    c1.setDescription(new Text("desc"));

    Good g1 = new Good();
    Good g2 = new Good();
    Good g3 = new Good();

    g1.setName("g1_name");
    g2.setName("g2_name");
    g3.setName("g3_name");

    g1.setDescription(new Text("g1_desc"));
    g2.setDescription(new Text("g2_desc"));
    g3.setDescription(new Text("g3_desc"));

    c.getGoods().add(g1);
    c.getGoods().add(g2);

    c1.getGoods().add(g3);
View Full Code Here

  @Test
  public void persistGood() {
    Category c = new Category();
    Key categoryKey = dh.saveCategoryWithGoods(c);

    Good g = new Good();
    String name = "hello";
    String descr = "descr";
    String imageKey = "otnuotenuh";

    g.setName(name);
    g.setDescription(new Text(descr));
    g.setImageBlobKey(imageKey);
    g.setParentKeyStr(KeyFactory.keyToString(categoryKey));

    dh.persistGood(g.toJson());

    assertEquals(1,
        ds.prepare(new Query(Good.KIND)).countEntities(withLimit(10)));

    List<Entity> list = ds.prepare(new Query(Good.KIND)).asList(
View Full Code Here

TOP

Related Classes of com.denisk.appengine.nl.server.data.Good

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.