Example #1
0
  @Dynamic("editor")
  public static Result hostMeetUp() {
    final Form<utils.Forms.MeetUpHosting> filledForm = HOST_MEETUP_FORM.bindFromRequest();
    final User u = Mupi.getLocalUser(session());
    final models.Profile p = u.getProfile();
    String lastName = p.getLastName();
    if (lastName == null) lastName = "";
    String interest = "--desconhecido--";
    String location = "--desconhecida--";

    if (getLocalInterest() != null && getLocalInterest() != -1)
      interest = models.Interest.find.byId(getLocalInterest()).getName();

    if (getLocalLocation() != null && getLocalLocation() != -1)
      location = models.Location.find.byId(getLocalLocation()).getName();

    final String subject =
        "[EventoMupi][Local] "
            + p.getFirstName()
            + " "
            + lastName
            + " quer receber encontros amiguinhos!  Yayyy!!";

    final String body =
        "O usuário "
            + p.getFirstName()
            + " "
            + lastName
            + " ("
            + u.email
            + ") "
            + "quer receber encontros da seguinte comunidade:\n"
            + "\n    Localidade - "
            + location
            + "\n    Interesse - "
            + interest
            + "\n\n Ele redigiu a seguinte descrição:\n"
            + filledForm.get().description;
    final String from = "*****@*****.**";
    final String to = MupiParams.HOST_MEETUP_EMAIL;
    final String replyTo = "*****@*****.**";

    new AssyncEmailSender(subject, body, from, replyTo, to).send();

    final String userSubject = "Receber Evento Mupi";
    final String userBody =
        "Olá "
            + p.getFirstName()
            + ",\n\n"
            + "Recebemos sua mensagem sobre o interesse em receber Eventos Mupi. Em breve entraremos em contato para os próximos passos.\n\n\n"
            + "Atenciosamente,\n"
            + "Equipe Mupi";
    final String userFrom = "*****@*****.**";
    final String userTo = u.email;
    final String userReplyTo = "*****@*****.**";

    new AssyncEmailSender(userSubject, userBody, userFrom, userReplyTo, userTo).send();

    return redirect(routes.Feed.feed());
  }
Example #2
0
  @Dynamic("editor")
  public static Result removePublication(Long id) {
    final User u = Mupi.getLocalUser(session());
    final models.Profile p = u.profile;

    Publication pub = models.Publication.find.byId(id);

    if (pub.getProfile().getId() == p.getId()
        && (pub.getPub_typ() == conf.MupiParams.PubType.DISCUSSION
            || pub.getPub_typ() == conf.MupiParams.PubType.IDEA
            || pub.getPub_typ() == conf.MupiParams.PubType.QUESTION)) {
      models.Publication.unpublish(id);
      return AjaxResponse.build(0, "Publicação removida!");
    } else if (pub.getProfile().getId() == p.getId()
        && pub.getPub_typ() == MupiParams.PubType.EVENT) {
      return AjaxResponse.build(
          2, "Esta publicação pertence à um evento! Você não pode removê-la!");
    } else if (pub.getProfile().getId() == p.getId()
        && pub.getPub_typ() == MupiParams.PubType.MUPI_EVENT) {
      return AjaxResponse.build(
          2, "Esta publicação pertence à um evento Mupi! Você não pode removê-la!");
    } else {
      return AjaxResponse.build(4, "Esta publicação não é sua! Você não pode removê-la");
    }
  }
Example #3
0
  @Restrict(Mupi.USER_ROLE)
  public static Result nextPublications(Long last) {
    final models.Profile p = Mupi.getLocalUser(session()).profile;
    Long i = getLocalInterest();
    Long l = getLocalLocation();
    models.Interest iObj = null;
    models.Location lObj = null;
    if (i != null) iObj = models.Interest.find.byId(i);
    if (l != null) lObj = models.Location.find.byId(l);

    List<models.Publication> pubs = new ArrayList<models.Publication>();

    if (i == null || i == -1) {
      if (l == null || l == -1) {
        pubs =
            Publication.findByInterests(models.Interest.getIds(p.getInterests()), last).getList();
      } else {
        pubs =
            Publication.findByInterestsLocation(models.Interest.getIds(p.getInterests()), l, last)
                .getList();
      }
    } else {
      if (l == null || l == -1) {
        pubs = Publication.findByInterest(i, last).getList();
      } else {
        pubs = Publication.findByInterestLocation(i, l, last).getList();
      }
    }

    if (pubs.isEmpty()) return AjaxResponse.build(2, "");
    else return AjaxResponse.build(0, pubList.render(pubs, iObj, lObj).body());
  }
