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