MiG InfoCom MiG Calendar DBConnect Guide User Manual
Page 21

MiG InfoCom AB
the queue and an exception is fired to the
ExceptionListener
s.
It is then up to the listeners to handle the situation.
Loading only Visible Activities
The DBConnect activity poll does not out of the box know about what
date/time ranges the user are currently watching in the date areas.
This means that it will load all activities which is many times not
desirable, since keeping them all in memory can be too much. Even
though MiG Calendar can typically hold about 100.000 activities in a
normal PC's memory it will still reduce performance.
There is an easy way you can make DBConnect only load activities
that are visible. You can even add date ranges that are interesting
other than the ones handled automatically by the date areas. All date
areas (e.g.
DefaultDateArea
) register their visible date range as
a
Subscription
to the
ActivityDepository
. What you need
to do is to add a specific
WHERE
clause to the
DBDataProvider
that tells the database to only return activities between certain ranges.
Fortunately there is a utility method that creates this
SQLExpression
for you and it is even dynamic in that it reads the
active subscriptions for every call.
All you have to do is:
SQLExpression expr =
DBUtil.getDynamicActivitySubscriptionsSQLExpression("affect_start_millis",
"affect_end_millis", null);
DBDataProvider provider = (DBDataProvider) activitySynchronizer.getDataProvider()
provider.setReadWhereExpression(expr);
There is also a static version of the method above. It will create a filter
for the subscriptions as they are registered at the time of the method
call.
Custom Properties in Activities or Categories
Both the
Activity
and
Category
classes uses a
PropertyKey
to get and set property values. This is happening in the background
even if you use the convenience methods such as
activity.setSummary(“summary”)
which is the same thing
as calling
activity.setPropertySilent(AbstractActivity.PRO
P_SUMMARY, “summary”)
.
This makes it very easy to have custom properties in your activities
and categories. All you have to do is create the
PropertyKey
by
DBConnect Guide
Page 21 / 25