Example #4
0
  @Dynamic("editor")
  public static Result removeComment(Long id) {
    final User u = Mupi.getLocalUser(session());
    final models.Profile p = u.profile;

    if (models.PubComment.find.byId(id).getProfile().getId() == p.getId()) {
      models.PubComment.uncomment(id);
      return AjaxResponse.build(0, "Cometário removido!");
    } else {
      return AjaxResponse.build(2, "Este comentário não é seu! Você não pode removê-lo");
    }
  }
Example #5
0
  public static void checkCompany(String name) {
    Boolean result = true;
    Profile profile = Profile.find("name=?", name).first();
    if (profile != null) {
      result = false;
    }

    renderJSON(result);
  }
Example #6
0
  public static void show() {
    String username = session.get("username");
    if (username != null) {
      User user = User.getByUserName(username);
      Profile profile = Profile.find("user.id=?", user.id).first();

      render(profile);
    }
  }
Example #7
0
  public static void toubiao() {
    String username = session.get("username");
    if (username != null) {
      User user = User.getByUserName(username);
      Profile profile = Profile.find("user.id=?", user.id).first();

      String payStyle = params.get("payStyle");
      String invoice = params.get("invoice");
      String comments = params.get("comments");
      String requestS = params.get("request");

      Request request = Request.findById(Long.valueOf(requestS));
      Toubiao toubiao = null;
      toubiao = Toubiao.find("request.id=? and profile.id=?", request.id, profile.id).first();
      if (toubiao == null) {
        toubiao = new Toubiao();
      }
      toubiao.profile = profile;
      toubiao.user = user;
      toubiao.request = request;
      toubiao.payStyle = payStyle;
      toubiao.invoice = invoice;
      toubiao.comments = comments;
      toubiao.again = false;
      toubiao.save();

      String price = "0";
      String price2 = "0";
      String price3 = "0";
      Baojia baojia = null;
      for (Specification spec : request.specifications) {
        price = params.get("price" + spec.id);
        price2 = params.get("price" + spec.id + "-2");
        price3 = params.get("price" + spec.id + "-3");
        baojia = Baojia.find("toubiao.id=? and specification.id=?", toubiao.id, spec.id).first();
        if (baojia == null) {
          baojia = new Baojia();
          baojia.toubiao = toubiao;
          baojia.specification = spec;
        }
        if (price != null && !"".equals(price) && !"0".equals(price))
          baojia.price = Double.valueOf(price);
        if (price2 != null && !"".equals(price2) && !"0".equals(price2))
          baojia.secondPrice = Double.valueOf(price2);
        if (price3 != null && !"".equals(price3) && !"0".equals(price3))
          baojia.thirdPrice = Double.valueOf(price3);
        baojia.save();

        if (!toubiao.baojias.contains(baojia)) {

          toubiao.baojias.add(baojia);
          toubiao.save();
        }
      }
    }
    redirect("/");
  }
Example #8
0
  @Restrict(Mupi.USER_ROLE)
  public static Result renderFeedContent(
      int status,
      Page<models.Publication> l_pubs,
      Page<models.Promotion> l_prom,
      models.Interest i,
      models.Location l) {

    final models.Profile p = Mupi.getLocalUser(session()).profile;
    final String iSession;
    if (i == null) iSession = "-1";
    else iSession = i.getId().toString();
    final String lSession;
    if (l == null) lSession = "-1";
    else lSession = l.getId().toString();

    session().put("interest", iSession);
    session().put("location", lSession);

    return AjaxResponse.build(
        status,
        feedContent
            .render(
                p.getLocations(),
                p.getInterests(),
                l_pubs,
                l_prom,
                i,
                l,
                PROMOTION_FORM,
                PROMOTE_MEETUP_FORM,
                HOST_MEETUP_FORM,
                MyUsernamePasswordAuthProvider.LOGIN_FORM,
                MyUsernamePasswordAuthProvider.SIGNUP_FORM)
            .body());
  }
