| 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 |
Administrative groups.. |
|---|
| 8 |
=================================================================== --> |
|---|
| 9 |
|
|---|
| 10 |
<hibernate-mapping> |
|---|
| 11 |
<class name="org.bedework.calfacade.svc.BwAdminGroup" |
|---|
| 12 |
table="adminGroups"> |
|---|
| 13 |
<id name="id" type="integer" column="userid" unsaved-value="-1"> |
|---|
| 14 |
<generator class="native"/> |
|---|
| 15 |
</id> |
|---|
| 16 |
|
|---|
| 17 |
<version name="seq" column="seq" type="integer" /> |
|---|
| 18 |
|
|---|
| 19 |
<property name="account" column="name" type="text"/> |
|---|
| 20 |
|
|---|
| 21 |
<!-- |
|---|
| 22 |
<set name="groupMembers" table="adminGroupMembers" |
|---|
| 23 |
lazy="true" > |
|---|
| 24 |
<key> |
|---|
| 25 |
<column name="groupname" not-null="true" /> |
|---|
| 26 |
</key> |
|---|
| 27 |
<many-to-many class="org.bedework.calfacade.BwUser" |
|---|
| 28 |
column="userid" /> |
|---|
| 29 |
</set> |
|---|
| 30 |
--> |
|---|
| 31 |
|
|---|
| 32 |
<property name="description" column="description" type="text"/> |
|---|
| 33 |
<many-to-one name="groupOwner" |
|---|
| 34 |
class="org.bedework.calfacade.BwUser" |
|---|
| 35 |
not-null="true" /> |
|---|
| 36 |
|
|---|
| 37 |
<many-to-one name="owner" |
|---|
| 38 |
class="org.bedework.calfacade.BwUser" |
|---|
| 39 |
column="ownerid" |
|---|
| 40 |
not-null="true" /> |
|---|
| 41 |
</class> |
|---|
| 42 |
|
|---|
| 43 |
<!-- This is a cheat to get around some problems. |
|---|
| 44 |
|
|---|
| 45 |
I was unable to execute that query. Hibernate 3.1 may allow it. |
|---|
| 46 |
Rather than build the table names into the java and use direct jdbc |
|---|
| 47 |
I added a bogus class and mapped it here. |
|---|
| 48 |
--> |
|---|
| 49 |
|
|---|
| 50 |
<class name="org.bedework.calfacade.svc.BwAdminGroupEntry" |
|---|
| 51 |
table="adminGroupMembers"> |
|---|
| 52 |
<composite-id> |
|---|
| 53 |
<key-many-to-one name="grp" column="groupid" |
|---|
| 54 |
class="org.bedework.calfacade.svc.BwAdminGroup"/> |
|---|
| 55 |
<key-property name="memberId" column="memberid" |
|---|
| 56 |
type="integer"/> |
|---|
| 57 |
<key-property name="memberIsGroup" column="member_is_group" |
|---|
| 58 |
type="true_false" /> |
|---|
| 59 |
</composite-id> |
|---|
| 60 |
|
|---|
| 61 |
<property name="groupId" column="groupid" |
|---|
| 62 |
type="integer" insert="false" update="false"/> |
|---|
| 63 |
|
|---|
| 64 |
<!-- |
|---|
| 65 |
<id name="groupId" column="groupid" unsaved-value="-1"> |
|---|
| 66 |
<generator class="foreign"> |
|---|
| 67 |
<param name="property">grp</param> |
|---|
| 68 |
</generator> |
|---|
| 69 |
</id> |
|---|
| 70 |
|
|---|
| 71 |
<many-to-one name="grp" column="groupid" |
|---|
| 72 |
class="org.bedework.calfacade.svc.BwAdminGroup" |
|---|
| 73 |
not-null="true" |
|---|
| 74 |
insert="false" update="false" /> |
|---|
| 75 |
|
|---|
| 76 |
<property name="memberId" column="memberid" type="integer" |
|---|
| 77 |
unique-key="agmembers_key" /> |
|---|
| 78 |
|
|---|
| 79 |
<property name="memberIsGroup" type="true_false" |
|---|
| 80 |
unique-key="agmembers_key" > |
|---|
| 81 |
<column name="member_is_group" not-null="true" /> |
|---|
| 82 |
</property> |
|---|
| 83 |
--> |
|---|
| 84 |
</class> |
|---|
| 85 |
|
|---|
| 86 |
<!-- ================================================================= |
|---|
| 87 |
Administrative groups queries |
|---|
| 88 |
================================================================= --> |
|---|
| 89 |
|
|---|
| 90 |
<query name="getAllAdminGroups"><![CDATA[ |
|---|
| 91 |
from org.bedework.calfacade.svc.BwAdminGroup ag |
|---|
| 92 |
order by ag.account |
|---|
| 93 |
]]></query> |
|---|
| 94 |
|
|---|
| 95 |
<query name="getAdminGroups"><![CDATA[ |
|---|
| 96 |
select ag.grp from org.bedework.calfacade.svc.BwAdminGroupEntry ag |
|---|
| 97 |
where ag.memberId=:entId and ag.memberIsGroup=:isgroup |
|---|
| 98 |
]]></query> |
|---|
| 99 |
|
|---|
| 100 |
<query name="getGroupUserMembers"><![CDATA[ |
|---|
| 101 |
select u from |
|---|
| 102 |
org.bedework.calfacade.svc.BwAdminGroupEntry age, |
|---|
| 103 |
org.bedework.calfacade.BwUser u |
|---|
| 104 |
where u.id = age.memberId and |
|---|
| 105 |
age.grp=:gr and age.memberIsGroup=false |
|---|
| 106 |
]]></query> |
|---|
| 107 |
|
|---|
| 108 |
<query name="getGroupParents"><![CDATA[ |
|---|
| 109 |
select ag from |
|---|
| 110 |
org.bedework.calfacade.svc.BwAdminGroupEntry age, |
|---|
| 111 |
org.bedework.calfacade.svc.BwAdminGroup ag |
|---|
| 112 |
where ag.id = age.groupId and |
|---|
| 113 |
age.memberId=:grpid age.memberIsGroup=true |
|---|
| 114 |
]]></query> |
|---|
| 115 |
|
|---|
| 116 |
<query name="getGroupGroupMembers"><![CDATA[ |
|---|
| 117 |
select ag from |
|---|
| 118 |
org.bedework.calfacade.svc.BwAdminGroupEntry age, |
|---|
| 119 |
org.bedework.calfacade.svc.BwAdminGroup ag |
|---|
| 120 |
where ag.id = age.memberId and |
|---|
| 121 |
age.grp=:gr and age.memberIsGroup=true |
|---|
| 122 |
]]></query> |
|---|
| 123 |
|
|---|
| 124 |
<query name="removeAllGroupMembers"><![CDATA[ |
|---|
| 125 |
delete from |
|---|
| 126 |
org.bedework.calfacade.svc.BwAdminGroupEntry |
|---|
| 127 |
where grp=:gr |
|---|
| 128 |
]]></query> |
|---|
| 129 |
|
|---|
| 130 |
<query name="removeFromAllGroups"><![CDATA[ |
|---|
| 131 |
delete from |
|---|
| 132 |
org.bedework.calfacade.svc.BwAdminGroupEntry |
|---|
| 133 |
where memberId=:mbrId and memberIsGroup=:isgroup |
|---|
| 134 |
]]></query> |
|---|
| 135 |
|
|---|
| 136 |
<query name="findAdminGroupEntry"><![CDATA[ |
|---|
| 137 |
from org.bedework.calfacade.svc.BwAdminGroupEntry |
|---|
| 138 |
where grp=:grp and memberId=:mbrId and memberIsGroup=:isgroup |
|---|
| 139 |
]]></query> |
|---|
| 140 |
</hibernate-mapping> |
|---|
| 141 |
|
|---|