]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
8667b5b53731602fbf41efaba19e67a619e1532e
[tmp/jakarta-migration.git] /
1 /**\r
2  * This document is a part of the source code and related artifacts\r
3  * for CollectionSpace, an open source collections management system\r
4  * for museums and related institutions:\r
5  *\r
6  * http://www.collectionspace.org\r
7  * http://wiki.collectionspace.org\r
8  *\r
9  * Copyright (c)) 2009 Regents of the University of California\r
10  *\r
11  * Licensed under the Educational Community License (ECL), Version 2.0.\r
12  * You may not use this file except in compliance with this License.\r
13  *\r
14  * You may obtain a copy of the ECL 2.0 License at\r
15  * https://source.collectionspace.org/collection-space/LICENSE.txt\r
16  *\r
17  * Unless required by applicable law or agreed to in writing, software\r
18  * distributed under the License is distributed on an "AS IS" BASIS,\r
19  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
20  * See the License for the specific language governing permissions and\r
21  * limitations under the License.\r
22  */\r
23 \r
24 package org.collectionspace.services.organization.client.sample;\r
25 \r
26 import java.util.ArrayList;\r
27 import java.util.Arrays;\r
28 import java.util.HashMap;\r
29 import java.util.List;\r
30 import java.util.Map;\r
31 \r
32 import javax.ws.rs.core.MediaType;\r
33 import javax.ws.rs.core.MultivaluedMap;\r
34 import javax.ws.rs.core.Response;\r
35 \r
36 import org.apache.log4j.BasicConfigurator;\r
37 import org.collectionspace.services.OrganizationJAXBSchema;\r
38 import org.collectionspace.services.client.OrgAuthorityClient;\r
39 import org.collectionspace.services.client.OrgAuthorityClientUtils;\r
40 import org.collectionspace.services.client.PayloadInputPart;\r
41 import org.collectionspace.services.client.PoxPayloadIn;\r
42 import org.collectionspace.services.client.PoxPayloadOut;\r
43 import org.collectionspace.services.client.test.ServiceRequestType;\r
44 import org.collectionspace.services.organization.OrgauthoritiesCommon;\r
45 import org.collectionspace.services.organization.OrgauthoritiesCommonList;\r
46 import org.collectionspace.services.organization.OrganizationsCommon;\r
47 import org.collectionspace.services.organization.OrganizationsCommonList;\r
48 import org.jboss.resteasy.client.ClientResponse;\r
49 import org.jboss.resteasy.plugins.providers.multipart.InputPart;\r
50 import org.jboss.resteasy.plugins.providers.multipart.OutputPart;\r
51 import org.slf4j.Logger;\r
52 import org.slf4j.LoggerFactory;\r
53 \r
54 /**\r
55  * OrgAuthority Sample, carries out tests against a\r
56  * deployed and running OrgAuthority Service.\r
57  *\r
58  * $LastChangedRevision: 1055 $\r
59  * $LastChangedDate: 2009-12-09 12:25:15 -0800 (Wed, 09 Dec 2009) $\r
60  */\r
61 public class Sample {\r
62     private static final Logger logger =\r
63         LoggerFactory.getLogger(Sample.class);\r
64 \r
65     // Instance variables specific to this test.\r
66     private OrgAuthorityClient client = new OrgAuthorityClient();\r
67     final String SERVICE_PATH_COMPONENT = "organizations";\r
68     final String ITEM_SERVICE_PATH_COMPONENT = "items";\r
69 \r
70 \r
71     // ---------------------------------------------------------------\r
72     // Create\r
73     // ---------------------------------------------------------------\r
74     protected String createOrgAuthRefName(String orgAuthorityName) {\r
75         return "urn:cspace:org.collectionspace.demo:orgauthority:name("\r
76                         +orgAuthorityName+")";\r
77     }\r
78 \r
79     protected String createOrganizationRefName(\r
80                                                 String orgAuthRefName, String orgName) {\r
81         return orgAuthRefName+":organization:name("+orgName+")";\r
82     }\r
83 \r
84     \r
85 \r
86     public void createOrgAuthority(String orgAuthName, List<Map<String,String>> orgInfos ) {\r
87 \r
88         // Expected status code: 201 Created\r
89         int EXPECTED_STATUS_CODE = Response.Status.CREATED.getStatusCode();\r
90         // Type of service request being tested\r
91         ServiceRequestType REQUEST_TYPE = ServiceRequestType.CREATE;\r
92 \r
93         logger.info("Import: Create orgAuthority: \"" + orgAuthName +"\"");\r
94         String baseOrgAuthRefName = createOrgAuthRefName(orgAuthName);\r
95         String fullOrgAuthRefName = baseOrgAuthRefName+"'"+orgAuthName+"'";\r
96         PoxPayloadOut multipart = \r
97                 OrgAuthorityClientUtils.createOrgAuthorityInstance(\r
98                                 orgAuthName, fullOrgAuthRefName, \r
99                                 client.getCommonPartName());\r
100         ClientResponse<Response> res = client.create(multipart);\r
101 \r
102         int statusCode = res.getStatus();\r
103 \r
104         if(!REQUEST_TYPE.isValidStatusCode(statusCode)) {\r
105                 throw new RuntimeException("Could not create enumeration: \""+orgAuthName\r
106                                 +"\" "+ OrgAuthorityClientUtils.invalidStatusCodeMessage(REQUEST_TYPE, statusCode));\r
107         }\r
108         if(statusCode != EXPECTED_STATUS_CODE) {\r
109                 throw new RuntimeException("Unexpected Status when creating enumeration: \""\r
110                                 +orgAuthName +"\", Status:"+ statusCode);\r
111         }\r
112 \r
113         // Store the ID returned from this create operation\r
114         // for additional tests below.\r
115         String newOrgAuthId = OrgAuthorityClientUtils.extractId(res);\r
116         logger.info("Import: Created orgAuthority: \"" + orgAuthName +"\" ID:"\r
117                                 +newOrgAuthId );\r
118         \r
119         // Add items to the orgAuthority\r
120         for(Map<String,String> orgInfo : orgInfos){\r
121                 createItemInOrgAuth(newOrgAuthId, baseOrgAuthRefName, orgInfo);\r
122         }\r
123         \r
124     }\r
125     \r
126     private String createItemInOrgAuth(String vcsid, \r
127                 String orgAuthorityRefName, Map<String,String> orgInfo) {\r
128         // Expected status code: 201 Created\r
129         int EXPECTED_STATUS_CODE = Response.Status.CREATED.getStatusCode();\r
130         // Type of service request being tested\r
131         ServiceRequestType REQUEST_TYPE = ServiceRequestType.CREATE;\r
132         String shortName = orgInfo.get(OrganizationJAXBSchema.SHORT_NAME);\r
133         String refName = createOrganizationRefName(\r
134                                                 orgAuthorityRefName, shortName)+"'"+shortName+"'";\r
135 \r
136 \r
137         logger.info("Import: Create Item: \""+shortName+\r
138                         "\" in orgAuthority: \"" + orgAuthorityRefName +"\"");\r
139         PoxPayloadOut multipart = \r
140                 OrgAuthorityClientUtils.createOrganizationInstance(refName, orgInfo, client.getItemCommonPartName() );\r
141 \r
142         ClientResponse<Response> res = client.createItem(vcsid, multipart);\r
143 \r
144         int statusCode = res.getStatus();\r
145 \r
146         if(!REQUEST_TYPE.isValidStatusCode(statusCode)) {\r
147                 throw new RuntimeException("Could not create Item: \""+shortName\r
148                                 +"\" in orgAuthority: \"" + orgAuthorityRefName\r
149                                 +"\" "+ OrgAuthorityClientUtils.invalidStatusCodeMessage(REQUEST_TYPE, statusCode));\r
150         }\r
151         if(statusCode != EXPECTED_STATUS_CODE) {\r
152                 throw new RuntimeException("Unexpected Status when creating Item: \""+shortName\r
153                                 +"\" in orgAuthority: \"" + orgAuthorityRefName +\r
154                                 "\", Status:"+ statusCode);\r
155         }\r
156 \r
157         return OrgAuthorityClientUtils.extractId(res);\r
158     }\r
159 \r
160 \r
161    // ---------------------------------------------------------------\r
162    // Read\r
163    // ---------------------------------------------------------------\r
164 \r
165    private OrgauthoritiesCommonList readOrgAuthorities() {\r
166 \r
167         // Expected status code: 200 OK\r
168         int EXPECTED_STATUS_CODE = Response.Status.OK.getStatusCode();\r
169         // Type of service request being tested\r
170         ServiceRequestType REQUEST_TYPE = ServiceRequestType.READ;\r
171 \r
172         // Submit the request to the service and store the response.\r
173         ClientResponse<OrgauthoritiesCommonList> res = client.readList();\r
174         OrgauthoritiesCommonList list = res.getEntity();\r
175 \r
176         int statusCode = res.getStatus();\r
177         if(!REQUEST_TYPE.isValidStatusCode(statusCode)) {\r
178                 throw new RuntimeException("Could not read list of orgAuthorities: "\r
179                 + OrgAuthorityClientUtils.invalidStatusCodeMessage(REQUEST_TYPE, statusCode));\r
180         }\r
181         if(statusCode != EXPECTED_STATUS_CODE) {\r
182                 throw new RuntimeException("Unexpected Status when reading " +\r
183                 "list of orgAuthorities, Status:"+ statusCode);\r
184         }\r
185 \r
186         return list;\r
187    }\r
188 \r
189     private List<String> readOrgAuthorityIds(OrgauthoritiesCommonList list) {\r
190 \r
191         List<String> ids = new ArrayList<String>();\r
192         List<OrgauthoritiesCommonList.OrgauthorityListItem> orgAuthorities =\r
193             list.getOrgauthorityListItem();\r
194         for (OrgauthoritiesCommonList.OrgauthorityListItem orgAuthority : orgAuthorities) {\r
195             ids.add(orgAuthority.getCsid());\r
196         }\r
197         return ids;\r
198    }\r
199     \r
200    private OrgauthoritiesCommon readOrgAuthority(String orgAuthId) {\r
201 \r
202         // Expected status code: 200 OK\r
203         int EXPECTED_STATUS_CODE = Response.Status.OK.getStatusCode();\r
204         // Type of service request being tested\r
205         ServiceRequestType REQUEST_TYPE = ServiceRequestType.READ;\r
206 \r
207         // Submit the request to the service and store the response.\r
208         OrgauthoritiesCommon orgAuthority = null;\r
209         try {\r
210             ClientResponse<String> res = client.read(orgAuthId);\r
211             int statusCode = res.getStatus();\r
212             if(!REQUEST_TYPE.isValidStatusCode(statusCode)) {\r
213                 throw new RuntimeException("Could not read orgAuthority"\r
214                     + OrgAuthorityClientUtils.invalidStatusCodeMessage(REQUEST_TYPE, statusCode));\r
215             }\r
216             if(statusCode != EXPECTED_STATUS_CODE) {\r
217                 throw new RuntimeException("Unexpected Status when reading " +\r
218                     "orgAuthority, Status:"+ statusCode);\r
219             }\r
220             PoxPayloadIn input = new PoxPayloadIn(res.getEntity());\r
221             PayloadInputPart orgAuthorityPart = input.getPart(client.getCommonPartName());\r
222             orgAuthority = (OrgauthoritiesCommon) orgAuthorityPart.getBody();\r
223         } catch (Exception e) {\r
224             throw new RuntimeException("Could not read orgAuthority: ", e);\r
225         }\r
226 \r
227         return orgAuthority;\r
228     }\r
229 \r
230     private OrganizationsCommonList readItemsInOrgAuth(String orgAuthId) {\r
231 \r
232         // Expected status code: 200 OK\r
233         int EXPECTED_STATUS_CODE = Response.Status.OK.getStatusCode();\r
234         // Type of service request being tested\r
235         ServiceRequestType REQUEST_TYPE = ServiceRequestType.READ;\r
236 \r
237         // Submit the request to the service and store the response.\r
238 \r
239         //was: ClientResponse<OrganizationsCommonList> res = client.readItemList(orgAuthId);\r
240         //new API: readItemList(String inAuthority, String partialTerm, String keywords)\r
241         ClientResponse<OrganizationsCommonList> res = client.readItemList(orgAuthId, "", "");//TODO:   .New call, most certainly wrong.  Just trying to get this to compile. Laramie20100728\r
242 \r
243         OrganizationsCommonList list = res.getEntity();\r
244 \r
245         int statusCode = res.getStatus();\r
246 \r
247         if(!REQUEST_TYPE.isValidStatusCode(statusCode)) {\r
248                 throw new RuntimeException("Could not read items in orgAuthority: "\r
249                 + OrgAuthorityClientUtils.invalidStatusCodeMessage(REQUEST_TYPE, statusCode));\r
250         }\r
251         if(statusCode != EXPECTED_STATUS_CODE) {\r
252                 throw new RuntimeException("Unexpected Status when reading " +\r
253                 "items in orgAuthority, Status:"+ statusCode);\r
254         }\r
255 \r
256         return list;\r
257     }\r
258 \r
259     private List<String> readOrganizationIds(OrganizationsCommonList list) {\r
260 \r
261         List<String> ids = new ArrayList<String>();\r
262         List<OrganizationsCommonList.OrganizationListItem> items =\r
263             list.getOrganizationListItem();\r
264         for (OrganizationsCommonList.OrganizationListItem item : items) {\r
265             ids.add(item.getCsid());\r
266         }\r
267         return ids;\r
268    }\r
269 \r
270     // ---------------------------------------------------------------\r
271     // Delete\r
272     // ---------------------------------------------------------------\r
273 \r
274     private void deleteOrgAuthority(String vcsid) {\r
275          // Expected status code: 200 OK\r
276         int EXPECTED_STATUS_CODE = Response.Status.OK.getStatusCode();\r
277         // Type of service request being tested\r
278         ServiceRequestType REQUEST_TYPE = ServiceRequestType.DELETE;\r
279 \r
280         ClientResponse<Response> res = client.delete(vcsid);\r
281         int statusCode = res.getStatus();\r
282 \r
283         if(!REQUEST_TYPE.isValidStatusCode(statusCode)) {\r
284                 throw new RuntimeException("Could not delete orgAuthority: "\r
285                 + OrgAuthorityClientUtils.invalidStatusCodeMessage(REQUEST_TYPE, statusCode));\r
286         }\r
287         if(statusCode != EXPECTED_STATUS_CODE) {\r
288                 throw new RuntimeException("Unexpected Status when deleting " +\r
289                 "orgAuthority, Status:"+ statusCode);\r
290         }\r
291     }\r
292 \r
293     private void deleteAllOrgAuthorities() {\r
294         List<String> ids = readOrgAuthorityIds(readOrgAuthorities());\r
295         for (String id : ids) {\r
296             deleteOrgAuthority(id);\r
297         }\r
298     }\r
299 \r
300         private void deleteOrganization(String vcsid, String itemcsid) {\r
301          // Expected status code: 200 OK\r
302         int EXPECTED_STATUS_CODE = Response.Status.OK.getStatusCode();\r
303         // Type of service request being tested\r
304         ServiceRequestType REQUEST_TYPE = ServiceRequestType.DELETE;\r
305 \r
306         ClientResponse<Response> res = client.deleteItem(vcsid, itemcsid);\r
307         int statusCode = res.getStatus();\r
308 \r
309         if(!REQUEST_TYPE.isValidStatusCode(statusCode)) {\r
310                 throw new RuntimeException("Could not delete orgAuthority item: "\r
311                 + OrgAuthorityClientUtils.invalidStatusCodeMessage(REQUEST_TYPE, statusCode));\r
312         }\r
313         if(statusCode != EXPECTED_STATUS_CODE) {\r
314                 throw new RuntimeException("Unexpected Status when deleting " +\r
315                 "orgAuthority item, Status:"+ statusCode);\r
316         }\r
317     }\r
318 \r
319     private void deleteAllItemsForOrgAuth(String orgAuthId) {\r
320         List<String> itemIds = readOrganizationIds(readItemsInOrgAuth(orgAuthId));\r
321         for (String itemId : itemIds) {\r
322             deleteOrganization(orgAuthId, itemId);\r
323         }\r
324     }\r
325 \r
326     // ---------------------------------------------------------------\r
327     // Utility methods used by tests above\r
328     // ---------------------------------------------------------------\r
329 \r
330 \r
331     // Retrieve individual fields of orgAuthority records.\r
332 \r
333     private String displayAllOrgAuthorities(OrgauthoritiesCommonList list) {\r
334         StringBuffer sb = new StringBuffer();\r
335             List<OrgauthoritiesCommonList.OrgauthorityListItem> orgAuthorities =\r
336                     list.getOrgauthorityListItem();\r
337             int i = 0;\r
338         for (OrgauthoritiesCommonList.OrgauthorityListItem orgAuthority : orgAuthorities) {\r
339             sb.append("orgAuthority [" + i + "]" + "\n");\r
340             sb.append(displayOrgAuthorityDetails(orgAuthority));\r
341             i++;\r
342         }\r
343         return sb.toString();\r
344     }\r
345 \r
346     private String displayOrgAuthorityDetails(\r
347         OrgauthoritiesCommonList.OrgauthorityListItem orgAuthority) {\r
348             StringBuffer sb = new StringBuffer();\r
349             sb.append("displayName=" + orgAuthority.getDisplayName() + "\n");\r
350             sb.append("vocabType=" + orgAuthority.getVocabType() + "\n");\r
351             // sb.append("csid=" + orgAuthority.getCsid() + "\n");\r
352             sb.append("URI=" + orgAuthority.getUri() + "\n");\r
353         return sb.toString();\r
354     }\r
355 \r
356     // Retrieve individual fields of organization records.\r
357 \r
358     private String displayAllOrganizations(OrganizationsCommonList list) {\r
359         StringBuffer sb = new StringBuffer();\r
360         List<OrganizationsCommonList.OrganizationListItem> items =\r
361                 list.getOrganizationListItem();\r
362         int i = 0;\r
363         for (OrganizationsCommonList.OrganizationListItem item : items) {\r
364             sb.append("organization [" + i + "]" + "\n");\r
365             sb.append(displayOrganizationDetails(item));\r
366             i++;\r
367         }\r
368         return sb.toString();\r
369     }\r
370 \r
371     private String displayOrganizationDetails(\r
372         OrganizationsCommonList.OrganizationListItem item) {\r
373             StringBuffer sb = new StringBuffer();\r
374             sb.append("csid=" + item.getCsid() + "\n");\r
375             sb.append("displayName=" + item.getDisplayName() + "\n");\r
376             // sb.append("URI=" + item.getUri() + "\n");\r
377         return sb.toString();\r
378     }\r
379 \r
380 //    private Object extractPart(PoxPayloadIn input, String label,\r
381 //        Class clazz) throws Exception {\r
382 //        Object obj = null;\r
383 //        for(PayloadInputPart part : input.getParts()){\r
384 //            String partLabel = part.getHeaders().getFirst("label");\r
385 //            if(label.equalsIgnoreCase(partLabel)){\r
386 //                String partStr = part.getBodyAsString();\r
387 //                if(logger.isDebugEnabled()){\r
388 //                    logger.debug("extracted part str=\n" + partStr);\r
389 //                }\r
390 //                obj = part.getBody(clazz, null);\r
391 //                if(logger.isDebugEnabled()){\r
392 //                    logger.debug("extracted part obj=\n", obj, clazz);\r
393 //                }\r
394 //                break;\r
395 //            }\r
396 //        }\r
397 //        return obj;\r
398 //    }\r
399 \r
400         public static void main(String[] args) {\r
401 \r
402         // Configure logging.\r
403                 BasicConfigurator.configure();\r
404 \r
405         logger.info("OrgAuthority Sample starting...");\r
406 \r
407                 Sample sample = new Sample();\r
408         OrgauthoritiesCommonList orgAuthorities;\r
409         List<String> orgAuthIds;\r
410         String details = "";\r
411 \r
412         // Optionally delete all orgAuthorities and organizations.\r
413 \r
414         boolean ENABLE_DELETE_ALL = false;\r
415         if (ENABLE_DELETE_ALL) {\r
416 \r
417             logger.info("Deleting all organizations and orgAuthorities ...");\r
418 \r
419             // For each orgAuthority ...\r
420             orgAuthorities = sample.readOrgAuthorities();\r
421             orgAuthIds = sample.readOrgAuthorityIds(orgAuthorities);\r
422             for (String orgAuthId : orgAuthIds) {\r
423                 logger.info("Deleting all organizations for orgAuthority ...");\r
424                 sample.deleteAllItemsForOrgAuth(orgAuthId);\r
425                 logger.info("Deleting orgAuthority ...");\r
426                 sample.deleteOrgAuthority(orgAuthId);\r
427             }\r
428 \r
429             logger.info("Reading orgAuthorities after deletion ...");\r
430             orgAuthorities = sample.readOrgAuthorities();\r
431             details = sample.displayAllOrgAuthorities(orgAuthorities);\r
432             logger.info(details);\r
433 \r
434             logger.info("Reading items in each orgAuthority after deletion ...");\r
435             orgAuthIds = sample.readOrgAuthorityIds(orgAuthorities);\r
436             for (String orgAuthId : orgAuthIds) {\r
437                 OrganizationsCommonList items = sample.readItemsInOrgAuth(orgAuthId);\r
438                 details = sample.displayAllOrganizations(items);\r
439                 logger.info(details);\r
440             }\r
441 \r
442         }\r
443 \r
444         // Create new authorities, each populated with organizations.\r
445         Map<String, String> mmiOrgMap = new HashMap<String,String>();\r
446         mmiOrgMap.put(OrganizationJAXBSchema.SHORT_NAME, "MMI");\r
447         mmiOrgMap.put(OrganizationJAXBSchema.LONG_NAME, "Museum of the Moving Image");\r
448         //mmiOrgMap.put(OrganizationJAXBSchema.CONTACT_NAME, "Megan Forbes");\r
449         mmiOrgMap.put(OrganizationJAXBSchema.FOUNDING_DATE, "1984");\r
450         mmiOrgMap.put(OrganizationJAXBSchema.FOUNDING_PLACE, "Astoria, NY");\r
451         Map<String, String> pahmaOrgMap = new HashMap<String,String>();\r
452         pahmaOrgMap.put(OrganizationJAXBSchema.SHORT_NAME, "PAHMA");\r
453         pahmaOrgMap.put(OrganizationJAXBSchema.LONG_NAME, "Phoebe A. Hearst Museum of Anthropology");\r
454         pahmaOrgMap.put(OrganizationJAXBSchema.NAME_ADDITIONS, "University of California, Berkeley");\r
455         //pahmaOrgMap.put(OrganizationJAXBSchema.CONTACT_NAME, "Michael Black");\r
456         pahmaOrgMap.put(OrganizationJAXBSchema.FOUNDING_DATE, "1901");\r
457         pahmaOrgMap.put(OrganizationJAXBSchema.FOUNDING_PLACE, "Berkeley, CA");\r
458         Map<String, String> savoyOrgMap = new HashMap<String,String>();\r
459         savoyOrgMap.put(OrganizationJAXBSchema.SHORT_NAME, "Savoy Theatre");\r
460         savoyOrgMap.put(OrganizationJAXBSchema.FOUNDING_DATE, "1900");\r
461         savoyOrgMap.put(OrganizationJAXBSchema.DISSOLUTION_DATE, "1952");\r
462         savoyOrgMap.put(OrganizationJAXBSchema.FOUNDING_PLACE, "New York, NY");\r
463         List<Map<String, String>> orgMaps = \r
464                 Arrays.asList(mmiOrgMap, pahmaOrgMap, savoyOrgMap );\r
465         \r
466                 sample.createOrgAuthority("Sample Org Authority", orgMaps);\r
467 \r
468                 logger.info("OrgAuthority Sample complete.");\r
469 \r
470         logger.info("Reading orgAuthorities and items ...");\r
471         // Get a list of orgAuthorities.\r
472         orgAuthorities = sample.readOrgAuthorities();\r
473         // For each orgAuthority ...\r
474         for (OrgauthoritiesCommonList.OrgauthorityListItem\r
475             orgAuthority : orgAuthorities.getOrgauthorityListItem()) {\r
476             // Get its display name.\r
477             logger.info(orgAuthority.getDisplayName());\r
478             // Get a list of the organizations in this orgAuthority.\r
479             OrganizationsCommonList items =\r
480                 sample.readItemsInOrgAuth(orgAuthority.getCsid());\r
481             // For each organization ...\r
482             for (OrganizationsCommonList.OrganizationListItem\r
483                 item : items.getOrganizationListItem()) {\r
484                 // Get its display name.\r
485                 logger.info(" " + item.getDisplayName());\r
486             }\r
487         }\r
488 \r
489         // Sample alternate methods of reading all orgAuthorities and\r
490         // organizations separately.\r
491         boolean RUN_ADDITIONAL_SAMPLES = false;\r
492         if (RUN_ADDITIONAL_SAMPLES) {\r
493 \r
494             logger.info("Reading all orgAuthorities ...");\r
495             details = sample.displayAllOrgAuthorities(orgAuthorities);\r
496             logger.info(details);\r
497 \r
498             logger.info("Reading all organizations ...");\r
499             orgAuthIds = sample.readOrgAuthorityIds(orgAuthorities);\r
500             for (String orgAuthId : orgAuthIds) {\r
501                 OrganizationsCommonList items = sample.readItemsInOrgAuth(orgAuthId);\r
502                 details = sample.displayAllOrganizations(items);\r
503                 logger.info(details);\r
504             }\r
505 \r
506         }\r
507 \r
508         }\r
509 \r
510 }\r