Example #9
0
  public static void forget() throws Throwable {

    String username = params.get("username");
    String mobile = params.get("mobile");

    Profile p = Profile.find("user.username=? and contact_phone=?", username, mobile).first();
    if (p == null) {
      flash.error("用户名和手机不匹配,请确认您输入的信息");
      flash.put("username", username);
      toForget();
    } else {
      // SendSMS
      SendMessage m = new SendMessage();
      m.sendSms(p.contact_phone, "您的密码为:" + p.user.password, "0000009");
      flash.success("您的密码已发送您的手机,请查收");
      flash.put("username", username);
      Secure.login();
    }
  }
Example #10
0
  @Restrict(Mupi.USER_ROLE)
  public static Result comment(String body, Long id) {
    final User u = Mupi.getLocalUser(session());
    final models.Profile p = u.profile;
    final models.Publication pub = models.Publication.find.byId(id);

    String safeBody =
        Jsoup.clean(
            textWithLinks(body.replaceAll("(\r\n|\n)", " <br/> ")),
            Whitelist.none().addTags("br", "a").addAttributes("a", "href", "target"));

    if (pub != null) PubComment.create(pub, p, safeBody);
    List<UserEmail> l_ue = models.Profile.emailsFromPublication(pub);
    for (UserEmail ue : l_ue) {
      if (u.getEmail().equalsIgnoreCase(ue.getEmail()))
        System.out.println("Commenter: " + ue.getEmail());
      else System.out.println(ue.getEmail());
    }
    return selectFeed(getLocalInterest(), getLocalLocation());
  }
Example #11
0
  public static void save(
      String firstname, String lastname, String email, String gender, String phonenumber) {
    Profile profile = getCurrentProfile();
    profile.firstname = firstname;
    profile.lastname = lastname;
    profile.email = email;
    profile.gender = gender;
    profile.phonenumber = phonenumber;

    validation.required("firstname", firstname);
    validation.required("lastname", lastname);
    validation.required("email", email);
    validation.required("gender", gender);
    validation.required("phonenumber", phonenumber);

    if (validation.hasErrors()) {
      render("@form", profile);
    } else {
      profile.isComplete = true;
      profile.save();
      Application.index();
    }
  }
