MiG InfoCom MiG Calendar DBConnect Guide User Manual
Page 11
![background image](https://www.manualsdir.com/files/798677/content/doc011.png)
MiG InfoCom AB
corresponding columns in a database or elements in an XML
document. This mapping is almost the only thing you need to tell the
DBConnect plugin for it to work. Some properties need, for instance to
optimize database queries, to be scattered over one or many
database columns. The opposite is also true. Some database column
values is calculated from more than one property of the activity. For
instance the “affected start and end date/time” column are calculated
from the base date range of the activity together with an optional
recurrence rule.
Load/Save Mappings to File
All classes that are used to map DBConnect to a database structure
are both
Serializable
and have XML delegates so they can be
loaded/saved to XML. There are convenience load and save methods
in
DBUtil
that handle the specifics.
Mandatory Properties
Some properties of the activity and category are mandatory to store in
the backing store (database or XML file for instance). Take the
“affected start and end date/time” above. The plugin must know which
is the first and last date/time that the activity will affect so that it
doesn't have to load all activities if it just wants to show one day in the
calendar.
Those mandatory property mappings normally have
static
convenience factory methods in the
PropertyMapping
class but
they also exist as public classes.
Here follows a complete list of the mandatory mappings. Note that
there are no arguments for the methods. Pleas see the example code
and/or JavaDoc API Documentation for this.
For
Activities
:
ID – This is the ID of the activity. Normally an
Integer
,
Long
or
String
.
To create the mapping use:
new IDMapping(...)
Affect Start/End - This is the total date range that the activity will
affect expressed in milliseconds. In this value the recurrence rule is
included and thus the end can be set to an extremely high value if the
activity is recurrent without a stop date. The database column must
return a
Long
. This value is typically used to optimize the database
DBConnect Guide
Page 11 / 25