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