-
Notifications
You must be signed in to change notification settings - Fork 179
/
views.xml
254 lines (225 loc) · 7.96 KB
/
views.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<entry key="UDynGroupMembers">
CREATE TABLE UDynGroupMembers(
any_id CHAR(36),
group_id CHAR(36),
UNIQUE(any_id, group_id))
</entry>
<entry key="ADynGroupMembers">
CREATE TABLE ADynGroupMembers(
anyType_id VARCHAR(255),
any_id CHAR(36),
group_id CHAR(36),
UNIQUE(anyType_id, any_id, group_id))
</entry>
<entry key="DynRoleMembers">
CREATE TABLE DynRoleMembers(
any_id CHAR(36),
role_id VARCHAR(255),
UNIQUE(any_id, role_id))
</entry>
<entry key="DynRealmMembers">
CREATE TABLE DynRealmMembers(
any_id CHAR(36),
dynRealm_id VARCHAR(255),
UNIQUE(any_id, dynRealm_id))
</entry>
<!-- user -->
<entry key="user_search">
CREATE VIEW user_search AS
SELECT u.id as any_id, u.* FROM SyncopeUser u
</entry>
<entry key="user_search_unique_attr">
CREATE VIEW user_search_unique_attr AS
SELECT ua.owner_id AS any_id,
ua.schema_id AS schema_id,
uav.booleanvalue AS booleanvalue,
uav.datevalue AS datevalue,
uav.doublevalue AS doublevalue,
uav.longvalue AS longvalue,
uav.stringvalue AS stringvalue
FROM UPlainAttrUniqueValue uav, UPlainAttr ua
WHERE uav.attribute_id = ua.id
</entry>
<entry key="user_search_attr">
CREATE VIEW user_search_attr AS
SELECT ua.owner_id AS any_id,
ua.schema_id AS schema_id,
uav.booleanvalue AS booleanvalue,
uav.datevalue AS datevalue,
uav.doublevalue AS doublevalue,
uav.longvalue AS longvalue,
uav.stringvalue AS stringvalue
FROM UPlainAttrValue uav, UPlainAttr ua
WHERE uav.attribute_id = ua.id
</entry>
<entry key="user_search_null_attr">
CREATE VIEW user_search_null_attr AS
SELECT u.id AS any_id,
PlainSchema.id AS schema_id,
NULL::int4 AS booleanvalue,
NULL::timestamp AS datevalue,
NULL::float8 AS doublevalue,
NULL::int8 AS longvalue,
NULL AS stringvalue
FROM SyncopeUser u CROSS JOIN PlainSchema
LEFT OUTER JOIN UPlainAttr ua ON (PlainSchema.id = ua.schema_id AND ua.owner_id = u.id)
WHERE ua.id IS NULL
</entry>
<entry key="user_search_urelationship">
CREATE VIEW user_search_urelationship AS
SELECT m.user_id AS any_id, m.anyObject_id AS right_any_id, m.type_id AS type
FROM URelationship m
</entry>
<entry key="user_search_umembership">
CREATE VIEW user_search_umembership AS
SELECT m.user_id AS any_id, g.id AS group_id, g.name AS group_name
FROM UMembership m, SyncopeGroup g
WHERE m.group_id = g.id
</entry>
<entry key="user_search_role">
CREATE VIEW user_search_role AS
SELECT ss.user_id AS any_id, ss.role_id AS role_id
FROM SyncopeUser_SyncopeRole ss
</entry>
<entry key="user_search_resource">
CREATE VIEW user_search_resource AS
SELECT st.user_id AS any_id, st.resource_id AS resource_id
FROM SyncopeUser_ExternalResource st
</entry>
<entry key="user_search_group_res">
CREATE VIEW user_search_group_res AS
SELECT m.user_id AS any_id, st.resource_id AS resource_id
FROM UMembership m, SyncopeGroup r, SyncopeGroup_ExternalResource st
WHERE m.group_id = r.id AND st.group_id = r.id
</entry>
<!-- anyObject -->
<entry key="anyObject_search">
CREATE VIEW anyObject_search AS
SELECT a.id as any_id, a.* FROM AnyObject a
</entry>
<entry key="anyObject_search_unique_attr">
CREATE VIEW anyObject_search_unique_attr AS
SELECT ua.owner_id AS any_id,
ua.schema_id AS schema_id,
uav.booleanvalue AS booleanvalue,
uav.datevalue AS datevalue,
uav.doublevalue AS doublevalue,
uav.longvalue AS longvalue,
uav.stringvalue AS stringvalue
FROM APlainAttrUniqueValue uav, APlainAttr ua
WHERE uav.attribute_id = ua.id
</entry>
<entry key="anyObject_search_attr">
CREATE VIEW anyObject_search_attr AS
SELECT ua.owner_id AS any_id,
ua.schema_id AS schema_id,
uav.booleanvalue AS booleanvalue,
uav.datevalue AS datevalue,
uav.doublevalue AS doublevalue,
uav.longvalue AS longvalue,
uav.stringvalue AS stringvalue
FROM APlainAttrValue uav, APlainAttr ua
WHERE uav.attribute_id = ua.id
</entry>
<entry key="anyObject_search_null_attr">
CREATE VIEW anyObject_search_null_attr AS
SELECT u.id AS any_id,
PlainSchema.id AS schema_id,
NULL::int4 AS booleanvalue,
NULL::timestamp AS datevalue,
NULL::float8 AS doublevalue,
NULL::int8 AS longvalue,
NULL AS stringvalue
FROM AnyObject u CROSS JOIN PlainSchema
LEFT OUTER JOIN APlainAttr ua ON (PlainSchema.id = ua.schema_id AND ua.owner_id = u.id)
WHERE ua.id IS NULL
</entry>
<entry key="anyObject_search_arelationship">
CREATE VIEW anyObject_search_arelationship AS
SELECT m.left_anyObject_id AS any_id, m.right_anyObject_id AS right_any_id, m.type_id AS type
FROM ARelationship m
</entry>
<entry key="anyObject_search_amembership">
CREATE VIEW anyObject_search_amembership AS
SELECT m.anyObject_id AS any_id, g.id AS group_id, g.name AS group_name
FROM AMembership m, SyncopeGroup g
WHERE m.group_id = g.id
</entry>
<entry key="anyObject_search_resource">
CREATE VIEW anyObject_search_resource AS
SELECT st.anyObject_id AS any_id, st.resource_id AS resource_id
FROM AnyObject_ExternalResource st
</entry>
<entry key="anyObject_search_group_res">
CREATE VIEW anyObject_search_group_res AS
SELECT m.anyObject_id AS any_id, st.resource_id AS resource_id
FROM AMembership m, SyncopeGroup r, SyncopeGroup_ExternalResource st
WHERE m.group_id = r.id AND st.group_id = r.id
</entry>
<!-- group -->
<entry key="group_search">
CREATE VIEW group_search AS
SELECT r.id as any_id, r.* FROM SyncopeGroup r
</entry>
<entry key="group_search_unique_attr">
CREATE VIEW group_search_unique_attr AS
SELECT ua.owner_id AS any_id,
ua.schema_id AS schema_id,
uav.booleanvalue AS booleanvalue,
uav.datevalue AS datevalue,
uav.doublevalue AS doublevalue,
uav.longvalue AS longvalue,
uav.stringvalue AS stringvalue
FROM GPlainAttrUniqueValue uav, GPlainAttr ua
WHERE uav.attribute_id = ua.id
</entry>
<entry key="group_search_attr">
CREATE VIEW group_search_attr AS
SELECT ua.owner_id AS any_id,
ua.schema_id AS schema_id,
uav.booleanvalue AS booleanvalue,
uav.datevalue AS datevalue,
uav.doublevalue AS doublevalue,
uav.longvalue AS longvalue,
uav.stringvalue AS stringvalue
FROM GPlainAttrValue uav, GPlainAttr ua
WHERE uav.attribute_id = ua.id
</entry>
<entry key="group_search_null_attr">
CREATE VIEW group_search_null_attr AS
SELECT u.id AS any_id,
PlainSchema.id AS schema_id,
NULL::int4 AS booleanvalue,
NULL::timestamp AS datevalue,
NULL::float8 AS doublevalue,
NULL::int8 AS longvalue,
NULL AS stringvalue
FROM SyncopeGroup u CROSS JOIN PlainSchema
LEFT OUTER JOIN GPlainAttr ua ON (PlainSchema.id = ua.schema_id AND ua.owner_id = u.id)
WHERE ua.id IS NULL
</entry>
<entry key="group_search_resource">
CREATE VIEW group_search_resource AS
SELECT st.group_id AS any_id, st.resource_id AS resource_id
FROM SyncopeGroup_ExternalResource st
</entry>
</properties>