Package models

Examples of models.User$UserMapper


  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

    }
    renderJSON(gson().toJson(user));
  }
 
  public static void add(JsonObject body) throws ValidationException {
    User user = new Gson().fromJson(body, User.class);
    validation.valid(user);
    if(validation.hasErrors()) {
      throw new ValidationException(validation.errors());
    }
    user.insert();
    UserProfile user_profile = new UserProfile(user,Profile.findByType(ProfileType.INTERNSHIP));
    user_profile.insert();
    response.status = StatusCode.CREATED;
    Map map = new HashMap();
    map.put("id", user.id);
View Full Code Here

    response.setHeader("location", url);
    renderJSON(gson().toJson(user));
  }
 
  public static void edit(Long id, JsonObject body) {
    User user = gson().fromJson(body, User.class);
    if(user==null) {
      notFound();
    }
    user.update();
    response.status = StatusCode.OK;
    Map map = new HashMap();
    map.put("id", user.id);
    String url = Router.reverse("api.Users.get", map).url;// GET /clients/1541
    response.setHeader("location", url);
View Full Code Here

    String url = Router.reverse("api.Users.get", map).url;// GET /clients/1541
    response.setHeader("location", url);
  }
 
  public static void delete(Long id) {
    final User user = User.findById(id);
    if(user==null) {
      notFound();
    }
    InternshipFamiliar.delete(user);
    user.delete();
    response.status = StatusCode.NO_RESPONSE;
  }
View Full Code Here

  public static void listFamiliars(Long id, Integer offset, Integer limit) {
    if(offset == null) offset = 0;
    if(limit==null || limit > LIMIT || limit==0) {
      limit = LIMIT;
    }
    final User internal = User.findById(id);
    if(internal==null) {
      notFound();
    }
    Data<User> data = new Data<User>();
    data.total = InternshipFamiliar.countByInternship(internal);
View Full Code Here

TOP

Related Classes of models.User$UserMapper

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.