Browse code

Fix: fix hollow fields

Thomas Fricker authored on 09/10/2018 12:33:36
Showing 12 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,38 @@
0
+/* BEGIN LICENSE
1
+ * Copyright © Blue Mind SAS, 2012-2016
2
+ *
3
+ * This file is part of BlueMind. BlueMind is a messaging and collaborative
4
+ * solution.
5
+ *
6
+ * This program is free software; you can redistribute it and/or modify
7
+ * it under the terms of either the GNU Affero General Public License as
8
+ * published by the Free Software Foundation (version 3 of the License).
9
+ *
10
+ *
11
+ * This program is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
+ *
15
+ * See LICENSE.txt
16
+ * END LICENSE
17
+ */
18
+package net.bluemind.core.api;
19
+
20
+import java.lang.annotation.ElementType;
21
+import java.lang.annotation.Retention;
22
+import java.lang.annotation.RetentionPolicy;
23
+import java.lang.annotation.Target;
24
+
25
+/**
26
+ * 
27
+ * @author Thomas Fricker
28
+ * 
29
+ *         Fields markes as WriteOnly won't get populated when retrieving data
30
+ *
31
+ */
32
+
33
+@Target(value = ElementType.FIELD)
34
+@Retention(RetentionPolicy.RUNTIME)
35
+public @interface WriteOnly {
36
+
37
+}
... ...
@@ -23,6 +23,7 @@ import java.util.List;
23 23
 
24 24
 import net.bluemind.core.api.BMApi;
25 25
 import net.bluemind.core.api.Email;
26
+import net.bluemind.core.api.WriteOnly;
26 27
 
