Exemplo n.º 1
0
 public Group queryGroup(int groupID) {
   ArrayList<Properties> pl =
       dbComm.query(
           String.format(SELECT_FROM_WHERE, FIELDS_GROUPS, TABLE_GROUPS, "groupID=" + groupID));
   Properties p = pl.get(0);
   return makeGroup(p);
 }
Exemplo n.º 2
0
 public Event queryEvent(int eventID, boolean fetchAlarm) {
   ArrayList<Properties> pl =
       dbComm.query(
           String.format(SELECT_FROM_WHERE, FIELDS_EVENT, TABLE_EVENT, "eventID=" + eventID));
   Properties p = pl.get(0);
   return makeEvent(p, fetchAlarm);
 }
Exemplo n.º 3
0
 public ArrayList<User> queryUsers() {
   ArrayList<User> users = new ArrayList<User>();
   ArrayList<Properties> pl = dbComm.query(String.format(SELECT_FROM, FIELDS_USER, TABLE_USER));
   for (Properties p : pl) {
     users.add(makeUser(p));
   }
   return users;
 }
Exemplo n.º 4
0
 public ArrayList<Alarm> queryAlarms() {
   ArrayList<Alarm> alarms = new ArrayList<Alarm>();
   ArrayList<Properties> pl = dbComm.query(String.format(SELECT_FROM, FIELDS_ALARM, TABLE_ALARM));
   for (Properties p : pl) {
     alarms.add(makeAlarm(p, true));
   }
   return alarms;
 }
Exemplo n.º 5
0
 public ArrayList<Room> queryRooms() {
   ArrayList<Room> rooms = new ArrayList<Room>();
   ArrayList<Properties> pl = dbComm.query(String.format(SELECT_FROM, FIELDS_ROOM, TABLE_ROOM));
   for (Properties p : pl) {
     rooms.add(makeRoom(p));
   }
   return rooms;
 }
Exemplo n.º 6
0
 public ArrayList<Event> queryEvents() {
   ArrayList<Event> events = new ArrayList<Event>();
   ArrayList<Properties> pl = dbComm.query(String.format(SELECT_FROM, FIELDS_EVENT, TABLE_EVENT));
   for (Properties p : pl) {
     events.add(makeEvent(p, true));
   }
   return events;
 }
Exemplo n.º 7
0
 public ArrayList<Notification> queryNotifications() {
   ArrayList<Notification> notifications = new ArrayList<Notification>();
   ArrayList<Properties> pl =
       dbComm.query(String.format(SELECT_FROM, FIELDS_NOTIFICATION, TABLE_NOTIFICATION));
   for (Properties p : pl) {
     notifications.add(makeNotification(p));
   }
   return notifications;
 }
Exemplo n.º 8
0
 public ArrayList<Group> queryGroups() {
   ArrayList<Group> groups = new ArrayList<Group>();
   ArrayList<Properties> pl =
       dbComm.query(String.format(SELECT_FROM, FIELDS_GROUPS, TABLE_GROUPS));
   for (Properties p : pl) {
     groups.add(makeGroup(p));
   }
   return groups;
 }
Exemplo n.º 9
0
 public Notification queryNotification(int notificationID) {
   ArrayList<Properties> pl =
       dbComm.query(
           String.format(
               SELECT_FROM_WHERE,
               FIELDS_NOTIFICATION,
               TABLE_NOTIFICATION,
               "notificationID=" + notificationID));
   Properties p = pl.get(0);
   return makeNotification(p);
 }
Exemplo n.º 10
0
 private ArrayList<User> queryMembers(int groupID) {
   ArrayList<Properties> pl =
       dbComm.query(
           String.format(
               SELECT_FROM_WHERE, FIELDS_IS_MEMBER_OF, TABLE_IS_MEMBER_OF, "groupID=" + groupID));
   ArrayList<User> members = new ArrayList<User>();
   for (Properties p : pl) {
     members.add(queryUser(p.getProperty("username")));
   }
   return members;
 }
Exemplo n.º 11
0
 public User queryUser(String username) {
   ArrayList<Properties> pl =
       dbComm.query(
           String.format(
               SELECT_FROM_WHERE, FIELDS_USER, TABLE_USER, "username='******'"));
   if (pl.size() > 0) {
     Properties p = pl.get(0);
     return makeUser(p);
   } else {
     return null;
   }
 }
