]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
736f7637df49f0f5767051455af23f9d96450751
[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.List;\r
29 \r
30 import javax.ws.rs.core.MediaType;\r
31 import javax.ws.rs.core.MultivaluedMap;\r
32 import javax.ws.rs.core.Response;\r
33 \r
34 import org.apache.log4j.BasicConfigurator;\r
35 import org.collectionspace.services.client.OrgAuthorityClient;\r
36 import org.collectionspace.services.client.test.ServiceRequestType;\r
37 import org.collectionspace.services.organization.OrgauthoritiesCommon;\r
38 import org.collectionspace.services.organization.OrgauthoritiesCommonList;\r
39 import org.collectionspace.services.organization.OrganizationsCommon;\r
40 import org.collectionspace.services.organization.OrganizationsCommonList;\r
41 import org.jboss.resteasy.client.ClientResponse;\r
42 import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;\r
43 import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;\r
44 import org.jboss.resteasy.plugins.providers.multipart.InputPart;\r
45 import org.jboss.resteasy.plugins.providers.multipart.OutputPart;\r
46 import org.slf4j.Logger;\r
47 import org.slf4j.LoggerFactory;\r
48 \r
49 /**\r
50  * OrgAuthority Sample, carries out tests against a\r
51  * deployed and running OrgAuthority Service.\r
52  *\r
53  * $LastChangedRevision: 1055 $\r
54  * $LastChangedDate: 2009-12-09 12:25:15 -0800 (Wed, 09 Dec 2009) $\r
55  */\r
56 public class Sample {\r
57     private static final Logger logger =\r
58         LoggerFactory.getLogger(Sample.class);\r
59 \r
60     // Instance variables specific to this test.\r
61     private OrgAuthorityClient client = new OrgAuthorityClient();\r
62     final String SERVICE_PATH_COMPONENT = "organizations";\r
63     final String ITEM_SERVICE_PATH_COMPONENT = "items";\r
64 \r
65 \r
66     // ---------------------------------------------------------------\r
67     // Create\r
68     // ---------------------------------------------------------------\r
69 \r
70     public void createEnumeration(String orgAuthName, List<String> enumValues ) {\r
71 \r
72         // Expected status code: 201 Created\r
73         int EXPECTED_STATUS_CODE = Response.Status.CREATED.getStatusCode();\r
74         // Type of service request being tested\r
75         ServiceRequestType REQUEST_TYPE = ServiceRequestType.CREATE;\r
76 \r
77         logger.info("Import: Create orgAuthority: \"" + orgAuthName +"\"");\r
78         MultipartOutput multipart = createOrgAuthorityInstance(orgAuthName, \r
79                         createRefName(orgAuthName), "enum");\r
80         ClientResponse<Response> res = client.create(multipart);\r
81 \r
82         int statusCode = res.getStatus();\r
83 \r
84         if(!REQUEST_TYPE.isValidStatusCode(statusCode)) {\r
85                 throw new RuntimeException("Could not create enumeration: \""+orgAuthName\r
86                                 +"\" "+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));\r
87         }\r
88         if(statusCode != EXPECTED_STATUS_CODE) {\r
89                 throw new RuntimeException("Unexpected Status when creating enumeration: \""\r
90                                 +orgAuthName +"\", Status:"+ statusCode);\r
91         }\r
92 \r
93         // Store the ID returned from this create operation\r
94         // for additional tests below.\r
95         String newOrgAuthId = extractId(res);\r
96         logger.info("Import: Created orgAuthority: \"" + orgAuthName +"\" ID:"\r
97                                 +newOrgAuthId );\r
98         \r
99         // Add items to the orgAuthority\r
100         for(String itemName : enumValues){\r
101                 createItemInOrgAuth(newOrgAuthId, orgAuthName, itemName, createRefName(itemName));\r
102         }\r
103         \r
104     }\r
105     \r
106     private String createItemInOrgAuth(String vcsid, String orgAuthName, String itemName, String refName) {\r
107         // Expected status code: 201 Created\r
108         int EXPECTED_STATUS_CODE = Response.Status.CREATED.getStatusCode();\r
109         // Type of service request being tested\r
110         ServiceRequestType REQUEST_TYPE = ServiceRequestType.CREATE;\r
111 \r
112         logger.info("Import: Create Item: \""+itemName+"\" in orgAuthority: \"" + orgAuthName +"\"");\r
113         MultipartOutput multipart = createOrganizationInstance(itemName, refName);\r
114         ClientResponse<Response> res = client.createItem(vcsid, multipart);\r
115 \r
116         int statusCode = res.getStatus();\r
117 \r
118         if(!REQUEST_TYPE.isValidStatusCode(statusCode)) {\r
119                 throw new RuntimeException("Could not create Item: \""+itemName\r
120                                 +"\" in orgAuthority: \"" + orgAuthName\r
121                                 +"\" "+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));\r
122         }\r
123         if(statusCode != EXPECTED_STATUS_CODE) {\r
124                 throw new RuntimeException("Unexpected Status when creating Item: \""+itemName\r
125                                 +"\" in orgAuthority: \"" + orgAuthName +"\", Status:"+ statusCode);\r
126         }\r
127 \r
128         return extractId(res);\r
129     }\r
130 \r
131 \r
132    // ---------------------------------------------------------------\r
133    // Read\r
134    // ---------------------------------------------------------------\r
135 \r
136    private OrgauthoritiesCommonList readOrgAuthorities() {\r
137 \r
138         // Expected status code: 200 OK\r
139         int EXPECTED_STATUS_CODE = Response.Status.OK.getStatusCode();\r
140         // Type of service request being tested\r
141         ServiceRequestType REQUEST_TYPE = ServiceRequestType.READ;\r
142 \r
143         // Submit the request to the service and store the response.\r
144         ClientResponse<OrgauthoritiesCommonList> res = client.readList();\r
145         OrgauthoritiesCommonList list = res.getEntity();\r
146 \r
147         int statusCode = res.getStatus();\r
148         if(!REQUEST_TYPE.isValidStatusCode(statusCode)) {\r
149                 throw new RuntimeException("Could not read list of orgAuthorities: "\r
150                 + invalidStatusCodeMessage(REQUEST_TYPE, statusCode));\r
151         }\r
152         if(statusCode != EXPECTED_STATUS_CODE) {\r
153                 throw new RuntimeException("Unexpected Status when reading " +\r
154                 "list of orgAuthorities, Status:"+ statusCode);\r
155         }\r
156 \r
157         return list;\r
158    }\r
159 \r
160     private List<String> readOrgAuthorityIds(OrgauthoritiesCommonList list) {\r
161 \r
162         List<String> ids = new ArrayList<String>();\r
163         List<OrgauthoritiesCommonList.OrgauthorityListItem> orgAuthorities =\r
164             list.getOrgauthorityListItem();\r
165         for (OrgauthoritiesCommonList.OrgauthorityListItem orgAuthority : orgAuthorities) {\r
166             ids.add(orgAuthority.getCsid());\r
167         }\r
168         return ids;\r
169    }\r
170     \r
171    private OrgauthoritiesCommon readOrgAuthority(String orgAuthId) {\r
172 \r
173         // Expected status code: 200 OK\r
174         int EXPECTED_STATUS_CODE = Response.Status.OK.getStatusCode();\r
175         // Type of service request being tested\r
176         ServiceRequestType REQUEST_TYPE = ServiceRequestType.READ;\r
177 \r
178         // Submit the request to the service and store the response.\r
179         OrgauthoritiesCommon orgAuthority = null;\r
180         try {\r
181             ClientResponse<MultipartInput> res = client.read(orgAuthId);\r
182             int statusCode = res.getStatus();\r
183             if(!REQUEST_TYPE.isValidStatusCode(statusCode)) {\r
184                 throw new RuntimeException("Could not read orgAuthority"\r
185                     + invalidStatusCodeMessage(REQUEST_TYPE, statusCode));\r
186             }\r
187             if(statusCode != EXPECTED_STATUS_CODE) {\r
188                 throw new RuntimeException("Unexpected Status when reading " +\r
189                     "orgAuthority, Status:"+ statusCode);\r
190             }\r
191             MultipartInput input = (MultipartInput) res.getEntity();\r
192             orgAuthority = (OrgauthoritiesCommon) extractPart(input,\r
193                     client.getCommonPartName(), OrgauthoritiesCommon.class);\r
194         } catch (Exception e) {\r
195             throw new RuntimeException("Could not read orgAuthority: ", e);\r
196         }\r
197 \r
198         return orgAuthority;\r
199     }\r
200 \r
201     private OrganizationsCommonList readItemsInOrgAuth(String orgAuthId) {\r
202 \r
203         // Expected status code: 200 OK\r
204         int EXPECTED_STATUS_CODE = Response.Status.OK.getStatusCode();\r
205         // Type of service request being tested\r
206         ServiceRequestType REQUEST_TYPE = ServiceRequestType.READ;\r
207 \r
208         // Submit the request to the service and store the response.\r
209         ClientResponse<OrganizationsCommonList> res =\r
210                 client.readItemList(orgAuthId);\r
211         OrganizationsCommonList list = res.getEntity();\r
212 \r
213         int statusCode = res.getStatus();\r
214 \r
215         if(!REQUEST_TYPE.isValidStatusCode(statusCode)) {\r
216                 throw new RuntimeException("Could not read items in orgAuthority: "\r
217                 + invalidStatusCodeMessage(REQUEST_TYPE, statusCode));\r
218         }\r
219         if(statusCode != EXPECTED_STATUS_CODE) {\r
220                 throw new RuntimeException("Unexpected Status when reading " +\r
221                 "items in orgAuthority, Status:"+ statusCode);\r
222         }\r
223 \r
224         return list;\r
225     }\r
226 \r
227     private List<String> readOrganizationIds(OrganizationsCommonList list) {\r
228 \r
229         List<String> ids = new ArrayList<String>();\r
230         List<OrganizationsCommonList.OrganizationListItem> items =\r
231             list.getOrganizationListItem();\r
232         for (OrganizationsCommonList.OrganizationListItem item : items) {\r
233             ids.add(item.getCsid());\r
234         }\r
235         return ids;\r
236    }\r
237 \r
238     // ---------------------------------------------------------------\r
239     // Delete\r
240     // ---------------------------------------------------------------\r
241 \r
242     private void deleteOrgAuthority(String vcsid) {\r
243          // Expected status code: 200 OK\r
244         int EXPECTED_STATUS_CODE = Response.Status.OK.getStatusCode();\r
245         // Type of service request being tested\r
246         ServiceRequestType REQUEST_TYPE = ServiceRequestType.DELETE;\r
247 \r
248         ClientResponse<Response> res = client.delete(vcsid);\r
249         int statusCode = res.getStatus();\r
250 \r
251         if(!REQUEST_TYPE.isValidStatusCode(statusCode)) {\r
252                 throw new RuntimeException("Could not delete orgAuthority: "\r
253                 + invalidStatusCodeMessage(REQUEST_TYPE, statusCode));\r
254         }\r
255         if(statusCode != EXPECTED_STATUS_CODE) {\r
256                 throw new RuntimeException("Unexpected Status when deleting " +\r
257                 "orgAuthority, Status:"+ statusCode);\r
258         }\r
259     }\r
260 \r
261     private void deleteAllOrgAuthorities() {\r
262         List<String> ids = readOrgAuthorityIds(readOrgAuthorities());\r
263         for (String id : ids) {\r
264             deleteOrgAuthority(id);\r
265         }\r
266     }\r
267 \r
268         private void deleteOrganization(String vcsid, String itemcsid) {\r
269          // Expected status code: 200 OK\r
270         int EXPECTED_STATUS_CODE = Response.Status.OK.getStatusCode();\r
271         // Type of service request being tested\r
272         ServiceRequestType REQUEST_TYPE = ServiceRequestType.DELETE;\r
273 \r
274         ClientResponse<Response> res = client.deleteItem(vcsid, itemcsid);\r
275         int statusCode = res.getStatus();\r
276 \r
277         if(!REQUEST_TYPE.isValidStatusCode(statusCode)) {\r
278                 throw new RuntimeException("Could not delete orgAuthority item: "\r
279                 + invalidStatusCodeMessage(REQUEST_TYPE, statusCode));\r
280         }\r
281         if(statusCode != EXPECTED_STATUS_CODE) {\r
282                 throw new RuntimeException("Unexpected Status when deleting " +\r
283                 "orgAuthority item, Status:"+ statusCode);\r
284         }\r
285     }\r
286 \r
287     private void deleteAllItemsForOrgAuth(String orgAuthId) {\r
288         List<String> itemIds = readOrganizationIds(readItemsInOrgAuth(orgAuthId));\r
289         for (String itemId : itemIds) {\r
290             deleteOrganization(orgAuthId, itemId);\r
291         }\r
292     }\r
293 \r
294     // ---------------------------------------------------------------\r
295     // Utility methods used by tests above\r
296     // ---------------------------------------------------------------\r
297 \r
298     private MultipartOutput createOrgAuthorityInstance(\r
299                 String displayName, String refName, String vocabType) {\r
300         OrgauthoritiesCommon orgAuthority = new OrgauthoritiesCommon();\r
301         orgAuthority.setDisplayName(displayName);\r
302         orgAuthority.setRefName(refName);\r
303         orgAuthority.setVocabType(vocabType);\r
304         MultipartOutput multipart = new MultipartOutput();\r
305         OutputPart commonPart = multipart.addPart(orgAuthority, MediaType.APPLICATION_XML_TYPE);\r
306         commonPart.getHeaders().add("label", client.getCommonPartName());\r
307 \r
308         if(logger.isDebugEnabled()){\r
309                 logger.debug("to be created, orgAuthority common ",\r
310                                         orgAuthority, OrgauthoritiesCommon.class);\r
311         }\r
312 \r
313         return multipart;\r
314     }\r
315 \r
316     private MultipartOutput createOrganizationInstance(\r
317                 String displayName, String refName) {\r
318         OrganizationsCommon organization = new OrganizationsCommon();\r
319         organization.setShortName(displayName);\r
320         organization.setRefName(refName);\r
321         MultipartOutput multipart = new MultipartOutput();\r
322         OutputPart commonPart = multipart.addPart(organization, MediaType.APPLICATION_XML_TYPE);\r
323         commonPart.getHeaders().add("label", client.getItemCommonPartName());\r
324 \r
325         if(logger.isDebugEnabled()){\r
326                 logger.debug("to be created, organization common ", organization, OrganizationsCommon.class);\r
327         }\r
328 \r
329         return multipart;\r
330     }\r
331 \r
332     // Retrieve individual fields of orgAuthority records.\r
333 \r
334     private String displayAllOrgAuthorities(OrgauthoritiesCommonList list) {\r
335         StringBuffer sb = new StringBuffer();\r
336             List<OrgauthoritiesCommonList.OrgauthorityListItem> orgAuthorities =\r
337                     list.getOrgauthorityListItem();\r
338             int i = 0;\r
339         for (OrgauthoritiesCommonList.OrgauthorityListItem orgAuthority : orgAuthorities) {\r
340             sb.append("orgAuthority [" + i + "]" + "\n");\r
341             sb.append(displayOrgAuthorityDetails(orgAuthority));\r
342             i++;\r
343         }\r
344         return sb.toString();\r
345     }\r
346 \r
347     private String displayOrgAuthorityDetails(\r
348         OrgauthoritiesCommonList.OrgauthorityListItem orgAuthority) {\r
349             StringBuffer sb = new StringBuffer();\r
350             sb.append("displayName=" + orgAuthority.getDisplayName() + "\n");\r
351             sb.append("vocabType=" + orgAuthority.getVocabType() + "\n");\r
352             // sb.append("csid=" + orgAuthority.getCsid() + "\n");\r
353             sb.append("URI=" + orgAuthority.getUri() + "\n");\r
354         return sb.toString();\r
355     }\r
356 \r
357     // Retrieve individual fields of organization records.\r
358 \r
359     private String displayAllOrganizations(OrganizationsCommonList list) {\r
360         StringBuffer sb = new StringBuffer();\r
361         List<OrganizationsCommonList.OrganizationListItem> items =\r
362                 list.getOrganizationListItem();\r
363         int i = 0;\r
364         for (OrganizationsCommonList.OrganizationListItem item : items) {\r
365             sb.append("organization [" + i + "]" + "\n");\r
366             sb.append(displayOrganizationDetails(item));\r
367             i++;\r
368         }\r
369         return sb.toString();\r
370     }\r
371 \r
372     private String displayOrganizationDetails(\r
373         OrganizationsCommonList.OrganizationListItem item) {\r
374             StringBuffer sb = new StringBuffer();\r
375             sb.append("csid=" + item.getCsid() + "\n");\r
376             sb.append("displayName=" + item.getDisplayName() + "\n");\r
377             // sb.append("URI=" + item.getUri() + "\n");\r
378         return sb.toString();\r
379     }\r
380 \r
381     private Object extractPart(MultipartInput input, String label,\r
382         Class clazz) throws Exception {\r
383         Object obj = null;\r
384         for(InputPart part : input.getParts()){\r
385             String partLabel = part.getHeaders().getFirst("label");\r
386             if(label.equalsIgnoreCase(partLabel)){\r
387                 String partStr = part.getBodyAsString();\r
388                 if(logger.isDebugEnabled()){\r
389                     logger.debug("extracted part str=\n" + partStr);\r
390                 }\r
391                 obj = part.getBody(clazz, null);\r
392                 if(logger.isDebugEnabled()){\r
393                     logger.debug("extracted part obj=\n", obj, clazz);\r
394                 }\r
395                 break;\r
396             }\r
397         }\r
398         return obj;\r
399     }\r
400 \r
401     /**\r
402      * Returns an error message indicating that the status code returned by a\r
403      * specific call to a service does not fall within a set of valid status\r
404      * codes for that service.\r
405      *\r
406      * @param serviceRequestType  A type of service request (e.g. CREATE, DELETE).\r
407      *\r
408      * @param statusCode  The invalid status code that was returned in the response,\r
409      *                    from submitting that type of request to the service.\r
410      *\r
411      * @return An error message.\r
412      */\r
413     protected String invalidStatusCodeMessage(ServiceRequestType requestType, int statusCode) {\r
414         return "Status code '" + statusCode + "' in response is NOT within the expected set: " +\r
415                 requestType.validStatusCodesAsString();\r
416     }\r
417 \r
418     protected String extractId(ClientResponse<Response> res) {\r
419         MultivaluedMap<String, Object> mvm = res.getMetadata();\r
420         String uri = (String) ((ArrayList<Object>) mvm.get("Location")).get(0);\r
421         if(logger.isDebugEnabled()){\r
422                 logger.info("extractId:uri=" + uri);\r
423         }\r
424         String[] segments = uri.split("/");\r
425         String id = segments[segments.length - 1];\r
426         if(logger.isDebugEnabled()){\r
427                 logger.debug("id=" + id);\r
428         }\r
429         return id;\r
430     }\r
431     \r
432     protected String createRefName(String displayName) {\r
433         return displayName.replaceAll("\\W", "");\r
434     }\r
435 \r
436         public static void main(String[] args) {\r
437 \r
438         // Configure logging.\r
439                 BasicConfigurator.configure();\r
440 \r
441         logger.info("OrgAuthority Sample starting...");\r
442 \r
443                 Sample vbi = new Sample();\r
444         OrgauthoritiesCommonList orgAuthorities;\r
445         List<String> orgAuthIds;\r
446         String details = "";\r
447 \r
448         // Optionally delete all orgAuthorities and organizations.\r
449 \r
450         boolean ENABLE_DELETE_ALL = false;\r
451         if (ENABLE_DELETE_ALL) {\r
452 \r
453             logger.info("Deleting all organizations and orgAuthorities ...");\r
454 \r
455             // For each orgAuthority ...\r
456             orgAuthorities = vbi.readOrgAuthorities();\r
457             orgAuthIds = vbi.readOrgAuthorityIds(orgAuthorities);\r
458             for (String orgAuthId : orgAuthIds) {\r
459                 logger.info("Deleting all organizations for orgAuthority ...");\r
460                 vbi.deleteAllItemsForOrgAuth(orgAuthId);\r
461                 logger.info("Deleting orgAuthority ...");\r
462                 vbi.deleteOrgAuthority(orgAuthId);\r
463             }\r
464 \r
465             logger.info("Reading orgAuthorities after deletion ...");\r
466             orgAuthorities = vbi.readOrgAuthorities();\r
467             details = vbi.displayAllOrgAuthorities(orgAuthorities);\r
468             logger.info(details);\r
469 \r
470             logger.info("Reading items in each orgAuthority after deletion ...");\r
471             orgAuthIds = vbi.readOrgAuthorityIds(orgAuthorities);\r
472             for (String orgAuthId : orgAuthIds) {\r
473                 OrganizationsCommonList items = vbi.readItemsInOrgAuth(orgAuthId);\r
474                 details = vbi.displayAllOrganizations(items);\r
475                 logger.info(details);\r
476             }\r
477 \r
478         }\r
479 \r
480         // Create new authorities, each populated with organizations.\r
481 \r
482                                 /*\r
483                 final String acquisitionMethodsVocabName = "Acquisition Methods";\r
484                 final String entryMethodsVocabName = "Entry Methods";\r
485                 final String entryReasonsVocabName = "Entry Reasons";\r
486                 final String responsibleDeptsVocabName = "Responsible Departments";\r
487 \r
488                 List<String> acquisitionMethodsEnumValues = \r
489                         Arrays.asList("Gift","Purchase","Exchange","Transfer","Treasure");\r
490                 List<String> entryMethodsEnumValues = \r
491                         Arrays.asList("In person","Post","Found on doorstep");\r
492                 List<String> entryReasonsEnumValues = \r
493                         Arrays.asList("Enquiry","Commission","Loan");\r
494                 List<String> respDeptNamesEnumValues = \r
495                         Arrays.asList("Antiquities","Architecture and Design","Decorative Arts",\r
496                                                                         "Ethnography","Herpetology","Media and Performance Art",\r
497                                                                         "Paintings and Sculpture","Paleobotany","Photographs",\r
498                                                                         "Prints and Drawings");\r
499         \r
500                 vbi.createEnumeration(acquisitionMethodsVocabName, acquisitionMethodsEnumValues);\r
501                 vbi.createEnumeration(entryMethodsVocabName, entryMethodsEnumValues);\r
502                 vbi.createEnumeration(entryReasonsVocabName, entryReasonsEnumValues);\r
503                 vbi.createEnumeration(responsibleDeptsVocabName, respDeptNamesEnumValues);\r
504                 */\r
505 \r
506                 logger.info("OrgAuthority Sample complete.");\r
507 \r
508         logger.info("Reading orgAuthorities and items ...");\r
509         // Get a list of orgAuthorities.\r
510         orgAuthorities = vbi.readOrgAuthorities();\r
511         // For each orgAuthority ...\r
512         for (OrgauthoritiesCommonList.OrgauthorityListItem\r
513             orgAuthority : orgAuthorities.getOrgauthorityListItem()) {\r
514             // Get its display name.\r
515             logger.info(orgAuthority.getDisplayName());\r
516             // Get a list of the organizations in this orgAuthority.\r
517             OrganizationsCommonList items =\r
518                 vbi.readItemsInOrgAuth(orgAuthority.getCsid());\r
519             // For each organization ...\r
520             for (OrganizationsCommonList.OrganizationListItem\r
521                 item : items.getOrganizationListItem()) {\r
522                 // Get its display name.\r
523                 logger.info(" " + item.getDisplayName());\r
524             }\r
525         }\r
526 \r
527         // Sample alternate methods of reading all orgAuthorities and\r
528         // organizations separately.\r
529         boolean RUN_ADDITIONAL_SAMPLES = false;\r
530         if (RUN_ADDITIONAL_SAMPLES) {\r
531 \r
532             logger.info("Reading all orgAuthorities ...");\r
533             details = vbi.displayAllOrgAuthorities(orgAuthorities);\r
534             logger.info(details);\r
535 \r
536             logger.info("Reading all organizations ...");\r
537             orgAuthIds = vbi.readOrgAuthorityIds(orgAuthorities);\r
538             for (String orgAuthId : orgAuthIds) {\r
539                 OrganizationsCommonList items = vbi.readItemsInOrgAuth(orgAuthId);\r
540                 details = vbi.displayAllOrganizations(items);\r
541                 logger.info(details);\r
542             }\r
543 \r
544         }\r
545 \r
546         }\r
547 \r
548 }\r