Package com.ikai.photosharing.shared

Examples of com.ikai.photosharing.shared.Tag


      show();
      textBox.setFocus(true);
    }

    private void saveTag(final int x, final int y, final TextBox textBox) {
      Tag tag = new Tag();

      // TODO: Change this to also pass the Image
      tag.setPhotoKey(uploadedImage.getKey());
      tag.setBody(textBox.getValue());
      tag.setX(x);
      tag.setY(y);

      imageService.tagImage(tag, new AsyncCallback<String>() {

        @Override
        public void onFailure(Throwable caught) {
View Full Code Here


  @Test
  public void testPut() {

    TagDao dao = new TagDao();
    Tag tag = new Tag();
    tag.setBody("tag body");
    tag.setCreatedAt(new Date());
    tag.setPhotoKey("photoKey");
    tag.setTaggerId("1");

    tag.setX(100);
    tag.setY(100);

    String key = dao.put(tag);

    Key rawKey = null;

    try {
      rawKey = KeyFactory.stringToKey(key);
    } catch (NullPointerException e) {
      Assert.fail("put() returned null key");
    }

    try {
      Entity entity = datastore.get(rawKey);

      assertEquals("body not set", tag.getBody(),
          (String) entity.getProperty("body"));
      assertEquals("createdAt not set", tag.getCreatedAt(),
          (Date) entity.getProperty("createdAt"));
      assertEquals("taggerId not set", tag.getTaggerId(),
          (String) entity.getProperty("taggerId"));
      assertEquals("photoKey not set", tag.getPhotoKey(),
          (String) entity.getProperty("photoKey"));

      assertEquals("x not set", new Long(100l),
          (Long) entity.getProperty("x"));
      assertEquals("y not set", new Long(100l),
View Full Code Here

 
  @Test
  public void testGetForPhoto() throws Exception {   
    Key imageKey = KeyFactory.createKey("UploadedImage", "imageKey");
   
    Tag tag = new Tag();
    tag.setPhotoKey(KeyFactory.keyToString(imageKey));
    tag.setX(0);
    tag.setY(0);
   
    TagDao dao = new TagDao();
    dao.put(tag);
   
    UploadedImage image = new UploadedImage();
    image.setKey(KeyFactory.keyToString(imageKey));
   
    List<Tag> results = dao.getForImage(image);
    Tag result = results.get(0);
    assertEquals(tag, result);
   
   
  }
View Full Code Here

    query.addFilter("photoKey", FilterOperator.EQUAL, image.getKey());
   
    List<Tag> results = new ArrayList<Tag>();
   
    for(Entity entity : datastore.prepare(query).asIterable(FetchOptions.Builder.withDefaults())) {
      Tag tag = new Tag();
      tag.setPhotoKey((String) entity.getProperty("photoKey"));
      tag.setBody((String) entity.getProperty("body"));
      tag.setCreatedAt((Date) entity.getProperty("createdAt"));
      tag.setTaggerId((String) entity.getProperty("taggerId"));
      tag.setX((Long) entity.getProperty("x"));
      tag.setY((Long) entity.getProperty("y"));
      results.add(tag);
    }
   
    return results;
  }
View Full Code Here

TOP

Related Classes of com.ikai.photosharing.shared.Tag

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.