Example #12
0
  public static void imp(File file) {
    String result = "";
    String profiles = "";
    int imported = 0;
    int missed = 0;

    if (file != null) {

      Config config = Config.find("1=1").first();

      FileInputStream fileInputStream = null;
      HSSFWorkbook workbook = null;
      try {
        fileInputStream = new FileInputStream(file);
        workbook = new HSSFWorkbook(fileInputStream);
      } catch (FileNotFoundException e) {
        e.printStackTrace();
      } catch (IOException e) {
        e.printStackTrace();
      }

      Profile profile = null;
      User user = null;
      String value = "";
      Material material = null;

      SendMessage m = new SendMessage();
      for (int x = 0; x < workbook.getNumberOfSheets(); x++) {

        HSSFSheet worksheet = workbook.getSheetAt(x);
        HSSFRow row = null;
        HSSFCell cell = null;
        DecimalFormat df = new DecimalFormat("#");
        df.setMaximumFractionDigits(0);

        for (int i = 1; i < worksheet.getLastRowNum(); i++) {
          String unit = "万元";
          String business = "0";
          try {
            row = worksheet.getRow(i);
            if (row.getLastCellNum() < 22) {
              continue;
            }
            cell = row.getCell(0);
            value = cell.getStringCellValue();
            user = User.find("username=?", value).first();
            if (user == null) {
              user = new User(value, getRandomPwd(), ApplicationRole.getByName("user"));
              user.save();
            }

            profile = Profile.find("user.id=?", user.id).first();
            if (profile == null) {
              profile = new Profile();
              profile.user = user;
            }

            profile.is_audit = 1;
            cell = row.getCell(1);
            value = cell.getStringCellValue();
            profile.name = value;

            cell = row.getCell(2);
            value = cell.getStringCellValue();
            material = Material.find("name=?", value).first();
            if (material == null) {
              material = new Material();
              material.name = value;
              material.save();
            }
            if (!profile.materials.contains(material)) profile.materials.add(material);

            cell = row.getCell(3);
            if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
              value = String.valueOf(cell.getNumericCellValue());
            } else {
              value = cell.getStringCellValue();
            }

            cell = row.getCell(4);
            if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
              value = String.valueOf(cell.getNumericCellValue());
            } else {
              value = cell.getStringCellValue();
            }

            cell = row.getCell(5);
            if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
              value = String.valueOf(cell.getNumericCellValue());
            } else {
              value = cell.getStringCellValue();
            }
            profile.registration_number = value;

            cell = row.getCell(6);
            if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
              df.setMaximumFractionDigits(2);
              value = String.valueOf(df.format(cell.getNumericCellValue()));
            } else {
              value = cell.getStringCellValue();
            }
            if (value.contains("美元")) {
              value = value.replace("(美元)", "").trim();
              unit = "万美元";
            }
            profile.registration_assets = value;
            profile.registration_assets_unit = unit;

            df.setMaximumFractionDigits(0);
            cell = row.getCell(7);
            if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
              value = String.valueOf(cell.getNumericCellValue());
            } else {
              value = cell.getStringCellValue();
            }
            profile.registration_address = value;

            cell = row.getCell(8);
            if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
              value = String.valueOf(cell.getNumericCellValue());
            } else {
              value = cell.getStringCellValue();
            }
            profile.bank_name = value;

            cell = row.getCell(9);
            if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
              value = String.valueOf(cell.getNumericCellValue());
            } else {
              value = cell.getStringCellValue();
            }
            profile.account_name = value;

            cell = row.getCell(10);
            if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
              value = String.valueOf(cell.getNumericCellValue());
            } else {
              value = cell.getStringCellValue();
            }
            profile.tfn = value;

            cell = row.getCell(11);
            if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
              value = String.valueOf(cell.getNumericCellValue());
            } else {
              value = cell.getStringCellValue();
            }
            profile.factory_name = value;

            cell = row.getCell(12);
            if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
              value = String.valueOf(cell.getNumericCellValue());
            } else {
              value = cell.getStringCellValue();
            }
            profile.factory_address = value;

            cell = row.getCell(13);
            if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
              value = String.valueOf(df.format(cell.getNumericCellValue()));
            } else {
              value = cell.getStringCellValue();
            }
            profile.first_supply = value.replaceAll("年", "");

            cell = row.getCell(14);
            if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
              value = String.valueOf(cell.getNumericCellValue());
            } else {
              value = cell.getStringCellValue();
            }
            profile.legal_person = value;

            cell = row.getCell(15);
            if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
              value = String.valueOf(cell.getNumericCellValue());
            } else {
              value = cell.getStringCellValue();
            }
            profile.contact_name = value;

            cell = row.getCell(16);
            if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
              value = String.valueOf(cell.getNumericCellValue());
            } else {
              value = cell.getStringCellValue();
            }
            profile.contact_job = value;

            cell = row.getCell(17);
            if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
              value = String.valueOf(df.format(cell.getNumericCellValue()));
            } else {
              value = cell.getStringCellValue();
            }
            profile.contact_phone = value;

            cell = row.getCell(18);
            if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
              value = String.valueOf(cell.getNumericCellValue());
            } else {
              value = cell.getStringCellValue();
            }
            profile.sales_name = value;

            cell = row.getCell(19);
            if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
              value = String.valueOf(cell.getNumericCellValue());
            } else {
              value = cell.getStringCellValue();
            }
            profile.sales_job = value;

            cell = row.getCell(20);
            if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
              value = String.valueOf(df.format(cell.getNumericCellValue()));
            } else {
              value = cell.getStringCellValue();
            }
            profile.sales_phone = value;

            cell = row.getCell(21);
            if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
              value = String.valueOf(cell.getNumericCellValue());
            } else {
              value = cell.getStringCellValue();
            }
            if (value.equals("自营")) {
              business = "1";
            } else if (value.equals("经销")) {
              business = "2";
            } else if (value.equals("挂靠")) {
              business = "3";
            } else {
              business = "0";
            }
            profile.business_model = business;
            profile.save();
            imported += 1;

            if (profile.contact_phone != null) {
              String message =
                  "您的信息已导入,用户名:" + user.username + ",密码:" + user.password + ",请登录比价平台上传资质文件";
              if (config.msg_import != null && !"".equals(config.msg_import)) {
                message =
                    config
                        .msg_import
                        .replace("{username}", user.username)
                        .replace("{passowrd}", user.password);
              }
              m.sendSms(profile.contact_phone, message, "0000001");
              if (profile.contact_email != null && !"".equals(profile.contact_phone)) {
                m.sendMail(
                    profile.contact_email,
                    "[" + Messages.get("application.name") + "]信息导入",
                    message);
              }
            }
          } catch (Exception e) {
            missed += 1;
            if (!"".equals(profiles)) {
              profiles += "," + profile.name;
            } else {
              profiles += profile.name;
            }
            e.printStackTrace();
          }
        }
      }

      result = "成功导入" + imported + "条记录,丢失" + missed + "条记录。";
      if (!"".equals(profiles)) {
        result += "丢失导入的供应商为:" + profiles;
      }
    }
    redirect("/admin/profiles?result=" + URLEncoder.encode(result));
  }
