1.1 --- a/imiptools/stores/common.py Thu Apr 21 23:17:35 2016 +0200
1.2 +++ b/imiptools/stores/common.py Thu Apr 21 23:20:57 2016 +0200
1.3 @@ -35,26 +35,57 @@
1.4
1.5 # Event and event metadata access.
1.6
1.7 + def get_all_events(self, user, dirname=None):
1.8 +
1.9 + """
1.10 + Return a set of (uid, recurrenceid) tuples for all events. Unless
1.11 + 'dirname' is specified, only active events are returned; otherwise,
1.12 + events from the given 'dirname' are returned.
1.13 + """
1.14 +
1.15 + cancelled = self.get_cancelled_events(user)
1.16 + active = self.get_events(user)
1.17 +
1.18 + if dirname == "cancellations":
1.19 + uids = cancelled
1.20 + else:
1.21 + uids = active
1.22 +
1.23 + if not uids:
1.24 + return set()
1.25 +
1.26 + all_events = set()
1.27 +
1.28 + # Add all qualifying parent events to the result set.
1.29 +
1.30 + for uid in uids:
1.31 + all_events.add((uid, None))
1.32 +
1.33 + # Process all parent events regardless of status to find those in the
1.34 + # category/directory of interest.
1.35 +
1.36 + for uid in active + cancelled:
1.37 +
1.38 + if dirname == "cancellations":
1.39 + recurrenceids = self.get_cancelled_recurrences(user, uid)
1.40 + else:
1.41 + recurrenceids = self.get_active_recurrences(user, uid)
1.42 +
1.43 + all_events.update([(uid, recurrenceid) for recurrenceid in recurrenceids])
1.44 +
1.45 + return all_events
1.46 +
1.47 def get_events(self, user):
1.48
1.49 "Return a list of event identifiers."
1.50
1.51 pass
1.52
1.53 - def get_all_events(self, user):
1.54 -
1.55 - "Return a set of (uid, recurrenceid) tuples for all events."
1.56 + def get_cancelled_events(self, user):
1.57
1.58 - uids = self.get_events(user)
1.59 - if not uids:
1.60 - return set()
1.61 + "Return a list of event identifiers for cancelled events."
1.62
1.63 - all_events = set()
1.64 - for uid in uids:
1.65 - all_events.add((uid, None))
1.66 - all_events.update([(uid, recurrenceid) for recurrenceid in self.get_recurrences(user, uid)])
1.67 -
1.68 - return all_events
1.69 + pass
1.70
1.71 def get_event(self, user, uid, recurrenceid=None, dirname=None):
1.72
1.73 @@ -301,13 +332,20 @@
1.74
1.75 def get_freebusy_for_update(self, user, name=None):
1.76
1.77 - "Get free/busy details for the given 'user'."
1.78 + """
1.79 + Get free/busy details for the given 'user' that may be updated,
1.80 + potentially affecting the stored information directly.
1.81 + """
1.82
1.83 return self.get_freebusy(user, name, True)
1.84
1.85 def get_freebusy_for_other_for_update(self, user, other):
1.86
1.87 - "For the given 'user', get free/busy details for the 'other' user."
1.88 + """
1.89 + For the given 'user', get free/busy details for the 'other' user
1.90 + that may be updated, potentially affecting the stored information
1.91 + directly.
1.92 + """
1.93
1.94 return self.get_freebusy_for_other(user, other, True)
1.95
1.96 @@ -323,6 +361,15 @@
1.97
1.98 pass
1.99
1.100 + def get_freebusy_others(self, user):
1.101 +
1.102 + """
1.103 + For the given 'user', return a list of other users for whom free/busy
1.104 + information is retained.
1.105 + """
1.106 +
1.107 + pass
1.108 +
1.109 # Tentative free/busy periods related to countering.
1.110
1.111 def get_freebusy_offers(self, user, mutable=False):
1.112 @@ -333,7 +380,10 @@
1.113
1.114 def get_freebusy_offers_for_update(self, user):
1.115
1.116 - "Get free/busy offers for the given 'user'."
1.117 + """
1.118 + Get free/busy offers for the given 'user' that may be updated,
1.119 + potentially affecting the stored information directly.
1.120 + """
1.121
1.122 return self.get_freebusy_offers(user, True)
1.123
1.124 @@ -552,6 +602,14 @@
1.125
1.126 pass
1.127
1.128 + def set_group(self, quota, store_user, user_group):
1.129 +
1.130 + """
1.131 + For the given 'quota', set a mapping from 'store_user' to 'user_group'.
1.132 + """
1.133 +
1.134 + pass
1.135 +
1.136 def get_limits(self, quota):
1.137
1.138 """
1.139 @@ -572,6 +630,15 @@
1.140
1.141 # Free/busy period access for users within quota groups.
1.142
1.143 + def get_freebusy_users(self, quota):
1.144 +
1.145 + """
1.146 + Return a list of users whose free/busy details are retained for the
1.147 + given 'quota'.
1.148 + """
1.149 +
1.150 + pass
1.151 +
1.152 def get_freebusy(self, quota, user, mutable=False):
1.153
1.154 "Get free/busy details for the given 'quota' and 'user'."
1.155 @@ -580,7 +647,10 @@
1.156
1.157 def get_freebusy_for_update(self, quota, user):
1.158
1.159 - "Get free/busy details for the given 'quota' and 'user'."
1.160 + """
1.161 + Get free/busy details for the given 'quota' and 'user' that may be
1.162 + updated, potentially affecting the stored information directly.
1.163 + """
1.164
1.165 return self.get_freebusy(quota, user, True)
1.166
1.167 @@ -605,7 +675,8 @@
1.168
1.169 """
1.170 Return a list of journal entries for the given 'quota' for the indicated
1.171 - 'group'.
1.172 + 'group' that may be updated, potentially affecting the stored
1.173 + information directly.
1.174 """
1.175
1.176 return self.get_entries(quota, group, True)