From 7c300775343ab2589c1d4ec77b179cd291f3f4bf Mon Sep 17 00:00:00 2001 From: Patrick Schmitz Date: Wed, 9 Dec 2009 20:25:15 +0000 Subject: [PATCH] CSPACE-600, CSPACE-572 Fixed. Removed inVocabulary reference from all REST payloads - this should not be visible to consumers. Work on CSPACE-590, CSPACE-547. Added support for refname to payloads. --- .../services/client/test/VocabularyServiceTest.java | 1 - .../vocabulary/importer/VocabularyBaseImport.java | 5 ++--- .../services/VocabularyItemJAXBSchema.java | 3 ++- .../services/VocabularyItemListItemJAXBSchema.java | 1 + .../services/VocabularyJAXBSchema.java | 2 ++ .../services/VocabularyListItemJAXBSchema.java | 1 + .../jaxb/src/main/resources/vocabulary_common.xsd | 2 ++ .../src/main/resources/vocabularyitem_common.xsd | 4 ++-- .../services/vocabulary/client/sample/Sample.java | 5 ++--- .../nuxeo/VocabularyDocumentModelHandler.java | 3 ++- .../nuxeo/VocabularyItemDocumentModelHandler.java | 12 +++++++----- 11 files changed, 23 insertions(+), 16 deletions(-) diff --git a/services/vocabulary/client/src/test/java/org/collectionspace/services/client/test/VocabularyServiceTest.java b/services/vocabulary/client/src/test/java/org/collectionspace/services/client/test/VocabularyServiceTest.java index 6da36afc0..af40300a4 100644 --- a/services/vocabulary/client/src/test/java/org/collectionspace/services/client/test/VocabularyServiceTest.java +++ b/services/vocabulary/client/src/test/java/org/collectionspace/services/client/test/VocabularyServiceTest.java @@ -970,7 +970,6 @@ public class VocabularyServiceTest extends AbstractServiceTest { private MultipartOutput createVocabularyItemInstance(String inVocabulary, String displayName, String refName) { VocabularyitemsCommon vocabularyItem = new VocabularyitemsCommon(); - vocabularyItem.setInVocabulary(inVocabulary); vocabularyItem.setDisplayName(displayName); if(refName!=null) vocabularyItem.setRefName(refName); diff --git a/services/vocabulary/import/src/main/java/org/collectionspace/services/vocabulary/importer/VocabularyBaseImport.java b/services/vocabulary/import/src/main/java/org/collectionspace/services/vocabulary/importer/VocabularyBaseImport.java index e448af7d8..c35231967 100644 --- a/services/vocabulary/import/src/main/java/org/collectionspace/services/vocabulary/importer/VocabularyBaseImport.java +++ b/services/vocabulary/import/src/main/java/org/collectionspace/services/vocabulary/importer/VocabularyBaseImport.java @@ -104,7 +104,7 @@ public class VocabularyBaseImport { if(logger.isDebugEnabled()){ logger.debug("Import: Create Item: \""+itemName+"\" in vocabulary: \"" + vocabName +"\""); } - MultipartOutput multipart = createVocabularyItemInstance(vcsid, itemName, refName); + MultipartOutput multipart = createVocabularyItemInstance(itemName, refName); ClientResponse res = client.createItem(vcsid, multipart); int statusCode = res.getStatus(); @@ -145,9 +145,8 @@ public class VocabularyBaseImport { } private MultipartOutput createVocabularyItemInstance( - String inVocabulary, String displayName, String refName) { + String displayName, String refName) { VocabularyitemsCommon vocabularyItem = new VocabularyitemsCommon(); - vocabularyItem.setInVocabulary(inVocabulary); vocabularyItem.setDisplayName(displayName); vocabularyItem.setRefName(refName); MultipartOutput multipart = new MultipartOutput(); diff --git a/services/vocabulary/jaxb/src/main/java/org/collectionspace/services/VocabularyItemJAXBSchema.java b/services/vocabulary/jaxb/src/main/java/org/collectionspace/services/VocabularyItemJAXBSchema.java index c0c3038e0..97127893b 100644 --- a/services/vocabulary/jaxb/src/main/java/org/collectionspace/services/VocabularyItemJAXBSchema.java +++ b/services/vocabulary/jaxb/src/main/java/org/collectionspace/services/VocabularyItemJAXBSchema.java @@ -9,7 +9,8 @@ package org.collectionspace.services; */ public interface VocabularyItemJAXBSchema { final static String DISPLAY_NAME = "displayName"; - final static String IN_VOCABULARY = "inVocabulary"; + final static String REF_NAME = "refName"; + final static String CSID = "csid"; } diff --git a/services/vocabulary/jaxb/src/main/java/org/collectionspace/services/VocabularyItemListItemJAXBSchema.java b/services/vocabulary/jaxb/src/main/java/org/collectionspace/services/VocabularyItemListItemJAXBSchema.java index f5f947b4c..204a4879b 100644 --- a/services/vocabulary/jaxb/src/main/java/org/collectionspace/services/VocabularyItemListItemJAXBSchema.java +++ b/services/vocabulary/jaxb/src/main/java/org/collectionspace/services/VocabularyItemListItemJAXBSchema.java @@ -2,6 +2,7 @@ package org.collectionspace.services; public interface VocabularyItemListItemJAXBSchema { final static String DISPLAY_NAME = "displayName"; + final static String REF_NAME = "refName"; final static String CSID = "csid"; final static String URI = "url"; } diff --git a/services/vocabulary/jaxb/src/main/java/org/collectionspace/services/VocabularyJAXBSchema.java b/services/vocabulary/jaxb/src/main/java/org/collectionspace/services/VocabularyJAXBSchema.java index fa90ed4ad..09d23eb7a 100644 --- a/services/vocabulary/jaxb/src/main/java/org/collectionspace/services/VocabularyJAXBSchema.java +++ b/services/vocabulary/jaxb/src/main/java/org/collectionspace/services/VocabularyJAXBSchema.java @@ -9,7 +9,9 @@ package org.collectionspace.services; */ public interface VocabularyJAXBSchema { final static String DISPLAY_NAME = "displayName"; + final static String REF_NAME = "refName"; final static String VOCAB_TYPE = "vocabType"; + final static String CSID = "csid"; } diff --git a/services/vocabulary/jaxb/src/main/java/org/collectionspace/services/VocabularyListItemJAXBSchema.java b/services/vocabulary/jaxb/src/main/java/org/collectionspace/services/VocabularyListItemJAXBSchema.java index eae544106..de04bc533 100644 --- a/services/vocabulary/jaxb/src/main/java/org/collectionspace/services/VocabularyListItemJAXBSchema.java +++ b/services/vocabulary/jaxb/src/main/java/org/collectionspace/services/VocabularyListItemJAXBSchema.java @@ -2,6 +2,7 @@ package org.collectionspace.services; public interface VocabularyListItemJAXBSchema { final static String DISPLAY_NAME = "displayName"; + final static String REF_NAME = "refName"; final static String VOCAB_TYPE = "vocabType"; final static String CSID = "csid"; final static String URI = "url"; diff --git a/services/vocabulary/jaxb/src/main/resources/vocabulary_common.xsd b/services/vocabulary/jaxb/src/main/resources/vocabulary_common.xsd index 539f589cc..0b3cf6470 100644 --- a/services/vocabulary/jaxb/src/main/resources/vocabulary_common.xsd +++ b/services/vocabulary/jaxb/src/main/resources/vocabulary_common.xsd @@ -50,6 +50,8 @@ + diff --git a/services/vocabulary/jaxb/src/main/resources/vocabularyitem_common.xsd b/services/vocabulary/jaxb/src/main/resources/vocabularyitem_common.xsd index cd2a95ee6..6f3b04981 100644 --- a/services/vocabulary/jaxb/src/main/resources/vocabularyitem_common.xsd +++ b/services/vocabulary/jaxb/src/main/resources/vocabularyitem_common.xsd @@ -20,10 +20,8 @@ - - @@ -40,6 +38,8 @@ + diff --git a/services/vocabulary/sample/sample/src/main/java/org/collectionspace/services/vocabulary/client/sample/Sample.java b/services/vocabulary/sample/sample/src/main/java/org/collectionspace/services/vocabulary/client/sample/Sample.java index f55a4a203..d6f647535 100644 --- a/services/vocabulary/sample/sample/src/main/java/org/collectionspace/services/vocabulary/client/sample/Sample.java +++ b/services/vocabulary/sample/sample/src/main/java/org/collectionspace/services/vocabulary/client/sample/Sample.java @@ -110,7 +110,7 @@ public class Sample { ServiceRequestType REQUEST_TYPE = ServiceRequestType.CREATE; logger.info("Import: Create Item: \""+itemName+"\" in vocabulary: \"" + vocabName +"\""); - MultipartOutput multipart = createVocabularyItemInstance(vcsid, itemName, refName); + MultipartOutput multipart = createVocabularyItemInstance(itemName, refName); ClientResponse res = client.createItem(vcsid, multipart); int statusCode = res.getStatus(); @@ -314,9 +314,8 @@ public class Sample { } private MultipartOutput createVocabularyItemInstance( - String inVocabulary, String displayName, String refName) { + String displayName, String refName) { VocabularyitemsCommon vocabularyItem = new VocabularyitemsCommon(); - vocabularyItem.setInVocabulary(inVocabulary); vocabularyItem.setDisplayName(displayName); vocabularyItem.setRefName(refName); MultipartOutput multipart = new MultipartOutput(); diff --git a/services/vocabulary/service/src/main/java/org/collectionspace/services/vocabulary/nuxeo/VocabularyDocumentModelHandler.java b/services/vocabulary/service/src/main/java/org/collectionspace/services/vocabulary/nuxeo/VocabularyDocumentModelHandler.java index 40ee88cdd..b60a31033 100644 --- a/services/vocabulary/service/src/main/java/org/collectionspace/services/vocabulary/nuxeo/VocabularyDocumentModelHandler.java +++ b/services/vocabulary/service/src/main/java/org/collectionspace/services/vocabulary/nuxeo/VocabularyDocumentModelHandler.java @@ -124,6 +124,8 @@ public class VocabularyDocumentModelHandler VocabularyListItem ilistItem = new VocabularyListItem(); ilistItem.setDisplayName((String) docModel.getProperty(getServiceContext().getCommonPartLabel(), VocabularyJAXBSchema.DISPLAY_NAME)); + ilistItem.setRefName((String) docModel.getProperty(getServiceContext().getCommonPartLabel(), + VocabularyJAXBSchema.REF_NAME)); ilistItem.setVocabType((String) docModel.getProperty(getServiceContext().getCommonPartLabel(), VocabularyJAXBSchema.VOCAB_TYPE)); String id = NuxeoUtils.extractId(docModel.getPathAsString()); @@ -135,7 +137,6 @@ public class VocabularyDocumentModelHandler return coList; } - /** * getQProperty converts the given property to qualified schema property * @param prop diff --git a/services/vocabulary/service/src/main/java/org/collectionspace/services/vocabulary/nuxeo/VocabularyItemDocumentModelHandler.java b/services/vocabulary/service/src/main/java/org/collectionspace/services/vocabulary/nuxeo/VocabularyItemDocumentModelHandler.java index be8ca9f38..4025fa0cf 100644 --- a/services/vocabulary/service/src/main/java/org/collectionspace/services/vocabulary/nuxeo/VocabularyItemDocumentModelHandler.java +++ b/services/vocabulary/service/src/main/java/org/collectionspace/services/vocabulary/nuxeo/VocabularyItemDocumentModelHandler.java @@ -136,9 +136,13 @@ public class VocabularyItemDocumentModelHandler while(iter.hasNext()){ DocumentModel docModel = iter.next(); VocabularyitemListItem ilistItem = new VocabularyitemListItem(); - ilistItem.setDisplayName((String) docModel.getProperty(getServiceContext().getCommonPartLabel("vocabularyItems"), - VocabularyItemJAXBSchema.DISPLAY_NAME)); - String id = NuxeoUtils.extractId(docModel.getPathAsString()); + ilistItem.setDisplayName( + (String) docModel.getProperty(getServiceContext().getCommonPartLabel("vocabularyItems"), + VocabularyItemJAXBSchema.DISPLAY_NAME)); + ilistItem.setRefName( + (String) docModel.getProperty(getServiceContext().getCommonPartLabel("vocabularyItems"), + VocabularyItemJAXBSchema.REF_NAME)); + String id = NuxeoUtils.extractId(docModel.getPathAsString()); ilistItem.setUri("/vocabularies/"+inVocabulary+"/items/" + id); ilistItem.setCsid(id); list.add(ilistItem); @@ -152,8 +156,6 @@ public class VocabularyItemDocumentModelHandler return coList; } - - /** * getQProperty converts the given property to qualified schema property * @param prop -- 2.47.3