Package com.rapleaf.jack.test_project.database_1.models

Examples of com.rapleaf.jack.test_project.database_1.models.User


    if(owned==null) owned=true;
    if(offset == null) offset = 0;
    if(limit==null || limit > LIMIT || limit==0) {
      limit = LIMIT;
    }
    User current = getCurrentUser();
    Data<Photo> data = new Data<Photo>();
    if(owned) {
      data.total = Photo.countByOwner(current);
      data.data = Photo.paginate(Photo.all(current), offset, limit);
    } else {
View Full Code Here


  }
 
  public static void add(Upload data) throws IOException {
    //TO-DO Security control check.
    String key = GAEFileService.createFile(MimeTypes.getContentType(data.getFileName()), data.getFileName(),data.asBytes());
    User currentUser = getCurrentUser();
    Photo photo = new Photo();
    photo.filename = data.getFileName();
    photo.owner = currentUser;
    response.status = StatusCode.CREATED;
    Map map = new HashMap();
View Full Code Here

  public static void get(Long id) {
    Photo photo = Photo.findById(id);
    if(photo == null) {
      notFound();
    }
    User currentUser = getCurrentUser();
    if(photo.owner.id!=currentUser.id &&
        !ContentTag.exists(photo.id, Tag.findOrCreateByName("shared", currentUser)))
      forbidden();
    renderJSON(gson().toJson(photo));
  }
View Full Code Here

      forbidden();
    renderJSON(gson().toJson(photo));
  }
 
  public static void delete(Long id) {
    User currentUser = getCurrentUser();
    Photo photo = Photo.findById(id);
    if(photo == null) notFound();
    if(photo.owner.id!=currentUser.id) forbidden();
    photo.delete();
    response.status = StatusCode.NO_RESPONSE;
View Full Code Here

  public static void takephoto(String image) {
      String[] imageData = image.split(",");
      try {
      byte[] imageBytes = Base64.decode(imageData[imageData.length-1]);
      String key = GAEFileService.createFile(MimeTypes.getContentType("me-"+System.currentTimeMillis()), "me-"+System.currentTimeMillis(),imageBytes);
      User currentUser = getCurrentUser();
      Photo photo = new Photo();
      photo.filename = "me-"+System.currentTimeMillis();
      photo.owner = currentUser;
      response.status = StatusCode.CREATED;
      Map map = new HashMap();
View Full Code Here


public class AdminController extends BaseAdminResidence {
  public static void index() {
    // Mock creation of users for testing the security and the diferents profiles access.
    User familiar = User.findByUsername("basoko");
    if(familiar == null) {
      familiar = new User();
      familiar.username = "basoko";
      familiar.password = "12345";
      familiar.save();
    }
   
    User interned = User.findByUsername("david");
    if(interned == null) {
      interned = new User();
      interned.username = "david";
      interned.password = "12345";
      interned.save();
    }

    render("residences/admin/index.html");
  }
View Full Code Here

import controllers.Data;

public class Profile extends MeApi {
 
  public static void get() {
    User current = getCurrentUser();
    renderTemplate("api/user.json", current);
    //renderJSON(gson().toJson(current, User.class));
  }
View Full Code Here

    renderTemplate("api/user.json", current);
    //renderJSON(gson().toJson(current, User.class));
  }
 
  public static void save(JsonObject body) {
    User user = gson().fromJson(body, User.class);
    user.update();
    response.status = StatusCode.OK;
    String url = Router.reverse("api.Profile.get").url;
    response.setHeader("location", url);
  }
View Full Code Here

    String url = Router.reverse("api.Profile.get").url;
    response.setHeader("location", url);
  }
 
  public static void publicProfile(Long id) {
    User user = User.findById(id);
    if(user==null) notFound();
    renderTemplate("api/publicUser.json", user);
  }
View Full Code Here

    Type dataType = new TypeToken<Data<User>>(){}.getType();
    renderJSON(gson().toJson(data, dataType));
  }
 
  public static void get(Long id) {
    final User user = User.findById(id);
    if(user==null) {
      notFound();
    }
    renderJSON(gson().toJson(user));
  }
View Full Code Here

TOP

Related Classes of com.rapleaf.jack.test_project.database_1.models.User

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.