Example #13
0
  public static void save() throws Throwable {
    String username = params.get("username");
    String name = params.get("name");
    String password = params.get("password");
    String[] materials = params.getAll("material");
    String registration_number = params.get("registration_number");
    String registration_assets = params.get("registration_assets");
    String registration_assets_unit = params.get("registration_assets_unit");
    String registration_address = params.get("registration_address");
    String bank_name = params.get("bank_name");
    String account_name = params.get("account_name");
    String tfn = params.get("tfn");
    String legal_person = params.get("legal_person");
    String factory_name = params.get("factory_name");
    String factory_address = params.get("factory_address");
    String first_supply = params.get("first_supply");
    String business_model = params.get("business_model");
    String contact_name = params.get("contact_name");
    String contact_job = params.get("contact_job");
    String contact_phone = params.get("contact_phone");
    String contact_email = params.get("contact_email");
    String sales_name = params.get("sales_name");
    String sales_job = params.get("sales_job");
    String sales_phone = params.get("sales_phone");
    String[] files = params.getAll("files");

    User user = null;
    Material m = null;
    Files file = null;
    if (username != null && password != null && !"".equals(username) && !"".equals(password)) {
      user = User.find("username=?", username).first();
      if (user == null) {
        user = new User(username, password, ApplicationRole.getByName("user"));
        user.save();
      }

      Profile profile = Profile.find("user.id=?", user.id).first();
      if (profile == null) {
        profile = new Profile();
        profile.user = user;
      }

      if (materials != null) {
        for (String material_id : materials) {
          m = Material.find("id=?", Long.valueOf(material_id.trim())).first();
          if (m != null) profile.materials.add(m);
        }
      }
      profile.name = name;
      profile.registration_number = registration_number;
      profile.registration_assets = registration_assets;
      profile.registration_address = registration_address;
      profile.registration_assets_unit = registration_assets_unit;
      profile.bank_name = bank_name;
      profile.account_name = account_name;
      profile.tfn = tfn;
      profile.legal_person = legal_person;
      profile.factory_name = factory_name;
      profile.factory_address = factory_address;
      profile.first_supply = first_supply;
      profile.business_model = business_model;
      profile.contact_name = contact_name;
      profile.contact_job = contact_job;
      profile.contact_phone = contact_phone;
      profile.contact_email = contact_email;
      profile.sales_name = sales_name;
      profile.sales_job = sales_job;
      profile.sales_phone = sales_phone;

      if (files != null) {
        for (String f : files) {
          file = Files.find("id=?", Long.valueOf(f)).first();
          if (file != null) {
            profile.files.add(file);
          }
        }
      }

      profile.save();
    }

    session.put("username", username);

    Secure.redirectToOriginalURL();
  }