Exemplo n.º 12
0
 private User queryOwner(int eventID) {
   ArrayList<Properties> pl =
       dbComm.query(
           String.format(
               SELECT_FROM_WHERE, FIELDS_IS_OWNER, TABLE_IS_OWNER, "eventID=" + eventID));
   if (pl.size() != 0) {
     Properties p = pl.get(0);
     return queryUser(p.getProperty("username"));
   } else {
     return null;
   }
 }
Exemplo n.º 13
0
 public ArrayList<Event> queryEvents(User user) {
   ArrayList<Event> events = new ArrayList<Event>();
   String query =
       String.format(
           SELECT_FROM_WHERE,
           "event." + FIELDS_EVENT,
           TABLE_EVENT + " JOIN " + TABLE_IS_OWNER + " ON event.eventID=isOwner.eventID ",
           "username='******'");
   ArrayList<Properties> pl = dbComm.query(query);
   for (Properties p : pl) {
     events.add(makeEvent(p, true));
   }
   return events;
 }
Exemplo n.º 14
0
 public ArrayList<Notification> queryNotificationsTo(String username) {
   ArrayList<Properties> pl =
       dbComm.query(
           String.format(
               SELECT_FROM_WHERE,
               FIELDS_NOTIFICATION_TO,
               TABLE_NOTIFICATION_TO,
               "username='******'"));
   ArrayList<Notification> notifications = new ArrayList<Notification>();
   for (Properties p : pl) {
     notifications.add(queryNotification(Integer.parseInt(p.getProperty("notificationID"))));
   }
   return notifications;
 }
Exemplo n.º 15
0
 private ArrayList<User> queryParticipants(int eventID, String status) {
   ArrayList<Properties> pl =
       dbComm.query(
           String.format(
               SELECT_FROM_WHERE,
               FIELDS_IS_PARTICIPANT,
               TABLE_IS_PARTICIPANT,
               "eventID=" + eventID + " and status=" + status));
   ArrayList<User> users = new ArrayList<User>();
   for (Properties p : pl) {
     users.add(queryUser(p.getProperty("username")));
   }
   return users;
 }
Exemplo n.º 16
0
 private Alarm queryAlarm(User user, int eventID) {
   ArrayList<Properties> pl =
       dbComm.query(
           String.format(
               SELECT_FROM_WHERE,
               FIELDS_ALARM,
               TABLE_ALARM,
               "username='******' and eventID=" + eventID));
   if (pl.size() > 0) {
     Properties p = pl.get(0);
     return makeAlarm(p, false);
   } else {
     return null;
   }
 }
Exemplo n.º 17
0
 private User queryNotificationTo(int notificationID) {
   ArrayList<Properties> pl =
       dbComm.query(
           String.format(
               SELECT_FROM_WHERE,
               FIELDS_NOTIFICATION_TO,
               TABLE_NOTIFICATION_TO,
               "notificationID=" + notificationID));
   User user = null;
   if (pl.size() > 0) {
     Properties p = pl.get(0);
     user = queryUser(p.getProperty("username"));
   }
   return user;
 }
Exemplo n.º 18
0
 private Room queryReservedRoom(int eventID) {
   ArrayList<Properties> pl =
       dbComm.query(
           String.format(
               SELECT_FROM_WHERE,
               FIELDS_RESERVED_ROOM,
               TABLE_RESERVED_ROOM,
               "eventID=" + eventID));
   Room room = null;
   if (pl.size() > 0) {
     Properties p = pl.get(0);
     room = queryRoom(Integer.parseInt(p.getProperty("roomID")));
   }
   return room;
 }
Exemplo n.º 19
0
 private Event queryNotificationEvent(int notificationID) {
   ArrayList<Properties> pl =
       dbComm.query(
           String.format(
               SELECT_FROM_WHERE,
               FIELDS_NOTIFICATION_FOR_EVENT,
               TABLE_NOTIFICATION_FOR_EVENT,
               "notificationID=" + notificationID));
   Event event = null;
   if (pl.size() > 0) {
     Properties p = pl.get(0);
     event = queryEvent(Integer.parseInt(p.getProperty("eventID")), true);
   }
   return event;
 }
Exemplo n.º 20
0
 public Room queryRoom(int roomID) {
   ArrayList<Properties> pl =
       dbComm.query(String.format(SELECT_FROM_WHERE, FIELDS_ROOM, TABLE_ROOM, "roomID=" + roomID));
   Properties p = pl.get(0);
   return makeRoom(p);
 }