root/trunk/calendar3/calCore/resources/hbms/Event.hbm.xml

Revision 200 (checked in by douglm, 7 years ago)

Subscription disappeared from event info after making changes to improve efficiency of lookup.

emitEvent.jsp was looking in the wrong place for the subscription.

guids are unique within a calendar collection only.

Line 
1 <?xml version="1.0"?>
2 <!DOCTYPE hibernate-mapping PUBLIC
3   "-//Hibernate/Hibernate Mapping DTD//EN"
4   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
5
6 <!-- ===================================================================
7      An Event in Bedework.
8      =================================================================== -->
9
10 <hibernate-mapping>
11   <class name="org.bedework.calfacade.BwEventObj"
12          table="events">
13     <id name="id" type="integer" column="eventid" unsaved-value="-1">
14       <generator class="native"/>
15     </id>
16
17     <version name="seq" column="seq" type="integer" />
18
19     <many-to-one name="creator"
20                  class="org.bedework.calfacade.BwUser" >
21       <column name="creatorid" not-null="true" index="idx_event_creator" />
22     </many-to-one>
23
24     <many-to-one name="owner"
25                  class="org.bedework.calfacade.BwUser"
26                  unique="true">
27       <column name="ownerid" not-null="true"
28               index="sidx_event_owner" />
29     </many-to-one>
30
31     <property name="access" column="access" type="text" />
32
33     <property name="publick" type="true_false" >
34       <column name="publick" not-null="true" />
35     </property>
36
37     <component name="dtstart"
38                class="org.bedework.calfacade.BwDateTime" >
39       <property name="dateType" column="start_date_type" type="true_false"
40                 not-null="true" />
41       <property name="tzid" column="start_tzid" type="string" />
42       <property name="dtval" column="start_dtval" type="string"
43                 not-null="true" />
44       <property name="date" column="start_date" type="string"
45                 not-null="true"
46                 index="idx_event_start" />
47     </component>
48
49     <!-- All day events and events which end when they start have no
50          end date/time -->
51     <component name="dtend"
52                class="org.bedework.calfacade.BwDateTime" >
53       <property name="dateType" column="end_date_type" type="true_false" />
54       <property name="tzid" column="end_tzid" type="string" />
55       <property name="dtval" column="end_dtval" type="string" />
56       <property name="date" column="end_date" type="string"
57                 index="idx_event_end" />
58     </component>
59
60     <property name="duration" column="duration" type="string" />
61
62     <property name="endType" column="end_type" type="char"
63               not-null="true" />
64
65     <property name="deleted" type="true_false">
66       <column name="deleted" not-null="true"
67               index="idx_event_deleted" />
68     </property>
69
70     <property name="summary" type="string" >
71       <column name="summary" not-null="true" />
72     </property>
73     <property name="description" column="description" type="text"/>
74
75     <property name="link" column="link" type="string" />
76
77     <property name="status" type="string" />
78
79     <property name="cost" column="cost" type="string"/>
80
81     <many-to-one name="organizer"
82                  class="org.bedework.calfacade.BwOrganizer"
83                  column="organizerid"
84                  cascade="all,delete-orphan"
85                  unique="true"
86                  not-null="false" />
87
88     <many-to-one name="calendar"
89                  class="org.bedework.calfacade.BwCalendar"
90                  column="calendarid"
91                  not-null="false"
92                  index="idx_event_calendar" unique-key="event-key" />
93     <!-- not-null should be true above - but the restore code needs
94          changing to write events with the calendar filled in. -->
95
96     <property name="dtstamp" column="dtstamp" type="string" />
97
98     <property name="lastmod" type="string" >
99       <column name="lastmod" not-null="true" />
100     </property>
101
102     <property name="created" type="string">
103       <column name="created" not-null="true" />
104     </property>
105
106     <property name="priority" type="integer" >
107       <column name="priority" not-null="true" />
108     </property>
109
110     <many-to-one name="sponsor"
111                  class="org.bedework.calfacade.BwSponsor" >
112       <column name="sponsorid" index="esi" />
113     </many-to-one>
114
115     <many-to-one name="location"
116                  class="org.bedework.calfacade.BwLocation" >
117       <column name="locationid" index="eli" />
118     </many-to-one>
119
120     <property name="name" column="eventname" type="text"/>
121
122     <!-- (ownerid +) calendarid + guid + sequence + recurrence-id is a unique key. -->
123     <property name="guid" type="text" unique-key="event-key" />
124
125     <property name="sequence" type="integer" unique-key="event-key" />
126
127     <property name="transparency" column="transparency" type="text"/>
128
129     <property name="categoriesChanged" type="true_false">
130       <column name="categories_changed" not-null="true" />
131     </property>
132
133     <set name="categories" table="event_categories"
134          lazy="true" >
135       <cache usage="read-write"/>
136       <key column="eventid"/>
137       <many-to-many class="org.bedework.calfacade.BwCategory"
138                     column="categoryid"/>
139     </set>
140
141     <property name="attendeesChanged" type="true_false">
142       <column name="attendees_changed" not-null="true" />
143     </property>
144
145     <set name="attendees" table="event_attendees"
146          cascade="all-delete-orphan" >
147       <key column="eventid"/>
148       <many-to-many class="org.bedework.calfacade.BwAttendee" />
149     </set>
150
151     <!-- We don't map the alarms because generally we have to fetch them
152          based on critera we cannot derive from the event.
153
154          Generally we only fetch the alarms for a given event and the
155          curremt user.
156     <set name="alarms" table="event_alarms"
157          lazy="true"
158          cascade="all-delete-orphan" >
159       <key column="eventid" />
160       <many-to-many class="org.bedework.calfacade.BwEventAlarm"
161                     column="id"/>
162     </set>
163          -->
164
165     <property name="recurring" type="true_false" column="recurring" not-null="true"
166               index="idx_event_recurring" />
167
168     <property name="recurrenceChanged" type="true_false">
169       <column name="recurrence_changed" not-null="true" />
170     </property>
171
172     <component name="recurrence"
173                class="org.bedework.calfacade.BwRecurrence" >
174       <set name="rrules" lazy="true" table="eventrrules"
175            cascade="all,delete-orphan">
176         <key column="eventid"/>
177         <element type="string" column="rrule" not-null="true"/>
178       </set>
179
180       <set name="rdates" lazy="true" table="eventrdates"
181            cascade="all,delete-orphan">
182         <key column="eventid"/>
183         <element type="string" column="rdate" not-null="true"/>
184       </set>
185
186       <set name="exdates" lazy="true" table="eventexdates"
187            cascade="all,delete-orphan">
188         <key column="eventid"/>
189         <element type="string" column="exdate" not-null="true"/>
190       </set>
191
192       <property name="recurrenceId" column="recurrence_id" type="string"
193                 unique-key="event-key" />
194
195       <property name="latestDate" column="latest_date" type="string"
196                 index="idx_event_latest_date" />
197
198       <property name="expanded" type="true_false" column="expanded" not-null="true"
199                 index="idx_event_expanded" />
200     </component>
201   </class>
202
203   <!-- =================================================================
204        Event queries
205        ================================================================= -->
206
207   <query name="eventsByName"><![CDATA[
208     from org.bedework.calfacade.BwEventObj as ev
209       where ev.name = :name and ev.calendar = :cal
210   ]]></query>
211
212   <!-- Use this to see if a guid exists. The count should be zero or one -->
213   <query name="getGuidCount"><![CDATA[
214     select count(*) from org.bedework.calfacade.BwEventObj as ev
215       where ev.guid = :guid
216   ]]></query>
217 </hibernate-mapping>
218
Note: See TracBrowser for help on using the browser.