root/releases/bedework-3.8/deployment/resources/hibernate/hbms/Calendar.hbm.xml

Revision 3479 (checked in by douglm, 1 year ago)

Change dtd in hbm.xml files to match hibernate 3.6

Line 
1 <?xml version="1.0"?>
2 <!DOCTYPE hibernate-mapping PUBLIC
3   "-//Hibernate/Hibernate Mapping DTD//EN"
4   "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
5
6 <!-- ===================================================================
7      A calendar definition in Bedework.
8      =================================================================== -->
9
10 <hibernate-mapping>
11   <class name="org.bedework.calfacade.BwCalendar"
12          table="bw_calendars" lazy="false">
13     <cache usage="read-write"/>
14     <id name="id" type="integer" column="id" unsaved-value="-1">
15       <generator class="native"/>
16     </id>
17
18     <version name="seq" column="bwseq" type="integer" />
19
20     <property name="creatorHref" column="bw_creator" type="string"
21               index="bwidx_cal_creator" />
22
23     <property name="ownerHref" column="bw_owner" type="string"
24               index="bwidx_cal_owner" />
25
26     <property name="access" column="bwaccess" type="string"
27               length="3900" />
28
29     <property name="publick" type="true_false" >
30       <column name="publick" not-null="true" />
31     </property>
32
33     <!-- This should be considered an internal, probably immutable name and
34          we use the display name in the ui.
35          Caldav may present the displayname -->
36     <property name="name" column="calname" type="string"
37               length="100" not-null="true" />
38                  <!-- unique-key="cal-sibling-names" -->
39
40     <!-- I wanted to specify unique="true" on this but mysql complains.
41          This is also probably too short.
42
43          For uniqueness maybe limit the length of the name and create a
44          unique key on the parent + name
45       -->
46     <property name="path" column="bwpath" type="string" length="3000"
47               not-null="true"
48               index="bwidx_calpath" />
49
50     <property name="colPath" column="bw_col_path" type="string" length="3000"
51               index="bwidx_cal_colpath" />
52
53     <!-- These need changing. Perhaps recast summary as displayNames
54          Both need to be multi-language.
55          For the moment limit the lengtgh for Oracle -->
56     <property name="summary" column="summary" type="string" length="500" />
57     <property name="description" column="description" type="string" length="1000" />
58
59     <property name="mailListId" column="mail_list_id" type="string"
60               length="200" />
61
62     <property name="calType" column="caltype" type="integer" not-null="true"/>
63
64     <one-to-one name="lastmod"
65                 class="org.bedework.calfacade.BwCollectionLastmod"
66                 cascade="save-update,delete"/>
67
68     <property name="created" type="string">
69       <column name="bw_created" length="16" not-null="true" />
70     </property>
71
72     <property name="filterExpr" column="bw_filterexpr" type="text" />
73
74     <property name="aliasUri" column="bw_alias_uri" type="string"
75               length="500" />
76
77     <property name="display" type="true_false"
78               column="display" not-null="true" />
79
80     <property name="affectsFreeBusy" type="true_false"
81               column="affects_free_busy" not-null="true" />
82
83     <property name="ignoreTransparency" type="true_false"
84               column="ignore_transparency" not-null="true" />
85
86     <property name="unremoveable" type="true_false"
87               column="unremoveable" not-null="true" />
88
89     <!--  Properties associated with remote subscriptions -->
90     <property name="refreshRate" column="bwrefreshseconds" type="integer" />
91     <property name="lastRefresh" column="bwlastrefresh" type="string"
92               length="16" />
93     <property name="lastEtag" column="bwlastetag" type="string"
94               length="256" />
95     <property name="remoteId" column="bwrid" type="string"
96               length="256" />
97     <property name="remotePw" column="bwrpw" type="string"
98               length="500" />
99
100     <set name="categories" table="bw_calendar_categories"
101          lazy="false">
102       <cache usage="read-write"/>
103       <key column="calendarid" foreign-key="bw_calcat_cid_fk" />
104       <many-to-many class="org.bedework.calfacade.BwCategory"
105                     column="categoryid"
106                     foreign-key="bw_cal_cat_fk" />
107     </set>
108
109     <set name="properties" table="bw_calendar_properties"
110          cascade="all,delete-orphan"
111          lazy="false">
112       <key column="bwid" foreign-key="bw_calprp_pid_fk" />
113       <composite-element class="org.bedework.calfacade.BwProperty">
114         <property name="name" type="string" length="200"
115                   column="bw_name"  />
116
117         <property name="value" column="bw_value" type="text"/>
118       </composite-element>
119     </set>
120   </class>
121
122   <!-- =================================================================
123        Collection last mod
124        ================================================================= -->
125
126   <class name="org.bedework.calfacade.BwCollectionLastmod"
127          table="bw_collection_lastmods" >
128     <cache usage="read-write"/>
129
130     <id name="id" column="bw_id">
131       <generator class="foreign">
132         <param name="property">dbEntity</param>
133       </generator>
134     </id>
135
136     <one-to-one name="dbEntity"
137                 class="org.bedework.calfacade.BwCalendar"
138                 constrained="true"/>
139
140     <property name="path" column="bwpath" type="string" length="3000"
141               not-null="true"
142               index="bwidx_collm_path" />
143
144     <property name="timestamp" type="string" >
145       <column name="bw_timestamp" length="16" not-null="true" />
146     </property>
147
148     <property name="sequence"  column="bw_sequence" type="integer" />
149   </class>
150
151   <!-- =================================================================
152        calendar queries
153        ================================================================= -->
154
155   <query name="getNamedCalendars"><![CDATA[
156     from org.bedework.calfacade.BwCalendar as cal
157       where cal.name=:name and 
158           (cal.filterExpr = null or cal.filterExpr <> '--TOMBSTONED--')
159   ]]></query>
160
161   <query name="getCalendarByPath"><![CDATA[
162     from org.bedework.calfacade.BwCalendar as cal
163       where cal.path=:path and
164           (cal.filterExpr = null or cal.filterExpr <> '--TOMBSTONED--')
165   ]]></query>
166
167   <query name="getCalendarById"><![CDATA[
168     from org.bedework.calfacade.BwCalendar as cal
169       where cal.id=:id
170   ]]></query>
171
172   <query name="getPublicCalendarCollections"><![CDATA[
173     from org.bedework.calfacade.BwCalendar as cal
174       where cal.calType=1 and cal.publick=true and 
175           (cal.filterExpr = null or cal.filterExpr <> '--TOMBSTONED--')
176   ]]></query>
177
178   <query name="getUserCalendarCollections"><![CDATA[
179     from org.bedework.calfacade.BwCalendar as cal
180       where cal.calType=1 and cal.publick=false and 
181           (cal.filterExpr = null or cal.filterExpr <> '--TOMBSTONED--')
182   ]]></query>
183
184   <query name="countCalendarEventRefs"><![CDATA[
185     select count(*) from org.bedework.calfacade.BwEventObj as ev
186       where ev.colPath = :colPath and ev.tombstoned=false
187   ]]></query>
188
189   <query name="countCalendarChildren"><![CDATA[
190     select count(*) from org.bedework.calfacade.BwCalendar as cal
191       where cal.colPath = :colPath and 
192           (cal.filterExpr = null or cal.filterExpr <> '--TOMBSTONED--')
193   ]]></query>
194 </hibernate-mapping>
Note: See TracBrowser for help on using the browser.