Example #14
0
  @Dynamic("editor")
  public static Result promote() {
    models.User u = Mupi.getLocalUser(session());
    MultipartFormData body = request().body().asMultipartFormData();
    FilePart picture = body.getFile("picture");
    String picturePath = BLANK_EVT;

    DynamicForm bindedForm = form().bindFromRequest();
    Long i = getInterest(bindedForm.get("interest"));
    Long l = getLocation(bindedForm.get("location"));
    models.Interest iObj = null;
    models.Location lObj = null;
    if (i != null) iObj = models.Interest.find.byId(i);
    if (l != null) lObj = models.Location.find.byId(l);

    final Form<models.Promotion> filledForm = form(models.Promotion.class).bindFromRequest();
    final models.Profile p = Mupi.getLocalUser(session()).profile;

    try {
      if (picture != null) {
        String fileName = picture.getFilename();
        File file = picture.getFile();
        int index = (fileName.toLowerCase()).lastIndexOf('.');
        String extension = "png";

        if (index > 0 && index < fileName.length() - 1) {
          extension = fileName.substring(index + 1).toLowerCase();
        }

        String hashTime = getMD5(System.currentTimeMillis());
        String hashCommunity = getMD5(iObj.toString() + lObj.toString());

        File destinationFile =
            new File(
                MupiParams.EVENT_ROOT
                    + MupiParams.PIC_ROOT
                    + "//"
                    + hashCommunity
                    + "//"
                    + hashTime
                    + fileName);
        FileUtils.copyFile(file, destinationFile);
        picturePath = "/" + hashCommunity + "/" + hashTime + fileName;

        File medium =
            new File(
                MupiParams.EVENT_ROOT
                    + MupiParams.PIC_MEDIUM
                    + "//"
                    + hashCommunity
                    + "//"
                    + hashTime
                    + fileName);
        medium.mkdirs();

        BufferedImage bi = ImageHandler.createSmallInterest(destinationFile);
        bi = ImageHandler.createMediumPromotion(destinationFile);
        ImageIO.write(bi, extension, medium);
      } else {
        picturePath = BLANK_EVT;
      }

      String safeDesc = Jsoup.clean(filledForm.get().getDescription(), Whitelist.simpleText());

      Promotion pr =
          models.Promotion.create(
              p,
              lObj,
              iObj,
              filledForm.get().getTitle(),
              filledForm.get().getAddress(),
              filledForm.get().getDate(),
              filledForm.get().getTime(),
              safeDesc,
              filledForm.get().getLink(),
              picturePath,
              PubType.EVENT,
              new Integer(0),
              new Integer(0),
              new Double(0.0));

      flash(Mupi.FLASH_MESSAGE_KEY, Messages.get("mupi.promotion.created"));

      List<UserEmail> l_ue = models.Profile.emailsFromPublication(pr.getPublication());
      for (UserEmail ue : l_ue) {
        if (u.getEmail().equalsIgnoreCase(ue.getEmail()))
          System.out.println("Commenter: " + ue.getEmail());
        else System.out.println(ue.getEmail());
      }

      return redirect(routes.Feed.feed());
    } catch (Exception e) {
      flash(
          Mupi.FLASH_ERROR_KEY,
          "Erro ao divulgar evento, por favor contate-nos para que possamos resolver este problema.");
      // System.out.println(e.getMessage());
      e.printStackTrace();
      return redirect(routes.Feed.feed());
    }
  }
Example #15
0
 public static void uploadPicture(Blob picture) {
   Profile profile = getCurrentProfile();
   profile.picture = picture;
   profile.save();
   // form();
 }
Example #16
0
 public static void getPicture(long id) {
   Profile profile = Profile.findById(id);
   response.setContentTypeIfNotSet(profile.picture.type());
   renderBinary(profile.picture.get());
 }
Example #17
0
 public static Profile getCurrentProfile() {
   String profileId = session.get("profile.id");
   Profile profile = Profile.findById(new Long(profileId));
   return profile;
 }