27 28
 /**
28 29
  * The vcard contains contact information, typically pertaining to a single
... ...
@@ -36,7 +37,7 @@ public class DirEntry extends BaseDirEntry {
36 36
 	public boolean hidden;
37 37
 	public boolean system;
38 38
 	public boolean archived;
39
-	// FIXME not used for now
39
+	@WriteOnly
40 40
 	public List<Email> emails;
41 41
 	public String orgUnitUid;
42 42
 	public OrgUnitPath orgUnitPath;
... ...
@@ -26,8 +26,8 @@ public class AddressBookRecord extends HollowObject {
26 26
         return  api().getHString(refOrdinal);
27 27
     }
28 28
 
29
-    public HString getNormalizedUid() {
30
-        int refOrdinal = delegate().getNormalizedUidOrdinal(ordinal);
29
+    public HString getDistinguishedName() {
30
+        int refOrdinal = delegate().getDistinguishedNameOrdinal(ordinal);
31 31
         if(refOrdinal == -1)
32 32
             return null;
33 33
         return  api().getHString(refOrdinal);
... ...
@@ -54,6 +54,13 @@ public class AddressBookRecord extends HollowObject {
54 54
         return  api().getListOfEmail(refOrdinal);
55 55
     }
56 56
 
57
+    public HString getEmail() {
58
+        int refOrdinal = delegate().getEmailOrdinal(ordinal);
59
+        if(refOrdinal == -1)
60
+            return null;
61
+        return  api().getHString(refOrdinal);
62
+    }
63
+
57 64
     public long getMinimalid() {
58 65
         return delegate().getMinimalid(ordinal);
59 66
     }
... ...
@@ -10,7 +10,7 @@ public interface AddressBookRecordDelegate extends HollowObjectDelegate {
10 10
 
11 11
     public int getUidOrdinal(int ordinal);
12 12
 
13
-    public int getNormalizedUidOrdinal(int ordinal);
13
+    public int getDistinguishedNameOrdinal(int ordinal);
14 14
 
15 15
     public int getDomainOrdinal(int ordinal);
16 16
 
... ...
@@ -18,6 +18,8 @@ public interface AddressBookRecordDelegate extends HollowObjectDelegate {
18 18
 
19 19
     public int getEmailsOrdinal(int ordinal);
20 20
 
21
+    public int getEmailOrdinal(int ordinal);
22
+
21 23
     public long getMinimalid(int ordinal);
22 24
 
23 25
     public Long getMinimalidBoxed(int ordinal);
... ...
@@ -11,10 +11,11 @@ public class AddressBookRecordDelegateCachedImpl extends HollowObjectAbstractDel
11 11
 
12 12
     private final int addressBookOrdinal;
13 13
     private final int uidOrdinal;
14
-    private final int normalizedUidOrdinal;
14
+    private final int distinguishedNameOrdinal;
15 15
     private final int domainOrdinal;
16 16
     private final int kindOrdinal;
17 17
     private final int emailsOrdinal;
18
+    private final int emailOrdinal;
18 19
     private final Long minimalid;
19 20
     private final int nameOrdinal;
20 21
     private final int surnameOrdinal;
... ...
@@ -54,10 +55,11 @@ public class AddressBookRecordDelegateCachedImpl extends HollowObjectAbstractDel
54 54
     public AddressBookRecordDelegateCachedImpl(AddressBookRecordTypeAPI typeAPI, int ordinal) {
55 55
         this.addressBookOrdinal = typeAPI.getAddressBookOrdinal(ordinal);
56 56
         this.uidOrdinal = typeAPI.getUidOrdinal(ordinal);
57
-        this.normalizedUidOrdinal = typeAPI.getNormalizedUidOrdinal(ordinal);
57
+        this.distinguishedNameOrdinal = typeAPI.getDistinguishedNameOrdinal(ordinal);
58 58
         this.domainOrdinal = typeAPI.getDomainOrdinal(ordinal);
59 59
         this.kindOrdinal = typeAPI.getKindOrdinal(ordinal);
60 60
         this.emailsOrdinal = typeAPI.getEmailsOrdinal(ordinal);
61
+        this.emailOrdinal = typeAPI.getEmailOrdinal(ordinal);
61 62
         this.minimalid = typeAPI.getMinimalidBoxed(ordinal);
62 63
         this.nameOrdinal = typeAPI.getNameOrdinal(ordinal);
63 64
         this.surnameOrdinal = typeAPI.getSurnameOrdinal(ordinal);
... ...
@@ -103,8 +105,8 @@ public class AddressBookRecordDelegateCachedImpl extends HollowObjectAbstractDel
103 103
         return uidOrdinal;
104 104
     }
105 105
 
106
-    public int getNormalizedUidOrdinal(int ordinal) {
107
-        return normalizedUidOrdinal;
106
+    public int getDistinguishedNameOrdinal(int ordinal) {
107
+        return distinguishedNameOrdinal;
108 108
     }
109 109
 
110 110
     public int getDomainOrdinal(int ordinal) {
... ...
@@ -119,6 +121,10 @@ public class AddressBookRecordDelegateCachedImpl extends HollowObjectAbstractDel
119 119
         return emailsOrdinal;
120 120
     }
121 121
 
122
+    public int getEmailOrdinal(int ordinal) {
123
+        return emailOrdinal;
124
+    }
125
+
122 126
     public long getMinimalid(int ordinal) {
123 127
         if(minimalid == null)
124 128
             return Long.MIN_VALUE;
... ...
@@ -21,8 +21,8 @@ public class AddressBookRecordDelegateLookupImpl extends HollowObjectAbstractDel
21 21
         return typeAPI.getUidOrdinal(ordinal);
22 22
     }
23 23
 
24
-    public int getNormalizedUidOrdinal(int ordinal) {
25
-        return typeAPI.getNormalizedUidOrdinal(ordinal);
24
+    public int getDistinguishedNameOrdinal(int ordinal) {
25
+        return typeAPI.getDistinguishedNameOrdinal(ordinal);
26 26
     }
27 27
 
28 28
     public int getDomainOrdinal(int ordinal) {
... ...
@@ -37,6 +37,10 @@ public class AddressBookRecordDelegateLookupImpl extends HollowObjectAbstractDel
37 37
         return typeAPI.getEmailsOrdinal(ordinal);
38 38
     }
39 39
 
40
+    public int getEmailOrdinal(int ordinal) {
41
+        return typeAPI.getEmailOrdinal(ordinal);
42
+    }
43
+
40 44
     public long getMinimalid(int ordinal) {
41 45
         return typeAPI.getMinimalid(ordinal);
42 46
     }
... ...
@@ -12,10 +12,11 @@ public class AddressBookRecordTypeAPI extends HollowObjectTypeAPI {
12 12
         super(api, typeDataAccess, new String[] {
13 13
             "addressBook",
14 14
             "uid",
15
-            "normalizedUid",
15
+            "distinguishedName",
16 16
             "domain",
17 17
             "kind",
18 18
             "emails",
19
+            "email",
19 20
             "minimalid",
20 21
             "name",
21 22
             "surname",
... ...
@@ -74,13 +75,13 @@ public class AddressBookRecordTypeAPI extends HollowObjectTypeAPI {
74 74
         return getAPI().getStringTypeAPI();
75 75
     }
76 76
 
77
-    public int getNormalizedUidOrdinal(int ordinal) {
77
+    public int getDistinguishedNameOrdinal(int ordinal) {
78 78
         if(fieldIndex[2] == -1)
79
-            return missingDataHandler().handleReferencedOrdinal("AddressBookRecord", ordinal, "normalizedUid");
79
+            return missingDataHandler().handleReferencedOrdinal("AddressBookRecord", ordinal, "distinguishedName");
80 80
         return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[2]);
81 81
     }
82 82
 
83
-    public StringTypeAPI getNormalizedUidTypeAPI() {
83
+    public StringTypeAPI getDistinguishedNameTypeAPI() {
84 84
         return getAPI().getStringTypeAPI();
85 85
     }
86 86
 
... ...
@@ -114,19 +115,29 @@ public class AddressBookRecordTypeAPI extends HollowObjectTypeAPI {
114 114
         return getAPI().getListOfEmailTypeAPI();
115 115
     }
116 116
 
117
-    public long getMinimalid(int ordinal) {
117
+    public int getEmailOrdinal(int ordinal) {
118 118
         if(fieldIndex[6] == -1)
119
+            return missingDataHandler().handleReferencedOrdinal("AddressBookRecord", ordinal, "email");
120
+        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[6]);
121
+    }
122
+
123
+    public StringTypeAPI getEmailTypeAPI() {
124
+        return getAPI().getStringTypeAPI();
125
+    }
126
+
127
+    public long getMinimalid(int ordinal) {
128
+        if(fieldIndex[7] == -1)
119 129
             return missingDataHandler().handleLong("AddressBookRecord", ordinal, "minimalid");
120
-        return getTypeDataAccess().readLong(ordinal, fieldIndex[6]);
130
+        return getTypeDataAccess().readLong(ordinal, fieldIndex[7]);
121 131
     }
122 132
 
123 133
     public Long getMinimalidBoxed(int ordinal) {
124 134
         long l;
125
-        if(fieldIndex[6] == -1) {
135
+        if(fieldIndex[7] == -1) {
126 136
             l = missingDataHandler().handleLong("AddressBookRecord", ordinal, "minimalid");
127 137
         } else {
128
-            boxedFieldAccessSampler.recordFieldAccess(fieldIndex[6]);
129
-            l = getTypeDataAccess().readLong(ordinal, fieldIndex[6]);
138
+            boxedFieldAccessSampler.recordFieldAccess(fieldIndex[7]);
139
+            l = getTypeDataAccess().readLong(ordinal, fieldIndex[7]);
130 140
         }
131 141
         if(l == Long.MIN_VALUE)
132 142
             return null;
... ...
@@ -136,9 +147,9 @@ public class AddressBookRecordTypeAPI extends HollowObjectTypeAPI {
136 136
 
137 137
 
138 138
     public int getNameOrdinal(int ordinal) {
139
-        if(fieldIndex[7] == -1)
139
+        if(fieldIndex[8] == -1)
140 140
             return missingDataHandler().handleReferencedOrdinal("AddressBookRecord", ordinal, "name");
141
-        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[7]);
141
+        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[8]);
142 142
     }
143 143
 
144 144
     public StringTypeAPI getNameTypeAPI() {
... ...
@@ -146,9 +157,9 @@ public class AddressBookRecordTypeAPI extends HollowObjectTypeAPI {
146 146
     }
147 147
 
148 148
     public int getSurnameOrdinal(int ordinal) {
149
-        if(fieldIndex[8] == -1)
149
+        if(fieldIndex[9] == -1)
150 150
             return missingDataHandler().handleReferencedOrdinal("AddressBookRecord", ordinal, "surname");
151
-        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[8]);
151
+        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[9]);
152 152
     }
153 153
 
154 154
     public StringTypeAPI getSurnameTypeAPI() {
... ...
@@ -156,9 +167,9 @@ public class AddressBookRecordTypeAPI extends HollowObjectTypeAPI {
156 156
     }
157 157
 
158 158
     public int getGivenNameOrdinal(int ordinal) {
159
-        if(fieldIndex[9] == -1)
159
+        if(fieldIndex[10] == -1)
160 160
             return missingDataHandler().handleReferencedOrdinal("AddressBookRecord", ordinal, "givenName");
161
-        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[9]);
161
+        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[10]);
162 162
     }
163 163
 
164 164
     public StringTypeAPI getGivenNameTypeAPI() {
... ...
@@ -166,9 +177,9 @@ public class AddressBookRecordTypeAPI extends HollowObjectTypeAPI {
166 166
     }
167 167
 
168 168
     public int getTitleOrdinal(int ordinal) {
169
-        if(fieldIndex[10] == -1)
169
+        if(fieldIndex[11] == -1)
170 170
             return missingDataHandler().handleReferencedOrdinal("AddressBookRecord", ordinal, "title");
171
-        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[10]);
171
+        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[11]);
172 172
     }
173 173
 
174 174
     public StringTypeAPI getTitleTypeAPI() {
... ...
@@ -176,9 +187,9 @@ public class AddressBookRecordTypeAPI extends HollowObjectTypeAPI {
176 176
     }
177 177
 
178 178
     public int getOfficeLocationOrdinal(int ordinal) {
179
-        if(fieldIndex[11] == -1)
179
+        if(fieldIndex[12] == -1)
180 180
             return missingDataHandler().handleReferencedOrdinal("AddressBookRecord", ordinal, "officeLocation");
181
-        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[11]);
181
+        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[12]);
182 182
     }
183 183
 
184 184
     public StringTypeAPI getOfficeLocationTypeAPI() {
... ...
@@ -186,9 +197,9 @@ public class AddressBookRecordTypeAPI extends HollowObjectTypeAPI {
186 186
     }
187 187
 
188 188
     public int getDepartmentNameOrdinal(int ordinal) {
189
-        if(fieldIndex[12] == -1)
189
+        if(fieldIndex[13] == -1)
190 190
             return missingDataHandler().handleReferencedOrdinal("AddressBookRecord", ordinal, "departmentName");
191
-        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[12]);
191
+        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[13]);
192 192
     }
193 193
 
194 194
     public StringTypeAPI getDepartmentNameTypeAPI() {
... ...
@@ -196,9 +207,9 @@ public class AddressBookRecordTypeAPI extends HollowObjectTypeAPI {
196 196
     }
197 197
 
198 198
     public int getCompanyNameOrdinal(int ordinal) {
199
-        if(fieldIndex[13] == -1)
199
+        if(fieldIndex[14] == -1)
200 200
             return missingDataHandler().handleReferencedOrdinal("AddressBookRecord", ordinal, "companyName");
201
-        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[13]);
201
+        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[14]);
202 202
     }
203 203
 
204 204
     public StringTypeAPI getCompanyNameTypeAPI() {
... ...
@@ -206,9 +217,9 @@ public class AddressBookRecordTypeAPI extends HollowObjectTypeAPI {
206 206
     }
207 207
 
208 208
     public int getAssistantOrdinal(int ordinal) {
209
-        if(fieldIndex[14] == -1)
209
+        if(fieldIndex[15] == -1)
210 210
             return missingDataHandler().handleReferencedOrdinal("AddressBookRecord", ordinal, "assistant");
211
-        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[14]);
211
+        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[15]);
212 212
     }
213 213
 
214 214
     public StringTypeAPI getAssistantTypeAPI() {
... ...
@@ -216,9 +227,9 @@ public class AddressBookRecordTypeAPI extends HollowObjectTypeAPI {
216 216
     }
217 217
 
218 218
     public int getAddressBookManagerDistinguishedNameOrdinal(int ordinal) {
219
-        if(fieldIndex[15] == -1)
219
+        if(fieldIndex[16] == -1)
220 220
             return missingDataHandler().handleReferencedOrdinal("AddressBookRecord", ordinal, "addressBookManagerDistinguishedName");
221
-        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[15]);
221
+        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[16]);
222 222
     }
223 223
 
224 224
     public StringTypeAPI getAddressBookManagerDistinguishedNameTypeAPI() {
... ...
@@ -226,9 +237,9 @@ public class AddressBookRecordTypeAPI extends HollowObjectTypeAPI {
226 226
     }
227 227
 
228 228
     public int getAddressBookPhoneticGivenNameOrdinal(int ordinal) {
229
-        if(fieldIndex[16] == -1)
229
+        if(fieldIndex[17] == -1)
230 230
             return missingDataHandler().handleReferencedOrdinal("AddressBookRecord", ordinal, "addressBookPhoneticGivenName");
231
-        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[16]);
231
+        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[17]);
232 232
     }
233 233
 
234 234
     public StringTypeAPI getAddressBookPhoneticGivenNameTypeAPI() {
... ...
@@ -236,9 +247,9 @@ public class AddressBookRecordTypeAPI extends HollowObjectTypeAPI {
236 236
     }
237 237
 
238 238
     public int getAddressBookPhoneticSurnameOrdinal(int ordinal) {
239
-        if(fieldIndex[17] == -1)
239
+        if(fieldIndex[18] == -1)
240 240
             return missingDataHandler().handleReferencedOrdinal("AddressBookRecord", ordinal, "addressBookPhoneticSurname");
241
-        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[17]);
241
+        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[18]);
242 242
     }
243 243
 
244 244
     public StringTypeAPI getAddressBookPhoneticSurnameTypeAPI() {
... ...
@@ -246,9 +257,9 @@ public class AddressBookRecordTypeAPI extends HollowObjectTypeAPI {
246 246
     }
247 247
 
248 248
     public int getAddressBookPhoneticCompanyNameOrdinal(int ordinal) {
249
-        if(fieldIndex[18] == -1)
249
+        if(fieldIndex[19] == -1)
250 250
             return missingDataHandler().handleReferencedOrdinal("AddressBookRecord", ordinal, "addressBookPhoneticCompanyName");
251
-        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[18]);
251
+        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[19]);
252 252
     }
253 253
 
254 254
     public StringTypeAPI getAddressBookPhoneticCompanyNameTypeAPI() {
... ...
@@ -256,9 +267,9 @@ public class AddressBookRecordTypeAPI extends HollowObjectTypeAPI {
256 256
     }
257 257
 
258 258
     public int getAddressBookPhoneticDepartmentNameOrdinal(int ordinal) {
259
-        if(fieldIndex[19] == -1)
259
+        if(fieldIndex[20] == -1)
260 260
             return missingDataHandler().handleReferencedOrdinal("AddressBookRecord", ordinal, "addressBookPhoneticDepartmentName");
261
-        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[19]);
261
+        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[20]);
262 262
     }
263 263
 
264 264
     public StringTypeAPI getAddressBookPhoneticDepartmentNameTypeAPI() {
... ...
@@ -266,9 +277,9 @@ public class AddressBookRecordTypeAPI extends HollowObjectTypeAPI {
266 266
     }
267 267
 
268 268
     public int getStreetAddressOrdinal(int ordinal) {
269
-        if(fieldIndex[20] == -1)
269
+        if(fieldIndex[21] == -1)
270 270
             return missingDataHandler().handleReferencedOrdinal("AddressBookRecord", ordinal, "streetAddress");
271
-        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[20]);
271
+        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[21]);
272 272
     }
273 273
 
274 274
     public StringTypeAPI getStreetAddressTypeAPI() {
... ...
@@ -276,9 +287,9 @@ public class AddressBookRecordTypeAPI extends HollowObjectTypeAPI {
276 276
     }
277 277
 
278 278
     public int getPostOfficeBoxOrdinal(int ordinal) {
279
-        if(fieldIndex[21] == -1)
279
+        if(fieldIndex[22] == -1)
280 280
             return missingDataHandler().handleReferencedOrdinal("AddressBookRecord", ordinal, "postOfficeBox");
281
-        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[21]);
281
+        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[22]);
282 282
     }
283 283
 
284 284
     public StringTypeAPI getPostOfficeBoxTypeAPI() {
... ...
@@ -286,9 +297,9 @@ public class AddressBookRecordTypeAPI extends HollowObjectTypeAPI {
286 286
     }
287 287
 
288 288
     public int getLocalityOrdinal(int ordinal) {
289
-        if(fieldIndex[22] == -1)
289
+        if(fieldIndex[23] == -1)
290 290
             return missingDataHandler().handleReferencedOrdinal("AddressBookRecord", ordinal, "locality");
291
-        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[22]);
291
+        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[23]);
292 292
     }
293 293
 
294 294
     public StringTypeAPI getLocalityTypeAPI() {
... ...
@@ -296,9 +307,9 @@ public class AddressBookRecordTypeAPI extends HollowObjectTypeAPI {
296 296
     }
297 297
 
298 298
     public int getStateOrProvinceOrdinal(int ordinal) {
299
-        if(fieldIndex[23] == -1)
299
+        if(fieldIndex[24] == -1)
300 300
             return missingDataHandler().handleReferencedOrdinal("AddressBookRecord", ordinal, "stateOrProvince");
301
-        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[23]);
301
+        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[24]);
302 302
     }
303 303
 
304 304
     public StringTypeAPI getStateOrProvinceTypeAPI() {
... ...
@@ -306,9 +317,9 @@ public class AddressBookRecordTypeAPI extends HollowObjectTypeAPI {
306 306
     }
307 307
 
308 308
     public int getPostalCodeOrdinal(int ordinal) {
309
-        if(fieldIndex[24] == -1)
309
+        if(fieldIndex[25] == -1)
310 310
             return missingDataHandler().handleReferencedOrdinal("AddressBookRecord", ordinal, "postalCode");
311
-        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[24]);
311
+        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[25]);
312 312
     }
313 313
 
314 314
     public StringTypeAPI getPostalCodeTypeAPI() {
... ...
@@ -316,9 +327,9 @@ public class AddressBookRecordTypeAPI extends HollowObjectTypeAPI {
316 316
     }
317 317
 
318 318
     public int getCountryOrdinal(int ordinal) {
319
-        if(fieldIndex[25] == -1)
319
+        if(fieldIndex[26] == -1)
320 320
             return missingDataHandler().handleReferencedOrdinal("AddressBookRecord", ordinal, "country");
321
-        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[25]);
321
+        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[26]);
322 322
     }
323 323
 
324 324
     public StringTypeAPI getCountryTypeAPI() {
... ...
@@ -326,9 +337,9 @@ public class AddressBookRecordTypeAPI extends HollowObjectTypeAPI {
326 326
     }
327 327
 
328 328
     public int getDataLocationOrdinal(int ordinal) {
329
-        if(fieldIndex[26] == -1)
329
+        if(fieldIndex[27] == -1)
330 330
             return missingDataHandler().handleReferencedOrdinal("AddressBookRecord", ordinal, "dataLocation");
331
-        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[26]);
331
+        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[27]);
332 332
     }
333 333
 
334 334
     public DataLocationTypeAPI getDataLocationTypeAPI() {
... ...
@@ -336,9 +347,9 @@ public class AddressBookRecordTypeAPI extends HollowObjectTypeAPI {
336 336
     }
337 337
 
338 338
     public int getAddressStreetOrdinal(int ordinal) {
339
-        if(fieldIndex[27] == -1)
339
+        if(fieldIndex[28] == -1)
340 340
             return missingDataHandler().handleReferencedOrdinal("AddressBookRecord", ordinal, "addressStreet");
341
-        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[27]);
341
+        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[28]);
342 342
     }
343 343
 
344 344
     public StringTypeAPI getAddressStreetTypeAPI() {
... ...
@@ -346,9 +357,9 @@ public class AddressBookRecordTypeAPI extends HollowObjectTypeAPI {
346 346
     }
347 347
 
348 348
     public int getBusinessTelephoneNumberOrdinal(int ordinal) {
349
-        if(fieldIndex[28] == -1)
349
+        if(fieldIndex[29] == -1)
350 350
             return missingDataHandler().handleReferencedOrdinal("AddressBookRecord", ordinal, "businessTelephoneNumber");
351
-        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[28]);
351
+        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[29]);
352 352
     }
353 353
 
354 354
     public StringTypeAPI getBusinessTelephoneNumberTypeAPI() {
... ...
@@ -356,9 +367,9 @@ public class AddressBookRecordTypeAPI extends HollowObjectTypeAPI {
356 356
     }
357 357
 
358 358
     public int getHomeTelephoneNumberOrdinal(int ordinal) {
359
-        if(fieldIndex[29] == -1)
359
+        if(fieldIndex[30] == -1)
360 360
             return missingDataHandler().handleReferencedOrdinal("AddressBookRecord", ordinal, "homeTelephoneNumber");
361
-        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[29]);
361
+        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[30]);
362 362
     }
363 363
 
364 364
     public StringTypeAPI getHomeTelephoneNumberTypeAPI() {
... ...
@@ -366,9 +377,9 @@ public class AddressBookRecordTypeAPI extends HollowObjectTypeAPI {
366 366
     }
367 367
 
368 368
     public int getBusiness2TelephoneNumbersOrdinal(int ordinal) {
369
-        if(fieldIndex[30] == -1)
369
+        if(fieldIndex[31] == -1)
370 370
             return missingDataHandler().handleReferencedOrdinal("AddressBookRecord", ordinal, "business2TelephoneNumbers");
371
-        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[30]);
371
+        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[31]);
372 372
     }
373 373
 
374 374
     public StringTypeAPI getBusiness2TelephoneNumbersTypeAPI() {
... ...
@@ -376,9 +387,9 @@ public class AddressBookRecordTypeAPI extends HollowObjectTypeAPI {
376 376
     }
377 377
 
378 378
     public int getHome2TelephoneNumberOrdinal(int ordinal) {
379
-        if(fieldIndex[31] == -1)
379
+        if(fieldIndex[32] == -1)
380 380
             return missingDataHandler().handleReferencedOrdinal("AddressBookRecord", ordinal, "home2TelephoneNumber");
381
-        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[31]);
381
+        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[32]);
382 382
     }
383 383
 
384 384
     public StringTypeAPI getHome2TelephoneNumberTypeAPI() {
... ...
@@ -386,9 +397,9 @@ public class AddressBookRecordTypeAPI extends HollowObjectTypeAPI {
386 386
     }
387 387
 
388 388
     public int getMobileTelephoneNumberOrdinal(int ordinal) {
389
-        if(fieldIndex[32] == -1)
389
+        if(fieldIndex[33] == -1)
390 390
             return missingDataHandler().handleReferencedOrdinal("AddressBookRecord", ordinal, "mobileTelephoneNumber");
391
-        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[32]);
391
+        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[33]);
392 392
     }
393 393
 
394 394
     public StringTypeAPI getMobileTelephoneNumberTypeAPI() {
... ...
@@ -396,9 +407,9 @@ public class AddressBookRecordTypeAPI extends HollowObjectTypeAPI {
396 396
     }
397 397
 
398 398
     public int getPagerTelephoneNumberOrdinal(int ordinal) {
399
-        if(fieldIndex[33] == -1)
399
+        if(fieldIndex[34] == -1)
400 400
             return missingDataHandler().handleReferencedOrdinal("AddressBookRecord", ordinal, "pagerTelephoneNumber");
401
-        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[33]);
401
+        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[34]);
402 402
     }
403 403
 
404 404
     public StringTypeAPI getPagerTelephoneNumberTypeAPI() {
... ...
@@ -406,9 +417,9 @@ public class AddressBookRecordTypeAPI extends HollowObjectTypeAPI {
406 406
     }
407 407
 
408 408
     public int getPrimaryFaxNumberOrdinal(int ordinal) {
409
-        if(fieldIndex[34] == -1)
409
+        if(fieldIndex[35] == -1)
410 410
             return missingDataHandler().handleReferencedOrdinal("AddressBookRecord", ordinal, "primaryFaxNumber");
411
-        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[34]);
411
+        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[35]);
412 412
     }
413 413
 
414 414
     public StringTypeAPI getPrimaryFaxNumberTypeAPI() {
... ...
@@ -416,9 +427,9 @@ public class AddressBookRecordTypeAPI extends HollowObjectTypeAPI {
416 416
     }
417 417
 
418 418
     public int getAssistantTelephoneNumberOrdinal(int ordinal) {
419
-        if(fieldIndex[35] == -1)
419
+        if(fieldIndex[36] == -1)
420 420
             return missingDataHandler().handleReferencedOrdinal("AddressBookRecord", ordinal, "assistantTelephoneNumber");
421
-        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[35]);
421
+        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[36]);
422 422
     }
423 423
 
424 424
     public StringTypeAPI getAssistantTelephoneNumberTypeAPI() {
... ...
@@ -426,9 +437,9 @@ public class AddressBookRecordTypeAPI extends HollowObjectTypeAPI {
426 426
     }
427 427
 
428 428
     public int getUserCertificateOrdinal(int ordinal) {
429
-        if(fieldIndex[36] == -1)
429
+        if(fieldIndex[37] == -1)
430 430
             return missingDataHandler().handleReferencedOrdinal("AddressBookRecord", ordinal, "userCertificate");
431
-        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[36]);
431
+        return getTypeDataAccess().readOrdinal(ordinal, fieldIndex[37]);
432 432
     }
433 433
 
434 434
     public StringTypeAPI getUserCertificateTypeAPI() {
... ...
@@ -436,28 +447,28 @@ public class AddressBookRecordTypeAPI extends HollowObjectTypeAPI {
436 436
     }
437 437
 
438 438
     public byte[] getAddressBookX509Certificate(int ordinal) {
439
-        if(fieldIndex[37] == -1)
439
+        if(fieldIndex[38] == -1)
440 440
             return missingDataHandler().handleBytes("AddressBookRecord", ordinal, "addressBookX509Certificate");
441
-        boxedFieldAccessSampler.recordFieldAccess(fieldIndex[37]);
442
-        return getTypeDataAccess().readBytes(ordinal, fieldIndex[37]);
441
+        boxedFieldAccessSampler.recordFieldAccess(fieldIndex[38]);
442
+        return getTypeDataAccess().readBytes(ordinal, fieldIndex[38]);
443 443
     }
444 444
 
445 445
 
446 446
 
447 447
     public byte[] getUserX509Certificate(int ordinal) {
448
-        if(fieldIndex[38] == -1)
448
+        if(fieldIndex[39] == -1)
449 449
             return missingDataHandler().handleBytes("AddressBookRecord", ordinal, "userX509Certificate");
450
-        boxedFieldAccessSampler.recordFieldAccess(fieldIndex[38]);
451
-        return getTypeDataAccess().readBytes(ordinal, fieldIndex[38]);
450
+        boxedFieldAccessSampler.recordFieldAccess(fieldIndex[39]);
451
+        return getTypeDataAccess().readBytes(ordinal, fieldIndex[39]);
452 452
     }
453 453
 
454 454
 
455 455
 
456 456
     public byte[] getThumbnail(int ordinal) {
457
-        if(fieldIndex[39] == -1)
457
+        if(fieldIndex[40] == -1)
458 458
             return missingDataHandler().handleBytes("AddressBookRecord", ordinal, "thumbnail");
459
-        boxedFieldAccessSampler.recordFieldAccess(fieldIndex[39]);
460
-        return getTypeDataAccess().readBytes(ordinal, fieldIndex[39]);
459
+        boxedFieldAccessSampler.recordFieldAccess(fieldIndex[40]);
460
+        return getTypeDataAccess().readBytes(ordinal, fieldIndex[40]);
461 461
     }
462 462
 
463 463
 
... ...
@@ -25,7 +25,8 @@ Require-Bundle: org.eclipse.core.runtime,
25 25
  net.bluemind.mailshare.api,
26 26
  net.bluemind.server.api,
27 27
  net.bluemind.hornetq.client,
28
- net.bluemind.core.serialization
28
+ net.bluemind.core.serialization,
29
+ net.bluemind.config
29 30
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
30 31
 Automatic-Module-Name: net.bluemind.directory.hollow.datamodel.producer
31 32
 Bundle-ActivationPolicy: lazy
... ...
@@ -21,7 +21,6 @@ package net.bluemind.directory.hollow.datamodel.producer;
21 21
 import java.util.Arrays;
22 22
 import java.util.Collections;
23 23
 import java.util.List;
24
-import java.util.stream.Collectors;
25 24
 
26 25
 import net.bluemind.core.container.model.ItemValue;
27 26
 import net.bluemind.core.context.SecurityContext;
... ...
@@ -46,7 +45,7 @@ import net.bluemind.user.api.User;
46 46
 public abstract class DirEntrySerializer {
47 47
 
48 48
 	public static enum Property {
49
-		Emails, EmailAddressAscii, SmtpAddress, DisplayName, Account, Surname, GivenName, AddressBookProxyAddresses, OfficeLocation, DisplayType, ObjectType, SendRichInfo, BusinessTelephoneNumber, StreetAddress, Locality, StateOrProvince, PostalCode, Country, Title, CompanyName, Assistant, DepartmentName, AddressBookTargetAddress, HomeTelephoneNumber, Business2TelephoneNumbers, PrimaryFaxNumber, MobileTelephoneNumber, AssistantTelephoneNumber, PagerTelephoneNumber, Comment, UserCertificate, UserX509Certificate, AddressBookX509Certificate, AddressBookHomeMessageDatabaseAscii, AddressBookDisplayNamePrintableAscii, ThumbnailPhoto, postOfficeBox, AddressBookManagerDistinguishedName, Kind, DataLocation
49
+		Email, SmtpAddress, DisplayName, Account, Surname, GivenName, AddressBookProxyAddresses, OfficeLocation, DisplayType, ObjectType, SendRichInfo, BusinessTelephoneNumber, StreetAddress, Locality, StateOrProvince, PostalCode, Country, Title, CompanyName, Assistant, DepartmentName, AddressBookTargetAddress, HomeTelephoneNumber, Business2TelephoneNumbers, PrimaryFaxNumber, MobileTelephoneNumber, AssistantTelephoneNumber, PagerTelephoneNumber, Comment, UserCertificate, UserX509Certificate, AddressBookX509Certificate, AddressBookHomeMessageDatabaseAscii, AddressBookDisplayNamePrintableAscii, ThumbnailPhoto, postOfficeBox, AddressBookManagerDistinguishedName, Kind, DataLocation
50 50
 	}
51 51
 
52 52
 	protected ItemValue<DirEntry> dirEntry;
... ...
@@ -80,16 +79,12 @@ public abstract class DirEntrySerializer {
80 80
 
81 81
 	public Value get(Property property) {
82 82
 		switch (property) {
83
-		case AddressBookProxyAddresses:
84
-			return getAddressBookProxyAddresses();
85
-		case EmailAddressAscii:
83
+		case Email:
86 84
 			return getEmailAddress();
87 85
 		case AddressBookManagerDistinguishedName:
88 86
 			return new StringValue("/");
89 87
 		case ThumbnailPhoto:
90 88
 			return getPhoto();
91
-		case Emails:
92
-			return new ListValue(toEmails(dirEntry.value.emails));
93 89
 		case Kind:
94 90
 			return new StringValue(dirEntry.value.kind.name());
95 91
 		case DataLocation:
... ...
@@ -108,15 +103,6 @@ public abstract class DirEntrySerializer {
108 108
 		return Collections.emptyList();
109 109
 	}
110 110
 
111
-	private List<net.bluemind.directory.hollow.datamodel.Email> toEmails(List<net.bluemind.core.api.Email> emails) {
112
-		if (null == emails) {
113
-			return Collections.emptyList();
114
-		}
115
-		return emails.stream()
116
-				.map(e -> net.bluemind.directory.hollow.datamodel.Email.create(e.address, e.isDefault, e.allAliases))
117
-				.collect(Collectors.toList());
118
-	}
119
-
120 111
 	private Value getPhoto() {
121 112
 		try {
122 113
 			IDirectory directory = ServerSideServiceProvider.getProvider(SecurityContext.SYSTEM)
... ...
@@ -134,8 +120,4 @@ public abstract class DirEntrySerializer {
134 134
 		return new StringValue(dirEntry.value.email);
135 135
 	}
136 136
 
137
-	private Value getAddressBookProxyAddresses() {
138
-		return Value.NULL;
139
-	}
140
-
141 137
 }
... ...
@@ -26,6 +26,8 @@ import java.nio.file.Path;
26 26
 import java.nio.file.Paths;
27 27
 import java.nio.file.SimpleFileVisitor;
28 28
 import java.nio.file.attribute.BasicFileAttributes;
29
+import java.util.Collection;
30
+import java.util.Collections;
29 31
 import java.util.HashMap;
30 32
 import java.util.List;
31 33
 import java.util.Map;
... ...
@@ -48,6 +50,8 @@ import com.netflix.hollow.api.producer.fs.HollowFilesystemAnnouncer;
48 48
 import com.netflix.hollow.api.producer.fs.HollowFilesystemBlobStorageCleaner;
49 49
 import com.netflix.hollow.api.producer.fs.HollowFilesystemPublisher;
50 50
 
51
+import net.bluemind.config.InstallationId;
52
+import net.bluemind.core.api.Email;
51 53
 import net.bluemind.core.container.model.ItemValue;
52 54
 import net.bluemind.core.context.SecurityContext;
53 55
 import net.bluemind.core.rest.ServerSideServiceProvider;
... ...
@@ -58,7 +62,6 @@ import net.bluemind.directory.api.DirEntry;
58 58
 import net.bluemind.directory.api.IDirectory;
59 59
 import net.bluemind.directory.hollow.datamodel.AddressBookRecord;
60 60
 import net.bluemind.directory.hollow.datamodel.DataLocation;
61
-import net.bluemind.directory.hollow.datamodel.Email;
62 61
 import net.bluemind.directory.hollow.datamodel.OfflineAddressBook;
63 62
 import net.bluemind.domain.api.Domain;
64 63
 import net.bluemind.domain.api.IDomains;
... ...
@@ -140,6 +143,8 @@ public class DirectorySerializer implements DataSerializer {
140 140
 		IDirectory dirApi = prov.instance(IDirectory.class, domainUid);
141 141
 		IMailboxes mboxApi = prov.instance(IMailboxes.class, domainUid);
142 142
 
143
+		String installationId = InstallationId.getIdentifier();
144
+
143 145
 		List<String> allUids = dirApi.changeset(0L).created;
144 146
 
145 147
 		Map<String, DataLocation> locationCache = new HashMap<>();
... ...
@@ -154,7 +159,7 @@ public class DirectorySerializer implements DataSerializer {
154 154
 			for (ItemValue<DirEntry> entry : entries) {
155 155
 				AddressBookRecord rec = dirEntryToAddressBookRecord(domainUid, entry,
156 156
 						mailboxes.stream().filter(m -> m.uid.equals(entry.value.entryUid)).findAny().orElse(null),
157
-						locationCache);
157
+						locationCache, installationId);
158 158
 				rec.addressBook = oabs.computeIfAbsent(domainUid, d -> createOabEntry(domApi.get(domainUid)));
159 159
 				state.add(rec);
160 160
 			}
... ...
@@ -168,12 +173,12 @@ public class DirectorySerializer implements DataSerializer {
168 168
 
169 169
 	@SuppressWarnings("unchecked")
170 170
 	private AddressBookRecord dirEntryToAddressBookRecord(String domainUid, ItemValue<DirEntry> entry,
171
-			ItemValue<Mailbox> box, Map<String, DataLocation> datalocationCache) {
171
+			ItemValue<Mailbox> box, Map<String, DataLocation> datalocationCache, String installationId) {
172 172
 		AddressBookRecord rec = new AddressBookRecord();
173 173
 
174 174
 		DirEntrySerializer serializer = DirEntrySerializer.get(domainUid, entry);
175 175
 		rec.uid = entry.uid;
176
-		rec.normalizedUid = rec.uid.toLowerCase();
176
+		rec.distinguishedName = entryDN(entry.value.kind, rec.uid, domainUid, installationId);
177 177
 		rec.minimalid = entry.internalId;
178 178
 		rec.domain = domainUid;
179 179
 		String server = entry.value.dataLocation;
... ...
@@ -187,8 +192,9 @@ public class DirectorySerializer implements DataSerializer {
187 187
 				return location;
188 188
 			});
189 189
 		}
190
+		rec.emails = toEmails(box.value.emails);
190 191
 		rec.name = serializer.get(DirEntrySerializer.Property.DisplayName).toString();
191
-		rec.emails = (List<Email>) serializer.get(DirEntrySerializer.Property.Emails).toList();
192
+		rec.email = serializer.get(DirEntrySerializer.Property.Email).toString();
192 193
 		rec.kind = serializer.get(DirEntrySerializer.Property.Kind).toString();
193 194
 		rec.surname = serializer.get(DirEntrySerializer.Property.Surname).toString();
194 195
 		rec.givenName = serializer.get(DirEntrySerializer.Property.GivenName).toString();
... ...
@@ -227,6 +233,15 @@ public class DirectorySerializer implements DataSerializer {
227 227
 		return rec;
228 228
 	}
229 229
 
230
+	private List<net.bluemind.directory.hollow.datamodel.Email> toEmails(Collection<Email> emails) {
231
+		if (null == emails) {
232
+			return Collections.emptyList();
233
+		}
234
+		return emails.stream()
235
+				.map(e -> net.bluemind.directory.hollow.datamodel.Email.create(e.address, e.isDefault, e.allAliases))
236
+				.collect(Collectors.toList());
237
+	}
238
+
230 239
 	private OfflineAddressBook createOabEntry(ItemValue<Domain> domain) {
231 240
 		OfflineAddressBook oab = new OfflineAddressBook();
232 241
 		oab.containerGuid = UUID.nameUUIDFromBytes((domain.internalId + ":" + domain.uid).getBytes()).toString();
... ...
@@ -284,4 +299,14 @@ public class DirectorySerializer implements DataSerializer {
284 284
 		return announcementWatcher.getLatestVersion();
285 285
 	}
286 286
 
287
+	public static String entryDN(DirEntry.Kind kind, String entryUid, String domainUid, String installationId) {
288
+		return String.format("%s/ou=%s/cn=Recipients/cn=%s:%s", getOrgDn(installationId), domainUid, kind.toString(),
289
+				entryUid).toLowerCase();
290
+	}
291
+
292
+	public static String getOrgDn(String installationId) {
293
+		// return "/o="+installationId;
294
+		return "/o=Mapi";
295
+	}
296
+
287 297
 }
... ...
@@ -31,9 +31,9 @@ public class AddressBookRecord {
31 31
 	 */
