Ejemplo n.º 1
0
 public static List<Post_thread> all(String usrInterest) {
   return find.where()
       .eq("interest", usrInterest)
       .order()
       .desc("id")
       .fetch("user")
       .setMaxRows(8)
       .findList();
 }
  public static void delete(Long id) {
    Institution institution = find.ref(id);
    if (institution == null) {
      return;
    }

    institution.retired = true;
    institution.save();
  }
Ejemplo n.º 3
0
 public static Doctor findByFullName(String fullName) {
   String[] fio = fullName.split(" ");
   String query = "find doctor where name=:name and surname=:surname and patronymic=:patronymic";
   /*Doctor doctor = Ebean.find(Doctor.class).setQuery(query).setParameter("surname", fio[0])
   .setParameter("name", fio[1]).setParameter("patronymic", fio[2]).findUnique(); */
   Doctor doctor =
       find.setQuery(query)
           .setParameter("surname", fio[0])
           .setParameter("name", fio[1])
           .setParameter("patronymic", fio[2])
           .findUnique();
   return doctor;
 }
Ejemplo n.º 4
0
  // TODO: repair choosing doctor by typename
  public static List<String> fioListByType(String doctorTypeName) {
    /*String query = "find doctor fetch doctor_type.doctor_type_id";
    List<Doctor> doctors = Ebean.find(Doctor.class)
      .setQuery(query)
      .setParameter("doctor_type_id", new Long(1))
      .findList(); */
    String sql =
        "SELECT * FROM DOCTOR LEFT JOIN DOCTOR_TYPE ON DOCTOR_TYPE.ID = DOCTOR.DOCTOR_TYPE_ID";
    SqlQuery sqlQuery = Ebean.createSqlQuery(sql);
    List<SqlRow> list = sqlQuery.findList();
    /*RawSql rawSql = RawSqlBuilder.parse(sql).create();
    javax.persistence.Query<Doctor> query = Ebean.find(Doctor.class);
      query.setRawSql(rawSql);
      //.columnMapping("id",  "doctor.id")
      //.columnMapping("name",  "doctor.name")
      //.columnMapping("surname",  "doctor.surname")
      //.columnMapping("patronymic",  "doctor.patronymic")
      //.columnMapping("patronymic",  "doctor_type.doctor_type_name");
      List<Doctor> doctors = query.findList();  */

    // List<Doctor> doctors = Ebean.find(Doctor.class)
    // .fetch("doctor_type","doctor.doctor_type_id")
    // .findList();
    // List<Doctor> doctors = find.fetch("doctor_type")
    // .where().eq("doctor.doctor_type_name", doctorTypeName)
    // .findList();
    /*com.avaje.ebean.Query q = Ebean.createQuery(Doctor.class);
    q.join("doctor_type");
    final List<Doctor> eventList = q.findList();*/
    List<Doctor> doctors = find.where().eq("doctor_type_id", new Long(1)).findList();
    List<String> theList = new ArrayList<String>();
    for (Doctor doctor : doctors) {
      theList.add(doctor.getFullName());
    }
    return theList;
  }
Ejemplo n.º 5
0
 public static IdentityDocType get(Long id) {
   return find.ref(id);
 }
Ejemplo n.º 6
0
 public static void delete(Long id) {
   find.ref(id).delete();
 }
Ejemplo n.º 7
0
 public static List<IdentityDocType> all() {
   return find.all();
 }
Ejemplo n.º 8
0
 public static Post_thread getById(Long id) {
   return find.byId(id);
 }
Ejemplo n.º 9
0
 public static List<Post_thread> all() {
   return find.order().desc("id").fetch("user").setMaxRows(8).findList();
 }
Ejemplo n.º 10
0
 public static List<Doctor> allDoctors() {
   return find.all();
 }
Ejemplo n.º 11
0
 public static Doctor get(Long id) {
   return find.ref(id);
 }
 // Get all Institutions in the system
 public static List<Institution> getAll() {
   return find.where().ne("retired", true).findList();
 }
 // Get Institution by name
 public static Institution byName(String name) {
   return find.where().ne("retired", true).eq("name", name).findUnique();
 }
 // Get Institution by ID
 public static Institution byId(Long id) {
   return find.where().ne("retired", true).eq("id", id).findUnique();
 }