Package com.ikai.photosharing.shared

Examples of com.ikai.photosharing.shared.UploadedImage


  }

  @Override
  public UploadedImage get(String key) {
    UploadedImageDao dao = new UploadedImageDao();
    UploadedImage image = dao.get(key);
    return image;
  }
View Full Code Here


  @Override
  public void deleteImage(String key) {
    UserService userService = UserServiceFactory.getUserService();
    User user = userService.getCurrentUser();
    UploadedImageDao dao = new UploadedImageDao();
    UploadedImage image = dao.get(key);
    if(image.getOwnerId().equals(user.getUserId())) {
      dao.delete(key);
    }
  }
View Full Code Here

    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

  public UploadedImage get(String encodedKey) {
    Key key = KeyFactory.stringToKey(encodedKey);
    try {
      Entity result = datastore.get(key);
      UploadedImage image = fromEntity(result);
      image.setKey(encodedKey);
      return image;
    } catch (EntityNotFoundException e) {
      return null;
    }
View Full Code Here

    query.addSort(UploadedImage.CREATED_AT, SortDirection.DESCENDING);
    FetchOptions options = FetchOptions.Builder.withLimit(25);

    ArrayList<UploadedImage> results = new ArrayList<UploadedImage>();
    for (Entity result : datastore.prepare(query).asIterable(options)) {
      UploadedImage image = fromEntity(result);
      results.add(image);
    }
    return results;
  }
View Full Code Here

    Key key = KeyFactory.stringToKey(encodedKey);
    datastore.delete(key);
  }

  private UploadedImage fromEntity(Entity result) {
    UploadedImage image = new UploadedImage();
    image.setCreatedAt((Date) result.getProperty(UploadedImage.CREATED_AT));
    image.setServingUrl((String) result
        .getProperty(UploadedImage.SERVING_URL));
   
    image.setOwnerId((String) result.getProperty(UploadedImage.OWNER_ID));

    if (image.getKey() == null) {
      String encodedKey = KeyFactory.keyToString(result.getKey());
      image.setKey(encodedKey);
    }

    return image;
  }
View Full Code Here

TOP

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

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.