32 32
 	public String uid;
33 33
 	/**
34
-	 * normalizedUid (mapi - uid lowercase)
34
+	 * PidTagEmailAddress (X500 DN)
35 35
 	 */
36
-	public String normalizedUid;
36
+	public String distinguishedName;
37 37
 	/**
38 38
 	 * domain
39 39
 	 */
... ...
@@ -47,6 +47,10 @@ public class AddressBookRecord {
47 47
 	 */
48 48
 	public List<Email> emails;
49 49
 	/**
50
+	 * email
51
+	 */
52
+	public String email;
53
+	/**
50 54
 	 * internal-id
51 55
 	 */
52 56
 	public long minimalid;
... ...
@@ -16,6 +16,7 @@
16 16
  * See LICENSE.txt
17 17
  * END LICENSE
18 18
  */
19
+
19 20
 package net.bluemind.directory.hollow.datamodel;
20 21
 
21 22
 public class Email {
... ...
@@ -25,11 +26,11 @@ public class Email {
25 25
 	public boolean isDefault;
26 26
 
27 27
 	public static Email create(String address, boolean isDefault, boolean allAliases) {
28
-		Email e = new Email();
29
-		e.address = address;
30
-		e.isDefault = isDefault;
31
-		e.allAliases = allAliases;
32
-		return e;
28
+		Email email = new Email();
29
+		email.address = address;
30
+		email.isDefault = isDefault;
31
+		email.allAliases = allAliases;
32
+		return email;
33 33
 	}
34 34
 
35
-}
35
+}
36 36
\ No newline at end of file