--- /dev/null
+<document name="vocabularies">
+ <ns2:vocabularies_common xmlns:ns2="http://collectionspace.org/services/vocabulary" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <rev>3</rev>
+ <shortIdentifier>ShowItemsVocab</shortIdentifier>
+ <csid>${csid}</csid>
+ <displayName>ShowItems Vocabulary</displayName>
+ <description>
+ This is a test vocabulary for the ShowItems XMLReplay test group.
+ </description>
+ <source>XML Replay ShowItems test group.</source>
+ <refName>
+ urn:cspace:core.collectionspace.org:vocabularies:name(ShowItemsVocab)'ShowItems Vocabulary'
+ </refName>
+ </ns2:vocabularies_common>
+</document>
\ No newline at end of file
--- /dev/null
+<document name="vocabularies">
+ <ns2:collectionspace_core xmlns:ns2="http://collectionspace.org/collectionspace_core/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <updatedBy>admin@core.collectionspace.org</updatedBy>
+ <createdBy>admin@core.collectionspace.org</createdBy>
+ <workflowState>project</workflowState>
+ <tenantId>1</tenantId>
+ <refName>
+ urn:cspace:core.collectionspace.org:vocabularies:name(ShowItemsVocab)'ShowItems Vocabulary'
+ </refName>
+ <uri>/vocabularies/${csid}</uri>
+ </ns2:collectionspace_core>
+ <ns2:vocabularies_common xmlns:ns2="http://collectionspace.org/services/vocabulary" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <rev>3</rev>
+ <shortIdentifier>ShowItemsVocab</shortIdentifier>
+ <csid>${csid}</csid>
+ <displayName>ShowItems Vocabulary</displayName>
+ <description>
+ This is a test vocabulary for the ShowItems XMLReplay test group.
+ </description>
+ <source>XML Replay ShowItems test group.</source>
+ <refName>
+ urn:cspace:core.collectionspace.org:vocabularies:name(ShowItemsVocab)'ShowItems Vocabulary'
+ </refName>
+ </ns2:vocabularies_common>
+ <ns2:account_permission xmlns:ns2="http://collectionspace.org/services/authorization">
+ <account>
+ <accountId>fadf0bcf-7c34-40c3-b6e5-ab1988eba888</accountId>
+ <screenName>Administrator</screenName>
+ <userId>admin@core.collectionspace.org</userId>
+ <tenantId>1</tenantId>
+ </account>
+ </ns2:account_permission>
+ <ns2:abstract-common-list xmlns:ns2="http://collectionspace.org/services/jaxb">
+ <pageNum>0</pageNum>
+ <pageSize>${pgSz}</pageSize>
+ <itemsInPage>${itemsInPage}</itemsInPage>
+ <totalItems>${totalItems}</totalItems>
+ <fieldsReturned>
+ csid|uri|refName|updatedAt|workflowState|rev|sas|proposed|deprecated|termStatus|order|displayName|shortIdentifier
+ </fieldsReturned>
+ <list-item>
+ <csid>${createItem1}</csid>
+ <uri>
+ /vocabularies/${csid}/items/${createItem1}
+ </uri>
+ <refName>
+ urn:cspace:core.collectionspace.org:vocabularies:name(ShowItemsVocab):item:name(ShowItemsItem1)'ShowsItems item ShowItemsItem1'
+ </refName>
+ <workflowState>project</workflowState>
+ <rev>0</rev>
+ <sas>false</sas>
+ <proposed>true</proposed>
+ <order>1</order>
+ <displayName>ShowsItems item ShowItemsItem1</displayName>
+ <shortIdentifier>ShowItemsItem1</shortIdentifier>
+ </list-item>
+ <list-item>
+ <csid>${createItem2}</csid>
+ <uri>
+ /vocabularies/${csid}/items/${createItem2}
+ </uri>
+ <refName>
+ urn:cspace:core.collectionspace.org:vocabularies:name(ShowItemsVocab):item:name(ShowItemsItem2)'ShowsItems item ShowItemsItem2'
+ </refName>
+ <workflowState>project</workflowState>
+ <rev>0</rev>
+ <sas>false</sas>
+ <proposed>true</proposed>
+ <order>2</order>
+ <displayName>ShowsItems item ShowItemsItem2</displayName>
+ <shortIdentifier>ShowItemsItem2</shortIdentifier>
+ </list-item>
+ <list-item>
+ <csid>${createItem3}</csid>
+ <uri>
+ /vocabularies/${csid}/items/${createItem3}
+ </uri>
+ <refName>
+ urn:cspace:core.collectionspace.org:vocabularies:name(ShowItemsVocab):item:name(ShowItemsItem3)'ShowsItems item ShowItemsItem3'
+ </refName>
+ <workflowState>project</workflowState>
+ <rev>0</rev>
+ <sas>false</sas>
+ <proposed>true</proposed>
+ <order>3</order>
+ <displayName>ShowsItems item ShowItemsItem3</displayName>
+ <shortIdentifier>ShowItemsItem3</shortIdentifier>
+ </list-item>
+ </ns2:abstract-common-list>
+</document>
\ No newline at end of file
--- /dev/null
+<document name="vocabularies">
+ <ns2:collectionspace_core xmlns:ns2="http://collectionspace.org/collectionspace_core/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <updatedBy>admin@core.collectionspace.org</updatedBy>
+ <createdBy>admin@core.collectionspace.org</createdBy>
+ <workflowState>project</workflowState>
+ <tenantId>1</tenantId>
+ <refName>
+ urn:cspace:core.collectionspace.org:vocabularies:name(ShowItemsVocab)'ShowItems Vocabulary'
+ </refName>
+ <uri>/vocabularies/${csid}</uri>
+ </ns2:collectionspace_core>
+ <ns2:vocabularies_common xmlns:ns2="http://collectionspace.org/services/vocabulary" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <rev>3</rev>
+ <shortIdentifier>ShowItemsVocab</shortIdentifier>
+ <csid>${csid}</csid>
+ <displayName>ShowItems Vocabulary</displayName>
+ <description>
+ This is a test vocabulary for the ShowItems XMLReplay test group.
+ </description>
+ <source>XML Replay ShowItems test group.</source>
+ <refName>
+ urn:cspace:core.collectionspace.org:vocabularies:name(ShowItemsVocab)'ShowItems Vocabulary'
+ </refName>
+ </ns2:vocabularies_common>
+ <ns2:account_permission xmlns:ns2="http://collectionspace.org/services/authorization">
+ <account>
+ <accountId>fadf0bcf-7c34-40c3-b6e5-ab1988eba888</accountId>
+ <screenName>Administrator</screenName>
+ <userId>admin@core.collectionspace.org</userId>
+ <tenantId>1</tenantId>
+ </account>
+ </ns2:account_permission>
+ <ns2:abstract-common-list xmlns:ns2="http://collectionspace.org/services/jaxb">
+ <pageNum>0</pageNum>
+ <pageSize>${pgSz}</pageSize>
+ <itemsInPage>${itemsInPage}</itemsInPage>
+ <totalItems>${totalItems}</totalItems>
+ <fieldsReturned>
+ csid|uri|refName|updatedAt|workflowState|rev|sas|proposed|deprecated|termStatus|order|displayName|shortIdentifier
+ </fieldsReturned>
+ <list-item>
+ <csid>${createItem3}</csid>
+ <uri>
+ /vocabularies/${csid}/items/${createItem3}
+ </uri>
+ <refName>
+ urn:cspace:core.collectionspace.org:vocabularies:name(ShowItemsVocab):item:name(ShowItemsItem3)'ShowsItems item ShowItemsItem3'
+ </refName>
+ <workflowState>project</workflowState>
+ <rev>0</rev>
+ <sas>false</sas>
+ <proposed>true</proposed>
+ <order>3</order>
+ <displayName>ShowsItems item ShowItemsItem3</displayName>
+ <shortIdentifier>ShowItemsItem3</shortIdentifier>
+ </list-item>
+ </ns2:abstract-common-list>
+</document>
\ No newline at end of file
--- /dev/null
+<document name="vocabularies">
+ <ns2:collectionspace_core xmlns:ns2="http://collectionspace.org/collectionspace_core/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <updatedBy>admin@core.collectionspace.org</updatedBy>
+ <createdBy>admin@core.collectionspace.org</createdBy>
+ <workflowState>project</workflowState>
+ <tenantId>1</tenantId>
+ <refName>
+ urn:cspace:core.collectionspace.org:vocabularies:name(ShowItemsVocab)'ShowItems Vocabulary'
+ </refName>
+ <uri>/vocabularies/${csid}</uri>
+ </ns2:collectionspace_core>
+ <ns2:vocabularies_common xmlns:ns2="http://collectionspace.org/services/vocabulary" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <rev>3</rev>
+ <shortIdentifier>ShowItemsVocab</shortIdentifier>
+ <csid>${csid}</csid>
+ <displayName>ShowItems Vocabulary</displayName>
+ <description>
+ This is a test vocabulary for the ShowItems XMLReplay test group.
+ </description>
+ <source>XML Replay ShowItems test group.</source>
+ <refName>
+ urn:cspace:core.collectionspace.org:vocabularies:name(ShowItemsVocab)'ShowItems Vocabulary'
+ </refName>
+ </ns2:vocabularies_common>
+ <ns2:account_permission xmlns:ns2="http://collectionspace.org/services/authorization">
+ <account>
+ <accountId>fadf0bcf-7c34-40c3-b6e5-ab1988eba888</accountId>
+ <screenName>Administrator</screenName>
+ <userId>admin@core.collectionspace.org</userId>
+ <tenantId>1</tenantId>
+ </account>
+ </ns2:account_permission>
+ <ns2:abstract-common-list xmlns:ns2="http://collectionspace.org/services/jaxb">
+ <pageNum>0</pageNum>
+ <pageSize>${pgSz}</pageSize>
+ <itemsInPage>${itemsInPage}</itemsInPage>
+ <totalItems>${totalItems}</totalItems>
+ <fieldsReturned>
+ csid|uri|refName|updatedAt|workflowState|rev|sas|proposed|deprecated|termStatus|order|displayName|shortIdentifier
+ </fieldsReturned>
+ <list-item>
+ <csid>${createItem1}</csid>
+ <uri>
+ /vocabularies/${csid}/items/${createItem1}
+ </uri>
+ <refName>
+ urn:cspace:core.collectionspace.org:vocabularies:name(ShowItemsVocab):item:name(ShowItemsItem1)'ShowsItems item ShowItemsItem1'
+ </refName>
+ <workflowState>project</workflowState>
+ <rev>0</rev>
+ <sas>false</sas>
+ <proposed>true</proposed>
+ <order>1</order>
+ <displayName>ShowsItems item ShowItemsItem1</displayName>
+ <shortIdentifier>ShowItemsItem1</shortIdentifier>
+ </list-item>
+ <list-item>
+ <csid>${createItem2}</csid>
+ <uri>
+ /vocabularies/${csid}/items/${createItem2}
+ </uri>
+ <refName>
+ urn:cspace:core.collectionspace.org:vocabularies:name(ShowItemsVocab):item:name(ShowItemsItem2)'ShowsItems item ShowItemsItem2'
+ </refName>
+ <workflowState>project</workflowState>
+ <rev>0</rev>
+ <sas>false</sas>
+ <proposed>true</proposed>
+ <order>2</order>
+ <displayName>ShowsItems item ShowItemsItem2</displayName>
+ <shortIdentifier>ShowItemsItem2</shortIdentifier>
+ </list-item>
+ </ns2:abstract-common-list>
+</document>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<document name="vocabularyitems">
+ <ns3:vocabularyitems_common xmlns:ns3="http://collectionspace.org/services/vocabulary"
+ xmlns:ns2="http://collectionspace.org/services/jaxb">
+ <displayName>${displayName}</displayName>
+ <shortIdentifier>${itemID}</shortIdentifier>
+ <refName>urn:cspace:org.collectionspace.demo:vocabulary:name(TestOrderVocab):item:name(${itemID})'${displayName}'</refName>
+ <order>${order}</order>
+ <description>This is a test vocabulary item</description>
+ <source>Some mythical book</source>
+ <sourcePage>The page should match the order:${order}</sourcePage>
+ </ns3:vocabularyitems_common>
+</document>
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<document name="vocabularies">
+ <ns3:vocabularies_common xmlns:ns3="http://collectionspace.org/services/vocabulary"
+ xmlns:ns2="http://collectionspace.org/services/jaxb">
+ <displayName>ShowItems Vocabulary</displayName>
+ <shortIdentifier>ShowItemsVocab</shortIdentifier>
+ <description>This is a test vocabulary for the ShowItems XMLReplay test group.</description>
+ <source>XML Replay ShowItems test group.</source>
+ </ns3:vocabularies_common>
+</document>
+
<auth ID="admin@core.collectionspace.org">YWRtaW5AY29yZS5jb2xsZWN0aW9uc3BhY2Uub3JnOkFkbWluaXN0cmF0b3I=</auth>
<auth ID="testAdministator">YWRtaW5AY29sbGVjdGlvbnNwYWNlLm9yZzpBZG1pbmlzdHJhdG9y</auth>
</auths>
- <testGroup ID="TestOrder" autoDeletePOSTS="true">
+
+ <!-- This test group tests the "showItems" query param that can be sent to the /vocabularies/${id} endpoint.
+ The "showItems=true" query param adds all the vocabularies items to the returned payload.
+ -->
+ <testGroup ID="TestShowItems" autoDeletePOSTS="true">
+ <test ID="createShowItemsVocab">
+ <method>POST</method>
+ <uri>/cspace-services/vocabularies/</uri>
+ <filename>vocabulary/ShowItems/showItems-vocab.xml</filename>
+ </test>
+ <test ID="createItem1" auth="test">
+ <method>POST</method>
+ <uri>/cspace-services/vocabularies/${createShowItemsVocab.CSID}/items/</uri>
+ <filename>vocabulary/ShowItems/showItems-item-template.xml</filename>
+ <vars>
+ <var ID="itemID">ShowItemsItem1</var>
+ <var ID="order">1</var>
+ <var ID="displayName">ShowsItems item ${itemID}</var>
+ </vars>
+ </test>
+ <test ID="createItem2" auth="test">
+ <method>POST</method>
+ <uri>/cspace-services/vocabularies/${createShowItemsVocab.CSID}/items/</uri>
+ <filename>vocabulary/ShowItems/showItems-item-template.xml</filename>
+ <vars>
+ <var ID="itemID">ShowItemsItem2</var>
+ <var ID="order">2</var>
+ <var ID="displayName">ShowsItems item ${itemID}</var>
+ </vars>
+ </test>
+ <test ID="createItem3" auth="test">
+ <method>POST</method>
+ <uri>/cspace-services/vocabularies/${createShowItemsVocab.CSID}/items/</uri>
+ <filename>vocabulary/ShowItems/showItems-item-template.xml</filename>
+ <vars>
+ <var ID="itemID">ShowItemsItem3</var>
+ <var ID="order">3</var>
+ <var ID="displayName">ShowsItems item ${itemID}</var>
+ </vars>
+ </test>
+ <test ID="getShowItemsVocab">
+ <method>GET</method>
+ <uri>/cspace-services/vocabularies/${createShowItemsVocab.CSID}</uri>
+ <response>
+ <vars>
+ <var ID="csid">${createShowItemsVocab.CSID}</var>
+ </vars>
+ <expected level="ADDOK" />
+ <label>vocabularies_common</label>
+ <filename>vocabulary/ShowItems/res/showVocab.res.xml</filename>
+ </response>
+ </test>
+ <test ID="getShowItemsVocabWithItems">
+ <method>GET</method>
+ <uri>/cspace-services/vocabularies/${createShowItemsVocab.CSID}?showItems=true</uri>
+ <response>
+ <vars>
+ <var ID="pgSz">2500</var>
+ <var ID="itemsInPage">3</var>
+ <var ID="totalItems">3</var>
+ <var ID="csid">${createShowItemsVocab.CSID}</var>
+ <var ID="createItem1">${createItem1.CSID}</var>
+ <var ID="createItem2">${createItem2.CSID}</var>
+ <var ID="createItem3">${createItem3.CSID}</var>
+ </vars>
+ <expected level="ADDOK" />
+ <filename>vocabulary/ShowItems/res/showVocabWithItems.res.xml</filename>
+ </response>
+ </test>
+ <test ID="getShowItemsVocabWithItemsPaged">
+ <method>GET</method>
+ <uri>/cspace-services/vocabularies/${createShowItemsVocab.CSID}?showItems=true&pgSz=2</uri>
+ <response>
+ <vars>
+ <var ID="pgSz">2</var>
+ <var ID="itemsInPage">2</var>
+ <var ID="totalItems">3</var>
+ <var ID="csid">${createShowItemsVocab.CSID}</var>
+ <var ID="createItem1">${createItem1.CSID}</var>
+ <var ID="createItem2">${createItem2.CSID}</var>
+ <var ID="createItem3">${createItem3.CSID}</var>
+ </vars>
+ <expected level="ADDOK" />
+ <filename>vocabulary/ShowItems/res/showVocabWithItemsPaged.res.xml</filename>
+ </response>
+ </test>
+ <test ID="getShowItemsVocabWithItemsLastPage">
+ <method>GET</method>
+ <uri>/cspace-services/vocabularies/${createShowItemsVocab.CSID}?showItems=true&pgSz=2&pgNum=1</uri>
+ <response>
+ <vars>
+ <var ID="pgSz">2</var>
+ <var ID="itemsInPage">1</var>
+ <var ID="totalItems">3</var>
+ <var ID="csid">${createShowItemsVocab.CSID}</var>
+ <var ID="createItem1">${createItem1.CSID}</var>
+ <var ID="createItem2">${createItem2.CSID}</var>
+ <var ID="createItem3">${createItem3.CSID}</var>
+ </vars>
+ <expected level="ADDOK" />
+ <filename>vocabulary/ShowItems/res/showVocabWithLastPage.res.xml</filename>
+ </response>
+ </test>
+ </testGroup>
+
+ <testGroup ID="TestOrder" autoDeletePOSTS="true">
<!-- The purpose of this testGroup is to test the new "order" field
that was added in http://issues.collectionspace.org/browse/CSPACE-573
and to ensure that this order field is returned in list results,
*/
package org.collectionspace.services.vocabulary;
+import org.collectionspace.services.client.IClientQueryParams;
import org.collectionspace.services.client.PoxPayloadIn;
import org.collectionspace.services.client.PoxPayloadOut;
import org.collectionspace.services.client.VocabularyClient;
MultivaluedMap<String,String> queryParams = uriInfo.getQueryParameters();
String showItemsValue = (String)queryParams.getFirst(VocabularyClient.SHOW_ITEMS_QP);
boolean showItems = Tools.isTrue(showItemsValue);
+ if (showItems == true) {
+ //
+ // We'll honor paging params if we find any; otherwise we'll set the page size to 0 to get ALL the items
+ //
+ if (queryParams.containsKey(IClientQueryParams.PAGE_SIZE_PARAM) == false) {
+ queryParams.add(IClientQueryParams.PAGE_SIZE_PARAM, "0");
+ }
+ }
ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(request, uriInfo);
PoxPayloadOut payloadout = getAuthority(ctx, request, uriInfo, specifier, showItems);